:root {
  --bg: #eef2f7;
  --card: #ffffff;
  --ink: #1b2430;
  --muted: #5b6676;
  --accent: #1f4e8c;
  --accent-ink: #ffffff;
  --line: #dde3eb;
  --radius: 18px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--card);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.06);
}

.header {
  height: 190px;
  background-color: var(--accent);
  background-image: linear-gradient(135deg, rgba(0,0,0,0.15), rgba(255,255,255,0.15));
  background-size: cover;
  background-position: center;
}

.profile {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  border: 5px solid var(--card);
  margin: -66px auto 0;
  display: block;
  object-fit: cover;
  background: #d5dce6;
}

.body { padding: 14px 24px 32px; text-align: center; }

.profile[hidden] { display: none; }

h1 { font-size: 26px; margin: 10px 0 18px; letter-spacing: -0.01em; }
.tagline { color: var(--muted); margin: 0 0 22px; font-size: 15px; line-height: 1.4; }
.tagline:empty { display: none; }

.btn {
  display: block;
  width: 100%;
  padding: 15px 18px;
  border-radius: 999px;
  border: 0;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  margin: 0 0 12px;
  font-family: inherit;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-secondary { background: transparent; color: var(--accent); border: 2px solid var(--accent); }
.btn[hidden] { display: none; }
a.btn[hidden] { display: none; }
.btn:disabled { opacity: 0.6; cursor: default; }

.form { text-align: left; margin: 6px 0 18px; display: none; }
.form.open { display: block; }
.form label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; }
.form input[type="text"], .form input[type="email"], .form input[type="tel"] {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
}
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); margin: 14px 0; line-height: 1.4; }
.consent input { margin-top: 3px; }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.msg { font-size: 14px; margin: 8px 0 0; min-height: 1em; }
.msg.err { color: #a33a2b; }
.thanks { display: none; padding: 16px; background: var(--bg); border-radius: 14px; margin: 0 0 14px; }
.thanks.show { display: block; }
.recaptcha-note { font-size: 11px; color: var(--muted); margin-top: 10px; }
.recaptcha-note a { color: var(--muted); }

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 26px 0 12px;
}
.section-title[hidden] { display: none; }

