/* Токены — из дизайн-системы flexpanel.shop */
:root {
  --surface-background: #171F26;
  --surface-card: rgba(32, 43, 54, 0.5);
  --surface-background-secondary: #283847;
  --surface-line: rgba(49, 60, 71, 0.5);
  --surface-hover: rgba(49, 60, 71, 0.3);
  --surface-border: #313C47;
  --text-main: rgba(250, 252, 255, 0.85);
  --text-secondary: #838B8F;
  --brand: #FF7E29;
  --brand-hover: #FF924A;
  --brand-pressed: #E86A18;
  --brand-link-hover: #FF9A52;
  --brand-10: #FF7E291A;
  --success: #1EBD46;
  --attention: #FFC000;
  --error: #FB695E;
  --progress: #4DA3FF;
  --queued: #A78BFA;      /* в очереди */
  --partial: #2DD4BF;     /* выполнен частично */
  --canceling: #FF9466;   /* отменяется */
  --shadow-M: 0 8px 32px #0D161F;
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; min-height: 100vh; background: var(--surface-background); color: var(--text-main);
       font: 500 16px/24px var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-link-hover); }
h1 { margin: 0; font: 600 24px/32px var(--font); }
.muted { color: var(--text-secondary); }
.nums { font-variant-numeric: tabular-nums; }
.logo { font: 800 26px/1 var(--font); letter-spacing: .04em; background: linear-gradient(90deg, #FFA03A, #FF6A2B);
        -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo:hover { color: transparent; }

/* ---------- кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 8px 16px;
       border-radius: 999px; border: 1px solid var(--surface-border); background: transparent; color: var(--brand);
       font: 600 16px/22px var(--font); cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--surface-line); color: var(--brand); }
.btn-primary { height: 48px; padding: 12px 24px; border: none; background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); color: #fff; }
.btn-primary:active { background: var(--brand-pressed); }
.btn[disabled], .btn.disabled { opacity: .4; color: var(--text-secondary); pointer-events: none; cursor: default; }
.btn-primary[disabled] { color: #fff; }
.btn-sm { height: 38px; font-size: 15px; line-height: 20px; }
.btn-danger { color: var(--error); }
.btn-danger:hover { color: var(--error); background: #FB695E1A; }
.btn-block { width: 100%; }
.btn-arrow { flex: none; width: 40px; height: 40px; padding: 0; border-radius: 50%; border: 1px solid var(--surface-border);
             display: inline-flex; align-items: center; justify-content: center; color: var(--brand); }

/* ---------- поля ---------- */
.field { height: 48px; width: 100%; padding: 0 20px; border-radius: 999px; background: var(--surface-line);
         border: 1px solid var(--surface-border); color: var(--text-main); font: 500 16px/24px var(--font); outline: none; }
.field::placeholder { color: var(--text-secondary); }
.field:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-10); }
.field.is-error { border-color: var(--error); box-shadow: 0 0 0 3px #FB695E1A; }
.field.is-warn { border-color: var(--attention); box-shadow: 0 0 0 3px #FFC0001A; }
.field:disabled { opacity: .45; }
.field-sm { height: 44px; }
/* iOS (Safari и Telegram) рисует поле даты по-своему: оно шире своей карточки, а дата стоит
   по центру и не по высоте. Остальным браузерам правка не нужна — отсюда условие */
@supports (-webkit-touch-callout: none) {
  input[type=date].field { -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%;
                           line-height: 44px; text-align: left; }
  input[type=date].field::-webkit-date-and-time-value { text-align: left; margin: 0; }
}
.search { position: relative; }
.search svg { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search .field { padding-left: 46px; }
select.field { appearance: none; padding-right: 44px; cursor: pointer;
  background: var(--surface-line) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 20 20' fill='none' stroke='%23838B8F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 8l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 16px center; }
select.field option { background: var(--surface-background); }
.label { font: 500 14px/16px var(--font); color: var(--text-secondary); }

/* ---------- бейджи ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 10px;
         font: 600 14px/16px var(--font); white-space: nowrap; font-variant-numeric: tabular-nums; }
.badge-brand { background: var(--brand-10); color: var(--brand); }
.badge-muted { background: var(--surface-line); color: var(--text-secondary); }
.badge-attention { background: #FFC0001A; color: var(--attention); }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status { background: #838B8F1A; color: var(--text-secondary); }
.status-pending { background: #A78BFA1A; color: var(--queued); }
.status-partial { background: #2DD4BF1A; color: var(--partial); }
.status-paused { background: #FFC0001A; color: var(--attention); }
.status-canceling { background: #FF94661A; color: var(--canceling); }
.status-in_progress, .status-active, .status-processing { background: #4DA3FF1A; color: var(--progress); }
.status-completed { background: #1EBD461A; color: var(--success); }
.status-canceled, .status-cancelled { background: #FB695E1A; color: var(--error); }

.avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-background-secondary);
          display: flex; align-items: center; justify-content: center; color: var(--text-secondary); font: 600 14px/16px var(--font); }
.circle-icon { flex: none; width: 72px; height: 72px; border-radius: 50%; background: var(--surface-background-secondary);
               display: flex; align-items: center; justify-content: center; color: var(--text-secondary); }

/* ---------- каркас ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 224px; flex: none; padding: 24px 16px; display: flex; flex-direction: column; gap: 32px;
           position: sticky; top: 0; height: 100vh; }
.sidebar .logo { height: 40px; display: flex; align-items: center; padding-left: 8px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 16px; border-radius: 999px;
         color: var(--text-main); font: 500 16px/24px var(--font); }
.nav a svg { color: var(--text-secondary); flex: none; }
.nav a:hover { background: var(--surface-hover); color: var(--text-main); }
.nav a.active { background: var(--surface-line); color: var(--brand); font-weight: 600; }
.nav a.active svg { color: currentColor; }
.nav .ext { margin-left: auto; color: var(--text-secondary); font-size: 14px; }
.nav hr { border: none; height: 1px; background: var(--surface-line); margin: 12px 16px; }
.content { flex: 1; min-width: 0; padding: 0 48px 48px; }
.container { max-width: 1100px; }
.topbar { height: 88px; display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.who { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.page-head { display: flex; align-items: center; gap: 12px; margin: 8px 0 20px; }
.page-sub { font: 500 14px/16px var(--font); color: var(--text-secondary); margin: -14px 0 24px; }
.stack { display: flex; flex-direction: column; gap: 24px; }

.mobile-header, .menu-toggle, .mobile-menu, .m-only { display: none; }

/* ---------- переключатель языка ---------- */
.lang-switch { display: flex; align-items: center; padding: 3px; border-radius: 999px; border: 1px solid var(--surface-border); }
.lang-switch a { height: 32px; padding: 6px 12px; border-radius: 999px; color: var(--text-secondary); font: 600 14px/20px var(--font); }
.lang-switch a:hover { color: var(--text-main); }
.lang-switch a.active { background: var(--surface-line); color: var(--brand); }
.topbar .lang-switch { margin-right: 8px; }
.login-lang { position: absolute; top: 20px; right: 20px; }
.lang-row { display: flex; align-items: center; justify-content: space-between; padding: 0 16px 16px; }
.lang-row .lang-switch a { padding: 6px 14px; }

/* ---------- карточки ---------- */
.card { padding: 24px; border-radius: 20px; background: var(--surface-card); }
.empty { margin-top: 120px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.empty-title { font: 600 20px/28px var(--font); color: var(--text-main); }

/* ---------- заказы клиента ---------- */
.order-row { display: flex; align-items: center; gap: 20px; padding: 16px; margin: 0 -16px; border-radius: 16px;
             border-bottom: 1px solid var(--surface-line); color: inherit; }
.order-row:hover { background: var(--surface-card); color: inherit; }
.order-row .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.order-row .title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-weight: 600; }
.order-row .sub { font: 500 14px/16px var(--font); color: var(--text-secondary); overflow-wrap: anywhere; }
.order-row .metric { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.order-row .metric b { font: 600 16px/24px var(--font); font-variant-numeric: tabular-nums; }
.order-row .metric.done { width: 140px; }
.order-row .metric.price { width: 120px; }
.order-row .metrics { display: contents; }
.total-yes { color: var(--success); }
.total-no { color: var(--text-secondary); }

/* ---------- заказы админа ---------- */
.filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 20px; }
.filters .search { width: 360px; }
.filters select { width: 220px; }
.filters .btn-primary { height: 44px; }
.filters .row2 { display: contents; }
.grid-orders { display: grid; grid-template-columns: 120px 120px minmax(0, 1fr) 150px 120px 96px 136px 32px;
               gap: 16px; align-items: center; padding: 12px 16px; margin: 0 -16px; border-bottom: 1px solid var(--surface-line); }
.grid-head { font: 500 14px/16px var(--font); color: var(--text-secondary); }
.grid-orders.row { position: relative; border-radius: 12px; font-size: 15px; line-height: 20px; }
.grid-orders.row:hover { background: var(--surface-card); }
.grid-orders .id { font-weight: 600; font-variant-numeric: tabular-nums; }
/* вся строка кликабельна, ссылка на клиента — поверх */
.grid-orders .id::after { content: ""; position: absolute; inset: 0; border-radius: 12px; }
.grid-orders .client { position: relative; z-index: 1; color: var(--text-main); text-decoration: underline;
                       text-decoration-color: var(--surface-border); text-underline-offset: 4px; overflow-wrap: anywhere; }
.grid-orders .link { font-size: 14px; line-height: 18px; color: var(--text-secondary); overflow-wrap: anywhere; }
.grid-orders .date { font-size: 14px; line-height: 18px; color: var(--text-secondary); }
.grid-orders .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid-orders .btn-arrow { width: 32px; height: 32px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 24px; }
.pager .pages { display: flex; align-items: center; gap: 16px; }

/* ---------- карточка заказа ---------- */
.info { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 24px; }
.info > div { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.info .v { font-weight: 600; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.stats-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-bottom: 16px;
              border-bottom: 1px solid var(--surface-line); }
.stats-title { font: 600 20px/28px var(--font); }
.stats-total { display: flex; align-items: baseline; gap: 10px; color: var(--text-secondary); }
.stats-total b { font: 600 40px/44px var(--font); color: var(--success); font-variant-numeric: tabular-nums; }
.stats-total.stats-total-warn b { color: var(--attention); }
.stat-row { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--surface-line); }
.stat-row span:first-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.stat-row span:last-child { flex: none; font-weight: 600; font-variant-numeric: tabular-nums; }
.stats-empty { display: flex; align-items: center; gap: 16px; padding: 16px 0 8px; }
.stats-empty .i { flex: none; width: 48px; height: 48px; border-radius: 50%; background: var(--surface-background-secondary);
                  display: flex; align-items: center; justify-content: center; color: var(--text-secondary); font: 600 20px/1 var(--font); }

/* ---------- пользователи ---------- */
.grid-users { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 160px 300px; gap: 16px;
              align-items: center; padding: 8px 0; min-height: 64px; border-bottom: 1px solid var(--surface-line); }
.grid-users.grid-head { min-height: 0; padding: 12px 0; }
.grid-users .login { font-weight: 600; overflow-wrap: anywhere; }
.grid-users .act { display: flex; justify-content: flex-end; gap: 8px; }
.grid-users .note { font: 500 14px/16px var(--font); color: var(--text-secondary); padding-right: 16px; }
.grid-users form { margin: 0; }

/* ---------- аккаунты исполнителя ---------- */
.period-switch { align-self: flex-start; }
.buckets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.bucket { display: flex; flex-direction: column; gap: 6px; }
.bucket b { font: 600 24px/28px var(--font); }
.bucket .bar { height: 6px; border-radius: 3px; background: var(--surface-line); overflow: hidden; }
.bucket .bar i { display: block; height: 100%; border-radius: 3px; background: var(--brand); }
.grid-acc { display: grid; grid-template-columns: minmax(0, 1fr) 110px 120px 110px 110px 190px; gap: 16px; align-items: center;
            padding: 12px 0; border-bottom: 1px solid var(--surface-line); }
.grid-acc .acc { font-weight: 600; overflow-wrap: anywhere; }
.grid-acc .r { text-align: right; font-variant-numeric: tabular-nums; }
.grid-acc.grid-head a { color: var(--text-secondary); }
.grid-acc.grid-head a:hover, .grid-acc.grid-head a.sorted { color: var(--text-main); }
.grid-acc .date { font-size: 14px; }
.grid-acc .m-label { display: none; }

/* ---------- расчёты и услуги ---------- */
.grid-pay { display: grid; grid-template-columns: minmax(0, 1fr) 150px 150px 150px; gap: 16px; align-items: center;
            padding: 12px 0; border-bottom: 1px solid var(--surface-line); }
.grid-pay .r { text-align: right; font-variant-numeric: tabular-nums; }
.grid-pay .m-label { display: none; }
.cut { margin-bottom: 12px; padding: 16px 24px; }
.cut summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; list-style: none; }
.cut summary::-webkit-details-marker { display: none; }
.cut-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cut-amount { font-size: 20px; line-height: 28px; white-space: nowrap; }
.svc-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--surface-line); }
.svc-row form { margin: 0; }
.svc-id { font-weight: 600; margin-right: auto; }
.svc-form { display: flex; align-items: center; gap: 10px; }
.svc-form .field { width: 130px; }
.svc-add .field { width: 190px; }

