/* ═══════════════════════════════════════════════
   tools.css — стили рабочих блоков инструментов
   Все цвета/отступы — только через классы ниже.
   В JS допустимо: el.style.display = 'block/none'
   ═══════════════════════════════════════════════ */

.tool-block {
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  margin: 32px 0;
}

.tool-label { font-weight: 600; font-size: .95rem; display: block; margin-bottom: 10px; }

.tool-textarea {
  width: 100%;
  min-height: 160px;
  padding: 14px 16px;
  font-size: .9rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
  background: #fff;
  box-sizing: border-box;
  transition: border-color .15s;
}
.tool-textarea:focus { outline: none; border-color: var(--primary); }

.tool-input-meta { display: flex; justify-content: space-between; font-size:.8rem; color: var(--text-secondary); margin-top: 6px; }

.tool-btn {
  margin-top: 16px;
  padding: 12px 32px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.tool-btn:hover { background: var(--primary-dark); }
.tool-btn:disabled { opacity: .5; cursor: not-allowed; }

.tool-result {
  margin-top: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.tool-result-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.tool-copy-btn {
  font-size: .82rem; padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 4px; background: #fff; cursor: pointer;
}
.tool-result-content {
  padding: 20px;
  font-size: .92rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.tool-error {
  margin-top: 12px; padding: 12px 16px;
  background: #fff5f5; border: 1px solid #fc8181;
  border-radius: 8px; color: #c53030; font-size: .9rem;
}
.tool-select {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: .9rem; margin-bottom: 12px; background: #fff;
  box-sizing: border-box;
}
.tool-hint { font-size: .82rem; color: var(--text-secondary); margin-top: 8px; display: block; }
.tool-loading { color: var(--text-secondary); padding: 16px 0; }
.tool-empty { color: var(--text-secondary); }

/* ─── Двухколоночный режим (compare tools) ────────────────────── */
.tool-block--two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 640px) {
  .tool-block--two-col { grid-template-columns: 1fr; }
}
.tool-col { display: flex; flex-direction: column; }

/* ─── Match items ─────────────────────────────────────────────── */
.match-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px; border-bottom: 1px solid var(--border-light, #e2e8f0);
}
.match-badge {
  display: inline-block; font-size: .75rem; padding: 2px 8px;
  border-radius: 12px; background: var(--primary-light, #eff6ff); color: var(--primary, #3b82f6);
  white-space: nowrap; flex-shrink: 0;
}

/* ─── Alert items ─────────────────────────────────────────────── */
.tool-alert {
  padding: 10px 14px; border-radius: 6px;
  margin-bottom: 8px; font-size: .88rem; border-left: 3px solid;
}
.tool-alert--error  { border-color: #ef4444; background: #fef2f2; }
.tool-alert--ok     { border-color: #22c55e; background: #f0fdf4; }
.tool-alert--warn   { border-color: #eab308; background: #fefce8; }
.tool-alert--info   { border-color: #3b82f6; background: #eff6ff; }

/* ─── Risk score ──────────────────────────────────────────────── */
.risk-score-header {
  display: flex; align-items: center; gap: 24px;
  padding: 16px 20px; background: var(--bg-secondary);
  border-radius: 10px; margin-bottom: 20px;
}
.risk-score-circle {
  width: 72px; height: 72px; border-radius: 50%; border: 4px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 800; flex-shrink: 0;
}
.risk-score-circle--low    { border-color: #22c55e; color: #22c55e; }
.risk-score-circle--medium { border-color: #eab308; color: #eab308; }
.risk-score-circle--high   { border-color: #ef4444; color: #ef4444; }
.risk-score-label { font-size: 1.1rem; font-weight: 700; }
.risk-score-sub   { font-size: .85rem; color: var(--text-secondary); }
.risk-score-meta  { display: flex; flex-direction: column; gap: 4px; }

/* ─── Balance table ───────────────────────────────────────────── */
.balance-header            { font-weight: 700; margin-bottom: 16px; }
.balance-header--balanced  { color: #22c55e; }
.balance-header--warn      { color: #eab308; }
.balance-header--error     { color: #ef4444; }
.balance-table             { width: 100%; border-collapse: collapse; font-size: .88rem; }
.balance-table th          { text-align: left; padding: 8px; border-bottom: 2px solid var(--border); }
.balance-table th:not(:first-child) { text-align: center; }
.balance-table td          { padding: 8px; border-bottom: 1px solid var(--border-light, #e2e8f0); }
.balance-table td:not(:first-child) { text-align: center; }

/* ─── Financial rows ──────────────────────────────────────────── */
.financial-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: var(--bg-secondary);
  border-radius: 8px; margin-bottom: 8px;
}
.financial-row__label  { font-size: .9rem; }
.financial-row__amount { font-weight: 700; font-size: 1rem; }

/* ─── Timeline ────────────────────────────────────────────────── */
.timeline-wrap  { position: relative; padding-left: 24px; }
.timeline-spine {
  position: absolute; left: 8px; top: 0; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline-event {
  position: relative; padding: 10px 14px;
  background: var(--bg-secondary); border-radius: 8px;
  margin-bottom: 10px; margin-left: 8px;
}
.timeline-dot {
  position: absolute; left: -20px; top: 14px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--primary);
}
.timeline-dot--milestone    { background: #6366f1; }
.timeline-dot--deadline     { background: #ef4444; }
.timeline-dot--payment      { background: #22c55e; }
.timeline-dot--period_start { background: #3b82f6; }
.timeline-dot--period_end   { background: #f97316; }
.timeline-dot--notification { background: #a855f7; }
.timeline-event__type  { font-size: .82rem; color: var(--text-secondary); }
.timeline-event__title { font-weight: 600; font-size: .9rem; margin-top: 2px; }
.timeline-event__desc  { font-size: .82rem; color: var(--text-secondary); margin-top: 4px; }

/* ─── Hidden chars ────────────────────────────────────────────── */
.hc-item {
  border-radius: 8px; padding: 12px; margin-bottom: 8px;
  font-size: .88rem; border-left: 3px solid;
  background: var(--bg-secondary);
}
.hc-item[data-risk="critical"] { border-color: #ef4444; }
.hc-item[data-risk="high"]     { border-color: #f97316; }
.hc-item[data-risk="medium"]   { border-color: #eab308; }
.hc-item[data-risk="low"]      { border-color: #6b7280; }
.hc-code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-family: monospace; }
.hc-name { margin-left: 8px; font-weight: 600; }
.hc-name[data-risk="critical"] { color: #ef4444; }
.hc-name[data-risk="high"]     { color: #f97316; }
.hc-name[data-risk="medium"]   { color: #eab308; }
.hc-name[data-risk="low"]      { color: #6b7280; }
.hc-badge {
  font-size: .75rem; padding: 1px 6px; border-radius: 4px; margin-left: 6px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}
.hc-badge[data-risk="critical"] { background: #fef2f2; color: #ef4444; }
.hc-badge[data-risk="high"]     { background: #fff7ed; color: #f97316; }
.hc-badge[data-risk="medium"]   { background: #fefce8; color: #eab308; }
.hc-badge[data-risk="low"]      { background: #f9fafb; color: #6b7280; }
.hc-context { margin-top: 6px; color: var(--text-secondary); }
.hc-ok    { color: #22c55e; }
.hc-crit  { color: #ef4444; font-weight: 700; margin-bottom: 12px; }
.hc-warn  { color: #f97316; font-weight: 600; margin-bottom: 12px; }

/* ─── Result table (generic) ──────────────────────────────────── */
.tool-result-table {
  width: 100%; border-collapse: collapse; font-size: .9rem;
}
.tool-result-table th {
  text-align: left; padding: 8px;
  border-bottom: 2px solid var(--border);
  color: var(--text-secondary); font-size: .82rem;
}
.tool-result-table td {
  padding: 8px;
  border-bottom: 1px solid var(--bg-secondary, #f8fafc);
}
.tool-result-table td:first-child { font-weight: 600; color: var(--primary); }

/* ─── Manual calc block (vat-calculator) ──────────────────────── */
.tool-manual-calc {
  margin-top: 24px; padding: 20px;
  border: 1px solid var(--border); border-radius: 8px;
}
.tool-manual-calc h4 { margin: 0 0 14px; font-size: .95rem; }
.tool-calc-row {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
.tool-calc-row input[type=number] {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
  font-size: .9rem; width: 160px; box-sizing: border-box;
}
.tool-calc-row select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
  font-size: .9rem; background: #fff;
}
.tool-calc-row label { font-size: .88rem; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.tool-calc-result {
  margin-top: 12px; padding: 14px 16px;
  background: var(--bg-secondary); border-radius: 8px;
  font-size: .92rem;
}

/* ─── Finder results (промты 06) ──────────────────────────────── */
.finder-category { margin-bottom: 20px; }
.finder-category__title {
  font-weight: 700; font-size: .95rem; margin-bottom: 8px;
}
.finder-category__count {
  font-size: .82rem; color: var(--text-secondary); font-weight: 400; margin-left: 6px;
}
.finder-item {
  background: var(--bg-secondary); border-radius: 8px;
  padding: 12px 16px; margin-bottom: 8px; font-size: .88rem; line-height: 1.6;
}
.finder-item__match { font-weight: 700; color: var(--primary); }
.finder-item__context { color: var(--text-secondary); margin-top: 4px; }
