/* ==========================================================================
   CID — Center for Innovations Development / дизайн-код бренду
   Тема «Carbon data» (робота з даними). Шрифт Inter. Акцент Accent tech.
   ========================================================================== */
:root {
  /* Світла тема CID: White + Light Gray + Black текст, акценти бренду */
  --bg: #FFFFFF;          /* White */
  --panel: #FBFBFC;       /* майже білі поверхні */
  --panel-2: #F1F2F4;     /* Light Gray поверхня */
  --line: #D8DBE0;        /* лінії патерну / роздільники */
  --border: #E5E5E5;      /* Light Gray */
  --text: #090909;        /* Black */
  --text-2: #333333;      /* нейтральна шкала 80% */
  --muted: #666666;       /* нейтральна шкала 60% */
  --accent: #C4CBFF;      /* Accent tech — заливки (кнопки, чипи) */
  --accent-2: #D0D5FF;
  --accent-ink: #212C32;  /* темний текст на акценті */
  --accent-strong: #1056A0; /* Blue data — контрастний акцент (лінки, підкреслення, фокус) */
  --innovation: #6E9E13;  /* Innovation, затемнений для контрасту на білому */
  --brown: #A4896B;       /* Human brown — людяність */
  --ok: #6E9E13;
  --warn: #B67A12;
  --err: #D23A3A;
  --code-bg: #212C32;     /* Carbon data — темні блоки коду/даних на світлому */
  --code-fg: #E5E5E5;
  --radius: 12px;
  --font-family-base: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-family: var(--font-family-base);
  font-feature-settings: 'cv05' 1, 'ss01' 1; /* Inter — стилістичні альтернативи */
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  letter-spacing: -0.01em; -webkit-font-smoothing: antialiased; }

.app-header {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border); background: var(--panel);
}
/* Лінійний патерн CID: лінії на одну градацію нижче тону фону (#4B5E69) */
.app-header::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 40px);
  opacity: 0.7;
}
.brand { display: flex; align-items: center; gap: 14px; position: relative; }
.logo { display: inline-flex; color: var(--accent); }
.logo svg { display: block; }
.brand-logo { height: 56px; width: auto; display: block; }
.brand-sep { width: 1px; height: 40px; background: var(--line); display: inline-block; }
.brand-text { display: flex; flex-direction: column; }
.app-header h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.03em; }
.subtitle { margin: 2px 0 0; color: var(--muted); font-size: 12px; letter-spacing: 0; font-family: ui-monospace, monospace; }

.session { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 12px;
  border-radius: 999px; border: 1px solid var(--border); }
.session .dot { width: 8px; height: 8px; border-radius: 50%; }
.session--out { color: var(--muted); }
.session--out .dot { background: var(--muted); }
.session--in { color: var(--innovation); border-color: var(--innovation); }
.session--in .dot { background: var(--innovation); }

.tabs { display: flex; gap: 4px; padding: 12px 24px 0; border-bottom: 1px solid var(--border); background: var(--panel); flex-wrap: wrap; }
.tab { background: none; border: none; color: var(--muted); padding: 10px 16px; cursor: pointer;
  font-size: 14px; font-weight: 500; letter-spacing: -0.01em; border-bottom: 2px solid transparent; border-radius: 6px 6px 0 0; }
.tab:hover { color: var(--text); background: var(--panel-2); }
.tab.active { color: var(--text); border-bottom-color: var(--accent-strong); }

main { max-width: 960px; margin: 0 auto; padding: 28px 24px; }
.panel { display: none; }
.panel.active { display: block; }
.panel h2 { margin-top: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.04em; }

