/* CxL — editor */
.ed-body { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }

.ed-top {
  flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 12px clamp(14px, 2.5vw, 28px); border-bottom: 1px solid var(--line); background: var(--bg);
}
.ed-top .brand { justify-self: start; }
.ed-url {
  display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 16px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text); cursor: pointer;
  font: 500 14px var(--mono); transition: border-color .2s;
}
.ed-url:hover { border-color: var(--line-2); }
.ed-url b { font-weight: 600; }
.ed-url-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(40,200,64,.2); }
.ed-actions { justify-self: end; display: flex; align-items: center; gap: 6px; }
.ed-status { font-size: 13px; color: var(--muted); margin-right: 8px; transition: color .2s; }
.ed-status.saving { color: var(--accent); }

.ed-wrap { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 44%); }

.ed-panel { overflow-y: auto; padding: 24px clamp(14px, 3vw, 40px) 120px; }
.ed-panel > * { max-width: 640px; margin-left: auto; margin-right: auto; }

.ed-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); margin-bottom: 24px; position: sticky; top: 0; z-index: 5; }
.ed-tabs button {
  flex: 1; height: 40px; border: 0; border-radius: 999px; background: none; color: var(--muted);
  font: 600 14.5px var(--sans); cursor: pointer; transition: background .2s, color .2s;
}
.ed-tabs button:hover { color: var(--text); }
.ed-tabs button[aria-selected="true"] { background: var(--text); color: var(--bg); }

.ed-pane { animation: pane-in .35s var(--ease); }
@keyframes pane-in { from { opacity: 0; transform: translateY(6px); } }

