/* ==========================================================================
   Offerlane — builder app
   ========================================================================== */
body.app { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
.appbar {
  height: 64px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 0 18px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); z-index: 20;
}
.appbar .left, .appbar .right { display: flex; align-items: center; gap: 10px; }
.ai-pill { font-size: 0.75rem; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.ai-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.ai-pill.live .dot { background: var(--teal); box-shadow: 0 0 10px var(--teal); }
.score-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(21,24,31,.03); color: var(--text); font-weight: 600; font-size: .85rem; }
.score-chip .mini-ring { --p: 0; width: 30px; height: 30px; border-radius: 50%; background: conic-gradient(var(--c, var(--teal)) calc(var(--p) * 1%), rgba(21,24,31,.1) 0); display: grid; place-items: center; position: relative; }
.score-chip .mini-ring::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--ink); }
.score-chip .mini-ring b { position: relative; font-size: .68rem; }

.menu { position: relative; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; padding: 8px; border-radius: 16px;
  background: #fff; border: 1px solid var(--line-2); box-shadow: var(--shadow); display: none; z-index: 40;
}
.menu.open .menu-list { display: block; animation: pop .25s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.menu-list button { display: flex; width: 100%; gap: 10px; align-items: center; text-align: left; padding: 10px 12px; border-radius: 10px; background: none; border: 0; color: var(--text); font-size: .9rem; }
.menu-list button:hover { background: rgba(21,24,31,.06); }
.menu-list small { color: var(--faint); display: block; font-size: .75rem; }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

.workspace { flex: 1; display: grid; grid-template-columns: minmax(380px, 470px) 1fr; min-height: 0; }
.editor { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: #fff; }
.tabs { display: flex; gap: 4px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex: none; }
.tab { flex: 1; padding: 9px 10px; border-radius: 10px; background: none; border: 1px solid transparent; color: var(--muted); font-weight: 600; font-size: .86rem; transition: .2s; }
.tab:hover { color: var(--text); }
.tab.active { background: rgba(21,24,31,.07); border-color: var(--line-2); color: var(--text); }
.panes { flex: 1; overflow-y: auto; padding: 16px 16px 80px; scrollbar-width: thin; scrollbar-color: #d6d3cc transparent; }
.pane { display: none; }
.pane.active { display: block; animation: fadeUp .35s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }

.sample-banner { padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(161,98,7,.3); background: rgba(161,98,7,.06); font-size: .85rem; color: var(--muted); margin-bottom: 14px; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.sample-banner b { color: var(--gold); }

/* accordion sections */
.sec { border: 1px solid var(--line); border-radius: 16px; margin-bottom: 12px; background: rgba(21,24,31,.02); overflow: hidden; }
.sec > summary { list-style: none; cursor: pointer; padding: 15px 16px; display: flex; align-items: center; gap: 12px; font-weight: 600; }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: rgba(79,70,229,.12); color: var(--violet); font-size: .9rem; flex: none; }
.sec > summary .count { margin-left: auto; color: var(--faint); font-size: .8rem; font-weight: 500; }
.sec > summary::after { content: "⌄"; color: var(--faint); transition: transform .3s var(--ease); }
.sec[open] > summary::after { transform: rotate(180deg); }
.sec-body { padding: 4px 16px 16px; }
.hint { font-size: .8rem; color: var(--faint); margin: -2px 0 12px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.field label { font-size: .75rem; color: var(--muted); font-weight: 500; letter-spacing: .02em; }
.field input, .field textarea, .field select, .jd {
  width: 100%; background: #fff; border: 1px solid var(--line-2); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font: inherit; font-size: .9rem; transition: border-color .2s, box-shadow .2s;
}
.field textarea, .jd { resize: vertical; min-height: 84px; line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus, .jd:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(79,70,229,.18); }
.field input::placeholder, .field textarea::placeholder, .jd::placeholder { color: #9aa1ad; }

.item { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px; background: rgba(21,24,31,.015); }
.item-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.item-head .t { font-weight: 600; font-size: .88rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); background: rgba(21,24,31,.03); color: var(--muted); font-size: .8rem; transition: .2s; flex: none; }
.icon-btn:hover { color: var(--text); border-color: var(--line-2); background: rgba(21,24,31,.08); }
.icon-btn.danger:hover { color: var(--rose); border-color: rgba(190,18,60,.4); }

.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.ai-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 999px; font-size: .8rem; font-weight: 600;
  border: 1px solid rgba(79,70,229,.45); background: rgba(79,70,229,.1); color: var(--indigo); transition: .25s var(--ease);
}
.ai-btn:hover { background: rgba(79,70,229,.2); transform: translateY(-1px); }
.ai-btn.loading { pointer-events: none; opacity: .75; }
.ai-btn.loading::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.add-btn { width: 100%; padding: 11px; border-radius: 12px; border: 1px dashed var(--line-2); background: none; color: var(--muted); font-weight: 600; font-size: .85rem; transition: .2s; }
.add-btn:hover { color: var(--text); border-color: var(--violet); background: rgba(79,70,229,.06); }
.ghost-btn { padding: 8px 13px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(21,24,31,.03); color: var(--text); font-size: .8rem; font-weight: 600; }
.ghost-btn:hover { background: rgba(21,24,31,.08); }

.bullet-tips { display: flex; gap: 6px; flex-wrap: wrap; margin: -4px 0 8px; }
.bullet-tips span { font-size: .7rem; padding: 3px 8px; border-radius: 999px; }
.tip-ok { background: rgba(4,120,87,.1); color: var(--teal); }
.tip-warn { background: rgba(161,98,7,.1); color: var(--gold); }
.tip-bad { background: rgba(190,18,60,.1); color: var(--rose); }

/* design pane */
.label-sm { font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); margin: 18px 0 10px; font-weight: 600; }
.label-sm:first-child { margin-top: 0; }
.tpl-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tpl-opt { border: 2px solid var(--line); border-radius: 14px; padding: 8px; background: rgba(21,24,31,.02); text-align: left; color: var(--text); transition: .25s var(--ease); }
.tpl-opt:hover { border-color: var(--line-2); transform: translateY(-2px); }
.tpl-opt.active { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(79,70,229,.15); }
.tpl-opt .tpl-thumb { border-radius: 8px; }
.tpl-opt .nm { font-weight: 600; font-size: .82rem; margin-top: 8px; }
.tpl-opt .tg { font-size: .72rem; color: var(--faint); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; outline: 1px solid var(--line-2); transition: transform .2s; }
.swatch:hover { transform: scale(1.12); }
.swatch.active { border-color: #fff; }
.swatches input[type=color] { width: 34px; height: 34px; border: 0; background: none; padding: 0; cursor: pointer; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; }
.seg button { padding: 7px 14px; border-radius: 999px; border: 0; background: none; color: var(--muted); font-size: .82rem; font-weight: 600; }
.seg button.active { background: rgba(21,24,31,.1); color: var(--text); }
.order-list { display: grid; gap: 6px; }
.order-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(21,24,31,.02); }
.order-row input[type=text] { flex: 1; background: none; border: 0; color: var(--text); font: inherit; font-size: .86rem; padding: 4px; border-radius: 6px; }
.order-row input[type=text]:focus { outline: 1px solid var(--violet); }
.order-row.off { opacity: .45; }
.toggle { appearance: none; width: 34px; height: 20px; border-radius: 999px; background: #d6d3cc; position: relative; cursor: pointer; flex: none; transition: .2s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: .2s var(--ease); }
.toggle:checked { background: var(--violet); }
.toggle:checked::after { left: 17px; }

/* ATS pane */
.ats-top { display: flex; gap: 18px; align-items: center; padding: 18px; border-radius: 18px; border: 1px solid var(--line); background: rgba(21,24,31,.02); margin-bottom: 14px; }
.big-ring { --p: 0; --c: var(--teal); width: 92px; height: 92px; border-radius: 50%; flex: none; position: relative; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), rgba(21,24,31,.08) 0); transition: --p .8s; }
.big-ring::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--ink-2); }
.big-ring b { position: relative; font-size: 1.7rem; font-family: var(--serif); font-weight: 400; }
.ats-top h3 { margin: 0 0 4px; font-size: 1.05rem; }
.ats-top p { margin: 0; color: var(--muted); font-size: .85rem; }
.checks { display: grid; gap: 8px; margin: 12px 0; }
.check { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); font-size: .85rem; background: rgba(21,24,31,.015); }
.check .st { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; font-weight: 700; }
.check.pass .st { background: rgba(4,120,87,.15); color: var(--teal); }
.check.warn .st { background: rgba(161,98,7,.15); color: var(--gold); }
.check.fail .st { background: rgba(190,18,60,.15); color: var(--rose); }
.check .lb { font-weight: 600; }
.check .tp { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.kw-wrap { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.kw-wrap .kw { cursor: default; font-size: .75rem; }
.kw-wrap .kw.miss { cursor: pointer; transition: .2s; }
.kw-wrap .kw.miss:hover { background: rgba(190,18,60,.2); }

/* preview */
.preview { position: relative; overflow: auto; min-height: 0; background:
  #eef0f3; display: flex; flex-direction: column; align-items: center; padding: 30px 20px 60px; }
.preview-bar { position: sticky; top: 0; z-index: 5; display: flex; gap: 10px; align-items: center; justify-content: center; margin-bottom: 18px; flex-wrap: wrap; }
.page-meter { font-size: .8rem; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(255,255,255,.96); color: var(--muted); backdrop-filter: blur(8px); }
.page-meter.ok { color: var(--teal); border-color: rgba(4,120,87,.35); }
.page-meter.over { color: var(--gold); border-color: rgba(161,98,7,.35); }
.zoom-ctl { display: inline-flex; gap: 4px; padding: 3px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(255,255,255,.96); }
.zoom-ctl button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: none; color: var(--text); }
.zoom-ctl button:hover { background: rgba(21,24,31,.1); }
.page-wrap { position: relative; transform-origin: top center; flex: none; }
#previewArea .resume { box-shadow: 0 40px 100px -30px rgba(0,0,0,.8), 0 0 0 1px rgba(21,24,31,.04); transition: box-shadow .3s; }
.page-break { position: absolute; left: -14px; right: -14px; height: 0; border-top: 2px dashed rgba(161,98,7,.8); pointer-events: none; }
.page-break span { position: absolute; right: 0; top: -22px; font-size: 11px; background: #a16207; color: #fff; padding: 2px 8px; border-radius: 6px; font-weight: 700; font-family: var(--sans); }
.flash { animation: flash 1.2s var(--ease); }
@keyframes flash { 0% { box-shadow: 0 0 0 0 rgba(79,70,229,.8); } 100% { box-shadow: 0 0 0 30px rgba(79,70,229,0); } }

/* modal */
.modal { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; background: rgba(21,24,31,.45); backdrop-filter: blur(6px); padding: 20px; }
.modal.open { display: grid; animation: fadeUp .3s var(--ease); }
.modal-card { width: min(720px, 100%); max-height: 86vh; overflow: auto; background: #fff; border: 1px solid var(--line-2); border-radius: 22px; padding: 24px; box-shadow: var(--shadow); }
.modal-card pre { white-space: pre-wrap; font-size: .82rem; background: var(--ink-3); padding: 16px; border-radius: 12px; border: 1px solid var(--line); color: var(--text); max-height: 55vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; }
.modal-head h3 { margin: 0; }

.mobile-switch { display: none; }
@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  .preview { display: none; }
  body.show-preview .preview { display: flex; }
  body.show-preview .editor { display: none; }
  .mobile-switch { display: flex; position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 30; padding: 4px; border-radius: 999px; background: #fff; border: 1px solid var(--line-2); box-shadow: var(--shadow); }
  .mobile-switch button { padding: 10px 20px; border: 0; border-radius: 999px; background: none; color: var(--muted); font-weight: 600; }
  .mobile-switch button.active { background: var(--text); color: #fff; }
  .appbar .hide-md { display: none; }
}
@media (max-width: 560px) {
  .appbar { padding: 0 10px; gap: 6px; }
  .appbar .logo span:last-child { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .editor { min-width: 0; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
}

.sec, .item, .check, .order-row, .tpl-opt, .ats-top { background: #fff; }
