/* ==========================================================================
   TạoCV — Giao diện ứng dụng
   ========================================================================== */
:root {
  --bg: #f5f4f0;
  --bg-2: #ecebe5;
  --surface: #ffffff;
  --ink: #15171c;
  --ink-2: #3a3f4b;
  --muted: #6b7080;
  --faint: #9a9ea9;
  --line: #e6e4dd;
  --line-2: #efeee9;
  --field: #fbfbf9;
  --brand: #2f50f0;
  --brand-ink: #1d36c4;
  --brand-soft: #eef1ff;
  --ok: #12a26b;
  --warn: #d97706;
  --danger: #e5484d;
  --r-sm: 9px;
  --r: 14px;
  --r-lg: 22px;
  --sh-sm: 0 1px 2px rgba(20, 22, 30, .06);
  --sh: 0 12px 32px -14px rgba(20, 22, 30, .22);
  --sh-lg: 0 40px 90px -30px rgba(20, 22, 30, .4);
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Fraunces', Georgia, serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body.in-editor { overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
svg { flex: none; }
.btn svg, .icon-btn svg, .hero-points svg, .ui-mtabs svg, .cf-ic svg, .dl-ic svg, .acc svg, .pf svg, .x-btn svg, .add svg, .chip svg, .tool svg, .gal-item svg, .tpl-card svg, .dz svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--brand) 22%, transparent); }

.wrap { width: min(1200px, 100% - 40px); margin-inline: auto; }

/* ---------- Thương hiệu ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; font-size: 19px; }
.brand-mark { width: 32px; height: 32px; filter: drop-shadow(0 4px 10px rgba(47, 80, 240, .3)); }
.brand-name b { color: var(--brand); font-weight: 800; }

/* ---------- Nút ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 11px; font-weight: 600; font-size: 14px; white-space: nowrap; transition: transform .15s var(--ease), background .15s, box-shadow .2s, color .15s, border-color .15s; user-select: none; }
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-lg { height: 52px; padding: 0 24px; border-radius: 14px; font-size: 16px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 10px 24px -10px rgba(47, 80, 240, .8); }
.btn-primary:hover { background: var(--brand-ink); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #2a2d36; }
.btn-light { background: #fff; color: var(--ink); }
.btn-light:hover { background: #f1f1ee; }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn-ghost:hover { background: #fff; box-shadow: inset 0 0 0 1px #d6d3ca; }
.btn-soft { background: var(--bg); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn-soft:hover { background: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #cf3237; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--ink-2); transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }

.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--brand-ink); background: #fff; padding: 6px 12px 6px 10px; border-radius: 99px; box-shadow: var(--sh-sm), inset 0 0 0 1px var(--line); }
.eyebrow i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }

/* ==========================================================================
   TRANG CHỦ
   ========================================================================== */