.socials { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.social {
  display: block;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}

.footer {
  border-top: 1px solid var(--line);
  margin-top: 28px;
  padding-top: 16px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-line;
}

/* hide reCAPTCHA badge; the required notice is shown in the form instead */
.grecaptcha-badge { visibility: hidden; }

/* ---------- admin ---------- */
.admin { max-width: 760px; margin: 0 auto; padding: 24px; }
.admin h1 { text-align: left; }
.admin h2 { font-size: 18px; margin: 28px 0 10px; }
.admin .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.admin .grid .full { grid-column: 1 / -1; }
.admin label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.admin input[type="text"], .admin input[type="url"], .admin input[type="email"], .admin input[type="tel"], .admin input[type="number"], .admin textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
}
.admin textarea { min-height: 64px; }
.admin .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.admin .btn { width: auto; display: inline-block; padding: 11px 20px; margin: 0; }
.admin .preview-img { width: 120px; height: 80px; object-fit: cover; border-radius: 10px; background: #e3e8ef; }
.admin input[type="color"] { width: 56px; height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 2px; background: #fff; }
.admin .preview-img.round { width: 80px; border-radius: 50%; }
.admin table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin th, .admin td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin .status-sent { color: #2f6b3f; font-weight: 600; }
.admin .status-failed { color: #a33a2b; font-weight: 600; }
.admin .status-pending { color: var(--muted); }
.admin .hint { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.admin .bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin .saved { color: #2f6b3f; font-size: 14px; }
@media (max-width: 600px) { .admin .grid { grid-template-columns: 1fr; } }

.admin .color-row { display: flex; gap: 8px; align-items: center; }
.admin .color-row input[type="color"] { width: 46px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.admin .color-row input[type="text"] { width: 120px; }

/* ---------- blocks (card page) ---------- */
.btn-link { display: flex; align-items: center; justify-content: center; gap: 10px; }
.btn-link .icon { margin-left: -4px; }
.icon { width: 24px; height: 24px; border-radius: 6px; object-fit: contain; flex: none; background: #fff; }
.icon.letter {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 13px;
}
.socials { margin: 0 0 12px; }
.social { display: flex; align-items: center; gap: 10px; text-align: left; }
.social .icon { width: 28px; height: 28px; }
.social-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-block { color: var(--muted); font-size: 15px; line-height: 1.5; margin: 10px 0 16px; white-space: pre-line; }
.form-title { font-weight: 600; margin: 4px 0 2px; }
.form textarea { width: 100%; min-height: 90px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; font-size: 16px; font-family: inherit; }
.embed { margin: 6px 0 14px; }
.embed iframe { width: 100%; border: 1px solid var(--line); border-radius: 14px; background: #fff; }

/* ---------- block builder (admin) ---------- */
.admin .blocks-list { display: flex; flex-direction: column; gap: 10px; }
.admin .block-card { border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.admin .block-card.hidden-block { opacity: 0.55; }
.admin .block-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.admin .block-type { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); font-weight: 700; min-width: 86px; }
.admin .block-summary { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.admin .block-tools { display: flex; gap: 4px; }
.admin .tool { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 5px 9px; font-size: 13px; cursor: pointer; font-family: inherit; }
.admin .tool:disabled { opacity: 0.35; cursor: default; }
.admin .tool.danger { color: #a33a2b; }
.admin .block-body { border-top: 1px solid var(--line); padding: 12px; display: none; }
.admin .block-card.open .block-body { display: block; }
.admin .checks { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; }
.admin .checks label { display: flex; gap: 6px; align-items: center; color: var(--ink); margin: 0; }
.admin select { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; font-family: inherit; background: #fff; width: 100%; }
.admin .add-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.admin .icon-preview { width: 40px; height: 40px; border-radius: 8px; object-fit: contain; border: 1px solid var(--line); background: #fff; }
.admin .sticky-save { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; margin-top: 18px; border-top: 1px solid var(--line); z-index: 5; }

/* cropper modal */
.crop-modal { position: fixed; inset: 0; background: rgba(10, 16, 24, 0.7); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.crop-box { background: #fff; border-radius: 16px; padding: 16px; width: min(720px, 100%); max-height: 95vh; overflow: auto; }
.crop-area { width: 100%; height: min(60vh, 460px); background: #111; }
.crop-area img { display: block; max-width: 100%; }
.crop-box.round .cropper-view-box, .crop-box.round .cropper-face { border-radius: 50%; }
.crop-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }

/* ---------- theme: text, background, button styles ---------- */
:root { --text: #1b2430; }
.bg-layer { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.wrap .body h1, .wrap .footer, .wrap .tagline, .wrap .section-title, .wrap .text-block,
.wrap .form label, .wrap .consent, .wrap .recaptcha-note, .wrap .form-title { color: var(--text); }
.wrap .tagline, .wrap .section-title, .wrap .text-block, .wrap .footer, .wrap .consent, .wrap .recaptcha-note, .wrap .form label { opacity: 0.85; }
.wrap .recaptcha-note a { color: inherit; }
.form input, .form textarea { color: #1b2430; background: #fff; }

/* gradient background: no white card, content floats on the gradient */
body.theme-gradient { background: transparent; }
body.theme-gradient .wrap { background: transparent; box-shadow: none; }
body.theme-gradient .header[hidden] + .profile { margin-top: 36px; }
body.theme-gradient .footer { border-top-color: color-mix(in srgb, var(--text) 30%, transparent); }
body.theme-gradient .thanks { background: rgba(255, 255, 255, 0.14); color: var(--text); }

/* filled buttons */
body.buttons-filled .btn, body.buttons-filled .btn-secondary {
  background: var(--accent); color: var(--accent-ink); border: 2px solid var(--accent);
}
body.buttons-filled .social { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
body.buttons-filled .social .social-label { color: var(--accent-ink); }

/* outline buttons */
body.buttons-outline .btn, body.buttons-outline .btn-secondary, body.buttons-outline .btn-primary {
  background: transparent; color: var(--text); border: 2px solid var(--text);
}
body.buttons-outline .social { background: transparent; color: var(--text); border: 2px solid var(--text); }
body.buttons-outline .form .btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.tagline { white-space: pre-line; }

.admin .status-partial { color: #a66a00; font-weight: 600; }

/* Contact rows in the admin */
.admin .item-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.admin .item-row { display: grid; grid-template-columns: 22px 70px 110px 1fr auto; gap: 8px; align-items: start; }
.admin .item-row:has(.item-custom) { grid-template-columns: 22px 70px 110px 120px 1fr auto; }
.admin .item-kind { font-size: 13px; font-weight: 600; padding-top: 9px; color: #555; }
.admin .item-row:not(:has(.item-label)) { grid-template-columns: 22px 70px 1fr auto; }
.admin .item-tools { display: flex; gap: 4px; padding-top: 4px; }
.admin .item-value { width: 100%; }
@media (max-width: 600px) {
  .admin .item-row, .admin .item-row:has(.item-custom), .admin .item-row:not(:has(.item-label)) { grid-template-columns: 22px 1fr 1fr; }
  .admin .item-row .item-custom { grid-column: 2 / -1; }
  .admin .item-row .item-value { grid-column: 2 / -1; }
  .admin .item-row .item-tools { grid-column: 2 / -1; justify-content: flex-end; }
}

/* Drag to reorder */
.admin .drag-handle { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; color: #8a94a3;
  font-size: 18px; line-height: 1; padding: 8px 4px; border-radius: 6px; }
.admin .drag-handle:hover { background: #eef2f7; color: #1b2430; }
.admin .block-head .drag-handle { margin-right: 6px; }
.admin .item-row .drag-handle { padding-top: 10px; text-align: center; }
.admin .dragging { opacity: 0.9; box-shadow: 0 8px 24px rgba(13, 28, 60, 0.18); position: relative; z-index: 5; background: #fff; }
.admin .dragging .drag-handle { cursor: grabbing; }
body.is-dragging { user-select: none; -webkit-user-select: none; }
