/* TUTkp — интерфейс на дизайн-системе RecPlace (Raleway + Unbounded, светлая тема).
   Предпросмотр КП живёт в собственных токенах партнёра (--pb) и нашей системе не подчиняется:
   это его бренд, а не наш. */

:root {
  --ink: #1d1d1f;
  --ink-2: rgba(61, 60, 67, .6);
  --ink-3: rgba(61, 60, 67, .4);
  --link: #513dd7;
  --accent: #fa6520;
  --accent-65: #d04808;
  --accent-5: rgba(250, 101, 32, .07);
  --accent-15: rgba(250, 101, 32, .35);
  --success: #19712f;
  --danger: #ff3b30;
  --warn: #ff9500;
  --surface: #f5f5f5;
  --canvas: #f6f5fa;
  --bg: #ffffff;
  --sep: #c8c7cb;
  --sep-l: #f5f5f5;
  --r: 14px;
  font-variant-numeric: lining-nums proportional-nums;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: Raleway, system-ui, -apple-system, sans-serif;
  font-weight: 500;
  color: var(--ink);
  background: var(--canvas);
  font-variant-numeric: lining-nums proportional-nums;
  -webkit-font-smoothing: antialiased;
}

.unb { font-family: Unbounded, Raleway, system-ui, sans-serif; font-weight: 600; letter-spacing: -.015em; }

h1, h2, h3 { letter-spacing: -.015em; margin: 0; }

a { color: var(--link); text-decoration: none; }

/* ---------- каркас ---------- */

.top {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--sep-l);
}

.top-in {
  max-width: 1180px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}

.logo { font-family: Unbounded, sans-serif; font-weight: 700; font-size: 19px; letter-spacing: -.02em; }
.logo span { color: var(--accent); }

.tabs { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }

.tab {
  font: inherit; font-size: 14px; font-weight: 600;
  border: 0; background: transparent; color: var(--ink-2);
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  display: flex; align-items: center; gap: 7px;
}
.tab:hover { color: var(--ink); background: var(--surface); }
.tab.on { background: var(--ink); color: #fff; }
.tab .num {
  min-width: 19px; height: 19px; border-radius: 999px; font-size: 11px;
  display: grid; place-items: center; background: var(--accent); color: #fff;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 24px 140px; }

.view-title { font-family: Unbounded, sans-serif; font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin-bottom: 6px; }
.view-sub { color: var(--ink-2); font-size: 15px; margin-bottom: 26px; max-width: 720px; line-height: 1.55; }

.card { background: var(--bg); border: 1px solid var(--sep-l); border-radius: var(--r); padding: 22px; margin-bottom: 16px; }
.card-t { font-family: Unbounded, sans-serif; font-size: 15px; font-weight: 600; margin-bottom: 16px; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .g2, .g3 { grid-template-columns: 1fr; } }

/* ---------- поля ---------- */

label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }

input[type=text], input[type=number], select, textarea {
  width: 100%; font: inherit; font-size: 14px; font-weight: 500; color: var(--ink);
  padding: 10px 12px; border: 1px solid var(--sep); border-radius: 10px; background: var(--bg);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-15); border-color: var(--accent); }
textarea { resize: vertical; min-height: 86px; line-height: 1.55; }

input[type=color] { width: 46px; height: 40px; padding: 2px; border: 1px solid var(--sep); border-radius: 10px; background: var(--bg); cursor: pointer; }

.hint { font-size: 12px; color: var(--ink-3); margin-top: 6px; line-height: 1.45; }

.btn {
  font: inherit; font-size: 14px; font-weight: 600; border-radius: 10px; cursor: pointer;
  padding: 10px 16px; border: 1px solid transparent; display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-65); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-ghost { background: var(--bg); color: var(--ink); border-color: var(--sep); }
.btn-ghost:hover { background: var(--surface); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- логотип партнёра ---------- */

.logo-box {
  border: 1px dashed var(--sep); border-radius: 12px; padding: 14px;
  display: flex; align-items: center; gap: 14px; min-height: 84px; background: var(--surface);
}
.logo-box img { max-height: 54px; max-width: 220px; object-fit: contain; }
.logo-box .ph { color: var(--ink-3); font-size: 13px; }

/* ---------- каталог ---------- */

.grp { font-family: Unbounded, sans-serif; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 26px 0 12px; }
.grp:first-child { margin-top: 0; }

.sol {
  background: var(--bg); border: 1px solid var(--sep-l); border-radius: var(--r);
  padding: 18px 20px; margin-bottom: 12px;
}
.sol.picked { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-5); }
.sol.off { opacity: .62; }

