:root {
  --accent: #1f3b2c;          /* глибокий військовий зелений */
  --accent-2: #2f5d43;
  --accent-soft: #eef3f0;
  --bg: #f4f1ec;
  --card: #ffffff;
  --border: #dadce0;
  --text: #202124;
  --muted: #5f6368;
  --danger: #c5221f;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); }

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 14px 64px;
}

/* ---------- Картки ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 26px;
  margin-bottom: 14px;
}

.card.head {
  border-top: 10px solid var(--accent);
  padding-top: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.brand .logo {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.5px;
  flex: none;
}

h1 {
  font-size: 28px;
  font-weight: 600;
  margin: 4px 0 6px;
}

.subtitle { color: var(--muted); font-size: 15px; margin: 0; }

.required-note { color: var(--danger); font-size: 13px; margin-top: 14px; }

/* ---------- Питання ---------- */
.q-label {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 12px;
}
.q-label .req { color: var(--danger); margin-left: 3px; }

input[type="text"],
input[type="tel"],
textarea {
  width: 100%;
  border: none;
  border-bottom: 1px solid #9aa0a6;
  padding: 8px 2px;
  font-size: 15px;
  color: var(--text);
  background: transparent;
  transition: border-color 0.15s;
}
input[type="text"]:focus,
input[type="tel"]:focus,
textarea:focus {
  outline: none;
  border-bottom: 2px solid var(--accent-2);
}
::placeholder { color: #9aa0a6; }

.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  border-radius: 8px;
  cursor: pointer;
}
.opt:hover { background: var(--accent-soft); }
.opt input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.opt span { font-size: 15px; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Кнопки ---------- */
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.btn {
  border: none;
  border-radius: 8px;
  padding: 11px 26px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); }
.btn-link { background: transparent; color: var(--accent-2); font-weight: 500; }
.btn-link:hover { background: var(--accent-soft); }
.btn-secondary { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn-secondary:hover { background: #f8f9fa; }
.btn-danger { background: #fff; border: 1px solid #f2c5c4; color: var(--danger); }
.btn-danger:hover { background: #fdecec; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---------- Повідомлення ---------- */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.flash.error { background: #fdecec; color: var(--danger); border: 1px solid #f2c5c4; }
.flash.ok { background: #e7f4ec; color: #1e7e42; border: 1px solid #b7e0c6; }

.success-card { text-align: center; }
.success-card .check {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  font-size: 30px; margin: 0 auto 14px;
}

.footer-note { color: var(--muted); font-size: 12px; text-align: center; margin-top: 22px; }

/* ---------- Адмін ---------- */
.admin-body { background: #eef0f2; }
.topbar {
  background: var(--accent);
  color: #fff;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar .title { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.topbar a { color: #cfe6d8; font-size: 14px; }
.topbar > div { display: flex; align-items: center; }
.logout-form { display: inline; margin: 0; }
.logout-btn { background: none; border: none; color: #cfe6d8; font-size: 14px; cursor: pointer; padding: 0; font-family: inherit; }
.logout-btn:hover { color: #fff; text-decoration: underline; }
.admin-wrap { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-bottom: 16px;
}
.toolbar .spacer { flex: 1; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; color: var(--text); font-size: 14px; text-decoration: none;
}
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip .n { opacity: 0.75; margin-left: 4px; }

.panel { background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 18px; }
.panel h3 { margin: 0; padding: 14px 18px; border-bottom: 1px solid var(--border); font-size: 15px; }
.panel .body { padding: 16px 18px; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #eceef0; vertical-align: top; }
th { background: #f6f7f8; font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
tr:hover td { background: #fafbfc; }
td.nowrap, th.nowrap { white-space: nowrap; }

.badge { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.new { background: #fff3e0; color: #b26a00; }
.badge.processed { background: #e7f4ec; color: #1e7e42; }

.inline-form { display: inline; }
.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px; }

.login-wrap { max-width: 380px; margin: 8vh auto 0; padding: 0 16px; }
.login-wrap .field { margin-bottom: 16px; }
.login-wrap label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

.backup-list { list-style: none; margin: 0; padding: 0; }
.backup-list li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #eceef0; font-size: 13.5px; }
.backup-list li:last-child { border-bottom: none; }

/* ---------- Навігація рольова ---------- */
.topbar { flex-wrap: wrap; gap: 10px 18px; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; flex: 1; }
.nav a { color: #cfe6d8; font-size: 14px; padding: 4px 2px; border-bottom: 2px solid transparent; }
.nav a:hover { color: #fff; }
.nav a.on { color: #fff; border-bottom-color: #fff; }
.nav-sep { color: #4d7a60; }
.userbox { display: flex; align-items: center; gap: 12px; }
.userbox .who { color: #cfe6d8; font-size: 13px; white-space: nowrap; }

/* ---------- Форм-контроли адмінки ---------- */
.fl { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.inp {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 10px; font-size: 14px; font-family: inherit; color: var(--text); background: #fff;
}
.inp:focus { outline: none; border-color: var(--accent-2); }
.inp-sm { width: 110px; padding: 6px 8px; }
textarea.inp { resize: vertical; }
select.inp { cursor: pointer; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- Деталі заявки (key/value) ---------- */
table.kv td { padding: 8px 10px; }
table.kv td.k { color: var(--muted); width: 40%; }
table.kv tr.total td { border-top: 2px solid var(--border); }
.ans { display: inline-block; margin-right: 14px; font-size: 13px; }
.ans b { color: var(--muted); font-weight: 600; }

/* ---------- Конструктор питань / калькулятор ---------- */
.q-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.opt-list { margin: 8px 0; }
.opt-row { padding: 4px 0; font-size: 14px; border-bottom: 1px solid #f0f2f3; }
.price-box { align-self: flex-start; }

@media (max-width: 560px) {
  h1 { font-size: 23px; }
  .card { padding: 18px 16px; }
  .grid2 { grid-template-columns: 1fr; }
}