.ed-add {
  width: 100%; height: 56px; border-radius: 18px; border: 0; cursor: pointer;
  background: var(--text); color: var(--bg); font: 650 16px var(--sans); letter-spacing: -.01em;
  display: flex; align-items: center; justify-content: center; gap: 10px; transition: transform .2s var(--ease), box-shadow .2s;
}
.ed-add span { font-size: 24px; font-weight: 500; line-height: 1; }
.ed-add:hover { box-shadow: 0 0 0 4px rgba(255,255,255,.12), 0 12px 40px -10px rgba(255,255,255,.5); transform: translateY(-1px); }
.ed-add-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.ed-add--ghost { width: auto; padding: 0 20px; background: var(--bg-2); color: var(--text); border: 1px solid var(--line-2); }
.ed-add--ghost span { font-size: 15px; font-weight: 800; }
.ed-add--ghost:hover { box-shadow: none; border-color: rgba(255,255,255,.3); }
.ed-link-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ed-link-main .ed-link-fields { flex: 1; }
.ed-link-main input.emoji { flex: none; width: 42px; height: 42px; border-radius: 12px; border: 1px dashed var(--line-2); background: var(--bg); color: var(--text); text-align: center; font-size: 20px; outline: 0; padding: 0; }
.ed-link-main input.emoji:focus { border-style: solid; border-color: var(--yellow); }
.ed-link-main input.emoji::placeholder { color: rgba(245,245,247,.18); font-size: 16px; }
.ed-18 { width: auto; padding: 0 8px; font: 800 11px var(--sans); letter-spacing: .02em; }
.ed-18.on { color: #fff; background: var(--red); }
.ed-18.on:hover { background: var(--red); color: #fff; }
.ed-link--header { background: transparent; border-style: dashed; }
.ed-tag { align-self: flex-start; font: 600 10.5px var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--yellow); padding: 2px 6px 4px; }
.ed-link--header input.title { font-size: 13.5px; text-transform: uppercase; letter-spacing: .08em; }

.ed-seg { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.ed-seg button { flex: 1; height: 34px; border: 0; border-radius: 9px; background: none; color: var(--muted); font: 600 13px var(--sans); cursor: pointer; transition: background .2s, color .2s; }
.ed-seg button:hover { color: var(--text); }
.ed-seg button[aria-checked="true"] { background: var(--text); color: var(--bg); }
.ed-seg--sm { flex: none; }
.ed-seg--sm button { padding: 0 12px; height: 30px; white-space: nowrap; }
.ed-bg-opts { display: grid; gap: 12px; margin-top: 14px; }
.ed-bg-opts [hidden] { display: none !important; }
.ed-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ed-row--colors { margin-top: 14px; }
.ed-range { display: grid; grid-template-columns: 90px 1fr 48px; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.ed-range input { accent-color: var(--yellow); }
.ed-range output { font: 500 12.5px var(--mono); color: var(--text); text-align: right; }
.ed-upload { height: 38px; font-size: 13.5px; cursor: pointer; }
.ed-small { font-size: 12.5px; }
.ed-switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; cursor: pointer; }
.ed-switch + .ed-switch { border-top: 1px solid var(--line); }
.ed-switch > span:first-child { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.ed-switch small { font-size: 12.5px; }

.ed-links { list-style: none; padding: 0; margin: 16px auto 0; display: flex; flex-direction: column; gap: 12px; }
.ed-link {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center;
  padding: 14px 14px 14px 8px; border-radius: 18px; background: var(--bg-2); border: 1px solid var(--line);
  transition: border-color .2s, opacity .2s, transform .2s var(--ease);
  animation: pane-in .3s var(--ease);
}
.ed-link:focus-within { border-color: var(--line-2); }
.ed-link.is-off { opacity: .55; }
.ed-link.is-dragging { opacity: .4; }
.ed-link.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.ed-link.drop-after { box-shadow: 0 3px 0 var(--accent); }
.ed-drag { cursor: grab; color: var(--muted); display: grid; place-items: center; height: 100%; font-size: 14px; letter-spacing: -2px; user-select: none; touch-action: none; }
.ed-drag:active { cursor: grabbing; }
.ed-link-fields { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ed-link-fields input {
  width: 100%; background: none; border: 0; outline: 0; color: var(--text); padding: 4px 6px; border-radius: 8px;
  font: 600 15.5px var(--sans);
}
.ed-link-fields input.url { font: 400 13.5px var(--mono); color: var(--muted); }
.ed-link-fields input:focus { background: rgba(244,241,234,.05); }
.ed-link-fields input::placeholder { color: rgba(244,241,234,.3); }
.ed-link-tools { display: flex; align-items: center; gap: 2px; }
.ed-icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 0; background: none; color: var(--muted); cursor: pointer;
  display: grid; place-items: center; transition: background .2s, color .2s;
}
.ed-icon-btn:hover { background: rgba(244,241,234,.07); color: var(--text); }
.ed-icon-btn.on { color: var(--yellow); }
.ed-icon-btn.danger:hover { color: var(--red); background: rgba(255,95,87,.1); }

.toggle { position: relative; width: 38px; height: 22px; flex: none; margin: 0 4px; }
.toggle input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; z-index: 1; }
.toggle span { position: absolute; inset: 0; border-radius: 999px; background: rgba(244,241,234,.16); transition: background .2s; }
.toggle span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .25s var(--ease); }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { transform: translateX(16px); background: #fff; }
.toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.ed-hint { font-size: 13px; color: var(--muted); margin-top: 18px; }
.ed-hint.center { text-align: center; }
.kbd { font-family: var(--mono); background: var(--bg-3); padding: 1px 6px; border-radius: 6px; letter-spacing: -2px; }

.ed-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: 20px; padding: 20px; margin-bottom: 14px; }
.ed-card-title { font: 600 12px var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 14px; }

.ed-avatar-row { display: flex; align-items: center; gap: 18px; }
.ed-avatar { position: relative; width: 84px; height: 84px; border-radius: 50%; overflow: hidden; cursor: pointer; flex: none; background: var(--bg-3); }
.ed-avatar span, .ed-avatar img, .ed-avatar .initials { width: 100%; height: 100%; display: grid; place-items: center; object-fit: cover; }
.ed-avatar .initials { background: var(--grad); color: #fff; font-weight: 800; font-size: 28px; }
.ed-avatar i { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.55); font-style: normal; font-size: 12.5px; font-weight: 600; opacity: 0; transition: opacity .2s; }
.ed-avatar:hover i { opacity: 1; }
.ed-avatar-copy { display: flex; flex-direction: column; gap: 2px; font-size: 14px; align-items: flex-start; }
.ed-link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 0; margin-top: 6px; cursor: pointer; font: inherit; font-size: 13px; }
.ed-link-btn:hover { color: var(--text); }