.sol-head { display: flex; align-items: flex-start; gap: 14px; }
.sol-name { font-family: Unbounded, sans-serif; font-size: 15px; font-weight: 600; }
.sol-short { font-size: 13px; color: var(--ink-2); margin-top: 4px; line-height: 1.5; }
.sol-act { margin-left: auto; flex-shrink: 0; }

.tag { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; display: inline-block; white-space: nowrap; }
.tag.ok { background: rgba(52, 199, 89, .15); color: var(--success); }
.tag.warn { background: rgba(255, 149, 0, .18); color: #8a5200; }
.tag.bad { background: rgba(255, 59, 48, .13); color: #a3231b; }
.tag.info { background: rgba(81, 61, 215, .1); color: var(--link); }

.sol-cfg { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--sep-l); display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; }
@media (max-width: 900px) { .sol-cfg { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.sol-econ { margin-top: 14px; font-size: 13px; display: flex; gap: 20px; flex-wrap: wrap; color: var(--ink-2); }
.sol-econ b { color: var(--ink); font-weight: 700; }
.sol-econ .m-good b { color: var(--success); }
.sol-econ .m-bad b { color: var(--danger); }

.note { font-size: 12.5px; line-height: 1.5; padding: 10px 12px; border-radius: 10px; margin-top: 12px; }
.note.warn { background: rgba(255, 149, 0, .1); color: #6b4000; }
.note.bad { background: rgba(255, 59, 48, .08); color: #8f1f18; }
.note.info { background: var(--accent-5); color: var(--ink-2); }

/* ---------- нижняя панель экономики ---------- */

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: rgba(255, 255, 255, .93);
  backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--sep);
}
.dock-in {
  max-width: 1180px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
}
.kpi { line-height: 1.25; }
.kpi .k { font-size: 11px; font-weight: 600; color: var(--ink-3); }
.kpi .v { font-family: Unbounded, sans-serif; font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.kpi .v.good { color: var(--success); }
.kpi .v.bad { color: var(--danger); }
.dock .btnrow { margin-left: auto; }

/* ---------- красные линии ---------- */

.rl { margin-bottom: 16px; }
.rl-item { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.5; padding: 8px 0; border-bottom: 1px solid var(--sep-l); }
.rl-item:last-child { border-bottom: 0; }
.rl-item code { background: var(--surface); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }

/* ---------- предпросмотр КП ---------- */

.paper-wrap { display: flex; justify-content: center; }

.paper {
  --pb: #1d1d1f;
  background: #fff; width: 100%; max-width: 860px;
  padding: 46px 52px 40px; border-radius: 6px;
  box-shadow: 0 2px 34px rgba(0, 0, 0, .1);
  color: #1d1d1f; font-size: 14px; line-height: 1.62;
}
@media (max-width: 760px) { .paper { padding: 28px 22px; } }

.p-head { display: flex; align-items: flex-start; gap: 20px; border-bottom: 3px solid var(--pb); padding-bottom: 16px; margin-bottom: 30px; }
.p-head img { max-height: 52px; max-width: 210px; object-fit: contain; }
.p-brand { font-family: Unbounded, sans-serif; font-size: 20px; font-weight: 700; letter-spacing: -.02em; color: var(--pb); }
.p-contacts { margin-left: auto; text-align: right; font-size: 12px; color: rgba(61, 60, 67, .7); line-height: 1.6; }

.p-kicker { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--pb); }
.p-title { font-family: Unbounded, sans-serif; font-size: 27px; font-weight: 600; letter-spacing: -.02em; margin: 8px 0 14px; line-height: 1.2; }
.p-for { font-size: 15px; color: rgba(61, 60, 67, .75); margin-bottom: 30px; }

.p-sec { margin: 30px 0; }
.p-sec-t { font-family: Unbounded, sans-serif; font-size: 15px; font-weight: 600; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid #e6e5ea; }

.p-lead { line-height: 1.65; }

.p-item { margin: 22px 0; padding: 20px 22px; background: #fafafa; border-radius: 12px; border-left: 3px solid var(--pb); break-inside: avoid; }
.p-item-h { display: flex; align-items: baseline; gap: 14px; margin-bottom: 10px; }
.p-item-n { font-family: Unbounded, sans-serif; font-size: 16px; font-weight: 600; }
.p-item-p { margin-left: auto; font-family: Unbounded, sans-serif; font-size: 16px; font-weight: 600; color: var(--pb); white-space: nowrap; }
.p-item-lead { color: rgba(61, 60, 67, .8); margin-bottom: 14px; }

.p-ul { margin: 0; padding-left: 0; list-style: none; }
.p-ul li { position: relative; padding-left: 20px; margin-bottom: 6px; }
.p-ul li::before { content: ''; position: absolute; left: 4px; top: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--pb); }
.p-ul.dim li { color: rgba(61, 60, 67, .62); }
.p-ul.dim li::before { background: rgba(61, 60, 67, .3); }

.p-sub { font-size: 12px; font-weight: 700; color: rgba(61, 60, 67, .55); margin: 14px 0 7px; }

.p-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.p-table th { text-align: left; font-size: 11px; font-weight: 700; color: rgba(61, 60, 67, .55); padding: 8px 0; border-bottom: 1px solid #e6e5ea; }
.p-table td { padding: 11px 0; border-bottom: 1px solid #f0eff3; vertical-align: top; }
.p-table td:last-child, .p-table th:last-child { text-align: right; white-space: nowrap; }
.p-total td { border-bottom: 0; padding-top: 16px; font-family: Unbounded, sans-serif; font-size: 17px; font-weight: 600; }
.p-total td:last-child { color: var(--pb); }

.p-foot { margin-top: 36px; padding-top: 18px; border-top: 1px solid #e6e5ea; font-size: 11.5px; color: rgba(61, 60, 67, .6); line-height: 1.6; }
.p-legal { font-size: 11px; color: rgba(61, 60, 67, .5); margin-top: 12px; line-height: 1.6; }

.p-cta { margin-top: 30px; padding: 20px 22px; border-radius: 12px; background: var(--pb); color: #fff; }
.p-cta .t { font-family: Unbounded, sans-serif; font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.p-cta .s { font-size: 13px; opacity: .88; line-height: 1.6; }

/* ---------- печать ---------- */

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  .top, .dock, .noprint { display: none !important; }
  .wrap { padding: 0; max-width: none; }
  .paper { box-shadow: none; max-width: none; padding: 0; border-radius: 0; font-size: 11.5pt; }
  .p-item { background: #fafafa !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .p-cta { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .p-sec, .p-item { break-inside: avoid; }
}

/* ---------- режим «клиент открыл ссылку» ---------- */

/* Клиент партнёра не должен видеть вообще ничего нашего — включая шапку сервиса. */
body.readonly .top,
body.readonly .dock { display: none; }
body.readonly .wrap { padding-top: 28px; }

/* ---------- счёт ---------- */

.paper.inv { font-size: 13px; }

.inv-bank { width: 100%; border-collapse: collapse; margin-bottom: 22px; border: 1px solid #d9d8de; }
.inv-bank td { border-bottom: 1px solid #ecebf0; padding: 8px 12px; vertical-align: top; font-size: 12.5px; }
.inv-bank tr:last-child td { border-bottom: 0; }
.inv-bank .lab { width: 40%; font-size: 11px; font-weight: 700; color: rgba(61, 60, 67, .55); background: #fafafa; }
.inv-bank .val { font-variant-numeric: tabular-nums; }
.inv-bank .miss { color: #a3231b; font-weight: 600; }

.inv-parties { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.inv-parties td { padding: 6px 0; vertical-align: top; border-bottom: 1px solid #f0eff3; }
.inv-parties .lab { width: 130px; font-size: 11px; font-weight: 700; color: rgba(61, 60, 67, .55); }

.inv-items th, .inv-items td { font-size: 12.5px; }
.inv-items th:first-child, .inv-items td:first-child { width: 32px; text-align: left; }
.inv-items th:nth-child(3), .inv-items td:nth-child(3) { width: 64px; text-align: right; }
.inv-items th:nth-child(4), .inv-items td:nth-child(4),
.inv-items th:last-child, .inv-items td:last-child { width: 110px; text-align: right; white-space: nowrap; }

.inv-total { margin: 14px 0 0 auto; border-collapse: collapse; }
.inv-total td { padding: 5px 0 5px 26px; text-align: right; }
.inv-total td:first-child { font-size: 11.5px; color: rgba(61, 60, 67, .6); }
.inv-total .big td { font-family: Unbounded, sans-serif; font-size: 16px; font-weight: 600; padding-top: 12px; }
.inv-total .big td:last-child { color: var(--pb); }

.inv-words { margin-top: 18px; padding-top: 14px; border-top: 1px solid #e6e5ea; line-height: 1.7; }

.inv-sign { display: flex; gap: 60px; margin-top: 44px; }
.inv-sign > div { flex: 1; }
.inv-sign .lab { font-size: 11px; font-weight: 700; color: rgba(61, 60, 67, .55); margin-bottom: 26px; }
.inv-sign .line { border-bottom: 1px solid #1d1d1f; }
.inv-sign .nm { font-size: 11px; color: rgba(61, 60, 67, .6); margin-top: 5px; }

@media print {
  .inv-bank td { border-color: #1d1d1f !important; }
}
