/* AgentX Hub · айдентика «Температурний лист» для старих сторінок /dashboard і /ai.
   Підключається ПІСЛЯ власного <style> сторінки й перекриває його. Токени — з DESIGN.md.
   Поведінку сторінок не змінює: тільки вигляд. */

html:root {
  --paper: #F3F6F1; --sheet: #FBFCFA; --sheet2: #EEF3EF; --grid: #D5E4DB; --rail: #E6EDE7;
  --ink: #13221C; --ink2: #4A5E55; --ink3: #5E7067;
  --band: #13221C; --band2: #22332B; --bandink: #EAF1EC; --bandink2: #B7C7BE;
  --data-blue: #2457B3;
  --crit: #B42318; --critbg: #FBE3E0; --warn: #8A5300; --warnbg: #FCEFD6; --ok: #1F7A4D; --okbg: #DDEFE5;

  /* старі змінні сторінок → нові значення */
  --bg: var(--paper);
  --card-bg: var(--sheet);
  --card-border: var(--grid);
  --card-subtle: var(--sheet2);
  --card-nested: var(--rail);
  --accent: var(--ink);
  --accent-hover: var(--band2);
  --accent-warm: var(--warn);
  --text: var(--ink);
  --text-muted: var(--ink2);
  --text-tertiary: var(--ink3);
  --success: var(--ok);
  --success-bg: var(--okbg);
  --danger: var(--crit);
  --danger-bg: var(--critbg);
  --warning: var(--warn);
  --warning-bg: var(--warnbg);
  --warning-hover: #6F4300;
  --purple: var(--data-blue);
  --shadow-soft: none;
  --shadow-hover: none;
  --font: "Commissioner", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

html body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
html ::selection { background: #C8261F; color: #fff; }
html :focus-visible { outline: 2px solid var(--data-blue); outline-offset: 2px; }
html * { scrollbar-width: thin; scrollbar-color: #B8C9BF transparent; }

/* ---------- Смуга (спільна з /hub) ---------- */
html header.xb {
  position: sticky; top: 0; z-index: 100;
  min-height: 56px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 22px;
  padding: 8px max(24px, env(safe-area-inset-right, 0px)) 8px max(24px, env(safe-area-inset-left, 0px));
  background: var(--band); color: var(--bandink);
  border: 0; backdrop-filter: none; -webkit-backdrop-filter: none;
}
.xb-mark { font-weight: 700; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; color: var(--bandink); text-decoration: none; }
.xb-tabs { display: flex; gap: 4px; overflow-x: auto; }
.xb-tabs a { color: var(--bandink2); text-decoration: none; padding: 8px 12px; border-radius: 6px; font-weight: 500; white-space: nowrap; transition: background-color .15s ease, color .15s ease; }
.xb-tabs a:hover { color: #fff; }
.xb-tabs a[aria-current] { background: var(--band2); color: #fff; }
.xb-sp { flex: 1; }
.xb-live { display: flex; align-items: center; gap: 8px; color: var(--bandink2); white-space: nowrap; }
.xb-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
html .xb-btn {
  height: 34px; padding: 0 14px; border-radius: 6px; border: 1px solid #3A4D44; background: transparent;
  color: var(--bandink); font: 600 13px var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: background-color .15s ease, transform .14s cubic-bezier(.23,1,.32,1);
}
html .xb-btn:hover { background: var(--band2); }
html .xb-btn:active { transform: scale(.97); }
html .xb-btn.xb-primary { background: var(--bandink); color: var(--ink); border-color: var(--bandink); }
html .xb-btn.xb-primary:hover { background: #fff; }
html .xb-btn[disabled] { opacity: .6; cursor: progress; }
html .xb-ghost { background: transparent; border: 0; color: var(--bandink2); cursor: pointer; padding: 6px 8px; border-radius: 6px; font: 500 14px var(--font); }
html .xb-ghost:hover { color: #fff; }
html .xb .dropdown-menu { color: var(--ink); }
html .pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: #5BD08F; animation: none; box-shadow: none; }
@media (max-width: 760px) {
  html header.xb { position: static; gap: 8px 12px; padding-top: max(8px, env(safe-area-inset-top, 0px)); }
  .xb-sp { display: none; }
  .xb-tabs { order: 3; width: 100%; }
  .xb-live { order: 2; margin-left: auto; font-size: 13px; }
  .xb-actions { order: 4; width: 100%; }
}

/* ---------- Сторінкові заголовки ---------- */
html .hero-banner { background: transparent; border: 0; box-shadow: none; padding: 4px 0 0; margin-bottom: 14px; border-radius: 0; }
html .hero-title h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); text-wrap: balance; }
html .hero-title p { color: var(--ink2); max-width: 90ch; }
html .section-title { font-size: 15px; font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--ink); margin: 26px 0 10px; }
html .section-title .title-left { color: var(--ink); }

/* ---------- Підсумок замість плиток-цифр ---------- */
html .stats-grid { display: flex; flex-wrap: wrap; gap: 0; margin-bottom: 18px; background: var(--sheet); border-radius: 8px; overflow: hidden; }
html .stat-card {
  flex: 1 1 180px; display: block; background: transparent; border: 0; border-right: 1px solid var(--grid);
  box-shadow: none; border-radius: 0; padding: 12px 16px; transform: none;
}
html .stat-card:last-child { border-right: 0; }
html .stat-card:hover { transform: none; box-shadow: none; }
html .stat-card::before, html .stat-card::after { display: none; }
html .stat-icon { display: none; }
html .stat-info { display: flex; flex-direction: column; gap: 2px; }
html .stat-val { font-size: 20px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); line-height: 1.2; }
html .stat-lbl, html .stat-label { font-size: 12px; font-weight: 500; color: var(--ink2); text-transform: none; letter-spacing: 0; order: -1; }
html .stat-desc { font-size: 12px; color: var(--ink3); }

/* ---------- Кнопки ---------- */
html .btn {
  height: auto; min-height: 32px; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--grid);
  background: var(--sheet); color: var(--ink); font: 600 13px var(--font); box-shadow: none;
  transition: background-color .15s ease, border-color .15s ease, transform .14s cubic-bezier(.23,1,.32,1);
}
html .btn:hover { background: var(--sheet2); border-color: #B8C9BF; transform: none; box-shadow: none; }
html .btn:active { transform: scale(.97); }
html .btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
html .btn-primary:hover { background: var(--band2); border-color: var(--band2); color: #fff; }
html .btn-warning, html .btn-warn-outline { background: var(--warnbg); color: var(--warn); border-color: #EBD3A6; }
html .btn-warning:hover, html .btn-warn-outline:hover { background: #F8E4BD; color: var(--warn); }
html .btn-success { background: var(--okbg); color: var(--ok); border-color: #BFE0CD; }
html .btn-sm { min-height: 28px; padding: 4px 10px; font-size: 12px; }
html .btn[disabled] { opacity: .55; }

/* ---------- Плашки ---------- */
html .badge, html .tag-chip, html .badge-tag, html .badge-legacy, html .status-pill, html .fleet-status-pill, html .model-chip {
  border-radius: 99px; border: 0; padding: 2px 9px; font: 600 12px var(--font); text-transform: none; letter-spacing: 0;
  background: var(--sheet2); color: var(--ink2); box-shadow: none;
}
html .badge-success, html .status-online { background: var(--okbg); color: var(--ok); }
html .badge-danger { background: var(--critbg); color: var(--crit); }
html .badge-warning { background: var(--warnbg); color: var(--warn); }
html .badge-accent { background: #E3EAF7; color: var(--data-blue); }
html .badge-purple { background: #E3EAF7; color: var(--data-blue); }
html .model-chip-active { background: var(--ink); color: #fff; }

/* ---------- Поверхні ---------- */
html .container, html main { max-width: none; }
html .tree-group-card, html .detail-card, html .table-container, html .editor-container, html .logs-container, html .console-section {
  background: var(--sheet); border: 0; border-radius: 8px; box-shadow: none;
}
html .tree-group-card:hover, html .detail-card:hover { box-shadow: none; transform: none; }
html .tree-group-header { background: transparent; border-bottom: 1px solid var(--grid); }
html .tree-group-title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
html .tree-subgroup-header { background: var(--sheet2); border: 0; border-radius: 6px; }
html .tree-subgroup-title { font-weight: 600; color: var(--ink2); }
html .tree-node-row { background: transparent; border: 0; border-top: 1px solid var(--grid); border-radius: 0; box-shadow: none; }
html .tree-node-row:hover { background: #F1F6F2; transform: none; box-shadow: none; }
html .tree-node-title { font-size: 15px; font-weight: 700; color: var(--ink); }
html .tree-node-host, html .tree-node-id, html .tree-node-ip { font-family: var(--font); color: var(--ink3); font-variant-numeric: tabular-nums; }
html .tree-node-note, html .tree-node-ping { color: var(--ink2); }
html .tree-toggle-pill { background: var(--ink); color: #fff; border-radius: 6px; box-shadow: none; }
html .subgroup-arrow { color: var(--ink2); }
html .detail-card-title { color: var(--ink); font-weight: 700; }
html .detail-card-header { border-bottom: 1px solid var(--grid); }
html .detail-row { border-bottom: 1px solid var(--grid); }
html .detail-label { color: var(--ink2); }
html .detail-value { color: var(--ink); font-weight: 600; }
html .balance-huge { font-size: 26px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
html .cards-grid { gap: 12px; }

/* ---------- Таблиці ---------- */
html table { border-collapse: collapse; }
html th { background: var(--sheet2); color: var(--ink2); font: 500 12px var(--font); text-transform: none; letter-spacing: 0; border-bottom: 1px solid var(--grid); }
html td { border-bottom: 0; border-top: 1px solid var(--grid); color: var(--ink); }
html tr:hover td { background: transparent; }
html .matrix-table td, html .matrix-table th { border-color: var(--grid); }

/* ---------- Поля ---------- */
html .cmd-input, html .auth-input, html .node-select, html .search-box input, html input.search-box, html .editor-textarea, html select {
  border: 1px solid var(--grid); border-radius: 8px; background: #fff; color: var(--ink); font-family: var(--font); box-shadow: none;
}
/* справжні команди й файли навичок лишаються моноширинними */
html .console-input-row .cmd-input, html .editor-textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
html .cmd-input:focus, html .auth-input:focus, html .node-select:focus, html .search-box input:focus, html input.search-box:focus, html .editor-textarea:focus {
  outline: 2px solid var(--data-blue); outline-offset: 0; border-color: var(--data-blue);
}

/* ---------- Фільтри й перемикачі ---------- */
html .filter-group button, html .filter-group .btn, html .filter-chip { border-radius: 99px; }
html .view-toggle-group, html .tabs-nav { background: var(--rail); border: 0; border-radius: 8px; padding: 3px; box-shadow: none; }
html .view-toggle-btn, html .tab-btn { background: transparent; border: 0; color: var(--ink2); font: 600 13px var(--font); border-radius: 6px; box-shadow: none; }
html .view-toggle-btn.active, html .tab-btn.active { background: var(--sheet); color: var(--ink); box-shadow: none; }

/* ---------- Прогрес і індикатори ---------- */
html .progress-bar-bg { background: var(--grid); border-radius: 3px; }
html .progress-bar-fill { border-radius: 3px; }

/* ---------- Консоль і код (справжній код — моноширинний) ---------- */
html .cmd-output, html .code-block, html .log-line, html .logs-container {
  background: var(--band); color: var(--bandink); border: 0; border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
html .log-time { color: var(--bandink2); }
html .log-agent { color: #9CC3F5; }
html .log-mcp { color: #A9DDBF; }

/* ---------- Вікна ---------- */
html .modal-overlay, html #auth-overlay { background: rgba(19, 34, 28, .45); backdrop-filter: none; -webkit-backdrop-filter: none; }
html .modal-card, html .auth-card {
  background: var(--sheet); border: 0; border-radius: 8px;
  box-shadow: 0 18px 48px -18px rgba(19, 34, 28, .35);
}
html .modal-header { border-bottom: 1px solid var(--grid); }
html .modal-header h3, html .auth-card h2 { font-size: 18px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
html .dropdown-menu { background: var(--sheet); border: 1px solid var(--grid); border-radius: 8px; box-shadow: 0 12px 32px -12px rgba(19, 34, 28, .3); }
html .dropdown-item { color: var(--ink); border-radius: 6px; }
html .dropdown-item:hover { background: var(--sheet2); }
html .dropdown-divider { background: var(--grid); }
html .empty-state { color: var(--ink2); }

/* ---------- Перемикач (skills) ---------- */
html .switch .slider { background: var(--grid); }
html .switch input:checked + .slider { background: var(--ok); }

/* ---------- Іконки-кнопки ---------- */
html .x-close { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 32px; padding: 0; }
html .x-close svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

/* ---------- Уточнення для /ai ---------- */
html tr.active-row, html tr.active-row td { background: #EAF3EC; }
html .stat-card .stat-info .stat-label, html .stat-card .stat-info .stat-lbl { font-size: 12px; font-weight: 500; color: var(--ink2); text-transform: none; letter-spacing: 0; }
html .stat-card .stat-info .stat-val { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
html .stat-card .stat-info .stat-desc { font-size: 12px; color: var(--ink3); }
html .model-chip-active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Контраст і чесні індикатори ---------- */
html .pulse-dot, html .status-online, html .node-status, html [class*="dot"] { animation: none !important; box-shadow: none !important; }
html .logs-container [style*="danger"], html .logs-container .log-error, html .cmd-output [style*="danger"] { color: #FF8A80 !important; }
html .detail-card-header { padding-bottom: 10px; }
html .hero-banner { padding-bottom: 6px; }

/* ---------- Правки після рев'ю: семантика й телефон ---------- */
html .btn-warn-outline { background: var(--sheet); color: var(--ink); border-color: var(--grid); }
html .btn-warn-outline:hover { background: var(--sheet2); color: var(--ink); }
html .tag-chip { background: var(--sheet); color: var(--ink2); border: 1px solid var(--grid); box-shadow: none; }
html .tag-chip:hover { background: var(--sheet2); color: var(--ink); }
html .tag-chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
html [style*="uppercase"], html .stat-label, html th, html .section-title, html .badge { text-transform: none !important; letter-spacing: 0 !important; }
html #tab-skills .hero-banner { background: transparent !important; border: 0 !important; padding: 4px 0 6px; }
@media (max-width: 760px) {
  html .xb-actions { flex-wrap: nowrap; overflow-x: auto; width: 100%; }
  html .btn, html .xb-btn { min-height: 44px; }
}