.lp-nav { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.lp-nav.scrolled { border-bottom-color: var(--line); }
.lp-nav-in { height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.lp-links { display: flex; gap: 6px; }
.lp-links a { padding: 8px 14px; border-radius: 10px; font-size: 14px; font-weight: 500; color: var(--ink-2); transition: background .15s, color .15s; }
.lp-links a:hover { background: #fff; color: var(--ink); }

.hero { position: relative; overflow: hidden; padding: 56px 0 72px; }
.hero-bg { position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(600px 380px at 82% 30%, rgba(47, 80, 240, .14), transparent 70%),
    radial-gradient(520px 320px at 62% 80%, rgba(255, 140, 90, .14), transparent 70%),
    linear-gradient(rgba(21,23,28,.035) 1px, transparent 1px) 0 0 / 100% 32px,
    linear-gradient(90deg, rgba(21,23,28,.035) 1px, transparent 1px) 0 0 / 32px 100%;
  -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent); mask-image: linear-gradient(180deg, #000 60%, transparent); }
.hero-in { position: relative; display: grid; grid-template-columns: 1.02fr 1fr; gap: 40px; align-items: center; }
.hero-copy { position: relative; z-index: 4; }
.hero-copy h1 { margin: 22px 0 18px; font-size: clamp(38px, 4.7vw, 66px); line-height: 1.03; letter-spacing: -.04em; font-weight: 800; }
.hero-copy h1 em, .sec-head h2 em { font-family: var(--serif); font-style: italic; font-weight: 500; letter-spacing: -.02em; color: var(--brand); position: relative; white-space: nowrap; }
.hero-copy h1 em::after { content: ""; position: absolute; left: 2%; right: 2%; bottom: -.06em; height: .2em; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12' preserveAspectRatio='none'%3E%3Cpath d='M2 8 C 40 2, 80 2, 120 6 S 180 10, 198 4' fill='none' stroke='%23ff7a45' stroke-width='3.2' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat; }
.lead { font-size: 18px; line-height: 1.65; color: var(--ink-2); max-width: 560px; margin: 0; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.hero-cta .btn-primary svg { width: 20px; height: 20px; transition: transform .2s var(--ease); }
.hero-cta .btn-primary:hover svg { transform: translateX(3px); }
.hero-points { display: flex; flex-wrap: wrap; gap: 10px 22px; list-style: none; padding: 0; margin: 28px 0 0; font-size: 14px; color: var(--ink-2); font-weight: 500; }
.hero-points li { display: inline-flex; align-items: center; gap: 7px; }
.hero-points svg { width: 18px; height: 18px; color: var(--ok); stroke-width: 2.6; }

.hero-visual { position: relative; height: 540px; }
.fan { position: absolute; inset: 0; display: grid; place-items: center; }
.fan-card { position: absolute; width: 300px; aspect-ratio: 794 / 1123; border-radius: 10px; overflow: hidden; background: #fff; box-shadow: var(--sh-lg), 0 0 0 1px rgba(20,22,30,.05); transition: transform .6s var(--ease); }
.fan-card .thumb { width: 100%; height: 100%; }
.fan-card.c1 { transform: translate(-150px, 18px) rotate(-9deg) scale(.9); }
.fan-card.c3 { transform: translate(150px, 18px) rotate(8deg) scale(.9); }
.fan-card.c2 { transform: translateY(-6px); z-index: 2; }
.hero-visual:hover .c1 { transform: translate(-190px, 22px) rotate(-12deg) scale(.9); }
.hero-visual:hover .c3 { transform: translate(190px, 22px) rotate(11deg) scale(.9); }
.hero-visual:hover .c2 { transform: translateY(-14px) scale(1.02); }
.chip-float { position: absolute; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 10px; border-radius: 14px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); box-shadow: var(--sh), inset 0 0 0 1px rgba(20,22,30,.05); animation: float 6s ease-in-out infinite; }
.chip-float b { display: block; font-size: 13px; line-height: 1.2; }
.chip-float small { display: block; font-size: 11.5px; color: var(--muted); }
.chip-float.f1 { left: -8px; top: 70px; }
.chip-float.f2 { right: -4px; top: 210px; animation-delay: -2s; }
.chip-float.f3 { left: 30px; bottom: 34px; padding: 10px 14px; gap: 6px; animation-delay: -4s; }
.chip-float.f3 small { margin-left: 6px; color: var(--ink-2); font-weight: 600; font-size: 12px; }
.cf-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 11px; font-weight: 800; letter-spacing: .02em; }
.cf-ic.ok { background: #e3f7ee; color: var(--ok); }
.cf-ic.ok svg { width: 18px; height: 18px; stroke-width: 2.8; }
.cf-ic.pdf { background: #ffe9e4; color: #e0452b; }
.sw { width: 18px; height: 18px; border-radius: 50%; box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(0,0,0,.06); }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.lp-stats { padding: 6px 0 20px; }
.lp-stats-in { display: grid; grid-template-columns: repeat(4, 1fr); background: #fff; border-radius: var(--r-lg); box-shadow: var(--sh-sm), inset 0 0 0 1px var(--line); }
.lp-stats-in > div { padding: 22px 26px; display: flex; align-items: center; gap: 14px; }
.lp-stats-in > div + div { border-left: 1px solid var(--line-2); }
.lp-stats b { font-family: var(--serif); font-size: 34px; font-weight: 600; letter-spacing: -.02em; color: var(--ink); line-height: 1; }
.lp-stats span { font-size: 13.5px; color: var(--muted); line-height: 1.35; }

.lp-sec { padding: 72px 0; }
.sec-head { max-width: 680px; margin-bottom: 40px; }
.sec-head h2 { margin: 16px 0 10px; font-size: clamp(30px, 3.6vw, 44px); line-height: 1.1; letter-spacing: -.035em; font-weight: 800; }
.sec-head p { margin: 0; font-size: 17px; color: var(--ink-2); }

.tpl-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 26px 20px; }
.tpl-card { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.tpl-thumb { position: relative; border-radius: 12px; overflow: hidden; background: #fff; aspect-ratio: 794 / 1123; box-shadow: var(--sh), 0 0 0 1px rgba(20,22,30,.06); transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
.tpl-thumb .thumb { width: 100%; height: 100%; }
.tpl-thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, rgba(15, 18, 30, .55)); opacity: 0; transition: opacity .3s; }
.tpl-use { position: absolute; left: 50%; bottom: 16px; z-index: 2; transform: translate(-50%, 10px); opacity: 0; transition: .3s var(--ease); background: #fff; color: var(--ink); font-weight: 700; font-size: 13px; padding: 9px 16px; border-radius: 99px; white-space: nowrap; box-shadow: var(--sh); }
.tpl-card:hover .tpl-thumb { transform: translateY(-6px); box-shadow: var(--sh-lg), 0 0 0 1px rgba(20,22,30,.06); }
.tpl-card:hover .tpl-thumb::after { opacity: 1; }
.tpl-card:hover .tpl-use { opacity: 1; transform: translate(-50%, 0); }
.tpl-meta { display: flex; align-items: baseline; gap: 8px; padding: 0 2px; }
.tpl-meta b { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.tpl-meta span { font-size: 12.5px; color: var(--muted); }
.tpl-num { margin-left: auto; font-family: var(--serif); font-style: italic; color: var(--faint); font-size: 13px; }

.thumb { position: relative; overflow: hidden; background: #fff; }
.thumb-inner { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; }

.lp-steps { background: #fff; border-block: 1px solid var(--line); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: s; }
.step { position: relative; padding: 28px 26px 26px; border-radius: var(--r-lg); background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-2); }
.step-n { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 44px; line-height: 1; color: var(--brand); }
.step h3 { margin: 18px 0 8px; font-size: 19px; letter-spacing: -.015em; }
.step p { margin: 0; color: var(--ink-2); font-size: 15px; }
.step:not(:last-child)::after { content: ""; position: absolute; right: -16px; top: 46px; width: 12px; height: 12px; border-top: 2px solid #cfccc3; border-right: 2px solid #cfccc3; transform: rotate(45deg); }

.tips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.tip { padding: 26px 26px 24px; border-radius: var(--r-lg); background: #fff; box-shadow: var(--sh-sm), inset 0 0 0 1px var(--line); }
.tip-ic { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: #fff3ec; color: #f0603f; font-size: 16px; }
.tip h3 { margin: 14px 0 6px; font-size: 18px; letter-spacing: -.015em; }
.tip p { margin: 0; color: var(--ink-2); font-size: 15px; }
.tip code { font-size: .9em; background: var(--bg); padding: 2px 6px; border-radius: 6px; }

.cta-band { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 30px; padding: 48px 52px; border-radius: 28px; background: #12141a; color: #fff; }
.cta-band::before { content: ""; position: absolute; inset: 0; background: radial-gradient(500px 260px at 90% 0%, rgba(47, 80, 240, .55), transparent 70%), radial-gradient(420px 240px at 10% 120%, rgba(255, 122, 69, .35), transparent 70%); pointer-events: none; }
.cta-band > * { position: relative; }
.cta-band h2 { margin: 0 0 8px; font-size: clamp(26px, 3vw, 38px); letter-spacing: -.03em; line-height: 1.1; }
.cta-band p { margin: 0; color: rgba(255,255,255,.72); }

.lp-foot { padding: 28px 0 40px; color: var(--muted); font-size: 13.5px; }
.lp-foot-in { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 24px; }

/* ==========================================================================
   TRÌNH SOẠN
   ========================================================================== */
.ui { height: 100vh; height: 100dvh; display: grid; grid-template-rows: 62px 1fr; }
.ui-top { display: flex; align-items: center; gap: 18px; padding: 0 16px 0 20px; background: #fff; border-bottom: 1px solid var(--line); position: relative; z-index: 20; }
.ui-top .brand { font-size: 18px; }
.ui-top .brand-mark { width: 30px; height: 30px; }
.ui-save { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); padding-left: 18px; border-left: 1px solid var(--line); }
.ui-save i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(18, 162, 107, .15); transition: background .2s; }
.ui-save.saving i { background: var(--warn); box-shadow: 0 0 0 3px rgba(217, 119, 6, .15); }
.ui-top-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.dl { position: relative; }
.dl .chev { width: 16px; height: 16px; margin-left: -2px; opacity: .8; transition: transform .2s; }
.dl [aria-expanded="true"] .chev { transform: rotate(180deg); }
.dl-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 300px; padding: 6px; background: #fff; border-radius: 16px; box-shadow: var(--sh-lg), 0 0 0 1px rgba(20,22,30,.06); animation: pop .18s var(--ease); }
.dl-menu button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 11px; text-align: left; transition: background .12s; }
.dl-menu button:hover { background: var(--bg); }
.dl-menu b { display: block; font-size: 14px; }
.dl-menu small { display: block; font-size: 12px; color: var(--muted); }
.dl-ic { width: 40px; height: 40px; flex: none; border-radius: 11px; display: grid; place-items: center; font-size: 11px; font-weight: 800; letter-spacing: .02em; }
.dl-ic.pdf { background: #ffe9e4; color: #e0452b; }
.dl-ic.png { background: #e6f4ff; color: #1677d2; }
.dl-ic.prn { background: #efeee9; color: var(--ink-2); }
.dl-ic svg { width: 19px; height: 19px; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }

.ui-body { min-height: 0; display: grid; grid-template-columns: minmax(380px, 460px) 1fr; }
.ui-panel { min-height: 0; display: flex; flex-direction: column; background: #fff; border-right: 1px solid var(--line); }
.ui-panel-head { padding: 14px 18px 12px; border-bottom: 1px solid var(--line-2); display: grid; gap: 12px; }
.seg { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; background: var(--bg); border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line-2); }
.seg button { height: 34px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); transition: background .15s, color .15s, box-shadow .15s; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--sh-sm), 0 0 0 1px rgba(20,22,30,.05); }
.seg.sm button { height: 30px; font-size: 13px; }

.prog { display: flex; align-items: center; gap: 12px; }
.prog-ring { width: 40px; height: 40px; flex: none; position: relative; }
.prog-ring svg { width: 40px; height: 40px; transform: rotate(-90deg); }
.prog-ring circle { fill: none; stroke-width: 4; }
.prog-ring .bgc { stroke: var(--line-2); }
.prog-ring .fgc { stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset .5s var(--ease); }
.prog-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.prog.done .fgc { stroke: var(--ok); }
.prog-txt { min-width: 0; }
.prog-txt b { display: block; font-size: 13.5px; }
.prog-txt span { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prog-txt button { color: var(--brand); font-weight: 600; }
.prog-txt button:hover { text-decoration: underline; }

.ui-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px 40px; scrollbar-width: thin; scrollbar-color: #d8d6cf transparent; }
.ui-scroll::-webkit-scrollbar { width: 10px; }
.ui-scroll::-webkit-scrollbar-thumb { background: #dcdad3; border-radius: 10px; border: 3px solid #fff; }

/* ---------- Accordion ---------- */
.acc { border-radius: var(--r); background: #fff; box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .2s; }
.acc + .acc { margin-top: 10px; }
.acc.open { box-shadow: inset 0 0 0 1px #dcd9d0, 0 8px 24px -16px rgba(20,22,30,.25); }
.acc.off .acc-title, .acc.off .acc-ic { opacity: .45; }
.acc-head { display: flex; align-items: center; gap: 12px; padding: 12px 10px 12px 12px; cursor: pointer; user-select: none; }
.acc-ic { width: 36px; height: 36px; flex: none; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.acc-ic svg { width: 18px; height: 18px; }
.acc-title { flex: 1; min-width: 0; }
.acc-title b { display: block; font-size: 14.5px; font-weight: 650; letter-spacing: -.005em; }
.acc-title span { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-chev { width: 30px; height: 30px; display: grid; place-items: center; color: var(--faint); transition: transform .25s var(--ease); }
.acc-chev svg { width: 18px; height: 18px; }
.acc.open .acc-chev { transform: rotate(180deg); }
.acc-eye { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--faint); }
.acc-eye:hover { background: var(--bg); color: var(--ink); }
.acc-eye svg { width: 17px; height: 17px; }
.acc-body { padding: 4px 14px 16px; border-top: 1px solid var(--line-2); padding-top: 14px; }
.acc-hint { margin: -2px 0 12px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.acc-hint b { color: var(--ink-2); }

/* ---------- Trường nhập ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 .full { grid-column: 1 / -1; }
.fld { display: grid; gap: 6px; min-width: 0; }
.fld > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); display: flex; justify-content: space-between; gap: 8px; }
.fld > span em { font-style: normal; font-weight: 500; color: var(--faint); }
.inp { width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid #e3e1da; background: var(--field); font-size: 14px; transition: border-color .15s, box-shadow .15s, background .15s; outline: none; }
textarea.inp { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.55; resize: vertical; }
.inp::placeholder { color: #b0b3bb; }
.inp:hover { border-color: #d4d1c8; }
.inp:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent); }
.fld-note { font-size: 12px; color: var(--muted); }

/* Ảnh */
.pf { display: grid; grid-template-columns: 112px 1fr; gap: 16px; align-items: start; padding: 12px; margin-bottom: 14px; border-radius: 14px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-2); }
.pf-thumb { position: relative; width: 112px; height: 136px; border-radius: 12px; overflow: hidden; background: #e8e7e1; box-shadow: inset 0 0 0 1px rgba(0,0,0,.05); cursor: pointer; touch-action: none; }
.pf-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; user-select: none; }
.pf-thumb.has { cursor: grab; }
.pf-thumb.dragging { cursor: grabbing; }
.pf-thumb .pf-empty { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 6px; color: var(--muted); font-size: 11.5px; font-weight: 600; text-align: center; }
.pf-thumb .pf-empty svg { width: 26px; height: 26px; color: var(--brand); }
.pf-thumb.drop { box-shadow: inset 0 0 0 2px var(--brand); }
.pf-ctrl { display: grid; gap: 10px; min-width: 0; }
.pf-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.pf-btns .btn { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.pf-note { font-size: 12px; color: var(--muted); line-height: 1.45; }
.pf-note.demo { color: #b45309; }
.rng { display: grid; grid-template-columns: 68px 1fr; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 600; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--brand) var(--p, 50%), #dcdad3 var(--p, 50%)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: #dcdad3; }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--brand); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.2); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.2); }
input[type="range"]:disabled { opacity: .45; cursor: default; }

/* Mục trong danh sách */
.itm { border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.itm + .itm { margin-top: 10px; }
.itm-head { display: flex; align-items: center; gap: 8px; padding: 9px 8px 9px 12px; cursor: pointer; user-select: none; }
.itm-n { width: 22px; height: 22px; flex: none; border-radius: 7px; display: grid; place-items: center; background: var(--bg); font-size: 11px; font-weight: 700; color: var(--muted); }
.itm-t { flex: 1; min-width: 0; }
.itm-t b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.itm-t span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.itm-body { padding: 4px 12px 14px; }
.itm:not(.open) .itm-body { display: none; }
.itm.open { box-shadow: inset 0 0 0 1px #d8d5cc; background: #fff; }
.x-btn { width: 28px; height: 28px; flex: none; border-radius: 8px; display: grid; place-items: center; color: var(--faint); transition: background .12s, color .12s; }
.x-btn:hover { background: var(--bg); color: var(--ink); }
.x-btn.del:hover { background: #fdecec; color: var(--danger); }
.x-btn svg { width: 16px; height: 16px; }
.x-btn:disabled { opacity: .3; pointer-events: none; }

.rows { display: grid; gap: 8px; }
.row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; }
.row.r2 { grid-template-columns: 1fr 120px auto; }
.row .inp { height: 38px; }
.lvl { display: inline-flex; gap: 4px; padding: 0 4px; }
.lvl button { width: 16px; height: 16px; border-radius: 50%; background: #e3e1da; transition: background .12s, transform .12s; }
.lvl button.on { background: var(--brand); }
.lvl button:hover { transform: scale(1.2); }

.add { width: 100%; margin-top: 10px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--brand); border: 1.5px dashed color-mix(in srgb, var(--brand) 38%, #fff); transition: background .15s, border-color .15s; }
.add:hover { background: var(--brand-soft); border-color: var(--brand); }
.add svg { width: 17px; height: 17px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chips-label { width: 100%; font-size: 12px; font-weight: 600; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border-radius: 99px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); transition: background .12s, color .12s, box-shadow .12s; }
.chip:hover { background: var(--brand-soft); color: var(--brand-ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 30%, #fff); }
.chip svg { width: 13px; height: 13px; }
.chip.used { opacity: .45; pointer-events: none; }
.tagprev { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tagprev span { font-size: 12.5px; padding: 4px 10px; border-radius: 99px; background: var(--brand-soft); color: var(--brand-ink); font-weight: 500; }

/* ---------- Thẻ Giao diện ---------- */
.dsec + .dsec { margin-top: 24px; }
.dsec-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dsec-h b { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.dsec-h span { font-size: 12.5px; color: var(--muted); }
.dgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 12px; }
.dtpl { display: grid; gap: 7px; text-align: left; }
.dtpl .thumb { border-radius: 8px; aspect-ratio: 794 / 1123; box-shadow: 0 0 0 1px var(--line), var(--sh-sm); transition: box-shadow .15s, transform .2s var(--ease); }
.dtpl:hover .thumb { transform: translateY(-2px); box-shadow: 0 0 0 1px #cfccc3, var(--sh); }
.dtpl.on .thumb { box-shadow: 0 0 0 2px var(--brand), 0 0 0 5px color-mix(in srgb, var(--brand) 18%, transparent); }
.dtpl > b { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.dtpl.on > b { color: var(--brand-ink); }
.dtpl.on > b::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }

.swatches { display: flex; flex-wrap: wrap; gap: 9px; }
.swb { position: relative; width: 32px; height: 32px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); transition: transform .15s var(--ease); }
.swb:hover { transform: scale(1.1); }
.swb.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.swb.def::after { content: "★"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 12px; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.swb.custom { background: conic-gradient(from 0deg, #ff5f57, #febc2e, #28c840, #2bb3ff, #7c5cff, #ff5fa2, #ff5f57); overflow: hidden; }
.swb.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: 0; padding: 0; }

.opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-2); }
.opt + .opt { margin-top: 8px; }
.opt b { display: block; font-size: 13.5px; font-weight: 600; }
.opt small { display: block; font-size: 12px; color: var(--muted); }
.switch { position: relative; width: 42px; height: 24px; flex: none; border-radius: 99px; background: #d4d1c8; transition: background .2s; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s var(--ease); }
.switch.on { background: var(--brand); }
.switch.on::after { transform: translateX(18px); }
.sl { display: grid; grid-template-columns: 92px 1fr 46px; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); font-weight: 500; margin-top: 10px; }
.sl output { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tool { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; text-align: left; font-size: 13px; font-weight: 600; background: #fff; box-shadow: inset 0 0 0 1px var(--line); transition: background .12s, box-shadow .12s; }
.tool:hover { background: var(--bg); }
.tool svg { width: 18px; height: 18px; color: var(--muted); }
.tool.danger { color: var(--danger); }
.tool.danger svg { color: var(--danger); }

/* ---------- Khu xem trước ---------- */
.ui-stage { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg-2); background-image: radial-gradient(rgba(20,22,30,.09) 1px, transparent 1px); background-size: 18px 18px; }
.ui-bar { position: absolute; z-index: 5; left: 50%; top: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 5px; border-radius: 16px; background: rgba(255,255,255,.92); backdrop-filter: blur(10px); box-shadow: var(--sh), 0 0 0 1px rgba(20,22,30,.06); white-space: nowrap; }
.tswitch, .zoom { display: flex; align-items: center; gap: 2px; }
.tswitch-name { height: 34px; padding: 0 12px; border-radius: 10px; font-size: 14px; font-weight: 700; min-width: 148px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.tswitch-name:hover { background: var(--bg); }
.tswitch-name small { font-size: 11.5px; font-weight: 600; color: var(--faint); }
.qswatch { display: flex; gap: 5px; padding: 0 10px; border-inline: 1px solid var(--line); height: 26px; align-items: center; }
.qswatch button { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); transition: transform .12s; }
.qswatch button:hover { transform: scale(1.15); }
.qswatch button.on { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--ink); }
.zoom-val { height: 34px; min-width: 52px; padding: 0 8px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.zoom-val:hover { background: var(--bg); }
.ui-canvas { flex: 1; min-height: 0; overflow: auto; padding: 82px 40px 70px; display: flex; justify-content: center; align-items: flex-start; scrollbar-width: thin; }
.page-wrap { position: relative; flex: none; border-radius: 3px; box-shadow: 0 1px 2px rgba(20,22,30,.08), 0 30px 70px -28px rgba(20,22,30,.45); background: #fff; transition: box-shadow .2s; }
.page { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.page .ph { cursor: pointer; }
.page .ph::after { content: "Đổi ảnh"; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(15,18,30,.5); color: #fff; font: 600 13px/1 var(--font); letter-spacing: .02em; opacity: 0; transition: opacity .15s; }
.page .ph:hover::after { opacity: 1; }
.page-breaks { position: absolute; inset: 0; pointer-events: none; }
.page-breaks i { position: absolute; left: -14px; right: -14px; height: 0; border-top: 2px dashed var(--danger); }
.page-breaks i::after { content: attr(data-l); position: absolute; right: 0; top: -22px; font: 700 11px/1 var(--font); color: #fff; background: var(--danger); padding: 4px 8px; border-radius: 6px; font-style: normal; }
.fit-pill { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 5; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: rgba(255,255,255,.94); box-shadow: var(--sh), 0 0 0 1px rgba(20,22,30,.06); white-space: nowrap; color: var(--ink-2); }
.fit-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.fit-pill.warn { color: #9a3412; }
.fit-pill.warn i { background: var(--warn); }
.fit-pill small { color: var(--muted); font-weight: 500; }

.ui-mtabs { display: none; }

/* ---------- Hộp thoại ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; }
.modal-back { position: absolute; inset: 0; background: rgba(15, 17, 24, .5); backdrop-filter: blur(4px); animation: fade .2s; }
.modal-card { position: relative; background: #fff; border-radius: 22px; box-shadow: var(--sh-lg); animation: rise .28s var(--ease); max-height: calc(100dvh - 48px); display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 14px; }
.modal-head h3 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.gal-card { width: min(1180px, 100%); }
.gal-grid { overflow-y: auto; padding: 8px 24px 26px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 22px 18px; }
.gal-item { display: grid; gap: 9px; text-align: left; }
.gal-item .thumb { border-radius: 10px; aspect-ratio: 794 / 1123; box-shadow: 0 0 0 1px var(--line), var(--sh-sm); transition: transform .25s var(--ease), box-shadow .25s; }
.gal-item:hover .thumb { transform: translateY(-4px); box-shadow: 0 0 0 1px #cfccc3, var(--sh); }
.gal-item.on .thumb { box-shadow: 0 0 0 2.5px var(--brand), 0 0 0 7px color-mix(in srgb, var(--brand) 16%, transparent); }
.gal-item > b { font-size: 14px; display: flex; align-items: center; gap: 6px; }
.gal-item > span { font-size: 12px; color: var(--muted); }
.gal-item > b > .cur { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--brand); background: var(--brand-soft); padding: 2px 8px; border-radius: 99px; }
.cf-card { width: min(420px, 100%); padding: 26px; }
.cf-card h3 { margin: 0 0 8px; font-size: 19px; letter-spacing: -.015em; }
.cf-card p { margin: 0; color: var(--ink-2); font-size: 14.5px; }
.cf-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* ---------- Thông báo ---------- */
.toasts { position: fixed; z-index: 200; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { display: inline-flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 13px; background: #15171c; color: #fff; font-size: 14px; font-weight: 500; box-shadow: var(--sh-lg); animation: rise .25s var(--ease); pointer-events: auto; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .25s; }
.toast .spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; animation: spin .8s linear infinite; }
.toast .dot { width: 8px; height: 8px; border-radius: 50%; background: #3ddc97; }
.toast.err .dot { background: #ff6b6b; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Xuất file ---------- */
#export-stage { position: fixed; left: -20000px; top: 0; pointer-events: none; }
#print-root { display: none; }
@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff !important; overflow: visible !important; height: auto !important; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; width: 210mm; overflow: hidden; }
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1180px) {
  .hero-visual { height: 480px; }
  .fan-card { width: 240px; }
  .fan-card.c1 { transform: translate(-112px, 16px) rotate(-9deg) scale(.9); }
  .fan-card.c3 { transform: translate(112px, 16px) rotate(8deg) scale(.9); }
  .hero-visual:hover .c1 { transform: translate(-138px, 18px) rotate(-11deg) scale(.9); }
  .hero-visual:hover .c3 { transform: translate(138px, 18px) rotate(10deg) scale(.9); }
  .chip-float.f1 { left: 0; top: 40px; }
  .tpl-grid { grid-template-columns: repeat(4, 1fr); }
  .gal-grid { grid-template-columns: repeat(4, 1fr); }
  .qswatch { display: none; }
}
@media (max-width: 980px) {
  .hero-in { grid-template-columns: 1fr; }
  .hero-visual { height: 470px; }
  .fan-card { width: 250px; }
  .fan-card.c1 { transform: translate(-150px, 18px) rotate(-9deg) scale(.9); }
  .fan-card.c3 { transform: translate(150px, 18px) rotate(8deg) scale(.9); }
  .tpl-grid { grid-template-columns: repeat(3, 1fr); }
  .gal-grid { grid-template-columns: repeat(3, 1fr); }
  .lp-stats-in { grid-template-columns: 1fr 1fr; }
  .lp-stats-in > div:nth-child(3) { border-left: 0; }
  .lp-stats-in > div:nth-child(n+3) { border-top: 1px solid var(--line-2); }
  .steps { grid-template-columns: 1fr; }
  .step:not(:last-child)::after { display: none; }

  .ui { grid-template-rows: 58px 1fr 62px; }
  .ui-save { display: none; }
  .ui-body { grid-template-columns: 1fr; }
  .ui-panel { border-right: 0; }
  .ui-stage { display: none; }
  .ui.m-preview .ui-panel { display: none; }
  .ui.m-preview .ui-stage { display: flex; }
  .ui-canvas { padding: 74px 16px 70px; }
  .ui-mtabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 7px 10px calc(7px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); }
  .ui-mtabs button { display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; font-size: 14px; font-weight: 600; color: var(--muted); }
  .ui-mtabs button.on { background: var(--brand-soft); color: var(--brand-ink); }
  .ui-mtabs svg { width: 18px; height: 18px; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .wrap { width: calc(100% - 32px); }
  .lp-links { display: none; }
  .lp-nav-in .btn { height: 38px; padding: 0 14px; }
  .hero { padding: 30px 0 40px; }
  .lead { font-size: 16px; }
  .hero-visual { height: 380px; margin-top: 10px; }
  .fan-card { width: 200px; }
  .fan-card.c1 { transform: translate(-92px, 14px) rotate(-8deg) scale(.88); }
  .fan-card.c3 { transform: translate(92px, 14px) rotate(7deg) scale(.88); }
  .chip-float.f1 { left: 0; top: 10px; }
  .chip-float.f2 { right: 0; top: auto; bottom: 90px; }
  .chip-float.f3 { display: none; }
  .lp-stats-in > div { padding: 16px; }
  .lp-stats b { font-size: 26px; }
  .lp-sec { padding: 52px 0; }
  .tpl-grid { grid-template-columns: repeat(2, 1fr); gap: 20px 14px; }
  .tpl-num { display: none; }
  .tpl-meta { flex-direction: column; gap: 0; }
  .hero-cta .btn { flex: 1 1 100%; }
  .tips { grid-template-columns: 1fr; }
  .cta-band { flex-direction: column; align-items: flex-start; padding: 32px 26px; }

  .ui-top { gap: 8px; padding: 0 10px 0 14px; }
  .ui-top .brand-name { display: none; }
  #btn-gallery span { display: none; }
  #btn-gallery { width: 40px; padding: 0; }
  .ui-scroll { padding: 14px 14px 30px; }
  .ui-panel-head { padding: 12px 14px 10px; }
  .grid2 { grid-template-columns: 1fr; }
  .row.r2 { grid-template-columns: 1fr 96px auto; }
  .dgrid { grid-template-columns: repeat(2, 1fr); }
  .gal-grid { grid-template-columns: repeat(2, 1fr); padding: 6px 16px 20px; gap: 18px 12px; }
  .modal { padding: 10px; }
  .modal-head { padding: 18px 18px 10px; }
  .tswitch-name { min-width: 120px; }
  .dl-menu { width: min(300px, calc(100vw - 20px)); }
  .fit-pill small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