.muted { color: var(--muted); font-size: 13px; }
code { background: var(--panel-2); padding: 2px 6px; border-radius: 4px; font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.btn { background: var(--accent); color: var(--accent-ink); border: none; padding: 9px 16px;
  border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; transition: filter .15s; }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn--ghost { background: transparent; border: 1px solid var(--line); color: var(--text-2); }
.btn--ghost:hover { border-color: var(--accent); color: var(--text); filter: none; }
.btn--sm { padding: 6px 12px; font-size: 13px; }

.header-right { display: flex; align-items: center; gap: 14px; position: relative; }
.client-tag { font-family: ui-monospace, monospace; font-size: 11px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; }
.badge { display: inline-block; min-width: 18px; text-align: center; background: var(--accent);
  color: var(--accent-ink); border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 6px; margin-left: 2px; }

.row { display: flex; gap: 10px; align-items: center; margin: 12px 0; flex-wrap: wrap; }
.input, select, input[type="text"], input[type="password"] {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 9px 12px; border-radius: 8px; font-size: 14px; min-width: 220px; }
textarea.input { width: 100%; font-family: ui-monospace, monospace; }

.output { background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; overflow: auto; max-height: 420px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; white-space: pre-wrap; word-break: break-word; margin-top: 14px; color: var(--code-fg); }
.output.small { max-height: 220px; }
.output.is-error { border-color: var(--err); background: #fdecec; color: #a01f1f; }
input:focus, select:focus, textarea:focus, .input:focus { outline: none; border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(16,86,160,.12); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.chip { background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 4px 10px; border-radius: 999px; font-size: 12px; cursor: pointer; }
.chip:hover { border-color: var(--accent); }

.steps { list-style: none; padding: 0; margin: 0; }
.step { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px; }
.step-head { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.num { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px;
  background: var(--accent); color: var(--accent-ink); border-radius: 50%; font-size: 13px; font-weight: 700; }

.kep-form { display: grid; gap: 12px; margin: 14px 0; max-width: 460px; }
.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.field input, .field select { min-width: 0; }

.notice { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin: 10px 0;
  background: var(--panel-2); border: 1px solid var(--border); }
.notice--ok { border-color: var(--ok); color: var(--innovation); background: #f2f8e6; }
.notice--warn { border-color: var(--warn); color: var(--warn); background: #fbf3e2; }

.fallback { margin-top: 12px; }
.fallback summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.fallback[open] summary { color: var(--text); margin-bottom: 8px; }

.hidden { display: none; }

.file-banner { background: #7a2018; color: #ffd9d4; border-bottom: 1px solid var(--err);
  padding: 10px 20px; font-size: 13px; text-align: center; }
.file-banner code { background: rgba(0,0,0,.3); }

/* ---------- Звіт про фінансову спроможність ---------- */
.rep-org { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel);
  padding: 16px 18px; margin: 14px 0; }
.rep-org-name { font-size: 18px; font-weight: 600; }
.rep-org-sub { font-size: 12px; margin-top: 4px; }
.rep-section { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel);
  padding: 14px 18px; margin-bottom: 12px; }
.rep-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.rep-title { font-weight: 600; font-size: 14px; }
.rep-meta { color: var(--muted); font-size: 12px; }
.rep-method { margin-left: auto; font-size: 11px; color: var(--accent-strong); }
.rep-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin: 8px 0; }
.rep-field { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.rep-k { display: block; color: var(--muted); font-size: 11px; }
.rep-v { display: block; font-size: 14px; margin-top: 2px; word-break: break-word; }
.rep-raw summary { cursor: pointer; color: var(--muted); font-size: 12px; }
@media print {
  .app-header, .tabs, #report-guard, #btn-report-refresh, #btn-report-print { display: none !important; }
  body { background: #fff; color: #000; }
  .rep-org, .rep-section { border-color: #ccc; background: #fff; }
  .rep-method, .rep-k, .rep-org-sub { color: #555; }
}

/* ---------- Explorer методів без авторизації ---------- */
.explorer { display: grid; grid-template-columns: 340px 1fr; gap: 16px; margin-top: 14px; align-items: start; }
.method-list { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel);
  overflow: hidden; display: flex; flex-direction: column; max-height: 620px; }
#method-search { border: none; border-bottom: 1px solid var(--border); border-radius: 0; margin: 0; }
#method-items { overflow-y: auto; }
.ml-group { position: sticky; top: 0; background: var(--panel-2); color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: .5px; padding: 6px 12px; border-bottom: 1px solid var(--border); }
.ml-item { display: block; width: 100%; text-align: left; background: none; border: none;
  border-bottom: 1px solid rgba(255,255,255,.04); color: var(--text); padding: 8px 12px; cursor: pointer; }
.ml-item:hover { background: var(--panel-2); }
.ml-item.active { background: rgba(47,129,247,.15); box-shadow: inset 3px 0 0 var(--accent); }
.ml-path { display: block; font-family: ui-monospace, monospace; font-size: 12.5px; color: var(--accent-strong); }
.ml-sum { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.method-detail { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); padding: 18px; min-height: 200px; }
.detail-empty { padding: 40px 0; text-align: center; }
.md-head { display: flex; align-items: center; gap: 10px; }
.badge-get { background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 5px; letter-spacing: .5px; }
.md-path { font-size: 14px; }
.md-sum { color: var(--muted); font-size: 13px; margin: 8px 0 14px; }
.md-form { display: grid; gap: 12px; margin-bottom: 14px; max-width: 520px; }
.md-form .field span em { color: var(--muted); font-style: normal; font-size: 11px; }
.md-form .req { color: var(--err); }
.md-input { width: 100%; }
#md-file { margin: 10px 0; }
#md-file .btn { background: var(--ok); }