.ed-field { display: block; margin-bottom: 16px; }
.ed-field:last-child { margin-bottom: 0; }
.ed-field > span { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.ed-field input, .ed-field textarea, .ed-prefixed {
  width: 100%; background: var(--bg); border: 1px solid var(--line-2); border-radius: 12px; color: var(--text);
  font: 500 15px var(--sans); padding: 12px 14px; outline: 0; transition: border-color .2s, box-shadow .2s; resize: vertical;
}
.ed-field input:focus, .ed-field textarea:focus, .ed-prefixed:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(40,200,64,.12); }
.ed-prefixed { display: flex; align-items: center; padding: 0 14px; }
.ed-prefixed > span { font: 400 14.5px var(--mono); color: var(--muted); white-space: nowrap; }
.ed-prefixed input { border: 0 !important; box-shadow: none !important; padding: 12px 0; background: none; font-family: var(--mono); font-weight: 600; }
.ed-msg { display: block; min-height: 1.4em; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.ed-msg.ok { color: var(--accent); }
.ed-msg.err { color: var(--red); }

.ed-social { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.ed-social + .ed-social { border-top: 1px solid var(--line); }
.ed-social-icon { width: 38px; height: 38px; flex: none; border-radius: 11px; display: grid; place-items: center; background: var(--bg-3); color: var(--muted); transition: color .2s, background .2s; }
.ed-social.has .ed-social-icon { color: #fff; background: var(--accent); }
.ed-social input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font: 500 14.5px var(--sans); padding: 10px 4px; }
.ed-social input::placeholder { color: rgba(244,241,234,.3); }

.ed-themes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ed-theme {
  border: 0; padding: 0; cursor: pointer; background: none; color: var(--text); font: 500 12.5px var(--sans);
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.ed-theme-card { width: 100%; aspect-ratio: 3/4.6; border-radius: 14px; position: relative; overflow: hidden; box-shadow: 0 0 0 1px var(--line); transition: transform .2s var(--ease), box-shadow .2s; }
.ed-theme:hover .ed-theme-card { transform: translateY(-2px); }
.ed-theme[aria-checked="true"] .ed-theme-card { box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 4px var(--accent); }
.ed-theme-card i { position: absolute; left: 14%; right: 14%; height: 11%; border-radius: 999px; }
.ed-theme-card b { position: absolute; top: 14%; left: 50%; width: 26%; aspect-ratio: 1; transform: translateX(-50%); border-radius: 50%; }

.ed-accent { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ed-accents { display: flex; gap: 8px; flex-wrap: wrap; }
.ed-dot { width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer; box-shadow: 0 0 0 1px var(--line-2); transition: transform .2s; display: grid; place-items: center; color: var(--muted); font-size: 12px; background: var(--bg-3); }
.ed-dot:hover { transform: scale(1.1); }
.ed-dot[aria-checked="true"] { box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 4px var(--text); }
.ed-color { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 4px; border-radius: 999px; border: 1px solid var(--line-2); cursor: pointer; font-size: 13px; color: var(--muted); }
.ed-color input { width: 28px; height: 28px; border: 0; padding: 0; border-radius: 50%; background: none; cursor: pointer; }
.ed-color input::-webkit-color-swatch-wrapper { padding: 0; }
.ed-color input::-webkit-color-swatch { border: 0; border-radius: 50%; }
.ed-color input::-moz-color-swatch { border: 0; border-radius: 50%; }

.ed-btnstyles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.ed-btnstyle { border: 1px solid var(--line); background: var(--bg); color: var(--muted); border-radius: 14px; padding: 14px 8px 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 10px; font: 500 12px var(--sans); transition: border-color .2s, color .2s; }
.ed-btnstyle:hover { color: var(--text); }
.ed-btnstyle[aria-checked="true"] { border-color: var(--accent); color: var(--text); }
.ed-btnstyle i { width: 100%; height: 18px; display: block; background: var(--text); }
.ed-btnstyle[data-v="pill"] i { border-radius: 999px; }
.ed-btnstyle[data-v="rounded"] i { border-radius: 6px; }
.ed-btnstyle[data-v="square"] i { border-radius: 1px; }
.ed-btnstyle[data-v="outline"] i { background: none; border: 1.5px solid var(--text); border-radius: 6px; }
.ed-btnstyle[data-v="hard"] i { border-radius: 4px; box-shadow: 3px 3px 0 var(--accent); }

.ed-layouts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ed-layout { border: 1px solid var(--line); background: var(--bg); color: var(--muted); border-radius: 14px; padding: 12px; cursor: pointer; display: flex; align-items: center; gap: 12px; font: 600 13.5px var(--sans); transition: border-color .2s, color .2s; }
.ed-layout:hover { color: var(--text); }
.ed-layout[aria-checked="true"] { border-color: var(--accent); color: var(--text); }
.ed-layout-thumb { position: relative; width: 44px; height: 62px; border-radius: 8px; background: var(--bg-3); overflow: hidden; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; padding: 6px; }
.ed-layout-thumb i { display: block; width: 100%; height: 6px; border-radius: 3px; background: var(--line-2); }
.ed-layout--classic .ed-layout-thumb b { position: absolute; top: 9px; width: 16px; height: 16px; border-radius: 50%; background: var(--grad); }
.ed-layout--hero .ed-layout-thumb b { position: absolute; top: 0; left: 0; right: 0; height: 58%; background: linear-gradient(180deg, transparent 40%, var(--bg-3)), var(--grad); }
.ed-fonts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ed-font { border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 14px; padding: 14px 8px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: border-color .2s; }
.ed-font b { font-size: 26px; font-weight: 700; line-height: 1; }
.ed-font small { font: 500 12px var(--sans); color: var(--muted); }
.ed-font[aria-checked="true"] { border-color: var(--accent); }

/* Preview */
.ed-preview {
  position: relative; display: grid; place-items: center; padding: 24px; border-left: 1px solid var(--line);
  background: radial-gradient(60% 50% at 50% 50%, rgba(254,188,46,.08), transparent 70%), var(--bg);
  overflow: hidden;
}
.ed-preview .fx { z-index: 0; opacity: .9; }
.ed-preview .phone { z-index: 2; transform-origin: center; }
.ed-preview-close, .ed-fab { display: none; }

/* Dialog */
.ed-dialog {
  border: 1px solid var(--line-2); border-radius: 28px; padding: 32px; background: var(--bg-2); color: var(--text);
  width: min(460px, calc(100vw - 28px)); box-shadow: 0 40px 120px -20px rgba(0,0,0,.8);
}
.ed-dialog::backdrop { background: rgba(5,5,8,.7); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.ed-dialog[open] { animation: dlg .35s var(--ease); }
@keyframes dlg { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.ed-dialog .h2 { font-size: 38px; margin-bottom: 10px; }
.ed-dialog .muted { margin: 0 0 22px; }
.ed-dialog .claim-field { margin-bottom: 2px; }
.ed-dialog .claim-prefix { font-size: 13.5px; }
.ed-dialog .btn-block { margin-top: 14px; }
.ed-dialog .btn[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; transform: none; }
.ed-or { display: flex; align-items: center; gap: 12px; margin: 18px 0 14px; color: var(--muted); font-size: 12.5px; }
.ed-or::before, .ed-or::after { content: ''; flex: 1; height: 1px; background: var(--line-2); }
.ed-auth-links { margin-top: 14px; }
#auth-google svg { background: #fff; border-radius: 50%; padding: 2px; }
.ed-pub-url { margin: 0 0 14px !important; font: 500 13.5px var(--mono); }
.ed-pub-url b { color: var(--text); }
.ed-plans { display: grid; gap: 10px; margin: 6px 0 4px; }
.ed-plan { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; border-radius: 18px; background: var(--bg); border: 1.5px solid var(--line); color: var(--text); cursor: pointer; text-align: left; font: inherit; transition: border-color .2s; }
.ed-plan > span:first-child { display: flex; flex-direction: column; gap: 2px; }
.ed-plan small.muted { font-size: 12.5px; }
.ed-plan[aria-checked="true"] { border-color: var(--green); box-shadow: 0 0 0 3px rgba(40,200,64,.14); }
.ed-plan-price { font-weight: 650; font-size: 30px; line-height: 1; letter-spacing: -.05em; white-space: nowrap; }
.ed-plan-price small { font: 500 13px var(--sans); color: var(--muted); }
.ed-dialog-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }

.cx-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; z-index: 200;
  background: var(--text); color: var(--bg); font: 600 14px var(--sans); padding: 12px 20px; border-radius: 999px;
  transition: all .3s var(--ease); pointer-events: none;
}
.cx-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-height: 760px) and (min-width: 901px) {
  .ed-preview .phone { transform: scale(.86); }
}
@media (max-width: 900px) {
  .ed-top { grid-template-columns: auto 1fr auto; }
  .ed-url { justify-self: center; max-width: 100%; overflow: hidden; }
  .ed-url svg, .ed-status, #view-link { display: none; }
  .ed-wrap { grid-template-columns: 1fr; }
  .ed-preview {
    position: fixed; inset: 0; z-index: 60; border: 0; background-color: rgba(5,5,8,.92);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    opacity: 0; pointer-events: none; transition: opacity .3s;
  }
  .ed-preview.open { opacity: 1; pointer-events: auto; }
  .ed-preview-close { display: grid; place-items: center; position: absolute; top: 18px; right: 18px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--bg-3); color: var(--text); font-size: 16px; cursor: pointer; }
  .ed-fab {
    display: inline-flex; align-items: center; gap: 8px; position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40;
    height: 50px; padding: 0 22px; border-radius: 999px; border: 0; background: var(--text); color: var(--bg); font: 700 15px var(--sans);
    box-shadow: 0 16px 40px -10px rgba(0,0,0,.8); cursor: pointer;
  }
  .ed-btnstyles { grid-template-columns: repeat(3, 1fr); }
  .ed-fonts { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .ed-link { grid-template-columns: 22px 1fr; }
  .ed-link-tools { grid-column: 1 / -1; justify-content: flex-end; }
  .ed-range { grid-template-columns: 74px 1fr 44px; }
  .ed-url .muted { display: none; }
  .ed-themes { grid-template-columns: repeat(3, 1fr); }
  .ed-prefixed > span { font-size: 12.5px; }
}