/* ---------- выполнение ---------- */
.exec-speed { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.exec-speed-form { display: flex; gap: 12px; }
.exec-speed-form .field { width: 160px; }
.exec-speed-form .btn-primary { height: 44px; }
.grid-exec { display: grid; grid-template-columns: 130px minmax(0, 1fr) 160px 140px 130px; gap: 16px; align-items: center;
             padding: 12px 0; border-bottom: 1px solid var(--surface-line); }
.grid-exec .url { overflow-wrap: anywhere; color: var(--text-secondary); font-size: 14px; }
.grid-exec .r { text-align: right; font-variant-numeric: tabular-nums; }
.grid-exec .m-label { display: none; }

.order-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; width: 100%; }
.notice { display: flex; gap: 16px; align-items: flex-start; background: #FFC0001A; }
.notice-ico { flex: none; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
              background: #FFC00033; color: var(--attention); font: 600 18px/1 var(--font); }
.notice-title { font: 600 18px/24px var(--font); color: var(--attention); margin-bottom: 6px; }
.notice-text { font: 500 14px/20px var(--font); color: var(--text-main); margin-top: 6px; }
.notice-cancel { background: #FF94661A; }
.notice-cancel .notice-ico { background: #FF946633; color: var(--canceling); }
.notice-cancel .notice-title { color: var(--canceling); }
.notice-bad { background: #FB695E1A; }
.notice-bad .notice-ico { background: #FB695E33; color: var(--error); }
.notice-bad .notice-title { color: var(--error); }
.guard-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.guard-form label { display: flex; flex-direction: column; gap: 6px; }
.guard-form label .field { width: 170px; }
.guard-form .guard-wide { flex: 1; min-width: 200px; }
.guard-form .guard-wide .field { width: 100%; }
.guard-form .guard-check { flex-direction: row; align-items: center; gap: 8px; height: 44px; font-weight: 600; cursor: pointer; }
.guard-form input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); }

/* ---------- вход ---------- */
.login-page { position: relative; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
              gap: 32px; padding: 32px 16px; }
.login-page .logo { font-size: 30px; line-height: 40px; }
.login-card { width: 100%; max-width: 440px; padding: 40px; border-radius: 24px; background: var(--surface-card);
              border: 1px solid var(--surface-line); box-shadow: var(--shadow-M); display: flex; flex-direction: column; gap: 24px; }
.login-card form { display: flex; flex-direction: column; gap: 24px; margin: 0; }
.login-card .fieldset { display: flex; flex-direction: column; gap: 8px; }
.msg { display: flex; gap: 8px; align-items: flex-start; padding: 0 4px; font: 500 14px/16px var(--font); }
.msg .ico { flex: none; width: 16px; height: 16px; border-radius: 50%; background: currentColor; text-align: center; }
.msg .ico::before { content: "!"; color: var(--surface-background); font: 700 11px/16px var(--font); }
.msg .hint { display: block; margin-top: 4px; color: var(--text-secondary); }
.msg-error { color: var(--error); }
.msg-warn { color: var(--attention); }
.state-box { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px 16px; border-radius: 20px;
             background: var(--surface-line); text-align: center; }
.state-box .t { font: 600 20px/28px var(--font); margin-top: 4px; }
.state-box .d { font: 500 14px/20px var(--font); color: var(--text-secondary); }
.state-box .links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; margin-top: 4px; }
.state-box .links .text-link { height: 40px; display: flex; align-items: center; font-weight: 600; }
.state-ico { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font: 600 24px/1 var(--font); }
.state-ico.bad { background: #FB695E1A; color: var(--error); }
.state-ico.warn { background: #FFC0001A; color: var(--attention); }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--surface-border); border-top-color: var(--brand);
           animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.login-foot { border-top: 1px solid var(--surface-line); padding-top: 20px; display: flex; flex-direction: column; gap: 8px;
              font: 500 14px/20px var(--font); color: var(--text-secondary); }
.login-foot a { font-weight: 600; }
[hidden] { display: none !important; }

.not-found { margin-top: 160px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
/* ---------- статистика клиента (/stats) ----------
   Вёрстка из макета; у всех классов приставка cs-, чтобы не пересекаться с классами сайта. */
.cs-stats{--bg:#171F26;--card:rgba(32,43,54,.5);--line:rgba(49,60,71,.5);--border:#313C47;--text:rgba(250,252,255,.85);--text-strong:rgba(250,252,255,.96);--muted:#838B8F;--accent:#FF7E29;--accent-hover:#FF924A;--success:#1EBD46;--warning:#FFC000;--error:#FB695E;--mono:'JetBrains Mono',ui-monospace,monospace;
  color:var(--text);font:500 15px/22px Inter,system-ui,sans-serif}
.cs-stats button{font:inherit;color:inherit}
.cs-stats svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;flex:none}
/* ---------- Страница ---------- */
.cs-stats{container:stats/inline-size;max-width:1100px;margin:0 auto;display:flex;flex-direction:column;gap:20px}
.cs-stats-head{display:flex;flex-direction:column;gap:6px}
.cs-stats-head__title{margin:0;font:700 28px/36px Inter,sans-serif;color:var(--text-strong);letter-spacing:-.01em}
.cs-stats-head__sub{margin:0;color:var(--muted)}
.cs-card{background:var(--card);border-radius:20px;padding:24px;display:flex;flex-direction:column;gap:16px;min-width:0}
.cs-card__head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.cs-card__title{margin:0;font:600 18px/26px Inter,sans-serif;color:var(--text-strong)}
.cs-card__sub{margin:2px 0 0;font-size:14px;line-height:20px;color:var(--muted)}
.cs-mono{font-family:var(--mono);font-variant-numeric:tabular-nums}
.cs-muted{color:var(--muted)}
.cs-is-success{color:var(--success)}.cs-is-warning{color:var(--warning)}

/* ---------- Фильтры ---------- */
.cs-filters{display:flex;flex-direction:row;flex-wrap:wrap;gap:16px;align-items:flex-start}
.cs-field{display:flex;flex-direction:column;gap:8px;min-width:0}
.cs-field--client{flex:1 1 200px}
.cs-field--bot{flex:1.4 1 240px}
.cs-field--period{flex:0 1 auto}
.cs-field__label{font-size:13px;line-height:18px;font-weight:600;color:var(--muted)}
.cs-field__hint{font-size:13px;line-height:18px;color:var(--muted)}
.cs-input,.cs-select-btn{height:46px;border-radius:999px;border:1px solid var(--border);background:rgba(16,23,29,.6);color:var(--text-strong);padding:0 18px;font:500 15px/1 Inter,sans-serif;outline:none;transition:border-color .15s}
.cs-input:focus,.cs-select-btn:focus-visible,.cs-select-btn[aria-expanded=true]{border-color:var(--accent)}
.cs-input--date{width:156px;padding:0 14px;font-family:var(--mono);font-size:14px}
.cs-input--date::-webkit-calendar-picker-indicator{filter:invert(.6);cursor:pointer}
.cs-is-invalid .cs-input{border-color:var(--error)}
.cs-period{display:flex;align-items:center;gap:8px}
.cs-period__dash{color:var(--muted)}
.cs-chips{display:flex;flex-wrap:wrap;gap:6px}
.cs-chip{height:32px;padding:0 12px;border-radius:999px;border:1px solid var(--border);background:transparent;color:var(--muted);font-size:13px;font-weight:600;cursor:pointer}
.cs-chip:hover{color:var(--text-strong)}
.cs-chip.cs-is-active{background:rgba(255,126,41,.12);border-color:transparent;color:var(--accent)}
.cs-filters__actions{display:flex;gap:8px;margin-left:auto;padding-top:26px}
.cs-btn{height:46px;padding:0 22px;border-radius:999px;border:0;display:inline-flex;align-items:center;justify-content:center;gap:8px;font:600 15px/1 Inter,sans-serif;cursor:pointer;white-space:nowrap}
.cs-btn--primary{background:var(--accent);color:#fff}.cs-btn--primary:hover{background:var(--accent-hover)}
.cs-btn--primary:disabled{background:rgba(255,126,41,.3);color:rgba(255,255,255,.6);cursor:not-allowed}
.cs-btn--ghost{background:transparent;border:1px solid var(--border);color:var(--text-strong)}.cs-btn--ghost:hover{background:var(--line)}
.cs-btn--ghost:disabled{color:var(--muted);cursor:not-allowed;background:transparent}
.cs-btn__spinner{display:none;width:16px;height:16px;border-radius:50%;border:2px solid rgba(255,255,255,.35);border-top-color:#fff;animation:spin .7s linear infinite}
.cs-stats[data-state=loading] .cs-btn__spinner{display:block}
.cs-filters__error{display:none;flex-basis:100%;align-items:center;gap:10px;padding:12px 16px;border-radius:14px;background:rgba(251,105,94,.1);color:var(--text-strong);font-size:14px;line-height:20px}
.cs-filters__error b{color:var(--error);font-weight:600}
.cs-stats[data-state=toolong] .cs-filters__error{display:flex}

/* выпадающий список с поиском */
.cs-select{position:relative}
.cs-select-btn{width:100%;display:flex;align-items:center;gap:10px;text-align:left;cursor:pointer}
.cs-select-btn__value{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cs-select-btn__meta{color:var(--muted);font-size:13px}
.cs-select-btn svg{color:var(--muted);transform:rotate(90deg)}
.cs-select__pop{display:none;position:absolute;z-index:20;top:calc(100% + 6px);left:0;right:0;min-width:260px;padding:8px;border-radius:18px;background:#1E2832;border:1px solid var(--border);box-shadow:0 18px 40px rgba(0,0,0,.35)}
.cs-select.cs-is-open .cs-select__pop{display:block}
.cs-select__search{width:100%;height:40px;margin-bottom:6px}
.cs-select__list{max-height:264px;overflow-y:auto;display:flex;flex-direction:column;gap:2px}
.cs-option{display:flex;align-items:center;gap:10px;width:100%;min-height:40px;padding:8px 12px;border:0;border-radius:10px;background:transparent;text-align:left;cursor:pointer;color:var(--text)}
.cs-option:hover{background:var(--line)}
.cs-option.cs-is-selected{color:var(--accent)}
.cs-option__name{flex:1;min-width:0;overflow-wrap:anywhere}
.cs-option__meta{font-size:13px;color:var(--muted)}
.cs-select__empty{display:none;padding:10px 12px;color:var(--muted);font-size:14px}
.cs-bot-fixed{height:46px;display:flex;align-items:center;gap:10px;padding:0 18px;border-radius:999px;background:rgba(49,60,71,.35);color:var(--text-strong)}
.cs-bot-fixed__meta{color:var(--muted);font-size:13px}

/* роль и число ботов */
.cs-stats[data-role=client] .cs-field--client{display:none}
.cs-stats[data-bots=one] .cs-field--bot .cs-select,.cs-stats[data-bots=many] .cs-field--bot .cs-bot-fixed{display:none}
.cs-stats[data-bots=one] .cs-field--bot .cs-field__hint{display:block}
.cs-field--bot .cs-field__hint{display:none}

/* скачать */
.cs-dl{position:relative}
.cs-dl__menu{display:none;position:absolute;right:0;top:calc(100% + 6px);z-index:20;min-width:200px;padding:6px;border-radius:16px;background:#1E2832;border:1px solid var(--border);box-shadow:0 18px 40px rgba(0,0,0,.35)}
.cs-dl.cs-is-open .cs-dl__menu{display:block}
.cs-dl__item{display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;padding:10px 12px;border:0;border-radius:10px;background:transparent;text-align:left;cursor:pointer}
.cs-dl__item:hover{background:var(--line)}
.cs-dl__item b{font-weight:600;color:var(--text-strong)}
.cs-dl__item span{font-size:13px;color:var(--muted)}

/* выбранные фильтры */
.cs-applied{display:flex;flex-wrap:wrap;align-items:center;gap:8px;font-size:14px;color:var(--muted)}
.cs-applied__tag{display:inline-flex;align-items:center;gap:6px;height:30px;padding:0 12px;border-radius:999px;background:var(--line);color:var(--text-strong);font-weight:600}
.cs-applied__tag.cs-mono{font-weight:500;font-size:13px}
.cs-stats[data-state=initial] .cs-applied{display:none}

/* ---------- Состояния ---------- */
.cs-view{display:none;flex-direction:column;gap:20px}
.cs-stats[data-state=initial] .cs-view--initial,
.cs-stats[data-state=loading] .cs-view--loading,
.cs-stats[data-state=empty] .cs-view--empty,
.cs-stats[data-state=toolong] .cs-view--initial,
.cs-stats[data-state=data][data-set=all] .cs-view--all,
.cs-stats[data-state=data][data-set=bot] .cs-view--bot{display:flex}
.cs-notice{align-items:center;text-align:center;padding:48px 24px;gap:10px}
.cs-notice__icon{width:48px;height:48px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:rgba(255,126,41,.12);color:var(--accent);margin-bottom:6px}
.cs-notice__icon svg{width:22px;height:22px}
.cs-notice__title{margin:0;font:600 18px/26px Inter,sans-serif;color:var(--text-strong)}
.cs-notice__text{margin:0;max-width:440px;color:var(--muted);text-wrap:pretty}
.cs-notice__actions{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:10px}
.cs-skeleton{background:linear-gradient(90deg,rgba(49,60,71,.35) 0%,rgba(49,60,71,.7) 50%,rgba(49,60,71,.35) 100%);background-size:200% 100%;animation:shimmer 1.4s ease-in-out infinite;border-radius:10px}
.cs-loading-note{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:14px}
.cs-loading-note .cs-btn__spinner{display:block;border-color:rgba(255,126,41,.25);border-top-color:var(--accent)}
@keyframes shimmer{0%{background-position:100% 0}100%{background-position:-100% 0}}
@keyframes spin{to{transform:rotate(360deg)}}

/* ---------- Итоги ---------- */
.cs-totals{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px}
.cs-total{grid-column:span 1;background:var(--card);border-radius:20px;padding:20px 22px;display:flex;flex-direction:column;gap:8px;min-width:0}
.cs-total--wide{grid-column:span 2}
.cs-total__label{font-size:13px;line-height:18px;font-weight:600;color:var(--muted)}
.cs-total__value{font:700 28px/34px Inter,sans-serif;color:var(--text-strong);font-variant-numeric:tabular-nums;white-space:nowrap}
.cs-total__unit{margin-left:6px;font-size:14px;font-weight:600;color:var(--muted)}
.cs-total__row{display:flex;align-items:baseline;justify-content:space-between;gap:10px;flex-wrap:wrap}
.cs-total__share{font-size:14px;font-weight:600;color:var(--success)}
.cs-meter{height:6px;border-radius:3px;background:rgba(49,60,71,.8);overflow:hidden}
.cs-meter span{display:block;height:100%;border-radius:3px;background:var(--success)}

/* ---------- Таблицы ---------- */
.cs-grid{display:flex;flex-direction:column}
.cs-grid__head,.cs-grid__row{display:grid;align-items:center;gap:16px;padding:12px 4px;border-bottom:1px solid var(--line)}
.cs-grid__head{padding-top:0;font-size:12px;line-height:16px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
.cs-grid__row{font-size:14px;line-height:20px;color:var(--text)}
.cs-grid__row:last-child{border-bottom:0}
.cs-grid__row.cs-is-clickable{width:100%;border-left:0;border-right:0;border-top:0;background:transparent;text-align:left;cursor:pointer;border-radius:10px;color:var(--text)}
.cs-grid__row.cs-is-clickable:hover{background:rgba(49,60,71,.3)}
.cs-num{text-align:right;justify-self:end}
.cs-grid--links .cs-grid__head,.cs-grid--links .cs-grid__row{grid-template-columns:28px minmax(0,1fr) 90px 150px 36px}
.cs-grid--bots .cs-grid__head,.cs-grid--bots .cs-grid__row{grid-template-columns:minmax(0,1fr) 110px 130px 130px 20px}
.cs-grid--orders .cs-grid__head,.cs-grid--orders .cs-grid__row{grid-template-columns:110px 140px minmax(0,1fr) 160px 80px 100px 110px}
.cs-link-rank{font-family:var(--mono);font-size:12px;color:var(--muted)}
.cs-link-url{min-width:0;font-family:var(--mono);font-size:13px;line-height:20px;overflow-wrap:anywhere;word-break:break-word}
.cs-link-url a{color:var(--text-strong)}.cs-link-url a:hover{color:var(--accent)}
.cs-share{display:flex;align-items:center;gap:10px}
.cs-share__val{width:48px;text-align:right;font-size:13px;color:var(--text)}
.cs-share__bar{flex:1;height:4px;border-radius:2px;background:rgba(49,60,71,.8);overflow:hidden}
.cs-share__bar span{display:block;height:100%;border-radius:2px;background:var(--accent)}
.cs-icon-btn{width:36px;height:36px;display:flex;align-items:center;justify-content:center;border:0;border-radius:50%;background:transparent;color:var(--muted);cursor:pointer;position:relative}
.cs-icon-btn:hover{background:var(--line);color:var(--text-strong)}
.cs-icon-btn.cs-is-copied{color:var(--success)}
.cs-icon-btn.cs-is-copied::after{content:attr(data-copied);position:absolute;right:calc(100% + 4px);top:50%;transform:translateY(-50%);padding:3px 8px;border-radius:8px;background:#1E2832;border:1px solid var(--border);font-size:12px;line-height:16px;white-space:nowrap;color:var(--success)}
.cs-links[data-collapsed=true] .cs-is-extra{display:none}
.cs-more-btn{align-self:flex-start;height:40px;padding:0 18px;border-radius:999px;border:1px solid var(--border);background:transparent;color:var(--text-strong);font-weight:600;font-size:14px;cursor:pointer}
.cs-more-btn:hover{background:var(--line)}
.cs-links[data-collapsed=true] .cs-more-btn__hide,.cs-links[data-collapsed=false] .cs-more-btn__show{display:none}
.cs-bot-name{font-weight:600;color:var(--text-strong);min-width:0;overflow-wrap:anywhere}
.cs-row-chev{color:var(--muted);justify-self:end;display:flex}
.cs-order-id{color:var(--text-strong)}
.cs-badge{display:inline-flex;align-items:center;height:24px;padding:0 9px;border-radius:10px;font-size:13px;font-weight:600;white-space:nowrap;color:var(--c);background:color-mix(in srgb,var(--c) 10%,transparent)}
.cs-orders .cs-grid__row.cs-is-hidden{display:none}
.cs-pager{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.cs-pager__info{font-size:14px;color:var(--muted)}
.cs-pager__btns{display:flex;gap:4px}
.cs-pager__btn{min-width:36px;height:36px;padding:0 10px;border-radius:999px;border:0;background:transparent;color:var(--text);font-weight:600;font-size:14px;cursor:pointer;display:flex;align-items:center;justify-content:center}
.cs-pager__btn:hover:not(:disabled){background:var(--line)}
.cs-pager__btn.cs-is-active{background:rgba(255,126,41,.12);color:var(--accent)}
.cs-pager__btn:disabled{color:rgba(131,139,143,.4);cursor:default}

/* ---------- Средняя ширина ---------- */
@container stats (max-width:900px){
  .cs-totals{grid-template-columns:repeat(2,minmax(0,1fr))}
  .cs-total--wide{grid-column:span 2}
  .cs-filters__actions{margin-left:0;padding-top:0;flex-basis:100%}
  .cs-grid--orders .cs-grid__head,.cs-grid--orders .cs-grid__row{grid-template-columns:100px 130px minmax(0,1fr) 150px 70px 90px 100px;gap:10px}
}

/* ---------- Телефон ---------- */
@container stats (max-width:640px){
  .cs-stats-head__title{font-size:24px;line-height:32px}
  .cs-card{padding:18px 16px;border-radius:18px}
  .cs-filters{flex-direction:column;flex-wrap:nowrap;align-items:stretch;gap:14px}
  .cs-filters__actions,.cs-filters__error{flex-basis:auto}
  .cs-field--client,.cs-field--bot,.cs-field--period{flex:none}
  .cs-period{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr)}
  .cs-input--date{width:100%;min-width:0}
  .cs-filters__actions{display:grid;grid-template-columns:minmax(0,1fr) auto}
  .cs-dl__menu{right:0;left:auto}
  .cs-total{padding:16px}
  .cs-total__value{font-size:24px;line-height:30px}

  .cs-grid__head{display:none}
  .cs-grid__row{display:grid;gap:4px 12px;padding:14px 4px}

  .cs-grid--links .cs-grid__row{grid-template-columns:minmax(0,1fr) 36px;grid-template-areas:"url copy" "meta copy"}
  .cs-grid--links .cs-link-rank{display:none}
  .cs-grid--links .cs-link-url{grid-area:url}
  .cs-grid--links .cs-icon-btn{grid-area:copy;align-self:start}
  .cs-grid--links .cs-num{display:none}
  .cs-grid--links .cs-share{grid-area:meta}
  .cs-grid--links .cs-share::before{content:attr(data-count);font-family:var(--mono);font-size:13px;color:var(--text-strong);white-space:nowrap}
  .cs-grid--links .cs-share__val{width:auto;color:var(--muted)}

  .cs-grid--bots .cs-grid__row{grid-template-columns:repeat(3,minmax(0,1fr));grid-template-areas:"name name chev" "a b c"}
  .cs-grid--bots .cs-bot-name{grid-area:name}.cs-grid--bots .cs-row-chev{grid-area:chev}
  .cs-grid--bots .cs-num{justify-self:start;text-align:left;display:flex;flex-direction:column}
  .cs-grid--bots .cs-num::before,.cs-grid--orders .cs-num::before,.cs-grid--orders .cs-order-date::before{content:attr(data-label);font-family:Inter,sans-serif;font-size:12px;line-height:16px;color:var(--muted)}

  .cs-grid--orders .cs-grid__row{grid-template-columns:repeat(3,minmax(0,1fr));grid-template-areas:"id id status" "bot bot bot" "date date date" "q c i";gap:6px 12px}
  .cs-grid--orders .cs-order-id{grid-area:id}.cs-grid--orders .cs-order-status{grid-area:status;justify-self:end}
  .cs-grid--orders .cs-bot-name{grid-area:bot}
  .cs-grid--orders .cs-order-date{grid-area:date;display:flex;gap:6px;font-size:13px}
  .cs-grid--orders .cs-order-date::before{content:none}
  .cs-grid--orders .cs-num{justify-self:start;text-align:left;display:flex;flex-direction:column;margin-top:4px}
  .cs-pager{justify-content:center}.cs-pager__info{flex-basis:100%;text-align:center}
}
/* ---------- метрики ---------- */
.grid-metric { display: grid; grid-template-columns: 90px repeat(5, minmax(0, 1fr)); gap: 16px; align-items: center;
               padding: 10px 0; border-bottom: 1px solid var(--surface-line); font-variant-numeric: tabular-nums; }
.grid-metric.ab { grid-template-columns: 70px repeat(6, minmax(0, 1fr)); }
.grid-metric.ord { grid-template-columns: 110px minmax(0, 1.4fr) repeat(5, minmax(0, 1fr)); }
.grid-metric .r { text-align: right; }
.grid-metric .m-label { display: none; }
@media (max-width: 900px) {
  .grid-metric.grid-head { display: none; }
  .grid-metric, .grid-metric.ab, .grid-metric.ord { grid-template-columns: 1fr 1fr; gap: 8px; }
  .grid-metric .r { text-align: left; display: flex; flex-direction: column; gap: 2px; }
  .grid-metric .m-label { display: block; }
}
/* ---------- описание API ---------- */
.container:has(.api-layout) { max-width: 1240px; }
.api-layout { display: flex; gap: 48px; --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
              --api-dim: #A3AAAE; --api-panel: #10171D; --api-line: rgba(49, 60, 71, .5); }
.api-layout code { font-family: var(--mono); }
.api-toc { display: none; width: 196px; flex: none; position: sticky; top: 24px; align-self: flex-start; flex-direction: column; gap: 22px; padding-top: 8px; }
.api-toc > div { display: flex; flex-direction: column; gap: 2px; }
.api-toc .t { font: 600 12px/16px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--text-secondary); padding: 0 10px 6px; }
.api-toc a { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; font-size: 14px; line-height: 20px; color: var(--api-dim); }
.api-toc a:hover { color: rgba(250, 252, 255, .95); }
.api-toc a.on { color: var(--brand); background: rgba(255, 126, 41, .08); }
.api-toc .m { flex: none; width: 34px; font: 600 10px/16px var(--mono); }
.m-get { color: #4DA3FF; } .m-post { color: #FF7E29; }
.api-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 56px; }
.api-main section { scroll-margin-top: 16px; }
.api-main h2 { margin: 0; font: 700 22px/30px var(--font); }
.api-intro { display: flex; flex-direction: column; gap: 20px; padding-top: 8px; }
.api-title { display: flex; align-items: center; gap: 12px; }
.api-title h1 { font: 700 32px/40px var(--font); letter-spacing: -.01em; }
.api-title .ver { padding: 2px 8px; border-radius: 10px; background: var(--api-line); color: var(--text-secondary); font: 600 13px/18px var(--mono); }
.api-sub { color: var(--text-secondary); max-width: 620px; text-wrap: pretty; margin-top: -10px; }
.api-base { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 16px; border-radius: 14px; background: var(--api-panel);
            border: 1px solid var(--surface-border); max-width: 100%; }
.api-base .k { flex: none; font: 600 11px/16px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--text-secondary); }
.api-base code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font: 500 14px/20px var(--mono); color: rgba(250, 252, 255, .92); }
.api-copy { flex: none; height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text-secondary);
            font: 600 13px/1 var(--font); cursor: pointer; }
.api-copy:hover { background: var(--api-line); }
.api-copy.boxed { height: 32px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--surface-border); }
.api-copy.done { color: var(--success); }
.api-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.api-cards > div { padding: 18px; border-radius: 16px; background: var(--surface-card); display: flex; flex-direction: column; gap: 8px; }
.api-cards .h { font: 600 14px/20px var(--font); }
.api-cards .d { font-size: 14px; line-height: 20px; color: var(--text-secondary); text-wrap: pretty; }
.api-cards .d.small { font-size: 13px; line-height: 18px; }
.api-cards .d code { font-size: 13px; color: rgba(250, 252, 255, .9); }
.api-nums { display: flex; gap: 18px; }
.api-nums div { display: flex; flex-direction: column; }
.api-nums b { font: 700 22px/28px var(--font); font-variant-numeric: tabular-nums; }
.api-nums span { font-size: 13px; line-height: 18px; color: var(--text-secondary); }
.api-pill { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 10px; font: 600 13px/18px var(--mono); }
.api-pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.api-pill.ok, .api-pill.warn { margin-top: 2px; padding: 4px 10px; border-radius: 999px; font-family: var(--font); }
.api-pill.ok { background: #1EBD461A; color: var(--success); }
.api-pill.warn, .api-pill.warn:hover { background: #FFC0001A; color: var(--attention); }
.api-ep { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 28px; padding-top: 40px; border-top: 1px solid var(--api-line); }
.api-ep-text { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.api-sig { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.api-sig code { font: 500 15px/22px var(--mono); color: rgba(250, 252, 255, .92); }
.api-m { padding: 3px 8px; border-radius: 6px; font: 600 12px/16px var(--mono); }
.api-m.m-get { background: #4DA3FF1A; } .api-m.m-post { background: #FF7E291A; }
.api-m.sm { padding: 2px 7px; font-size: 11px; }
.api-desc { color: var(--api-dim); font-size: 15px; line-height: 24px; text-wrap: pretty; }
.api-desc.small { font-size: 14px; line-height: 20px; max-width: 680px; }
.api-params .t { font: 600 12px/16px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--text-secondary);
                 padding-bottom: 10px; border-bottom: 1px solid var(--api-line); }
.api-params .p { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--api-line); }
.api-params .p > div:first-child { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.api-params code { font: 600 14px/20px var(--mono); color: rgba(250, 252, 255, .95); }
.api-params .ty { font: 500 12px/16px var(--mono); color: var(--text-secondary); }
.api-params .req { font: 600 12px/16px var(--font); color: var(--error); }
.api-params .d { font-size: 14px; line-height: 20px; color: var(--api-dim); }
.api-note { display: flex; gap: 12px; padding: 14px 16px; border-radius: 14px; font-size: 14px; line-height: 20px; text-wrap: pretty; }
.api-note > span { flex: none; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font: 700 12px/1 var(--font); }
.api-note.note-info { background: rgba(77, 163, 255, .08); } .api-note.note-info > span { background: #4DA3FF26; color: #4DA3FF; }
.api-note.note-warn { background: #FFC00014; } .api-note.note-warn > span { background: #FFC00033; color: var(--attention); }
.api-ep-code { display: flex; flex-direction: column; gap: 12px; min-width: 0; position: sticky; top: 16px; align-self: start; }
.api-panel { border-radius: 14px; background: var(--api-panel); border: 1px solid var(--surface-border); overflow: hidden; }
.api-panel .bar { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 8px; border-bottom: 1px solid #253039; }
.api-panel .bar.resp { gap: 8px; padding-left: 14px; height: 41px; }
.api-panel .bar.resp i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.api-panel .bar .code { font: 600 13px/1 var(--mono); color: var(--success); }
.api-panel .bar .lbl { font: 500 13px/1 var(--font); color: var(--text-secondary); }
.api-panel .sp { flex: 1; }
.api-lang { height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text-secondary); font: 600 13px/1 var(--font); cursor: pointer; }
.api-lang.on { background: rgba(49, 60, 71, .7); color: rgba(250, 252, 255, .95); }
.api-panel pre { margin: 0; padding: 14px 16px; overflow-x: auto; font: 400 13px/21px var(--mono); color: rgba(250, 252, 255, .88); tab-size: 2; }
.api-panel pre .s { color: #9BD8A8; } .api-panel pre .k { color: #8CC4FF; } .api-panel pre .n { color: #FFB37A; }
.api-panel pre .w { color: #C4B5FD; } .api-panel pre .d { color: #6B757B; }
.api-sec { display: flex; flex-direction: column; gap: 16px; }
.api-sec.line { padding-top: 40px; border-top: 1px solid var(--api-line); }
.api-table { border-radius: 16px; background: var(--surface-card); padding: 4px 20px; }
.api-table.tight { border-radius: 14px; padding: 2px 16px; }
.api-table .r { display: grid; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--api-line); align-items: baseline; font-size: 14px; line-height: 20px; color: var(--api-dim); }
.api-table .r:last-child { border-bottom: none; }
.api-table .r.two { grid-template-columns: minmax(140px, 200px) minmax(0, 1fr); }
.api-table .r.three { grid-template-columns: 52px minmax(150px, 230px) minmax(0, 1fr); }
.api-table .r.col { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.api-table .r.col > div { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.api-table code { font: 500 14px/20px var(--mono); color: rgba(250, 252, 255, .92); overflow-wrap: anywhere; }
.api-table .r.two code { font-weight: 600; }
.api-table .c { justify-self: start; padding: 1px 7px; border-radius: 6px; font: 600 13px/18px var(--mono); }
.api-statuses { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 10px; }
.api-statuses > div { padding: 14px 16px; border-radius: 14px; background: var(--surface-card); display: flex; flex-direction: column; gap: 8px;
                      font-size: 14px; line-height: 20px; color: var(--api-dim); }
.api-internal { display: flex; flex-direction: column; gap: 20px; padding: 28px; border-radius: 20px; border: 1px dashed #3A4652; }
.api-internal > div:first-child { display: flex; flex-direction: column; gap: 8px; }
.api-internal .g { display: flex; flex-direction: column; gap: 12px; scroll-margin-top: 16px; }
.api-internal .gh { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; font: 600 17px/24px var(--font); }
.api-internal .gh code { font: 500 13px/20px var(--mono); color: var(--text-secondary); }
@media (min-width: 1240px) { .api-toc { display: flex; } }
@media (max-width: 700px) {
  .api-table .r.two, .api-table .r.three { grid-template-columns: 1fr; gap: 4px; }
  .api-internal { padding: 16px; }
  .api-ep-code { position: static; }
}
/* на телефоне сверху закреплена шапка — раздел при переходе по ссылке не должен под неё уезжать */
@media (max-width: 900px) { .api-main section, .api-internal .g { scroll-margin-top: 84px; } }
.not-found .code { font: 600 64px/72px var(--font); color: var(--surface-background-secondary); }

/* ---------- мобильная версия ---------- */
@media (max-width: 900px) {
  .layout { display: block; }
  .sidebar, .topbar { display: none; }
  .content { padding: 20px 16px 32px; }
  h1 { font-size: 22px; line-height: 28px; }
  .page-head { margin: 0 0 12px; gap: 10px; }
  .page-sub { margin: -4px 0 16px; font-size: 14px; line-height: 18px; }
  .stack { gap: 16px; }

  .mobile-header { display: flex; height: 64px; padding: 0 16px; align-items: center; justify-content: space-between;
                   border-bottom: 1px solid var(--surface-line); position: sticky; top: 0; z-index: 10; background: var(--surface-background); }
  .mobile-header .logo { font-size: 21px; }
  .burger { width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--surface-border); display: flex;
            flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; }
  .burger span { width: 16px; height: 2px; border-radius: 2px; background: var(--text-main); }
  .burger .x { display: none; width: auto; height: auto; background: none; color: var(--brand); font: 500 22px/1 var(--font); }
  .menu-toggle:checked ~ .mobile-header .burger span:not(.x) { display: none; }
  .menu-toggle:checked ~ .mobile-header .burger .x { display: block; }
  .menu-toggle:checked ~ .mobile-menu { display: flex; }
  .mobile-menu { position: fixed; inset: 64px 0 0; z-index: 10; background: var(--surface-background); padding: 24px 16px;
                 flex-direction: column; gap: 4px; }
  .mobile-menu .who { padding: 0 16px 20px; }
  .mobile-menu .nav a { height: 48px; }
  .mobile-menu .spacer { flex: 1; }
  .mobile-menu form { margin: 0; }
  .mobile-menu .btn { width: 100%; height: 48px; }

  .order-row { flex-direction: column; align-items: stretch; gap: 12px; margin: 0 0 12px; padding: 16px;
               border: none; background: var(--surface-card); }
  .d-only { display: none !important; }
  .order-row .circle-icon, .order-row > .btn-arrow { display: none; }
  .order-row .title { justify-content: space-between; }
  .order-row .sub { line-height: 18px; }
  .order-row .metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .order-row .metric { align-items: flex-start; width: auto !important; gap: 4px; }
  .order-row .m-foot { display: flex; align-items: center; justify-content: space-between;
                       border-top: 1px solid var(--surface-line); padding-top: 12px; }
  .order-row .m-foot .btn-arrow { width: 32px; height: 32px; }

  .filters { flex-direction: column; align-items: stretch; gap: 12px; }
  .filters .search, .filters select { width: 100%; }
  .filters .row2 { display: flex; gap: 8px; }
  .filters .row2 select { flex: 1; }
  .m-card { position: relative; display: flex !important; flex-direction: column; gap: 10px; margin-bottom: 12px; padding: 16px;
            border-radius: 16px; background: var(--surface-card); }
  .m-card .m-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
  .m-card .id { font: 600 16px/24px var(--font); font-variant-numeric: tabular-nums; }
  .m-card .id::after { content: ""; position: absolute; inset: 0; border-radius: 16px; }
  .m-card .client-line { font-size: 14px; line-height: 18px; }
  .m-card .client { position: relative; z-index: 1; color: var(--text-main); text-decoration: underline;
                    text-decoration-color: var(--surface-border); text-underline-offset: 4px; }
  .m-card .link { font-size: 14px; line-height: 18px; color: var(--text-secondary); overflow-wrap: anywhere; }
  .m-card .m-bottom { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; line-height: 16px;
                      color: var(--text-secondary); border-top: 1px solid var(--surface-line); padding-top: 10px;
                      font-variant-numeric: tabular-nums; }
  .pager { justify-content: center; }
  .pager .shown { display: none; }
  .pager .pages { width: 100%; justify-content: space-between; gap: 8px; }
  .pager .pages .btn { padding: 8px 14px; font-size: 15px; }
  .pager .pages span { font-size: 14px; }

  .card { padding: 16px; border-radius: 16px; }
  .info { display: flex; flex-direction: column; gap: 14px; }
  .info > div { flex-direction: row; justify-content: space-between; align-items: center; gap: 12px; }
  .info .v { font-size: 14px; line-height: 16px; text-align: right; }
  .stats-head { flex-direction: column; align-items: flex-start; gap: 8px; padding-bottom: 12px; }
  .stats-title { font-size: 18px; line-height: 24px; }
  .stats-total b { font-size: 36px; line-height: 40px; }
  .stat-row { align-items: flex-start; gap: 12px; font-size: 14px; line-height: 20px; }
  .stats-empty .i { width: 40px; height: 40px; font-size: 18px; }
  .empty, .not-found { margin-top: 96px; }
  .empty .btn-primary, .not-found .btn-primary { width: 100%; }
  .not-found .code { font-size: 48px; line-height: 56px; }

  .grid-users.grid-head { display: none; }
  .grid-users { display: grid; grid-template-columns: 1fr auto; gap: 10px 8px; padding: 16px; margin-bottom: 12px;
                border: none; border-radius: 16px; background: var(--surface-card); }
  .grid-users .role { grid-column: 2; grid-row: 1; justify-self: end; }
  .grid-users .tg { grid-column: 1; grid-row: 2; font-size: 14px; line-height: 18px; align-self: center; }
  .grid-users .act { grid-column: 1 / -1; grid-row: 3; justify-content: flex-start; flex-wrap: wrap; }
  .grid-users .act:has(.note) { grid-column: 2; grid-row: 2; }
  .grid-users .note { padding-right: 0; }

  .grid-exec.grid-head { display: none; }
  .grid-exec { grid-template-columns: 1fr 1fr; gap: 8px; }
  .grid-exec .url { grid-column: 1 / -1; grid-row: 2; }
  .grid-exec .r { text-align: left; display: flex; flex-direction: column; gap: 4px; }
  .grid-exec .m-label { display: block; }
  .guard-form label, .guard-form label .field, .guard-form .btn { width: 100%; }
  .guard-form .guard-check { width: auto; }
  .exec-speed-form { width: 100%; }
  .exec-speed-form .field { flex: 1; width: auto; }
  .buckets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-acc.grid-head { display: none; }
  .grid-acc { grid-template-columns: 1fr 1fr; gap: 8px; padding: 16px; margin-bottom: 12px; border: none;
              border-radius: 16px; background: var(--surface-card); }
  .grid-acc .acc, .grid-acc .date { grid-column: 1 / -1; text-align: left; }
  .grid-acc .r { text-align: left; display: flex; flex-direction: column; gap: 4px; }
  .grid-acc .m-label { display: block; }
  .grid-pay.grid-head { display: none; }
  .grid-pay { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .grid-pay > :first-child { grid-column: 1 / -1; font-weight: 600; }
  .grid-pay .r { text-align: left; display: flex; flex-direction: column; gap: 4px; }
  .grid-pay .m-label { display: block; }
  .cut { padding: 16px; }
  .svc-id { width: 100%; }
  .svc-form, .svc-add { width: 100%; flex-wrap: wrap; }
  .svc-form .field, .svc-add .field { flex: 1; width: auto; min-width: 110px; }

  .login-card { padding: 24px; }
}

/* ---------- boosts: таблицы ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th { text-align: left; color: var(--text-secondary); font-weight: 600; font-size: 13px; padding: 8px 12px; }
.tbl td { padding: 12px; border-top: 1px solid var(--surface-line); overflow-wrap: anywhere; }
.tbl tr:hover td { background: var(--surface-hover); }
.tbl .r { text-align: right; }
.tbl-wrap { overflow-x: auto; }
.tbl .nums, .tbl .badge { white-space: nowrap; overflow-wrap: normal; }
