/* MiCash contact form editor (contact-form-editor.js): the live form, and the panel beside it (below it on a phone).
   Colors come from the page: the dashboard's tokens, or the app's page (contact-form-editor.html). */
.cfe { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; color: var(--text, #e6e8eb); }
.cfe * { box-sizing: border-box; }
@media (max-width: 860px) { .cfe { grid-template-columns: minmax(0, 1fr); } }

/* Behind the form: a stand-in for your website (a soft grey: a see-through form shows it, like your site's section). */
.cfe-stage { min-width: 0; }
.cfe-site { border-radius: 16px; padding: 28px 18px; background: #7f8c8f; overflow: hidden; }
.cfe-site.clear { background: #4f5d5f; }   /* see-through: a stand-in for your website's own section */
.cfe-form { min-height: 120px; }
.cfe-below { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.cfe-row { display: flex; justify-content: center; }
.cfe-seg { display: inline-flex; padding: 2px; border-radius: 11px; background: var(--fill, rgba(118, 118, 128, .24)); }
.cfe-seg button { border: 0; background: none; padding: 7px 14px; border-radius: 9px; font: inherit; font-size: 13px; font-weight: 600; color: var(--text, #e6e8eb); cursor: pointer; }
.cfe-seg button.on { background: var(--surface-solid, #2c2c2e); color: var(--heading, #fff); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.cfe-adds { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: center; }
.cfe-muted { font-size: 13px; color: var(--muted, #8d929a); }
.cfe-chip { border: 1px dashed var(--muted, #8d929a); background: none; color: var(--text, #e6e8eb); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.cfe-chip:hover { border-color: var(--primary, #40b6ff); color: var(--primary, #40b6ff); }

/* The panel */
.cfe-side { position: sticky; top: 14px; border-radius: 16px; background: var(--card, rgba(255, 255, 255, .06)); border: 1px solid var(--card-border, rgba(255, 255, 255, .1)); overflow: hidden; }
@media (max-width: 860px) { .cfe-side { position: static; } }
.cfe-tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--separator, rgba(255, 255, 255, .1)); }
.cfe-tabs button { flex: 1; border: 0; background: none; padding: 9px 6px; border-radius: 10px; font: inherit; font-size: 14px; font-weight: 600; color: var(--muted, #8d929a); cursor: pointer; }
.cfe-tabs button.on { background: var(--fill, rgba(118, 118, 128, .24)); color: var(--heading, #fff); }
.cfe-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.cfe-body h3 { margin: 0; font-size: 17px; color: var(--heading, #fff); }
.cfe-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cfe-hint { margin: 4px 0; font-size: 14px; line-height: 1.45; color: var(--muted, #8d929a); }
.cfe-note { margin: 0; font-size: 13px; line-height: 1.4; color: var(--muted, #8d929a); }
.cfe-sub { margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--muted, #8d929a); }

.cfe-field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted, #8d929a); }
.cfe-field input, .cfe-field textarea, .cfe-item input {
  width: 100%; border: 1px solid var(--separator, rgba(255, 255, 255, .14)); border-radius: 10px; padding: 9px 11px;
  background: var(--fill, rgba(118, 118, 128, .16)); color: var(--heading, #fff); font: inherit; font-size: 15px; }
.cfe-field textarea { resize: vertical; min-height: 70px; }
.cfe-field input:focus, .cfe-field textarea:focus, .cfe-item input:focus { outline: 2px solid var(--primary, #40b6ff); outline-offset: 0; border-color: transparent; }
.cfe-field .mono, .cfe-item input[autocapitalize="none"] { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

.cfe-toggle, .cfe-color { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 15px; color: var(--heading, #fff); min-height: 34px; }
.cfe-toggle input { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 14px; background: var(--fill, rgba(118, 118, 128, .32));
  position: relative; cursor: pointer; flex: none; margin: 0; transition: background .2s; }
.cfe-toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s; }
.cfe-toggle input:checked { background: var(--success, #2fd67a); }
.cfe-toggle input:checked::after { transform: translateX(18px); }
.cfe-color span:first-child { flex: 1; }
.cfe-hex { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted, #8d929a); }
.cfe-color input { width: 36px; height: 30px; border: 1px solid var(--separator, rgba(255, 255, 255, .2)); border-radius: 8px; padding: 0; background: none; cursor: pointer; flex: none; }

.cfe-list { display: flex; flex-direction: column; gap: 6px; }
.cfe-item { display: flex; gap: 4px; align-items: center; margin: 0; }
.cfe-item input { flex: 1; min-width: 0; padding: 7px 10px; font-size: 14px; }
.cfe-ic { flex: none; width: 30px; height: 30px; border: 0; border-radius: 8px; background: var(--fill, rgba(118, 118, 128, .2)); color: var(--heading, #fff); font: inherit; font-size: 15px; line-height: 1; cursor: pointer; }
.cfe-ic:disabled { opacity: .35; cursor: default; }
.cfe-x { color: var(--danger, #ff6b6b); font-size: 19px; }
.cfe-add input { border-style: dashed; }

.cfe-remove { align-self: flex-start; border: 0; background: none; padding: 4px 0; font: inherit; font-size: 14px; font-weight: 600; color: var(--danger, #ff6b6b); cursor: pointer; }
.cfe-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.cfe-btn { border: 1px solid var(--separator, rgba(255, 255, 255, .2)); background: none; color: var(--heading, #fff); border-radius: 999px; padding: 9px 16px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.cfe-btn.primary { background: var(--primary, #40b6ff); border-color: transparent; color: #fff; }
.cfe-tokens { display: flex; flex-wrap: wrap; gap: 6px; }
.cfe-tokens .cfe-chip { border-style: solid; font-size: 12px; padding: 4px 10px; }
@media (prefers-reduced-motion: reduce) { .cfe-toggle input, .cfe-toggle input::after { transition: none; } }

/* The app (contact-form-editor.html): on a phone the panel is a sheet at the bottom, the form scrolls above it. */
.cfe-host .cfe-side { position: fixed; left: 0; right: 0; bottom: 0; top: auto; max-height: 52vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  border-radius: 18px 18px 0 0; border-bottom: 0; background: var(--sheet, #1c1c1e); box-shadow: 0 -8px 30px rgba(0, 0, 0, .35); z-index: 5; }
.cfe-host .cfe-tabs { position: sticky; top: 0; background: var(--sheet, #1c1c1e); z-index: 1; }
.cfe-host .cfe-body { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }

/* { } smart fields beside a box of wording */
.cfe-withbrace { display: flex; gap: 6px; align-items: flex-start; }
.cfe-withbrace input, .cfe-withbrace textarea { flex: 1; min-width: 0; }
.cfe-brace { flex: none; height: 38px; padding: 0 10px; border: 1px solid var(--separator, rgba(255, 255, 255, .14)); border-radius: 10px;
  background: var(--fill, rgba(118, 118, 128, .16)); color: var(--primary, #40b6ff); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.cfe-menu { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border-radius: 12px; background: var(--fill, rgba(118, 118, 128, .16)); }
.cfe-menu[hidden] { display: none; }
.cfe-menu .cfe-chip { border-style: solid; font-size: 12px; padding: 4px 10px; }
.cfe-field select { width: 100%; border: 1px solid var(--separator, rgba(255, 255, 255, .14)); border-radius: 10px; padding: 9px 11px;
  background: var(--fill, rgba(118, 118, 128, .16)); color: var(--heading, #fff); font: inherit; font-size: 15px; }
.cfe-btn:disabled { opacity: .4; cursor: default; }
