/* Тема как в Bybit collector (web_app INDEX_HTML) */
:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel2: #ffffff;
  --line: #d9e0e8;
  --text: #18212f;
  --muted: #667085;
  --good: #39d98a;
  --bad: #d92d20;
  --warn: #b7791f;
  --accent: #1f6feb;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.45 "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
.portal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 4px rgba(16, 24, 40, 0.06);
}
.portal-header h1 { font-size: 19px; margin: 0; font-weight: 700; }
.portal-nav { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.portal-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 14px;
}
.portal-nav a:hover { color: var(--text); background: #f4f6f8; }
.portal-nav a.active {
  background: #eef5ff;
  border-color: #c9d8f0;
  color: var(--accent);
  font-weight: 600;
}
/* Вкладка «Коллектор»: на всю ширину окна */
html.portal-collector-html {
  width: 100%;
  max-width: 100%;
}
body.portal-collector-full {
  min-width: 100%;
  margin: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
body.portal-collector-full .portal-header {
  max-width: none;
  width: 100%;
  box-sizing: border-box;
}
body.portal-collector-full > main.portal-main.portal-main--collector-full {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box;
}
body.portal-collector-full .portal-primary {
  width: 100vw;
  max-width: 100vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  box-sizing: border-box;
  margin-left: 0;
  margin-right: 0;
  margin-bottom: 24px;
  padding-left: 0;
  padding-right: 0;
}
body.portal-collector-full .collector-inline-root > header,
body.portal-collector-full .collector-inline-root > main {
  width: 100% !important;
  max-width: none !important;
  box-sizing: border-box;
  padding-left: 10px !important;
  padding-right: 10px !important;
}
body.portal-collector-full .collector-inline-root > header {
  padding-top: 10px !important;
  padding-bottom: 10px !important;
}
body.portal-collector-full .collector-inline-root > main {
  padding-top: 10px !important;
  padding-bottom: 16px !important;
}
.portal-main { max-width: 1100px; margin: 0 auto; padding: 16px 20px 32px; }
.portal-main--collector-full {
  max-width: none !important;
  width: 100%;
  margin: 0;
  padding: 0 !important;
  box-sizing: border-box;
}
body.portal-collector-full .collector-inline-root {
  width: 100% !important;
  max-width: none !important;
  min-height: calc(100vh - 56px);
  display: block;
  border: none;
  border-radius: 0;
  background: #fff;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.card h2 { margin: 0 0 10px; font-size: 15px; font-weight: 700; }
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-box {
  width: 100%;
  max-width: 400px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
  position: relative;
  overflow: hidden;
}
.login-box h1 { font-size: 20px; margin: 0 0 6px; }
.login-box .sub { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 4px; }
label:first-of-type { margin-top: 0; }
input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}
input:focus {
  outline: 2px solid rgba(31, 111, 235, 0.35);
  border-color: var(--accent);
}
button.btn-submit {
  margin-top: 18px;
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
}
button.btn-submit:hover { filter: brightness(1.05); }
.err {
  margin-top: 14px;
  padding: 10px 12px;
  background: #fef3f2;
  border: 1px solid #fecdca;
  border-radius: 8px;
  color: #b42318;
  font-size: 13px;
}
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0; }
button,
.btn {
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  text-decoration: none;
  display: inline-block;
}
button.primary,
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
button:hover,
.btn:hover {
  filter: brightness(1.02);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}
pre {
  background: #f8fafc;
  padding: 12px;
  border-radius: 6px;
  overflow: auto;
  font-size: 12px;
  border: 1px solid var(--line);
  max-height: 320px;
}
.flash {
  background: #eef5ff;
  border: 1px solid #c9d8f0;
  color: #233a5e;
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 14px;
  white-space: pre-wrap;
}
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}
.pill.ok { background: #ecfdf3; color: #027a48; }
.pill.bad { background: #fef3f2; color: #b42318; }
.pill.muted { background: #f4f6f8; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th,
td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; }
.collector-frame {
  width: 100%;
  min-height: calc(100vh - 120px);
  height: min(1200px, calc(100vh - 100px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: block;
}
.muted { color: var(--muted); font-size: 13px; }
code {
  font-size: 12px;
  background: #f8fafc;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

/* Дашборд */
body.login-page {
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(31, 111, 235, 0.12), transparent 55%),
    radial-gradient(900px 400px at 90% 110%, rgba(57, 217, 138, 0.1), transparent 50%),
    var(--bg);
}
.login-box::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(31, 111, 235, 0.45), rgba(57, 217, 138, 0.35));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.hero {
  border-radius: 12px;
  padding: 22px 24px;
  margin-bottom: 18px;
  background: linear-gradient(125deg, #0d3d82 0%, #1f6feb 42%, #3d8bfd 100%);
  color: #fff;
  box-shadow: 0 12px 32px rgba(31, 111, 235, 0.28);
}
.hero h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.hero p {
  margin: 0;
  font-size: 14px;
  opacity: 0.92;
  line-height: 1.5;
  max-width: 52rem;
}
body.portal-collector-full .hero p {
  max-width: none;
}
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.status-tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
}
.status-tile h3 {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.status-tile .big {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 6px;
  word-break: break-word;
}
.status-tile .hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 10px;
}

/* ——— Портал: коллектор сверху, дашборд бота, техблок внизу ——— */
.portal-primary {
  margin-bottom: 24px;
}
.flash-top {
  margin-bottom: 16px;
}
.flash-bad {
  background: #fef3f2;
  border: 1px solid #fecdca;
  color: #7a271a;
}
.pill.warn {
  background: #fffaeb;
  color: #b7791f;
  border: 1px solid #f5e0b3;
}

.bot-dash {
  max-width: 1200px;
  margin: 0 auto 32px;
}
.bot-dash-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
}
.bot-dash-title {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.bot-dash-sub {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 36rem;
  line-height: 1.5;
}
.bot-dash-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Якорь «#bot-dashboard-embed» не уезжает под sticky header */
.bot-dashboard-embed-host {
  scroll-margin-top: 88px;
}

.bot-metric-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.bot-metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.bot-metric-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}
.bot-metric-value {
  font-size: 22px;
  font-weight: 700;
}
.bot-metric-hint {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.card-head-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.bot-actions-card .bot-action-row {
  flex-wrap: wrap;
  gap: 10px;
}
button.danger,
button.danger:hover {
  background: #d92d20;
  color: #fff;
  border-color: #b42318;
}
button.danger:hover {
  filter: brightness(1.05);
}
button.sm {
  padding: 6px 12px;
  font-size: 13px;
}
button.muted-btn {
  background: #f4f6f8;
  color: var(--text);
  border: 1px solid var(--line);
}

.table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.bot-pos-table {
  font-size: 13px;
  min-width: 640px;
}
.bot-pos-table td.neg {
  color: #b42318;
  font-weight: 600;
}
.bot-pos-table td.pos {
  color: #027a48;
  font-weight: 600;
}
.td-actions {
  white-space: nowrap;
}
.td-nowrap {
  white-space: nowrap;
}
.td-note {
  max-width: 220px;
  font-size: 12px;
  color: var(--muted);
}
.inline-form {
  display: inline;
}

.risk-list {
  margin: 0;
  padding-left: 1.2rem;
  line-height: 1.65;
  color: var(--text);
}
.small-print {
  font-size: 12px;
  margin-top: 12px;
}

.portal-tech {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 2px solid var(--line);
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}
.tech-heading {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.tech-lead {
  margin: 0 0 16px;
  font-size: 13px;
}
.tech-flash {
  margin-bottom: 16px;
}
.tech-details {
  margin-top: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
}
.tech-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
}
.json-block {
  font-size: 11px;
  overflow-x: auto;
  max-height: 280px;
  background: #0d1117;
  color: #e6edf3;
  padding: 12px;
  border-radius: 6px;
  margin-top: 10px;
}
