/* Протокол за довършителни работи — първо за телефон. Светъл топъл фон, черно-бялото лого „RR“, бежов акцент. */
:root {
  --bg: #f6f3ee;
  --card: #ffffff;
  --ink: #1f1d1b;
  --ink-2: #4a443e;
  --muted: #847b71;
  --line: #e8e1d6;
  --line-2: #d9cfc0;
  --accent: #1f1d1b;
  --beige: #efe7db;
  --gold: #a38a66;
  --green: #2e7d46;
  --green-bg: #e6f3ea;
  --red: #b83a3a;
  --red-bg: #fbe8e6;
  --amber: #a46b0c;
  --amber-bg: #fbf1dc;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
body.noscroll { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.6; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 650; margin-bottom: 4px; }
h3 { font-size: 15px; font-weight: 650; margin: 16px 0 4px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.center { text-align: center; }
.splash { min-height: 100vh; display: grid; place-items: center; }
.splash img { opacity: 0.85; max-width: 60vw; height: auto; }

.wrap { width: 100%; max-width: 640px; margin: 0 auto; padding: 18px 14px calc(28px + env(safe-area-inset-bottom)); }
.top { text-align: center; padding: 6px 4px 18px; }
.top .logo { display: block; width: 150px; height: auto; margin: 0 auto 14px; }
.top h1 { margin-bottom: 8px; }
.top p { font-size: 15px; max-width: 34em; margin: 0 auto; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(31, 29, 27, 0.04); }
.lbl { display: block; font-size: 14px; font-weight: 600; color: var(--ink-2); margin: 14px 0 6px; }
input, select, textarea {
  width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: 12px; background: #fff;
  font-size: 16px; /* под 16px iPhone приближава страницата */ outline: none; -webkit-appearance: none; appearance: none;
}
select { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%23847b71' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 14px center; padding-right: 38px; }
select:disabled { background-color: #f3efe9; color: var(--muted); }
textarea { min-height: 92px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(31, 29, 27, 0.08); }
.two { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 560px) { .two { grid-template-columns: 1fr 1fr; } }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg button { min-height: 48px; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; font-weight: 650; font-size: 17px; }
.seg button.on { background: var(--ink); border-color: var(--ink); color: #fff; }

.item { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-top: 12px; background: #fcfbf9; }
.item-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.item-head b { flex: 1; font-size: 15px; }
.num { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 2px; }
.thumb { position: relative; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #eee; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button { position: absolute; top: 3px; right: 3px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 17px; line-height: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line-2); background: #fff; font-weight: 650; text-decoration: none; }
.btn.small { min-height: 42px; font-size: 15px; margin-top: 10px; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; font-size: 17px; }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.btn.add { width: 100%; margin-top: 12px; border-style: dashed; border-color: var(--gold); color: var(--ink); background: #fff; min-height: 52px; }
.btn.add .plus { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 19px; line-height: 1; }
.link { border: 0; background: none; padding: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 2px; font-size: inherit; }
.link.danger { color: var(--red); font-size: 14px; }

.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; margin-bottom: 14px; }
.check input { width: 22px; height: 22px; min-height: 0; padding: 0; margin: 1px 0 0; flex: none; -webkit-appearance: checkbox; appearance: auto; accent-color: var(--ink); }
.err { background: var(--red-bg); color: var(--red); border-radius: 10px; padding: 10px 12px; font-size: 15px; }
p.err.small { padding: 6px 10px; margin-top: 8px; }
.foot { text-align: center; color: var(--muted); font-size: 13.5px; padding: 8px 0 0; }
.foot .link { color: var(--muted); }
.last { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--beige); border-radius: 12px; padding: 10px 14px; font-size: 14.5px; margin-bottom: 14px; }

.busy { position: fixed; inset: 0; background: rgba(246, 243, 238, 0.86); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 50; padding: 20px; }
.busy-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 26px; display: grid; gap: 8px; justify-items: center; text-align: center; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); }
.spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--ink); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.done { text-align: center; }
.done .ok { width: 58px; height: 58px; border-radius: 50%; background: var(--green-bg); color: var(--green); display: grid; place-items: center; font-size: 30px; font-weight: 700; margin: 4px auto 12px; }
.done h1 { margin-bottom: 8px; }
.done .btn { width: 100%; margin-top: 6px; }
.preview { --k: 1; background: #eae6df; border-radius: 12px; overflow: hidden; padding: 4px; margin-top: 10px; }
.preview .docx-wrapper { background: transparent !important; padding: 0 !important; zoom: var(--k); display: block !important; }
.preview .docx-wrapper > section.docx { margin: 0 auto 8px !important; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12) !important; }

.sheet-bg { position: fixed; inset: 0; background: rgba(20, 18, 16, 0.45); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: 100%; max-width: 640px; max-height: 88vh; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 18px; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 10px; border-bottom: 1px solid var(--line); }
.sheet-head .x { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--beige); font-size: 22px; line-height: 1; }
.sheet-body { overflow: auto; padding: 6px 18px calc(18px + env(safe-area-inset-bottom)); }
.legal p { font-size: 15px; }
