/* Вкладка сделки живёт во фрейме Битрикса: без своей шапки, шрифт и цвета близки к интерфейсу портала. */
:root { --line: #dfe3e8; --muted: #6b7683; --accent: #2fc6f6; --accent-dark: #1aa8d8; --bad: #fdecea; --good: #eaf7e6; }
body { font: 14px/1.5 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: #1f2430; margin: 0; background: #fff; }
.page { padding: 24px; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 20px 0 8px; }
code { background: #f4f6f8; padding: 1px 4px; border-radius: 3px; }
.note { padding: 12px 14px; border-radius: 6px; background: #f4f6f8; margin: 0 0 12px; }
.bad { background: var(--bad); }
.good { background: var(--good); }
.hint { color: var(--muted); font-size: 13px; font-weight: 400; }

.app { padding: 12px 16px 24px; }
.topbar { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 0 0 12px; border-bottom: 1px solid var(--line); margin: 0 0 16px; }
.deal-title { font-weight: 600; margin-right: 12px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.panel { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; background: #fff; }
#source-panel { grid-column: 1 / -1; }
#saved-panel { grid-column: 1 / -1; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 0 0 10px; }
.row label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }
.row label.grow { flex: 1 1 240px; }
input, select { padding: 6px 8px; border: 1px solid #c6cdd5; border-radius: 4px; font: inherit; min-width: 90px; }
input[type=number] { width: 110px; }
button { padding: 7px 16px; border: 1px solid #c6cdd5; border-radius: 4px; background: #f4f6f8; font: inherit; cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--accent-dark); }
button:disabled { opacity: .5; cursor: default; }

.param-group { margin: 0 0 14px; }
.param-group h4 { font-size: 13px; margin: 0 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.param { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(120px, 1fr); gap: 8px; align-items: center; margin: 0 0 6px; }
.param .label { font-weight: 600; font-size: 13px; }
.param .sub { color: var(--muted); font-weight: 400; display: block; font-size: 12px; }
.param input, .param select { width: 100%; box-sizing: border-box; }
.param.checkbox { grid-template-columns: auto 1fr; }
.param.child { margin-left: 20px; }
.param.inert .label { color: var(--muted); }

.total { font-size: 26px; font-weight: 700; margin: 0 0 8px; }
.total .hint { font-size: 13px; font-weight: 400; margin-left: 8px; }
table.lines { border-collapse: collapse; width: 100%; margin: 0 0 12px; font-size: 13px; }
table.lines th, table.lines td { border-bottom: 1px solid var(--line); padding: 4px 8px; text-align: left; }
table.lines th { color: var(--muted); font-weight: 600; }
table.lines td.num, table.lines th.num { text-align: right; white-space: nowrap; }
table.lines tr.sum td { font-weight: 600; }
details.section summary { cursor: pointer; font-weight: 600; margin: 8px 0 4px; }
.save-row { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.busy { opacity: .55; pointer-events: none; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #1f2430; color: #fff; padding: 10px 16px; border-radius: 6px; max-width: 80%; z-index: 10; }
.toast.error { background: #c0392b; }

@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .param { grid-template-columns: 1fr; }
}
.paper-picker { display: flex; flex-direction: column; gap: 4px; }
.paper-picker select { width: 100%; box-sizing: border-box; }
.param.checkbox input[type=checkbox] { width: auto; justify-self: start; }
