/* ===== Дизайн-система ===== */
:root {
  --bg: #F5F4EF; --surface: #FFFFFF; --surface-2: #FBFAF7; --ink: #141B2D; --ink-2: #2B3348; --muted: #6B7080; --faint: #9A9DA8;
  --line: #E7E4DB; --line-2: #EFEDE6;
  --accent: #2F5BEA; --accent-2: #2448C4; --accent-soft: #E9EEFE;
  --ok: #17885C; --ok-soft: #E3F4EC; --warn: #B7700A; --warn-soft: #FBF0DB; --err: #C93C3C; --err-soft: #FBE7E5; --grey-soft: #EEEDE8;
  --radius: 14px; --radius-sm: 10px; --shadow: 0 1px 2px rgba(20,27,45,.05), 0 8px 24px rgba(20,27,45,.06); --shadow-lg: 0 20px 60px rgba(20,27,45,.18);
  --font: "Manrope Variable", "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Times New Roman", Tinos, "Liberation Serif", serif;
  --side: 256px; --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 800; } h2 { font-size: 20px; font-weight: 750; } h3 { font-size: 16px; font-weight: 700; }
p { margin: 0 0 10px; }
code, pre, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
pre { background: #121826; color: #E6E9F2; padding: 14px 16px; border-radius: 12px; overflow: auto; line-height: 1.55; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-logo { width: 44px; height: 44px; border-radius: 13px; background: var(--accent) url(/favicon.svg) center/cover; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.9); opacity: .7; } }
.muted { color: var(--muted); }
.small .ic, .tiny .ic, .who .ic { width: 15px; height: 15px; vertical-align: -3px; }
.btn.sm .ic { width: 16px; height: 16px; } .faint { color: var(--faint); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; } .gap-s > * + * { margin-top: 6px; }
.between { justify-content: space-between; } .center { text-align: center; } .right { text-align: right; }
.hide { display: none !important; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nowrap { white-space: nowrap; }

/* ===== Кнопки ===== */
.btn { appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 650; font-size: 14px; padding: 9px 14px; border-radius: 11px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; line-height: 1.2; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s, box-shadow .15s; text-decoration: none !important; min-height: 40px; }
.btn:hover { border-color: #D6D2C6; background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 6px 16px rgba(47,91,234,.25); }
.btn.primary:hover { background: var(--accent-2); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--err); }
.btn.danger.solid { background: var(--err); border-color: var(--err); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(20,27,45,.05); }
.btn.sm { padding: 6px 10px; font-size: 13px; min-height: 32px; border-radius: 9px; }
.btn.lg { padding: 13px 20px; font-size: 15px; min-height: 48px; border-radius: 13px; }
.btn.block { width: 100%; }
.btn.icon { padding: 0; width: 40px; }
.btn.icon.sm { width: 32px; }
.btn .ic { width: 18px; height: 18px; flex: none; }
.ic { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ===== Форми ===== */
label.f { display: block; }
label.f > span { display: block; font-size: 13px; font-weight: 650; color: var(--ink-2); margin-bottom: 6px; }
label.f > small { display: block; color: var(--muted); font-size: 12px; margin-top: 5px; }
.input, input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=url], input[type=tel], select, textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; min-height: 42px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 720px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.seg { display: inline-flex; background: var(--grey-soft); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 650; color: var(--muted); padding: 7px 12px; border-radius: 9px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ===== Картки ===== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card.flat { box-shadow: none; }
.card.pad-l { padding: 24px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.section-t { font-size: 12px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty .ic { width: 44px; height: 44px; stroke-width: 1.3; color: var(--faint); margin-bottom: 10px; }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

/* ===== Статуси ===== */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 999px; background: var(--grey-soft); color: var(--ink-2); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.err { background: var(--err-soft); color: var(--err); } .pill.info { background: var(--accent-soft); color: var(--accent); }
.pill.plain::before { display: none; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; }
.badge.err { background: var(--err); }

/* ===== Каркас кабінету ===== */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 14px; border-right: 1px solid var(--line); background: #F0EFE9; display: flex; flex-direction: column; gap: 14px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: var(--ink); text-decoration: none !important; letter-spacing: -.02em; }
.logo i { width: 32px; height: 32px; border-radius: 9px; background: url(/favicon.svg) center/cover; display: inline-block; flex: none; }
.logo small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.org-switch { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; cursor: pointer; text-align: left; font: inherit; }
.org-switch b { display: block; font-size: 13.5px; } .org-switch span { font-size: 12px; color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 800; display: grid; place-items: center; flex: none; font-size: 13px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--ink-2); font-weight: 600; font-size: 14px; text-decoration: none; }
.nav a:hover { background: rgba(20,27,45,.05); }
.nav a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.nav a .badge { margin-left: auto; }
.nav .sub { padding-left: 30px; font-size: 13.5px; }
.nav-t { font-size: 11px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); padding: 10px 10px 4px; }
.side-foot { margin-top: auto; font-size: 12px; color: var(--muted); padding: 6px 10px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: rgba(245,244,239,.86); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid transparent; }
.top.scrolled { border-bottom-color: var(--line); }
.top .search { max-width: 420px; flex: 1; position: relative; }
.top .search input { padding-left: 38px; background: var(--surface); }
.top .search .ic { position: absolute; left: 11px; top: 11px; color: var(--faint); }
.content { padding: 20px 28px 60px; max-width: 1280px; width: 100%; }
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-h p { margin: 4px 0 0; color: var(--muted); }
.mob-only { display: none; }
.bell { position: relative; }
.bell .dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--err); border: 2px solid var(--bg); }

/* мобільна навігація */
.tabbar { display: none; }
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .mob-only { display: block; }
  .top .mob-only { display: initial; }
  .btn.mob-only { display: inline-flex; }
  .desk-only { display: none !important; }
  .top { padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .top .search { display: none; }
  .content { padding: 14px 14px calc(96px + var(--safe-b)); }
  h1 { font-size: 22px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(255,255,255,.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + var(--safe-b)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 650; color: var(--muted); text-decoration: none; padding: 4px 0; position: relative; }
  .tabbar a.on { color: var(--accent); }
  .tabbar a .badge { position: absolute; top: -2px; left: 52%; transform: scale(.85); }
  .tabbar .fab { width: 50px; height: 50px; border-radius: 16px; background: var(--accent); color: #fff; display: grid; place-items: center; margin: -18px auto 0; box-shadow: 0 8px 20px rgba(47,91,234,.4); }
  .tabbar .fab .ic { width: 24px; height: 24px; stroke-width: 2.2; }
  .page-h { margin-bottom: 12px; }
  .card { padding: 14px; }
}

/* ===== Список документів ===== */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { border: 1px solid var(--line); background: var(--surface); padding: 7px 12px; border-radius: 999px; font: inherit; font-size: 13px; font-weight: 650; color: var(--ink-2); cursor: pointer; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .badge { height: 18px; min-width: 18px; font-size: 10.5px; }
.doclist { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.docrow { display: grid; grid-template-columns: 28px 40px minmax(0, 1.6fr) minmax(0, 1fr) 150px 110px; gap: 14px; align-items: center; padding: 13px 16px; border-top: 1px solid var(--line-2); cursor: pointer; transition: background .12s; color: inherit; text-decoration: none !important; }
.docrow:first-child { border-top: 0; }
.docrow:hover { background: var(--surface-2); }
.docrow.sel { background: var(--accent-soft); }
.docrow .ftype { width: 40px; height: 46px; border-radius: 8px; background: #F2F1EC; border: 1px solid var(--line); display: grid; place-items: center; font-size: 10px; font-weight: 800; color: var(--muted); position: relative; }
.docrow .ftype.pdf { color: #C93C3C; } .docrow .ftype.doc { color: #2F5BEA; } .docrow .ftype.xls { color: #17885C; }
.docrow .t { font-weight: 700; font-size: 14.5px; }
.docrow .s { font-size: 12.5px; color: var(--muted); }
.docrow .who { font-size: 13.5px; color: var(--ink-2); }
.docrow .when { font-size: 12.5px; color: var(--muted); text-align: right; }
.docrow input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.sigdots { display: inline-flex; gap: 3px; vertical-align: middle; margin-left: 6px; }
.sigdots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.sigdots i.on { background: var(--ok); }
@media (max-width: 960px) {
  .docrow { grid-template-columns: 24px 36px minmax(0, 1fr) auto; grid-template-areas: "c f t t" "c f w st"; row-gap: 4px; column-gap: 10px; padding: 12px; }
  .docrow .sigdots { display: none; }
  .docrow .t { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .docrow > :nth-child(1) { grid-area: c; } .docrow > :nth-child(2) { grid-area: f; width: 36px; height: 42px; }
  .docrow > :nth-child(3) { grid-area: t; } .docrow > :nth-child(4) { grid-area: w; } .docrow > :nth-child(5) { grid-area: st; justify-self: end; } .docrow > :nth-child(6) { display: none; }
}
.bulkbar { position: sticky; bottom: 16px; z-index: 30; margin-top: 14px; background: var(--ink); color: #fff; border-radius: 14px; padding: 10px 12px 10px 18px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow-lg); }
.bulkbar .btn { min-height: 36px; }
.bulkbar .btn.ghost { color: #fff; }
@media (max-width: 960px) { .bulkbar { bottom: calc(84px + var(--safe-b)); } }

/* ===== Сторінка документа ===== */
.docpage { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.docpage .aside { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 1100px) { .docpage { grid-template-columns: minmax(0, 1fr); } .docpage .aside { position: static; } }
.docpage > *, .builder > * { min-width: 0; }
.viewer { background: #E9E7E0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.viewer-bar > .grow { min-width: 0; }
.viewer-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface); border-bottom: 1px solid var(--line); font-size: 13px; }
.viewer-body { overflow: auto; padding: 16px; max-height: calc(100vh - 140px); min-height: 360px; -webkit-overflow-scrolling: touch; }
.viewer-body canvas { display: block; margin: 0 auto 14px; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.12); border-radius: 2px; max-width: none; }
.viewer-body img { display: block; max-width: 100%; margin: 0 auto; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.12); }
.viewer-body .txt { background: #fff; padding: 20px; white-space: pre-wrap; word-break: break-word; font-size: 13px; border-radius: 4px; }
.viewer-body .docx-wrapper { background: transparent !important; padding: 0 !important; }
.viewer-body .docx-wrapper > section.docx { box-shadow: 0 2px 12px rgba(0,0,0,.12) !important; margin-bottom: 14px !important; }
.viewer-body table.sheet { border-collapse: collapse; background: #fff; font-size: 12.5px; }
.viewer-body table.sheet td { border: 1px solid #ddd; padding: 4px 8px; }
.viewer-msg { padding: 60px 20px; text-align: center; color: var(--muted); }
@media (max-width: 960px) { .viewer-body { max-height: 62vh; min-height: 280px; padding: 10px; } }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.party { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.party:first-child { border-top: 0; padding-top: 0; }
.party .st { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--grey-soft); color: var(--muted); }
.party .st.ok { background: var(--ok-soft); color: var(--ok); } .party .st.err { background: var(--err-soft); color: var(--err); } .party .st.me { box-shadow: 0 0 0 2px var(--accent); }
.party .st .ic { width: 16px; height: 16px; stroke-width: 2.2; }
.sig { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface-2); font-size: 13px; position: relative; overflow: hidden; }
.sig::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--ok); }
.sig b { font-size: 14px; }
.actions { display: flex; flex-direction: column; gap: 8px; }
.actions .row .btn { flex: 1; }
.sticky-act { display: none; }
@media (max-width: 1100px) {
  .sticky-act { display: flex; gap: 8px; position: fixed; left: 0; right: 0; bottom: calc(64px + var(--safe-b)); z-index: 35; padding: 10px 14px; background: rgba(245,244,239,.95); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
  .sticky-act .btn { flex: 1; }
}
.timeline { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.timeline li { position: relative; padding: 0 0 12px 18px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 16px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.comment { padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 12px; font-size: 13.5px; }
.comment.me { background: var(--accent-soft); border-color: transparent; }
.comment .h { font-size: 12px; color: var(--muted); margin-bottom: 3px; }

/* ===== Модальні вікна ===== */
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(15,20,35,.45); display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 18px; width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow: auto; box-shadow: var(--shadow-lg); animation: rise .18s ease-out; }
.modal.wide { max-width: 860px; }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px 6px; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-b { padding: 10px 20px 20px; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 20px 18px; border-top: 1px solid var(--line-2); position: sticky; bottom: 0; background: var(--surface); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
@media (max-width: 640px) {
  .modal-wrap { place-items: end stretch; padding: 0; }
  .modal { max-width: none; border-radius: 20px 20px 0 0; max-height: 94vh; padding-bottom: var(--safe-b); animation: sheet .22s ease-out; }
  .modal-f .btn { flex: 1; }
}
@keyframes sheet { from { transform: translateY(40%); } }
.menu { position: absolute; z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 220px; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; font: inherit; font-size: 14px; color: var(--ink); border-radius: 8px; cursor: pointer; text-align: left; text-decoration: none !important; }
.menu button:hover, .menu a:hover { background: var(--grey-soft); }

/* ===== Тости ===== */
#toasts { position: fixed; z-index: 200; top: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; animation: rise .2s; display: flex; gap: 10px; align-items: flex-start; }
.toast.err { background: var(--err); } .toast.ok { background: #0F6B48; }
@media (max-width: 640px) { #toasts { left: 12px; right: 12px; top: calc(10px + env(safe-area-inset-top, 0px)); max-width: none; } }

/* ===== Завантаження файлів ===== */
.drop { border: 2px dashed #D3CFC3; border-radius: 16px; padding: 34px 20px; text-align: center; background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .ic { width: 40px; height: 40px; color: var(--accent); stroke-width: 1.5; }
.filelist .fi { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.filelist .fi + .fi { margin-top: 8px; }
.rcpt { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.rcpt + .rcpt { margin-top: 8px; }
.suggest { position: relative; }
.suggest .list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 280px; overflow: auto; padding: 4px; }
.suggest .list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 8px; font: inherit; font-size: 14px; cursor: pointer; }
.suggest .list button:hover, .suggest .list button.act { background: var(--grey-soft); }

/* ===== Підписання ===== */
.signer-card { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 14px; background: var(--ok-soft); border: 1px solid #BFE3D2; }
.signer-card .avatar { background: #fff; color: var(--ok); }
#sign-widget-parent { width: 100%; height: 560px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; }
#sign-widget-parent iframe { width: 100%; height: 100%; border: 0; }
@media (max-width: 640px) { #sign-widget-parent { height: 64vh; } }
.progress { list-style: none; padding: 0; margin: 0; }
.progress li { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line-2); font-size: 14px; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: rot .7s linear infinite; flex: none; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }
.tip { background: var(--accent-soft); color: var(--ink-2); border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.tip.warn { background: var(--warn-soft); }
.tip b { color: var(--ink); }

/* ===== Шаблони і конструктор ===== */
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; transition: box-shadow .15s, transform .15s; }
.tcard:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.tcard .paper { height: 110px; border-radius: 8px; background: linear-gradient(#fff, #fff) padding-box; border: 1px solid var(--line); position: relative; overflow: hidden; padding: 12px 16px; }
.tcard .paper i { display: block; height: 5px; border-radius: 3px; background: #E6E4DD; margin-bottom: 7px; }
.tcard .paper i.h { width: 50%; margin: 0 auto 10px; background: #CBC8BE; height: 7px; }
.tcard .paper i.s { width: 70%; } .tcard .paper i.xs { width: 40%; }
.tcard .paper .tbl { display: grid; grid-template-columns: 1fr 3fr 1fr 1fr; gap: 3px; margin-top: 8px; }
.tcard .paper .tbl b { height: 8px; background: #EFEDE7; border-radius: 2px; }
.builder { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .builder { grid-template-columns: minmax(0, 1fr); } }
.block { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 12px 12px; }
.block + .block { margin-top: 8px; }
.block.drag { opacity: .5; }
.block-h { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.block-h .bt { font-size: 12px; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; flex: 1; }
.block textarea { min-height: 60px; font-family: var(--serif); font-size: 15px; }
.block input.serif { font-family: var(--serif); }
.addbar { display: flex; flex-wrap: wrap; gap: 6px; }
.ph { display: inline-flex; align-items: center; font-size: 12px; padding: 3px 8px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-weight: 650; cursor: pointer; border: 0; font-family: var(--font); margin: 2px; }
.ph:hover { background: #DCE4FD; }
.items-t { width: 100%; border-collapse: separate; border-spacing: 0; }
.items-t th { font-size: 12px; text-align: left; color: var(--muted); font-weight: 650; padding: 0 6px 6px; }
.items-t td { padding: 3px; vertical-align: top; }
.items-t input { min-height: 38px; padding: 8px 9px; font-size: 14px; }
@media (max-width: 720px) {
  .items-t thead { display: none; }
  .items-t tr { display: grid; grid-template-columns: 1fr 1fr 1fr 40px; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line-2); }
  .items-t td { padding: 0; } .items-t td:first-child { grid-column: 1 / -1; }
}
.paper-prev { background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 36px 30px; font-family: var(--serif); font-size: 14px; color: #111; min-height: 400px; }

/* ===== Таблиці ===== */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 14px; border-top: 1px solid var(--line-2); vertical-align: middle; }
table.t tr:hover td { background: var(--surface-2); }

/* ===== Статистика ===== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .v { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.stat .l { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: 8px; }
.bars div { flex: 1; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; opacity: .85; position: relative; }
.bars div:hover { opacity: 1; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 10px 12px; font-weight: 650; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }

/* ===== Лендінг і авторизація ===== */
.land { min-height: 100vh; }
.land-nav { display: flex; align-items: center; justify-content: space-between; padding: 18px 28px; max-width: 1200px; margin: 0 auto; gap: 12px; }
.hero { max-width: 1200px; margin: 0 auto; padding: 40px 28px 30px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(32px, 5vw, 54px); line-height: 1.05; letter-spacing: -.03em; font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lead { font-size: 18px; color: var(--ink-2); margin: 18px 0 26px; max-width: 560px; }
.hero-art { position: relative; height: 420px; }
.hero-art .p { position: absolute; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 22px; width: 280px; font-family: var(--serif); }
.hero-art .p i { display: block; height: 6px; background: #ECEAE3; border-radius: 3px; margin-bottom: 9px; }
.hero-art .p1 { left: 10%; top: 20px; transform: rotate(-4deg); }
.hero-art .p2 { right: 0; top: 90px; transform: rotate(3deg); }
.hero-art .stamp { position: absolute; right: 10%; bottom: 30px; background: #fff; border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; font-size: 13px; border: 1px solid var(--line); }
.feat { max-width: 1200px; margin: 0 auto; padding: 30px 28px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feat .card h3 { margin: 10px 0 6px; }
.feat .card .ic { color: var(--accent); width: 26px; height: 26px; }
.steps { max-width: 1200px; margin: 0 auto; padding: 20px 28px 60px; }
.steps ol { list-style: none; padding: 0; margin: 18px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; counter-reset: s; }
.steps li { counter-increment: s; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--ink); color: #fff; font-weight: 800; margin-bottom: 10px; }
.land-foot { border-top: 1px solid var(--line); padding: 24px 28px; text-align: center; color: var(--muted); font-size: 13px; }
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 16px; } .hero-art { display: none; }
  .feat { grid-template-columns: 1fr; } .steps ol { grid-template-columns: 1fr 1fr; }
  .land-nav { padding: 14px 16px; } .hero, .feat, .steps { padding-left: 16px; padding-right: 16px; }
}
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: 100%; max-width: 420px; padding: 28px; box-shadow: var(--shadow); }
.auth .logo { margin-bottom: 22px; }
.public-wrap { max-width: 1200px; margin: 0 auto; padding: 16px 20px 120px; }
.docs-page { max-width: 920px; margin: 0 auto; padding: 20px 20px 80px; }
.docs-page h2 { margin: 32px 0 10px; } .docs-page h3 { margin: 22px 0 8px; }
.ep { display: flex; gap: 10px; align-items: center; font-family: ui-monospace, Menlo, monospace; font-size: 13.5px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; margin: 6px 0; overflow-x: auto; }
.ep b { font-size: 11px; padding: 2px 7px; border-radius: 6px; color: #fff; background: var(--ok); }
.ep b.post { background: var(--accent); } .ep b.put { background: var(--warn); } .ep b.del { background: var(--err); }
.copybox { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1px dashed var(--line); padding: 8px 10px; border-radius: 10px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; word-break: break-all; }

/* ===== Штамп: схема сторінки ===== */
.stamp-page { position: relative; width: 170px; height: 240px; flex: none; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); padding: 34px 18px; }
.stamp-page.off .zone { cursor: default; }
.stamp-page .lines i { display: block; height: 5px; border-radius: 3px; background: #ECEAE3; margin-bottom: 9px; }
.stamp-page .lines i:first-child { margin: 0 auto 14px; background: #CFCBC0; height: 7px; }
.stamp-page .zone { position: absolute; width: 33.3%; height: 26px; border: 0; background: transparent; cursor: pointer; border-radius: 4px; }
.stamp-page .zone:hover { background: var(--accent-soft); }
.stamp-page .zone.on { background: transparent; }
.z-top-left, .z-bottom-left { left: 0; } .z-top-center, .z-bottom-center { left: 33.3%; } .z-top-right, .z-bottom-right { right: 0; }
.z-top-left, .z-top-center, .z-top-right { top: 2px; } .z-bottom-left, .z-bottom-center, .z-bottom-right { bottom: 2px; }
.mini-stamp { position: absolute; display: flex; gap: 3px; pointer-events: none; }
.mini-stamp b { display: block; width: 34px; height: 15px; border: 1.5px solid var(--accent); border-radius: 3px; background: #fff; }
.mini-stamp.compact b { width: 70px; }
.mini-stamp.top { top: 6px; } .mini-stamp.bottom { bottom: 6px; }
.mini-stamp.left { left: 6px; } .mini-stamp.right { right: 6px; } .mini-stamp.center { left: 50%; transform: translateX(-50%); }
@media (max-width: 640px) { .land-nav .logo small { display: none; } }
