* { box-sizing: border-box; margin: 0; }

:root {
  --bg: #f4efe7;
  --card: #fffdf8;
  --ink: #23211e;
  --muted: #8d8578;
  --gold: #b3a289;
  --gold-soft: #cbbfae;
  --accent-dark: #23211e;
  --ok: #4a7a58;
  --err: #a83a30;
  --line: #e5ddce;
  --radius: 14px;
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 600px; margin: 0 auto; padding: 20px 14px 56px; }
.container.wide { max-width: 940px; }

/* ---------- фирменная шапка ---------- */

.brand { text-align: center; padding: 26px 0 6px; }
.brand-small { padding: 14px 0 2px; }
.logo-img { max-width: 270px; max-height: 260px; }
.monogram svg { width: 76px; height: 76px; }
.brand-name {
  font-family: var(--serif);
  font-size: 26px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 12px;
  color: var(--ink);
}
.brand-small .brand-name { font-size: 18px; }
.brand-tagline {
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}
.rule {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px auto 0;
  max-width: 320px;
  color: var(--gold);
  font-size: 11px;
}
.rule::before, .rule::after { content: ''; flex: 1; height: 1px; background: var(--gold-soft); }

.page-intro { text-align: center; padding: 14px 8px 20px; }
.page-intro .hint { max-width: 420px; margin: 6px auto 0; }

h1 { font-family: var(--serif); font-size: 27px; font-weight: 600; }
h2 { font-family: var(--serif); font-size: 18px; font-weight: 600; margin-bottom: 10px; }

.page-footer {
  text-align: center;
  margin-top: 30px;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}

/* ---------- карточки ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(35, 33, 30, 0.04);
}
.card.narrow { max-width: 380px; margin: 12vh auto 0; }
.card.center { text-align: center; }
.ok-banner { border-color: var(--gold); background: #faf6ee; }
.ok-banner code { display: block; margin: 8px 0; word-break: break-all; font-size: 13px; }

.doc-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-dark);
  color: #ece5d7;
  font-family: var(--sans);
  font-size: 13px;
  margin-right: 8px;
  vertical-align: -6px;
}

.consent-text {
  white-space: pre-wrap;
  font-size: 14px;
  max-height: 46vh;
  overflow-y: auto;
  padding: 4px 10px 4px 0;
  color: #3c3933;
}

.check {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
  cursor: pointer;
}
.consent-text + div .check:first-child, .consent-text + .check { margin-top: 10px; }
.check input {
  width: 22px;
  height: 22px;
  flex: none;
  accent-color: var(--accent-dark);
  margin-top: 1px;
}

.hint { color: var(--muted); font-size: 13px; }
.error { color: var(--err); font-size: 14px; margin: 10px 0; }

.ph { border-bottom: 1px dashed var(--gold); color: var(--muted); }
.ph.ph-filled { color: var(--ink); font-weight: 600; border-bottom-color: transparent; }

/* ---------- подпись ---------- */

.sig-wrap { position: relative; margin: 10px 0 16px; }
#sig-canvas {
  width: 100%;
  height: 190px;
  border: 1.5px dashed var(--gold);
  border-radius: 10px;
  background: #fbf8f1;
  touch-action: none;
  display: block;
}
#sig-clear { position: absolute; right: 8px; bottom: 8px; }

/* ---------- кнопки и поля ---------- */

.btn-primary, .btn-secondary {
  display: inline-block;
  width: 100%;
  padding: 15px 18px;
  border: none;
  border-radius: 10px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  margin-top: 10px;
}
.btn-primary { background: var(--accent-dark); color: #ece5d7; }
.btn-primary:hover { background: #3a362f; }
.btn-primary:disabled { opacity: 0.5; }
.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--gold);
  width: auto;
  padding: 10px 18px;
  font-size: 13px;
}
.btn-secondary:hover { background: #f3ecdf; }
.btn-link { background: none; border: none; color: var(--gold); cursor: pointer; font-size: 13px; text-decoration: underline; padding: 4px; }

.big-check { font-size: 54px; color: var(--ok); font-family: var(--serif); }

label { display: block; margin-bottom: 13px; font-size: 14px; font-weight: 500; }
input, select, textarea {
  width: 100%;
  padding: 12px 13px;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 15px;
  font-family: var(--sans);
  font-weight: 400;
  background: #fbf8f1;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 1.5px solid var(--gold); border-color: var(--gold); }
textarea { resize: vertical; }

/* ---------- админка ---------- */

.tabs { display: flex; gap: 4px; padding: 16px 0; flex-wrap: wrap; align-items: center; }
.tabs a { padding: 8px 16px; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: 14px; }
.tabs a.active { background: var(--accent-dark); color: #ece5d7; }
.tabs a.right { margin-left: auto; color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; letter-spacing: 0.04em; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.actions a { color: var(--gold); font-weight: 600; }

.badge { padding: 3px 10px; border-radius: 20px; font-size: 12px; white-space: nowrap; }
.badge.ok { background: #e4efe7; color: var(--ok); }
.badge.pending { background: #f1e9db; color: #8a7a5f; }
.badge.refused { background: #f3e2df; color: var(--err); }

.choice { border-top: 2px solid var(--line); margin-top: 12px; padding-top: 4px; }
.choice input[type=radio] { width: 22px; height: 22px; flex: none; accent-color: var(--accent-dark); }
.doc-refused .consent-text { opacity: 0.55; }
.doc-refused .check input[type=checkbox]:disabled + span { color: var(--muted); }

.list { list-style: none; }
.list li { padding: 13px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: none; }
.list .btn-secondary { margin-top: 8px; }

.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-form button { grid-column: 1 / -1; }
@media (max-width: 600px) {
  .grid-form { grid-template-columns: 1fr; }
  .brand-name { font-size: 21px; }
}
