/* PanLove — trình tạo thiệp từng mục (tao-thiep.html), bố cục tham khảo chungdoi.com:
   thanh công cụ (đổi mẫu · Chỉnh sửa/Xem trước · Xuất bản), mỗi mục là một thẻ gập/mở có công tắc Hiện/Ẩn. */
:root{
  --e-bg:#d9d6d7; --e-card:#ecebec; --e-field:#f5f4f5; --e-ink:#1f1a1c; --e-muted:#77707a; --e-line:#c9c4c7; --e-soft:#e2dfe1;
  --e-pink:#f0157a; --e-pink-ink:#c40c61; --e-pink-soft:#fde3ef; --e-ok:#067647; --e-bad:#c0262d; --e-hint:#f4b400;
  --e-sans:"Be Vietnam Pro",system-ui,sans-serif; --e-r:12px;
}
@media (prefers-color-scheme:dark){ :root:not([data-theme="light"]){
  --e-bg:#151314; --e-card:#211e20; --e-field:#2b282a; --e-ink:#f1eef0; --e-muted:#a39ca2; --e-line:#3d393c; --e-soft:#2f2b2e; --e-pink-soft:#3b1427;
} }
:root[data-theme="dark"]{ --e-bg:#151314; --e-card:#211e20; --e-field:#2b282a; --e-ink:#f1eef0; --e-muted:#a39ca2; --e-line:#3d393c; --e-soft:#2f2b2e; --e-pink-soft:#3b1427 }

*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body.ed{margin:0; background:var(--e-bg); color:var(--e-ink); font:400 15px/1.5 var(--e-sans); -webkit-font-smoothing:antialiased}
.ed button,.ed input,.ed select,.ed textarea{font:inherit; color:inherit}
.ed a{color:var(--e-pink-ink)}
.ed :focus-visible{outline:2px solid var(--e-pink); outline-offset:2px}
.ed [hidden]{display:none !important}
.ed-ic{width:18px; height:18px; flex:none; stroke:currentColor; fill:none; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round}

/* ---------- Thanh trên ---------- */
.ed-top{position:sticky; top:0; z-index:40; background:var(--e-card); border-bottom:1px solid var(--e-line)}
.ed-row1{display:flex; align-items:center; gap:12px; max-width:1280px; margin:0 auto; padding:10px 16px}
.ed-logo{display:flex; align-items:center; gap:8px; color:var(--e-ink) !important; text-decoration:none; font:400 28px/1 "Great Vibes",cursive}
.ed-logo b{display:grid; place-items:center; width:30px; height:30px; border-radius:8px; background:var(--e-pink); color:#fff; font:700 16px var(--e-sans)}
.ed-nav{display:none; gap:24px; margin:0 auto}
.ed-nav a{color:var(--e-ink); text-decoration:none; font-weight:500}
.ed-nav a:hover{color:var(--e-pink-ink)}
.ed-iconbtn{display:grid; place-items:center; width:40px; height:40px; border-radius:10px; border:0; background:transparent; cursor:pointer}
.ed-iconbtn:hover{background:var(--e-soft)}
.ed-row1 .ed-theme{margin-left:auto}
@media (min-width:760px){ .ed-nav{display:flex} .ed-row1 .ed-theme{margin-left:0} }
.ed-row2{display:flex; align-items:center; gap:10px; max-width:1280px; margin:0 auto; padding:0 16px 12px}
.ed-tpl{position:relative; display:flex; align-items:center; gap:10px; min-width:0; flex:0 1 300px; height:46px; padding:0 12px 0 0; border-radius:12px; border:1px solid var(--e-line);
  overflow:hidden; background:#000; color:#fff; cursor:pointer; text-align:left}
.ed-tpl img{position:absolute; inset:0; width:100%; height:100%; object-fit:cover; object-position:top; opacity:.55}
.ed-tpl span{position:relative; margin-left:auto; display:grid; line-height:1.15; text-shadow:0 1px 4px rgba(0,0,0,.6)}
.ed-tpl small{font-size:11px; opacity:.85; text-align:right}
.ed-tpl b{font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.ed-tpl .ed-ic{position:relative}
.ed-row2 .ed-seg-mode{display:none; margin:0 auto}
.ed-publish{margin-left:auto; display:inline-flex; align-items:center; gap:8px; height:40px; padding:0 16px; border-radius:10px; border:0; background:var(--e-pink); color:#fff !important; font-weight:700; cursor:pointer; white-space:nowrap}
.ed-publish:hover{background:var(--e-pink-ink)}
.ed-publish:disabled{opacity:.6; cursor:wait}
@media (min-width:760px){ .ed-row2 .ed-seg-mode{display:inline-flex} .ed-publish{margin-left:0} }
@media (max-width:759px){ .ed-tpl{flex:1 1 auto} }
@media (max-width:759px){ .ed-row2 .ed-gear{display:none} }

/* Công tắc phân đoạn */
.ed-seg{display:inline-flex; padding:4px; border-radius:12px; background:var(--e-soft); gap:2px}
.ed-seg label,.ed-seg button{position:relative; display:inline-flex; align-items:center; justify-content:center; gap:6px; flex:1; min-height:34px; padding:6px 16px; border-radius:9px; border:0;
  background:transparent; color:var(--e-muted); font-weight:600; font-size:14px; cursor:pointer; white-space:nowrap}
.ed-seg input{position:absolute; opacity:0; pointer-events:none}
.ed-seg label:has(input:checked),.ed-seg button[aria-pressed="true"]{background:var(--e-field); color:var(--e-ink); box-shadow:0 1px 3px rgba(0,0,0,.12)}
.ed-seg label:has(input:focus-visible){outline:2px solid var(--e-pink)}
.ed-seg.full{display:flex; width:100%}
.ed-seg.icons label{flex-direction:column; gap:2px; font-size:11.5px; min-height:52px}

/* ---------- Bố cục ---------- */
.ed-main{display:grid; gap:24px; max-width:1280px; margin:0 auto; padding:18px 16px 120px}
.ed-form{width:100%; max-width:640px; margin:0 auto}
.ed-side{display:none}
@media (min-width:1180px){
  .ed-main{grid-template-columns:minmax(0,640px) 400px; justify-content:center}
  .ed-side{display:block; position:sticky; top:132px; align-self:start}
  .ed-row2 .ed-seg-mode{display:none}
}
body.ed-preview .ed-form{display:none}
body.ed-preview .ed-side{display:block; position:static; margin:0 auto}
body.ed-preview .ed-main{grid-template-columns:1fr}

/* ---------- Thẻ mục ---------- */
.ed-card{background:var(--e-card); border:1px solid var(--e-line); border-radius:var(--e-r); margin-bottom:16px}
.ed-card > header{display:flex; align-items:center; gap:10px; padding:14px 16px; cursor:pointer; user-select:none}
.ed-card > header h2{margin:0; font-size:15px; font-weight:700; display:flex; align-items:center; gap:8px; flex:1; min-width:0}
.ed-card > header .ed-chev{transition:transform .2s}
.ed-card.closed > header .ed-chev{transform:rotate(-90deg)}
.ed-card.closed > .ed-body{display:none}
.ed-card.off > .ed-body{opacity:.55}
.ed-body{padding:4px 16px 18px; display:grid; gap:14px}
.ed-switch{display:inline-flex; align-items:center; gap:8px; font-size:13px; color:var(--e-muted); cursor:pointer}
.ed-switch input{appearance:none; -webkit-appearance:none; position:relative; width:34px; height:20px; margin:0; border-radius:999px; border:1.5px solid var(--e-muted); background:transparent; cursor:pointer; transition:.2s}
.ed-switch input::after{content:""; position:absolute; top:2px; left:2px; width:13px; height:13px; border-radius:50%; background:var(--e-muted); transition:.2s}
.ed-switch input:checked{border-color:var(--e-pink)}
.ed-switch input:checked::after{left:15px; background:var(--e-pink)}
.ed-sub{padding:12px 14px; border-radius:10px; border:1px solid var(--e-line); background:var(--e-field); display:grid; gap:12px}
.ed-sub-head{display:flex; align-items:center; justify-content:space-between; gap:10px}
.ed-sub-head b{font-size:14.5px}
.ed-sub-head p{margin:2px 0 0; font-size:12.5px; color:var(--e-muted)}

/* Trường nhập */
.ed-grid{display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px 12px}
.ed-grid .full{grid-column:1/-1}
@media (max-width:520px){ .ed-grid.stack{grid-template-columns:minmax(0,1fr)} }
.ed-f{display:grid; gap:6px; min-width:0}
.ed-f > span{font-size:13px; font-weight:700}
.ed-f > span i{font-style:normal; font-weight:400; color:var(--e-muted)}
.ed-f input:not([type=checkbox]):not([type=radio]):not([type=color]),.ed-f select,.ed-f textarea{width:100%; min-width:0; padding:9px 12px; border-radius:10px; border:1px solid var(--e-line); background:var(--e-field); font-size:15px}
.ed-f textarea{resize:vertical; min-height:76px}
.ed-f input:focus,.ed-f select:focus,.ed-f textarea:focus{outline:none; border-color:var(--e-pink); box-shadow:0 0 0 3px #f0157a22}
.ed-f input::placeholder,.ed-f textarea::placeholder{color:var(--e-muted); opacity:.8}
.ed-f .ed-auto{position:relative}
.ed-f .ed-auto input{padding-right:38px; background:var(--e-soft)}
.ed-f .ed-auto button{position:absolute; right:6px; top:50%; transform:translateY(-50%); border:0; background:none; color:var(--e-muted); cursor:pointer; padding:4px}
.ed-help{margin:-6px 0 0; font-size:12px; color:var(--e-muted)}
.ed-label{margin:0; font-size:11.5px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--e-muted)}
.ed-tip{display:flex; gap:10px; padding:12px 14px; border-radius:10px; background:var(--e-soft); font-size:14px; color:var(--e-muted)}
.ed-tip .ed-ic{color:var(--e-hint); margin-top:2px}
.ed-tip b{display:block; color:var(--e-ink); font-weight:600}
.ed-tip.info .ed-ic{color:#1e88e5}
.ed-hr{height:1px; background:var(--e-line); border:0; margin:4px 0}
.ed-group-t{margin:0; font-size:13.5px; font-weight:700; color:var(--e-muted)}
.ed-add{display:flex; align-items:center; justify-content:center; gap:8px; width:100%; min-height:38px; border-radius:10px; border:1.5px solid var(--e-ink); background:transparent; font-weight:600; font-size:14px; cursor:pointer}
.ed-add:hover{background:var(--e-soft)}
.ed-add:disabled{opacity:.4; cursor:not-allowed}
.ed-rep{position:relative; padding:14px; border-radius:10px; background:var(--e-field); border:1px solid var(--e-line); display:grid; gap:12px}
.ed-rep-t{margin:0; font-size:13px; font-weight:700; color:var(--e-pink-ink)}
.ed-del{position:absolute; top:8px; right:8px; display:grid; place-items:center; width:30px; height:30px; border-radius:8px; border:0; background:transparent; color:var(--e-bad); cursor:pointer}
.ed-del:hover{background:var(--e-soft)}
.ed-inline{display:flex; gap:8px; align-items:center}
.ed-inline > *{flex:1}
.ed-inline .ed-del{position:static; flex:none}
.ed-empty{padding:18px; border:1.5px dashed var(--e-line); border-radius:10px; text-align:center; color:var(--e-muted); font-size:14px}

/* Ảnh */
.ed-cover{display:grid; justify-items:center; gap:10px; text-align:center}
.ed-cover-box{position:relative; width:126px; aspect-ratio:5/8; border-radius:10px; border:1.5px solid var(--e-line); background:var(--e-soft); display:grid; place-items:center; overflow:hidden; color:var(--e-muted)}
.ed-cover-box img{width:100%; height:100%; object-fit:cover}
.ed-cover-box .ed-x{position:absolute; top:4px; right:4px}
.ed-upload{position:relative; display:inline-flex; align-items:center; gap:6px; padding:6px 14px; border-radius:8px; border:1.5px solid var(--e-pink); color:var(--e-pink-ink); font-size:13.5px; font-weight:600; cursor:pointer; background:transparent}
.ed-upload input{position:absolute; inset:0; opacity:0; cursor:pointer}
.ed-upload:focus-within{outline:2px solid var(--e-pink); outline-offset:2px}
.ed-small{font-size:12px; color:var(--e-muted); margin:0}
.ed-thumbs{display:grid; grid-template-columns:repeat(auto-fill,minmax(92px,1fr)); gap:10px}
.ed-thumb{position:relative; aspect-ratio:1; border-radius:10px; overflow:hidden; border:1px solid var(--e-line)}
.ed-thumb img{width:100%; height:100%; object-fit:cover}
.ed-x{position:absolute; top:4px; right:4px; width:24px; height:24px; border-radius:50%; border:0; background:rgba(0,0,0,.6); color:#fff; cursor:pointer; line-height:1; font-size:15px}
.ed-addimg{position:relative; aspect-ratio:1; display:grid; place-content:center; justify-items:center; gap:4px; border-radius:10px; border:1.5px dashed var(--e-muted); background:var(--e-soft); color:var(--e-muted); font-size:12.5px; cursor:pointer}
.ed-addimg input{position:absolute; inset:0; opacity:0; cursor:pointer}
.ed-addimg:focus-within{outline:2px solid var(--e-pink)}
.ed-music{display:grid; justify-items:center; gap:10px; padding:10px 0; text-align:center}
.ed-music-ic{display:grid; place-items:center; width:62px; height:62px; border-radius:50%; background:var(--e-soft); color:var(--e-muted)}
.ed-music audio{width:100%; max-width:360px}
.ed-btn-pink{position:relative; display:inline-flex; align-items:center; gap:8px; height:40px; padding:0 18px; border-radius:8px; border:0; background:var(--e-pink); color:#fff; font-weight:700; cursor:pointer}
.ed-btn-pink input{position:absolute; inset:0; opacity:0; cursor:pointer}
.ed-btn{display:inline-flex; align-items:center; justify-content:center; gap:6px; min-height:36px; padding:6px 14px; border-radius:9px; border:1px solid var(--e-line); background:var(--e-field); font-weight:600; font-size:13.5px; cursor:pointer; text-decoration:none; color:var(--e-ink) !important; white-space:nowrap}
.ed-btn:hover{border-color:var(--e-muted)}
.ed-btn.danger{color:var(--e-bad) !important}
.ed-colors{display:flex; flex-wrap:wrap; gap:10px; align-items:center}
.ed-color{position:relative}
.ed-color input{width:44px; height:44px; padding:0; border:2px solid var(--e-line); border-radius:50%; background:none; cursor:pointer; overflow:hidden}
.ed-color input::-webkit-color-swatch-wrapper{padding:0} .ed-color input::-webkit-color-swatch{border:0; border-radius:50%}
.ed-color .ed-x{top:-6px; right:-6px; width:20px; height:20px; font-size:12px}
.ed-coloradd{width:44px; height:44px; border-radius:50%; border:1.5px dashed var(--e-muted); background:transparent; color:var(--e-muted); font-size:20px; cursor:pointer}
.ed-guestbook{display:flex; align-items:center; gap:12px; padding:12px 14px; border-radius:10px; background:var(--e-soft); color:var(--e-ink) !important; text-decoration:none}
.ed-guestbook > span:first-child{display:grid; place-items:center; width:38px; height:38px; border-radius:10px; background:var(--e-field); border:1px solid var(--e-line)}
.ed-guestbook div{flex:1}
.ed-guestbook small{display:block; color:var(--e-muted)}
.ed-title-edit{display:inline-flex; align-items:center; gap:6px}
.ed-title-edit input{width:auto; min-width:60px; max-width:240px; padding:2px 6px; border:1px dashed transparent; border-radius:6px; background:transparent; font-weight:700; font-size:15px}
.ed-title-edit input:hover,.ed-title-edit input:focus{border-color:var(--e-line); background:var(--e-field); outline:none}
.ed-og{border:1px solid var(--e-line); border-radius:10px; overflow:hidden; background:var(--e-field)}
.ed-og img{display:block; width:100%; aspect-ratio:1200/630; object-fit:cover; background:var(--e-soft)}
.ed-og div{padding:10px 12px}
.ed-og small{display:block; font-size:11px; letter-spacing:.06em; text-transform:uppercase; color:var(--e-muted)}
.ed-og b{display:block; margin-top:2px}
.ed-og p{margin:2px 0 0; font-size:13px; color:#3b6fb6}

/* Xem trước */
.ed-phone{width:100%; max-width:390px; margin:0 auto; height:min(800px, calc(100vh - 160px)); border-radius:44px; padding:10px; background:#141213; box-shadow:0 30px 60px -30px rgba(0,0,0,.6)}
.ed-phone-in{height:100%; overflow-y:auto; overflow-x:hidden; border-radius:34px; background:#f3ebe3; scrollbar-width:thin}
.ed-phone-in .tp{max-width:none}
.ed-phone-in .tp-korea .tp-hero,.ed-phone-in .tp-romance .tp-hero{min-height:700px}
.ed-phone-in .tp-music{position:sticky; float:left; margin:-60px 0 0 14px}
.ed-side-note{margin:10px 0 0; text-align:center; font-size:12.5px; color:var(--e-muted)}
body.ed-preview .ed-phone{height:calc(100vh - 150px)}

/* Thanh dưới cố định (điện thoại) */
.ed-mbar{position:fixed; left:0; right:0; bottom:0; z-index:40; display:flex; gap:8px; padding:10px 16px calc(10px + env(safe-area-inset-bottom)); background:var(--e-card); border-top:1px solid var(--e-line)}
.ed-mbar .ed-seg{flex:1}
@media (min-width:760px){ .ed-mbar{display:none} }

/* Thông báo + hộp thoại */
.ed-toast{position:fixed; left:50%; bottom:84px; z-index:80; transform:translate(-50%, 20px); max-width:calc(100% - 32px); padding:10px 16px; border-radius:10px; background:#1f1a1c; color:#fff; font-size:14px;
  box-shadow:0 10px 30px rgba(0,0,0,.3); opacity:0; pointer-events:none; transition:.25s}
.ed-toast.show{opacity:1; transform:translate(-50%, 0)}
.ed-toast.bad{background:var(--e-bad)}
@media (min-width:760px){ .ed-toast{bottom:28px} }
.ed-dlg{position:fixed; inset:0; z-index:90; display:grid; place-items:center; padding:16px; background:rgba(10,8,9,.55)}
.ed-dlg[hidden]{display:none}
.ed-dlg-box{position:relative; width:100%; max-width:560px; max-height:calc(100vh - 32px); overflow:auto; padding:22px 20px 20px; border-radius:16px; background:var(--e-card); box-shadow:0 30px 80px rgba(0,0,0,.4)}
.ed-dlg-box h2{margin:0 0 4px; font-size:19px}
.ed-dlg-box > p{margin:0 0 14px; color:var(--e-muted); font-size:14px}
.ed-dlg-close{position:absolute; top:10px; right:10px}
.ed-tpl-grid{display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px}
@media (max-width:480px){ .ed-tpl-grid{grid-template-columns:repeat(2,minmax(0,1fr))} }
.ed-tpl-grid button{padding:0; border:2px solid var(--e-line); border-radius:12px; overflow:hidden; background:var(--e-field); cursor:pointer; text-align:center}
.ed-tpl-grid button[aria-pressed="true"]{border-color:var(--e-pink); box-shadow:0 0 0 3px #f0157a33}
.ed-tpl-grid img{display:block; width:100%; aspect-ratio:4/5; object-fit:cover; object-position:top}
.ed-tpl-grid b{display:block; padding:7px 4px; font-size:13px}
.ed-links{display:grid; gap:10px}
.ed-link-row{display:grid; grid-template-columns:minmax(0,1fr) auto auto; gap:6px; align-items:center}
.ed-link-row input{min-width:0; padding:9px 10px; border-radius:9px; border:1px solid var(--e-line); background:var(--e-field); font-size:13px; color:var(--e-muted)}
.ed-share-row{display:flex; flex-wrap:wrap; gap:8px; margin-top:4px}
.ed-ok{display:grid; place-items:center; width:54px; height:54px; margin:0 auto 10px; border-radius:50%; background:#e7f6ec; color:var(--e-ok)}
.ed-ok .ed-ic{width:28px; height:28px}
.ed-center{text-align:center}
.ed-warn{margin:12px 0 0; padding:10px 12px; border-radius:10px; background:#fff4d6; color:#7a5300; font-size:13px}
:root[data-theme="dark"] .ed-warn{background:#3a2e10; color:#f3d48a}

/* ================= Mobile first (19/10): chạm dễ, không phóng to, thao tác chính ở vùng ngón cái ================= */
.ed-f input:not([type=checkbox]):not([type=radio]):not([type=color]),.ed-f select,.ed-f textarea{font-size:16px; min-height:46px; padding:11px 12px; border-radius:12px}
.ed-f textarea{min-height:84px}
.ed-inline input,.ed-inline select{font-size:16px; min-height:46px; padding:10px 12px; border-radius:12px; border:1px solid var(--e-line); background:var(--e-field); min-width:0}
.ed-rep select,.ed-rep input,.ed-rep textarea{font-size:16px}
.ed-title-edit input{font-size:16px}
.ed-x{width:30px; height:30px; font-size:17px}
.ed-del{width:40px; height:40px}
.ed-card > header{min-height:58px}
.ed-switch{min-height:44px}
.ed-switch input{width:40px; height:24px}
.ed-switch input::after{width:16px; height:16px}
.ed-switch input:checked::after{left:18px}
.ed-seg label,.ed-seg button{min-height:42px}
.ed-add{min-height:46px}
.ed-card{scroll-margin-top:130px; transition:box-shadow .2s}
.ed-card.flash{box-shadow:0 0 0 3px var(--e-pink)}
.ed-body{animation:ed-open .22s ease}
@keyframes ed-open{from{opacity:0; transform:translateY(-4px)}}

/* Thanh trên gọn một hàng trên điện thoại */
@media (max-width:759px){
  .ed-row1{display:none}
  .ed-row2{padding:10px 12px 8px}
  .ed-row2 .ed-publish{display:none}
  .ed-row2 .ed-gear{display:grid}
}

/* Dải chuyển nhanh giữa các mục */
.ed-quick{display:flex; gap:6px; overflow-x:auto; max-width:1280px; margin:0 auto; padding:0 12px 10px; scrollbar-width:none; scroll-behavior:smooth}
.ed-quick::-webkit-scrollbar{display:none}
.ed-quick button{flex:none; display:inline-flex; align-items:center; gap:5px; min-height:34px; padding:5px 12px; border-radius:999px; border:1px solid var(--e-line); background:var(--e-field);
  font-size:13px; font-weight:600; color:var(--e-muted); cursor:pointer; white-space:nowrap}
.ed-quick button.done{color:var(--e-ink)}
.ed-quick button.done::before{content:""; width:7px; height:7px; border-radius:50%; background:var(--e-ok)}
.ed-quick button.cur{background:var(--e-ink); border-color:var(--e-ink); color:var(--e-card)}
.ed-quick .ed-req{background:var(--e-pink-soft); border-color:transparent; color:var(--e-pink-ink)}
.ed-quick .ed-req.ok{background:#e7f6ec; color:var(--e-ok)}
@media (min-width:1180px){ .ed-quick{padding:0 16px 12px} }
.ed-main{padding-bottom:calc(110px + env(safe-area-inset-bottom))}

/* Thanh dưới: Xem trước + Xuất bản trong vùng ngón cái */
.ed-mbar{gap:10px; align-items:center}
.ed-mbar .ed-btn{flex:1; min-height:48px; font-size:15px; border-radius:12px}
.ed-mbar .ed-publish{flex:1.3; height:48px; justify-content:center; border-radius:12px; margin:0; font-size:15px}

/* Xem trước: trang trượt lên toàn màn hình (điện thoại, máy tính bảng) */
.ed-side-head{display:none; align-items:center; gap:8px; padding:calc(8px + env(safe-area-inset-top)) 12px 8px; background:var(--e-card); border-bottom:1px solid var(--e-line)}
.ed-side-head b{flex:1; min-width:0; font-size:15px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.ed-side-head .ed-publish{height:40px; margin:0}
@media (max-width:1179px){
  .ed-side{display:flex !important; position:fixed; inset:0; z-index:70; flex-direction:column; background:var(--e-bg);
    transform:translateY(100%); visibility:hidden; transition:transform .32s cubic-bezier(.2,.8,.2,1), visibility 0s .32s}
  body.ed-preview .ed-side{position:fixed; margin:0; transform:none; visibility:visible; transition:transform .32s cubic-bezier(.2,.8,.2,1)}
  body.ed-preview .ed-form{display:block}
  body.ed-preview{overflow:hidden}
  .ed-side-head{display:flex}
  .ed-phone,body.ed-preview .ed-phone{flex:1; width:100%; max-width:none; height:auto; min-height:0; margin:0; border-radius:0; padding:0; background:transparent; box-shadow:none}
  .ed-phone-in{border-radius:0; overscroll-behavior:contain}
  .ed-phone-in .tp{max-width:480px; margin:0 auto}
  .ed-side-note{display:none}
}
@media (min-width:600px) and (max-width:1179px){
  .ed-phone,body.ed-preview .ed-phone{padding:16px 0; background:var(--e-bg)}
  .ed-phone-in{max-width:430px; margin:0 auto; border-radius:28px; box-shadow:0 20px 50px -20px rgba(0,0,0,.4)}
}
@media (prefers-reduced-motion:reduce){ .ed-side,.ed-body{transition:none !important; animation:none !important} }

/* Không để nội dung dài làm giãn khung trang trên điện thoại */
.ed-main{grid-template-columns:minmax(0,1fr)}
.ed-form,.ed-card,.ed-body,.ed-grid > *{min-width:0}
.ed-seg label,.ed-seg button{white-space:normal; text-align:center; line-height:1.25}
.ed-row2{min-width:0}
.ed-tpl{min-width:0}
@media (min-width:1180px){ .ed-main{grid-template-columns:minmax(0,640px) 400px} }

/* Nút đổi mẫu: ảnh thu nhỏ + chữ rõ */
.ed-tpl{background:var(--e-field); color:var(--e-ink); padding:4px 10px 4px 4px; gap:10px; flex:0 1 280px}
.ed-tpl img{position:static; width:30px; height:38px; flex:none; border-radius:7px; opacity:1; object-fit:cover; object-position:top}
.ed-tpl span{margin-left:0; flex:1; min-width:0; text-shadow:none; text-align:left}
.ed-tpl small{text-align:left; color:var(--e-muted); opacity:1}
@media (max-width:759px){ .ed-tpl{flex:1 1 auto} }

/* ===== Pancake frame (light theme): white surfaces, pill buttons, sans wordmark ===== */
@media not (prefers-color-scheme:dark){ :root:not([data-theme="dark"]){
  --e-bg:#f5f7fa; --e-card:#fff; --e-field:#f9fafb; --e-ink:#1d2939; --e-muted:#667085; --e-line:#eaecf0; --e-soft:#f2f4f7;
} }
:root[data-theme="light"]{ --e-bg:#f5f7fa; --e-card:#fff; --e-field:#f9fafb; --e-ink:#1d2939; --e-muted:#667085; --e-line:#eaecf0; --e-soft:#f2f4f7 }
:root{ --e-pink:#e0336f; --e-pink-ink:#c21f5a }
.ed-top{box-shadow:0 2px 8px #0000000a}
.ed-row1{min-height:64px}
.ed-logo{font:700 23px/1 var(--e-sans); letter-spacing:-.02em; gap:9px}
.ed-logo b{width:32px; height:32px; border-radius:10px; background:linear-gradient(292deg,#f0668f 14%,#d6245f 86%); font-size:15px}
.ed-logo i{font-style:normal; color:var(--e-pink)}
.ed-nav a{font-weight:400; font-size:16px}
.ed-publish,.ed-btn-pink{border-radius:9999px; padding:0 22px; font-weight:500}
.ed-btn{border-radius:9999px; padding:6px 16px}
.ed-seg{border-radius:9999px}
.ed-seg label,.ed-seg button{border-radius:9999px}
.ed-logo i{margin-left:-9px}
@media (max-width:759px){ .ed-top:not(:has(.ed-row2)) .ed-row1{display:flex} }
.ed-publish,.ed-btn-pink,.ed .ed-empty a{text-decoration:none}
