/* ==========================================================================
   Страница «Счёт для организации» сайта MCP:RSV Data Pro — на палитре сайта (assets/styles.css).
   Перенесена со страницы MCP:RSV Server (edt-ai-1c/invoice.css), разметка та же.
   ========================================================================== */

.inv {
  --surface: var(--bg-surface, #FFFFFF);
  --muted: var(--text-muted, #57534E);
  --dim: var(--text-dim, #8B8680);
  --line: var(--border, #E7E2DA);
  --soft: var(--accent-soft, rgba(124, 58, 237, 0.08));
  --soft2: var(--accent-soft2, rgba(124, 58, 237, 0.16));
  --ok-bg: #ECFDF5; --ok-line: #A7F3D0; --ok-fg: #065F46;
  --warn-bg: #FFFBEB; --warn-line: #FCD34D; --warn-fg: #78350F;
  --err: #B91C1C;
  padding-block: 40px 72px;
}
.inv-wrap {
  max-width: 1120px; margin: 0 auto;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.inv * { box-sizing: border-box; }
.inv-head { display: grid; gap: 10px; margin-bottom: 20px; }
.inv-head h1, .done h1 { margin: 0; font-size: clamp(28px, 4vw, 40px); letter-spacing: -0.02em; line-height: 1.1; }
.inv-head p { margin: 0; color: var(--muted); }
.inv-head .eyebrow { justify-self: start; }

.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; align-items: start; }
@media (max-width: 900px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }

.sect { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: grid; gap: 14px; }
.sect + .sect { margin-top: 16px; }
.sect h2, .total h2 { margin: 0; font-size: 17px; display: flex; gap: 10px; align-items: center; letter-spacing: -0.01em; }
.sect h2 .n { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 13px; display: grid; place-items: center; flex: none; }

.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .row { grid-template-columns: minmax(0, 1fr); } }
.f { display: grid; gap: 6px; min-width: 0; }
.f label { font-size: 13px; font-weight: 600; color: var(--muted); }
.f label small { font-weight: 400; color: var(--dim); }
.inv input, .inv select, .inv textarea {
  width: 100%; min-width: 0; font: inherit; font-size: 15px; color: var(--text);
  background: #FFFFFF; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.inv input:focus, .inv select:focus, .inv textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--accent-ring, 0 0 0 3px rgba(124, 58, 237, 0.18)); }
.inv textarea { min-height: 72px; resize: vertical; }
.inv input.bad { border-color: var(--err); box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.12); }
.hint, .small { font-size: 12.5px; color: var(--dim); }
.req { color: var(--err); font-weight: 700; }
.err { color: var(--err); font-size: 13px; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--bg-base, #FAF8F5); border: 1px solid var(--line); border-radius: 12px; justify-self: start; }
.seg button { border: 0; background: transparent; font: 600 14px/1 var(--font-sans, inherit); color: var(--muted); padding: 10px 14px; border-radius: 9px; cursor: pointer; }
.seg button.on { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3); }
.seg.edo button { min-width: 72px; }
.seg.bad { border-color: var(--err); box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.12); }
@media (max-width: 560px) {
  .seg:not(.edo) { display: grid; justify-self: stretch; }
  .seg:not(.edo) button { text-align: left; }
}

.inn-wrap { display: flex; gap: 8px; }
.inn-wrap input { font-family: var(--font-mono, monospace); letter-spacing: 0.03em; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px; padding: 11px 16px;
  font: 700 14px/1.1 var(--font-sans, inherit); cursor: pointer; background: var(--accent); color: #fff; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--accent-hi); }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--accent); background: var(--surface); }
.btn:disabled { opacity: 0.6; cursor: default; }

.found { border: 1px solid var(--ok-line); background: var(--ok-bg); color: var(--ok-fg); border-radius: 12px; padding: 12px 14px; display: grid; gap: 4px; font-size: 14px; }
.found b { font-size: 15px; color: #064E3B; }
.found .meta { color: #047857; font-size: 13px; }
.found.neutral { border-color: var(--line); background: var(--bg-base, #FAF8F5); color: var(--muted); }
.found.neutral b { color: var(--text); }
.found.neutral .meta { color: var(--muted); }
.found.miss { border-color: var(--warn-line); background: var(--warn-bg); }
.found.miss b, .found.miss .meta { color: var(--warn-fg); }

.note { border-radius: 12px; padding: 12px 14px; font-size: 13.5px; display: grid; gap: 4px; line-height: 1.45; }
.note.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-fg); }
.note.offer { background: var(--surface); border: 1px solid var(--soft2); border-left: 4px solid var(--accent); font-size: 14px; margin-bottom: 18px; }
.note.offer b { font-size: 15px; }
.note a, .checks a, .code-note a, .xsell a, .done a:not(.btn) { color: var(--accent); font-weight: 600; }
#foreign-block { display: grid; gap: 12px; }
#foreign-block[hidden], #ru-block[hidden], [hidden] { display: none !important; }

.drop { display: block; border: 1.5px dashed var(--soft2); border-radius: 12px; padding: 14px; text-align: center; color: var(--muted); font-size: 14px; background: var(--soft); cursor: pointer; }
.drop b { color: var(--accent); }
.drop .file-name { display: block; margin-top: 6px; font-weight: 600; color: var(--text); }
details.bank summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--accent); }
details.bank[open] summary { margin-bottom: 10px; }

/* строки покупки */
.lines { display: grid; gap: 10px; }
.line { position: relative; display: grid; grid-template-columns: minmax(158px, 1.15fr) minmax(150px, 1.1fr) minmax(112px, 0.8fr) 88px 90px 20px;
  gap: 8px; align-items: end; border-bottom: 1px dashed var(--line); padding-bottom: 10px; }
.line select { font-size: 14px; padding-left: 10px; padding-right: 4px; height: 44px; }
.line .sum { font-weight: 700; font-variant-numeric: tabular-nums; padding-bottom: 10px; text-align: right; white-space: nowrap; }
.line .sum s { color: var(--dim); font-weight: 500; font-size: 12.5px; display: block; }
.line .x { border: 0; background: none; color: var(--dim); font-size: 20px; cursor: pointer; padding-bottom: 8px; }
.line .x:hover { color: var(--err); }
.lbl-gift { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.gift { display: inline-block; padding: 1px 6px; border-radius: 6px; background: #FDE68A; color: #713F12; font-size: 11.5px; font-weight: 800; white-space: nowrap; }
@media (max-width: 1099px) {
  .line { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding-top: 4px; }
  .line .f-prod { grid-column: 1 / -1; }
  .line.removable .f-prod { padding-right: 30px; }
  .line .sum { text-align: right; padding: 0 0 10px; align-self: end; }
  .line .x { position: absolute; top: 0; right: 0; padding: 0 4px; }
}
@media (max-width: 760px) {
  .line .f-tier { grid-column: 1 / -1; }
  .line .sum { grid-column: 1 / -1; }
}
.qty { display: flex; align-items: stretch; height: 44px; border: 1px solid var(--line); border-radius: 10px; background: #FFFFFF; }
.qty button { border: 0; background: none; width: 30px; font-size: 18px; cursor: pointer; color: var(--muted); flex: none; }
.qty input { border: 0 !important; text-align: center; padding: 0 !important; box-shadow: none !important; font-variant-numeric: tabular-nums; }
.add-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.code-row { align-items: end; }
.code-row.only-note { grid-template-columns: minmax(0, 1fr); }
.code-note { font-size: 13px; color: var(--muted); line-height: 1.45; padding: 0 0 2px; min-height: 42px; display: flex; align-items: center; }
.code-row.only-note .code-note { min-height: 0; }
.code-note a, .xsell a { white-space: nowrap; }
.xsell { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 14px; border-radius: 12px; background: var(--soft); border: 1px solid var(--soft2); font-size: 14px; line-height: 1.45; }
.xsell > span { flex: 1 1 320px; min-width: 0; }
.xsell .btn { padding: 9px 12px; font-size: 13.5px; }

.checks { display: grid; gap: 8px; font-size: 14px; color: var(--muted); }
.checks label { display: flex; gap: 8px; align-items: flex-start; }
.checks input { width: auto !important; margin-top: 3px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* итог */
.total { position: sticky; top: 84px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: grid; gap: 12px; }
.tl { display: grid; gap: 8px; font-size: 13.5px; }
.tl > div { display: flex; justify-content: space-between; gap: 10px; }
.tl > div span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl .disc span:last-child { color: var(--ok-fg); }
.tl .gift-row { display: block; background: #FEF3C7; border: 1px solid #FCD34D; color: #713F12; border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.tl .soon-row { display: block; background: var(--soft); border: 1px solid var(--soft2); border-radius: 10px; padding: 8px 10px; font-size: 13px; color: var(--text); }
.tl .load-row { display: block; color: var(--dim); }
.tl .err-row { display: block; color: var(--err); }
.big { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); padding-top: 12px; }
.big b { font-size: 26px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.total .send { width: 100%; padding: 13px; font-size: 15px; }

/* готово */
.done { display: grid; gap: 14px; justify-items: start; padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; max-width: 680px; }
.done p { margin: 0; color: var(--muted); }
.done ul { margin: 0; padding-left: 18px; color: var(--muted); display: grid; gap: 6px; }

.inv-foot { border-top: 1px solid var(--border, #E7E2DA); padding-block: 22px; font-size: 13px; color: var(--text-dim, #8B8680); }
.inv-foot .inv-wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; }
.inv-foot a { color: inherit; }
