:root {
  --bg: #f0f5fa;
  --card: #ffffff;
  --teal: #0097a7;
  --teal-dark: #007a87;
  --teal-bg: #e6f5f7;
  --teal-border: rgba(0,151,167,.28);
  --ink: #0d1b2e;
  --sec: #374151;
  --muted: #6b7280;
  --line: rgba(13,27,46,.10);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 12px 34px rgba(13,27,46,.09);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background:
    radial-gradient(900px 420px at 50% -120px, rgba(0,151,167,.10), transparent 70%),
    var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

/* ---- Top bar ---- */
.topbar {
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar__inner {
  max-width: 600px; margin: 0 auto;
  padding: 13px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar__logo { display: inline-flex; }
.topbar__logo img { display: block; }
.topbar__back {
  font-size: 13px; font-weight: 600; color: var(--muted);
  text-decoration: none;
}
.topbar__back:hover { color: var(--teal); }

/* ---- Layout ---- */
.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 40px 20px 64px;
}

/* ---- Hero ---- */
.hero { text-align: center; margin-bottom: 22px; }
.hero__eyebrow {
  display: inline-block;
  font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--teal-dark);
  background: var(--teal-bg);
  border: 1px solid var(--teal-border);
  padding: 5px 12px; border-radius: 999px;
  margin-bottom: 14px;
}
.hero__title {
  font-size: 32px; font-weight: 800; letter-spacing: -.02em;
  line-height: 1.1;
}
.hero__sub {
  font-size: 15px; color: var(--muted);
  max-width: 400px; margin: 10px auto 0;
}

/* ---- Mode switch ---- */
.modeswitch {
  display: flex; gap: 4px;
  background: #e7eef5;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  max-width: 360px; margin: 0 auto 22px;
}
.modeswitch__opt {
  flex: 1;
  padding: 10px 12px;
  border: none; background: transparent;
  font-family: inherit; font-size: 14px; font-weight: 700;
  color: var(--sec); cursor: pointer;
  border-radius: 999px;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.modeswitch__opt.is-active {
  background: #fff; color: var(--teal-dark);
  box-shadow: 0 2px 8px rgba(13,27,46,.12);
}

/* ---- Form panel ---- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px 26px 28px;
}

/* ---- Sections ---- */
.fieldsec { padding: 20px 0; border-top: 1px solid var(--line); }
.fieldsec:first-of-type { border-top: none; }
.fieldsec__title {
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 14px;
}
.fieldsec__hint { font-size: 13px; color: var(--muted); margin: -6px 0 14px; }

/* ---- Fields ---- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.grid2 .field { margin-bottom: 12px; }
.field__label {
  font-size: 13px; font-weight: 600; color: var(--sec);
}
.field__opt { font-weight: 400; color: var(--muted); }
.field--inline { flex-direction: row; align-items: center; gap: 12px; }
.field--inline .field__label { flex: none; }
.field--inline select { flex: 1; }

input, select {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 15px; font-family: inherit;
  color: var(--ink); background: #fff;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-bg);
}
input::placeholder { color: #9aa4b2; }
select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M6 8 0 2l1.4-1.4L6 5.2 10.6.6 12 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px;
}

/* ---- Headshot ---- */
.photo-row { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.photo-thumb {
  width: 72px; height: 72px; flex: none;
  border-radius: 50%;
  background: var(--teal-bg);
  border: 2px dashed var(--teal-border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: none; }
.photo-thumb img[src] { display: block; }
.photo-thumb img[src] + .photo-thumb__ph { display: none; }
.photo-thumb__ph { font-size: 11px; font-weight: 700; color: var(--teal-dark); letter-spacing: .03em; }
.photo-copy { display: flex; flex-direction: column; gap: 4px; }
.btn-file {
  align-self: flex-start;
  padding: 9px 16px;
  border: 1.5px solid var(--teal-border);
  border-radius: var(--radius-sm);
  background: #fff; color: var(--teal-dark);
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.btn-file:hover { background: var(--teal-bg); border-color: var(--teal); }
.photo-hint { font-size: 12px; color: var(--muted); }

/* ---- Links / buttons ---- */
#buttons { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.btn-row { display: flex; gap: 8px; align-items: center; }
.btn-row input.b-label { flex: 2; }
.btn-row input.b-link { flex: 3; }
.btn-row select.b-type { flex: 1.6; min-width: 0; }
.btn-row button.b-remove {
  flex: none; width: 36px; height: 40px; padding: 0;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.btn-row button.b-remove:hover { border-color: #e74c3c; color: #e74c3c; }
.btn-add {
  align-self: flex-start;
  padding: 9px 16px;
  border: 1.5px dashed var(--teal-border); border-radius: var(--radius-sm);
  background: transparent; color: var(--teal-dark);
  font-size: 14px; font-weight: 700; font-family: inherit; cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.btn-add:hover { background: var(--teal-bg); border-color: var(--teal); }

/* ---- Consent ---- */
.consent {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 14px; color: var(--sec); cursor: pointer; margin-top: 4px;
}
.consent input[type="checkbox"] {
  width: 17px; height: 17px; flex: none; margin-top: 1px;
  accent-color: var(--teal); cursor: pointer;
}

/* ---- Errors + submit ---- */
.errors { font-size: 14px; color: #b91c1c; margin: 8px 0 0; }
.errors:empty { margin: 0; }
.btn-submit {
  display: flex; align-items: center; justify-content: center;
  width: 100%; margin-top: 20px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  font-size: 16px; font-weight: 700; font-family: inherit;
  background: var(--teal); color: #fff; border: none; cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,151,167,.28);
  transition: background .15s ease, transform .05s ease;
}
.btn-submit:hover { background: var(--teal-dark); }
.btn-submit:active { transform: translateY(1px); }
.finehint { text-align: center; font-size: 13px; color: var(--muted); margin-top: 12px; }
.legalnote { text-align: center; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legalnote a { color: var(--teal-dark); text-decoration: underline; }

/* ---- Footer ---- */
.sitefoot {
  text-align: center; font-size: 13px; color: var(--muted);
  padding: 0 20px 40px;
}
.sitefoot a { color: var(--teal-dark); text-decoration: none; }

/* ---- Mode-conditional fields ---- */
body[data-mode="general"] .med-only { display: none; }

/* ---- Template chooser ---- */
.templates { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 10px; max-width: 560px; margin: 0 auto 22px; }
.tpl { position: relative; background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 14px 12px;
  cursor: pointer; text-align: left; font-family: inherit; transition: border-color .15s, box-shadow .15s; }
.tpl-rec { display: inline-block; font-size: 9px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: #fff; background: var(--teal); border-radius: 4px; padding: 1px 6px; margin-bottom: 6px; font-style: normal; }
.tpl:hover { border-color: var(--teal); }
.tpl.is-active { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-bg); }
.tpl b { display: block; font-size: 14px; color: var(--ink); margin-bottom: 2px; }
.tpl span { font-size: 12px; color: var(--muted); }

/* ---- Block editor ---- */
.blocks-edit { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.block-edit { border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 12px; background: #fff; }
.block-edit__head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.block-edit__drag { cursor: grab; color: var(--muted); font-size: 16px; user-select: none; }
.block-edit__title { font-size: 13px; font-weight: 700; color: var(--sec); flex: 1; }
.block-edit__rm { border: none; background: none; color: var(--muted); font-size: 18px; cursor: pointer; line-height: 1; }
.block-edit__rm:hover { color: #e74c3c; }
.block-edit__fields { display: flex; flex-direction: column; gap: 8px; }
.block-edit textarea { width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font-size: 15px; font-family: inherit; resize: vertical; min-height: 70px; }
.sortable-ghost { opacity: .4; }

/* ---- Add-block menu ---- */
.add-wrap { position: relative; }
.add-menu[hidden] { display: none; }
.add-menu { position: absolute; z-index: 5; top: 110%; left: 0; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 6px; display: grid; gap: 2px; min-width: 220px; }
.add-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 12px; border: none; background: none;
  font-family: inherit; font-size: 14px; color: var(--ink); text-align: left; cursor: pointer; border-radius: 6px; }
.add-menu button:hover { background: var(--teal-bg); }
.add-menu button:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Pro gating ---- */
.pro-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.pro-badge { font-size: 10px; font-weight: 700; color: #fff; background: var(--teal); border-radius: 4px; padding: 1px 5px; vertical-align: middle; }
.pro-control.locked { opacity: .55; }
.pro-control.locked input { pointer-events: none; }

/* ---- Gallery editor thumbs ---- */
.gallery-thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.g-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }

/* ---- Feedback widget ---- */
.fb-fab { position: fixed; right: 18px; bottom: 18px; z-index: 40;
  background: var(--teal); color: #fff; border: none; border-radius: 999px;
  padding: 11px 18px; font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 22px rgba(0,151,167,.35); }
.fb-fab:hover { background: var(--teal-dark); }
.fb-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(13,27,46,.45);
  display: flex; align-items: center; justify-content: center; padding: 20px; }
.fb-overlay[hidden] { display: none; }
.fb-modal { position: relative; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  width: 100%; max-width: 440px; padding: 24px 22px 20px; }
.fb-close { position: absolute; top: 10px; right: 12px; border: none; background: none; font-size: 24px;
  line-height: 1; color: var(--muted); cursor: pointer; }
.fb-title { font-size: 18px; font-weight: 800; }
.fb-sub { font-size: 13px; color: var(--muted); margin: 4px 0 14px; }
.fb-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--sec); }
.fb-modal textarea { width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font-size: 15px; font-family: inherit; resize: vertical; }
.fb-status { font-size: 13px; color: var(--teal-dark); min-height: 1.2em; margin-bottom: 6px; }
.fb-actions { display: flex; justify-content: flex-end; gap: 8px; }
.fb-cancel { background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 16px; font-family: inherit; font-weight: 600; font-size: 14px; cursor: pointer; }
.fb-send { background: var(--teal); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 9px 18px; font-family: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.fb-send:hover { background: var(--teal-dark); }
.fb-send:disabled { opacity: .6; cursor: default; }

@media (max-width: 460px) {
  .grid2 { grid-template-columns: 1fr; }
  .hero__title { font-size: 27px; }
  .templates { grid-template-columns: 1fr; }
  .pro-grid { grid-template-columns: 1fr; }
}
