/* Reusable UI components. Page layout lives in layout.css / pages.css. */

/* ---------- card ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow); min-width: 0; }
.card-pad { padding: 16px 18px; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-head .sub { font-size: 12.5px; font-weight: 700; color: var(--muted); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: var(--r); font-size: 14px; font-weight: 800; white-space: nowrap; cursor: pointer; transition: transform .06s, box-shadow .15s, background .15s; user-select: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-pri { background: var(--blue); color: #fff; box-shadow: 0 8px 20px rgba(31,79,214,.25); }
.btn-pri:hover { background: #1A45C2; }
.btn-yel { background: var(--sun); color: #3D2A00; box-shadow: 0 8px 20px rgba(245,158,11,.28); }
.btn-yel:hover { background: #FFBC05; }
.btn-sec { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn-sec:hover { background: #F8FAFF; }
.btn-ghost { background: transparent; color: var(--ink2); }
.btn-ghost:hover { background: var(--soft); }
.btn-danger { background: #fff; color: var(--bad); box-shadow: inset 0 0 0 1px #F5C2C2; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn-xs { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn-lg { height: 50px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { width: 42px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.chip-sm { height: 22px; padding: 0 8px; font-size: 11px; border-radius: 7px; }
.c-gen { background: var(--gen-bg); color: var(--gen); }
.c-scene { background: var(--scene-bg); color: var(--scene); }
.c-seg { background: var(--seg-bg); color: var(--seg); }
.c-enr { background: var(--enr-bg); color: var(--enr-ink); }
.c-gaze { background: var(--gaze-bg); color: var(--gaze-ink); }
.c-ok { background: var(--ok-bg); color: var(--ok-ink); }
.c-warn { background: var(--warn-bg); color: var(--warn); }
.c-bad { background: var(--bad-bg); color: var(--bad); }
.c-mute { background: var(--soft); color: var(--ink2); }
.c-blue { background: var(--blue-bg); color: var(--blue); }

/* source tags on fields */
.src { font-style: normal; font-size: 10.5px; font-weight: 800; border-radius: 6px; padding: 1px 6px; white-space: nowrap; margin-left: auto; }
.s-label { background: var(--ok-bg); color: var(--ok-ink); }
.s-inf { background: var(--blue-bg); color: var(--blue); }
.s-you { background: var(--soft); color: var(--ink2); }
.s-need { background: var(--warn-bg); color: var(--warn); }

/* small status squares */
.st { display: inline-flex; width: 22px; height: 22px; border-radius: 7px; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; flex-shrink: 0; }
.st.ok { background: var(--ok-bg); color: var(--ok-ink); }
.st.run { background: var(--blue-bg); color: var(--blue); }
.st.rev { background: var(--warn-bg); color: var(--warn); }
.st.bad { background: #fff; box-shadow: inset 0 0 0 1.5px #F2B8B8; color: var(--bad); }
.st.off { background: var(--soft); color: #9AA6C4; }
.st.wait { background: #fff; box-shadow: inset 0 0 0 1.5px var(--line); color: var(--muted); }

/* ---------- segmented controls / tabs / filter chips ---------- */
.seg { display: inline-flex; background: var(--soft); border-radius: 11px; padding: 4px; gap: 4px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg > * { height: 34px; padding: 0 14px; display: inline-flex; align-items: center; gap: 8px; border-radius: 8px; font-size: 13.5px; font-weight: 700; color: var(--ink2); white-space: nowrap; cursor: pointer; }
.seg > .on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(15,28,51,.1); }
.seg em { font-style: normal; font-size: 11.5px; font-weight: 800; background: var(--blue-bg); color: var(--blue); border-radius: 8px; padding: 1px 7px; }
.seg-block { display: flex; }
.seg-block > * { flex: 1; justify-content: center; }
.fchips { display: flex; gap: 8px; flex-wrap: wrap; }
.fchip { height: 34px; padding: 0 14px; border-radius: 10px; display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 800; color: var(--ink2); background: #fff; box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; white-space: nowrap; }
.fchip em { font-style: normal; font-size: 12px; opacity: .75; }
.fchip.on { background: var(--ink); color: #fff; box-shadow: none; }
.fchip.warn:not(.on) { color: var(--warn); }
.fchip.bad:not(.on) { color: var(--bad); }

/* option chips (single / multi choice inside settings) */
.opt { display: flex; flex-wrap: wrap; gap: 6px; }
.opt > button { height: 32px; padding: 0 12px; border-radius: 9px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink2); background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.opt > button.on { background: var(--blue-bg); color: var(--blue); box-shadow: inset 0 0 0 1.5px #B9CCFA; font-weight: 800; }

/* ---------- toggle ---------- */
.tog { width: 40px; height: 23px; border-radius: 12px; background: #C9D3EA; position: relative; flex-shrink: 0; cursor: pointer; transition: background .15s; }
.tog::after { content: ''; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: left .15s; }
.tog.on { background: var(--blue); }
.tog.on::after { left: 20px; }
.tog.locked { opacity: .6; cursor: not-allowed; }
.setrow { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; font-size: 13px; font-weight: 800; }
.setrow small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }

/* ---------- key/value rows ---------- */
.kv { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 700; padding: 9px 0; border-bottom: 1px solid var(--soft); }
.kv:last-child { border-bottom: none; }
.kv > :first-child { color: var(--muted); }

/* ---------- progress bar ---------- */
.bar { height: 8px; border-radius: 4px; background: var(--soft); overflow: hidden; flex-shrink: 0; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--blue); transition: width .5s; }

/* ---------- inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 800; display: flex; align-items: center; gap: 6px; }
.input, .select, .textarea { width: 100%; height: 42px; border-radius: 10px; border: 1px solid var(--line); background: #fff; padding: 0 12px; font-size: 14px; font-weight: 700; color: var(--ink); }
.textarea { height: auto; min-height: 84px; padding: 10px 12px; line-height: 1.5; font-weight: 600; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(31,79,214,.12); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .src { position: absolute; right: 10px; }
.input-wrap .input { padding-right: 90px; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235B6A8F' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.select-sm { height: 36px; font-size: 13px; width: auto; }
.search { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 14px; border-radius: 11px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); font-size: 14px; min-width: 0; }
.search input { border: 0; background: transparent; outline: none; flex: 1; min-width: 0; font-weight: 600; color: var(--ink); }
.search svg { width: 16px; height: 16px; flex-shrink: 0; }
.kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; background: #fff; color: var(--muted); }

/* ---------- upload ---------- */
.drop { border: 2px dashed #A9C0F5; background: #F6F9FF; border-radius: 14px; padding: 22px 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; cursor: pointer; transition: background .15s, border-color .15s; }
.drop:hover, .drop.drag { background: #EDF3FF; border-color: var(--blue); }
.drop b { font-size: 14px; }
.drop span { font-size: 12px; color: var(--muted); font-weight: 600; }
.drop svg { width: 26px; height: 26px; color: var(--blue); }
.file-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.file-ic { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; flex-shrink: 0; }
.file-ic.xlsx { background: var(--ok-bg); color: var(--ok-ink); }
.file-ic.zip { background: var(--seg-bg); color: var(--seg); }
.file-row .up { height: 4px; border-radius: 2px; background: var(--soft); margin-top: 6px; overflow: hidden; }
.file-row .up i { display: block; height: 100%; background: var(--blue); }

/* ---------- note / info boxes ---------- */
.note { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: 12px; font-size: 12.5px; font-weight: 700; line-height: 1.5; color: var(--ink2); background: var(--bg); }
.note > :last-child { flex: 1; min-width: 0; }
.note.sun { background: var(--sun-bg); border: 1px solid #FFE08A; color: #7A4E00; }
.note.gen { background: var(--gen-bg); }
.note.ok { background: var(--ok-bg); color: #14532D; }
.note.blue { background: var(--blue-bg); border: 1px solid #C7D6FB; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; min-width: 0; }
.tbl th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 800; white-space: nowrap; }
.tbl td { font-size: 13.5px; padding: 10px; border-bottom: 1px solid var(--soft); font-weight: 600; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td { background: #FAFBFF; }
.tbl tbody tr.sel td { background: #F6F9FF; }
.tbl .nowrap { white-space: nowrap; }

/* ---------- tiles (images, product art) ---------- */
.tile { border-radius: 12px; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.tile img.photo { width: 100%; height: 100%; object-fit: contain; }
.checker { background-color: #fff; background-image: repeating-conic-gradient(#EEF1F6 0 25%, #fff 0 50%); background-size: 16px 16px; }
.studio { background: linear-gradient(180deg, #F7F5F2, #ECE8E2); }
.raw { background: linear-gradient(180deg, #D8CFC2 0 62%, #A99277 62%); }
.navybg { background: #0E1A3A; }
.tag { position: absolute; left: 8px; top: 8px; font-size: 11.5px; font-weight: 800; background: rgba(255,255,255,.93); border-radius: 7px; padding: 3px 9px; color: var(--ink2); z-index: 2; max-width: calc(100% - 16px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag.b { top: auto; bottom: 8px; }
.art { display: block; }
.heat { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: multiply; }
.ph { position: absolute; border: 2px dashed #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: #fff; background: rgba(14,26,58,.55); text-align: center; padding: 4px; }
.ring2 { position: absolute; border: 3px dashed #EC4899; border-radius: 50%; z-index: 3; pointer-events: none; }

/* result tiles with select + download */
.rt { border-radius: 14px; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; min-height: 220px; }
.rt.sel { box-shadow: 0 0 0 3px var(--blue); }
.rt .q { position: absolute; right: 8px; top: 8px; font-size: 11.5px; font-weight: 800; border-radius: 7px; padding: 3px 8px; z-index: 2; }
.rt .dlb { position: absolute; right: 8px; bottom: 8px; width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,.95); box-shadow: 0 1px 4px rgba(15,28,51,.15); display: flex; align-items: center; justify-content: center; color: var(--ink2); z-index: 2; }
.rt .dlb svg { width: 15px; height: 15px; }
.chk { width: 18px; height: 18px; border-radius: 5px; box-shadow: inset 0 0 0 1.5px var(--line); background: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #fff; flex-shrink: 0; cursor: pointer; }
.chk.on { background: var(--blue); box-shadow: none; }
.rt .chk { position: absolute; left: 10px; top: 10px; z-index: 2; }
.thumb { width: 84px; height: 84px; border-radius: 12px; flex-shrink: 0; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; }
.thumb.on { box-shadow: 0 0 0 3px var(--blue); }
.thumb .tag { font-size: 10px; padding: 1px 6px; top: auto; bottom: 5px; left: 5px; }
.pt { width: 42px; height: 46px; border-radius: 9px; display: flex; align-items: center; justify-content: center; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); background: #fff; flex-shrink: 0; position: relative; }
.pt img { width: 100%; height: 100%; object-fit: cover; }
.mini { display: flex; gap: 4px; }
.mini > div { width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); background: #fff; flex-shrink: 0; position: relative; }

/* ---------- download bar ---------- */
.dlbar { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #FCFDFF; border-radius: 0 0 var(--r-xl) var(--r-xl); }
.fmt { display: flex; gap: 6px; flex-wrap: wrap; }
.fmt > button { height: 32px; padding: 0 12px; border-radius: 9px; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 800; color: var(--ink2); background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.fmt > button.on { background: var(--blue-bg); color: var(--blue); box-shadow: inset 0 0 0 1.5px #B9CCFA; }

/* ---------- feature (pipeline step) rows ---------- */
.feat { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; }
.feat.on { border-color: #C7CFF7; background: #FAFBFF; }
.feat .ic { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.feat .ic svg { width: 16px; height: 16px; }
.feat:not(.on) .ic { opacity: .55; }
.feat.soon { background: var(--bg); border-style: dashed; }
.feat.soon .tog { opacity: .45; cursor: not-allowed; }
.feat b { display: block; font-size: 14px; }
.feat small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- attribute grid ---------- */
.att { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.att > div { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 6px 9px; min-width: 0; }
.fld { border-radius: 12px; background: var(--bg); padding: 10px 12px; }
.fld .k { display: flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.fld .v { font-size: 14px; font-weight: 600; margin-top: 4px; line-height: 1.45; }

/* ---------- ring / donut ---------- */
.ring { width: 84px; height: 84px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ring > div { width: 66px; height: 66px; border-radius: 50%; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* ---------- step timeline ---------- */
.timeline { display: flex; align-items: center; gap: 8px; padding: 12px 18px; overflow-x: auto; scrollbar-width: thin; }
.tn { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 150px; }
.tn .c { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; font-weight: 800; flex-shrink: 0; }
.tn b { display: block; font-size: 13.5px; white-space: nowrap; }
.tn span { font-size: 11.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tn.off .c { background: #fff !important; box-shadow: inset 0 0 0 2px var(--line); color: var(--muted); }
.tn.off b { color: var(--muted); }
.tn.run .c { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.tline { flex: 0 0 18px; height: 2px; background: var(--line); }

/* ---------- decision log ---------- */
.log { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--soft); font-size: 13px; font-weight: 700; line-height: 1.4; }
.log:last-child { border-bottom: none; }
.log .who { width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; flex-shrink: 0; }
.log small { display: block; color: var(--muted); font-weight: 600; font-size: 12px; }

/* ---------- stat tiles ---------- */
.stat { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.stat .l { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.stat .v { font-family: var(--disp); font-size: 28px; font-weight: 700; line-height: 1.05; }
.stat .d { font-size: 12px; font-weight: 800; color: var(--ok-ink); }

/* ---------- empty / loading ---------- */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 40px 16px; border-radius: 16px; background: var(--bg); color: var(--muted); font-weight: 700; }
.empty b { color: var(--ink); font-size: 15px; }
.skel { background: linear-gradient(90deg, #EEF2FA 25%, #F7F9FE 37%, #EEF2FA 63%); background-size: 400% 100%; animation: skel 1.4s ease infinite; border-radius: 10px; }
@keyframes skel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- toast ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 16px; font-size: 13.5px; font-weight: 700; box-shadow: var(--shadow-lg); max-width: 360px; animation: tin .2s ease; }
.toast.ok { background: #14532D; }
.toast.bad { background: #7F1D1D; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
@media (max-width: 767px) { .toasts { left: 16px; right: 16px; bottom: 80px; } .toast { max-width: none; } }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(14,26,58,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 150; }
.modal { background: #fff; border-radius: var(--r-xl); box-shadow: var(--shadow-lg); width: min(520px, 100%); max-height: calc(100vh / var(--z, 1) - 32px); overflow: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }

/* ---------- tooltip for charts ---------- */
.tt { position: fixed; pointer-events: none; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(20,48,143,.14); padding: 9px 11px; font-size: 12.5px; font-weight: 700; color: var(--ink); z-index: 250; display: none; min-width: 150px; }
.tt .r { display: flex; align-items: center; gap: 8px; justify-content: space-between; font-variant-numeric: tabular-nums; }
.tt .r span:first-child { display: flex; align-items: center; gap: 6px; color: var(--ink2); }
.tt i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* ---------- code ---------- */
.code { background: #0E1A3A; border-radius: 14px; padding: 14px 16px; font-family: var(--mono); font-size: 12.5px; line-height: 1.65; color: #DCE5FF; white-space: pre; overflow: auto; }
.code .k { color: #8FB8FF; } .code .s { color: #FDE68A; } .code .c { color: #7C8BB5; } .code .n { color: #5EEAD4; } .code .p { color: #F9A8D4; }
.dlbar > .btn:last-child { margin-left: auto; }

/* live app: controls for features that aren't built yet are hidden rather than answering "coming soon" */
body.live [data-soon] { display: none !important; }

/* ---------- touch up edge (brush editor) ---------- */
.edge-back { position: fixed; inset: 0; z-index: 200; background: rgba(14,26,58,.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.edge { background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); width: min(1280px, 100%); height: min(860px, 100%); display: flex; flex-direction: column; overflow: hidden; }
.edge-head, .edge-foot { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.edge-foot { border-bottom: 0; border-top: 1px solid var(--line); }
.edge-body { flex: 1; min-height: 0; display: flex; }
.edge-tools { width: 190px; flex: none; padding: 14px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.etool { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 10px; font-weight: 800; font-size: 14px; background: var(--soft); }
.etool i { width: 14px; height: 14px; border-radius: 50%; }
.etool.on { background: var(--blue-bg); color: var(--blue); box-shadow: inset 0 0 0 1.5px var(--blue); }
.esize { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 700; color: var(--ink2); }
.edge-stage { flex: 1; min-width: 0; position: relative; background: repeating-conic-gradient(#F2F4F8 0 25%, #fff 0 50%) 0 0 / 20px 20px; }
.edge-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: none; }
.edge-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 700; color: var(--ink2); }
@media (max-width: 767px) {
  .edge-back { padding: 0; } .edge { border-radius: 0; height: 100%; }
  .edge-body { flex-direction: column; } .edge-tools { width: auto; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .edge-tools p { display: none; } .edge-head small { display: none; }
}

/* ---------- before · after slider ---------- */
.cmp { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; cursor: ew-resize; touch-action: none; user-select: none; }
.cmp-layer { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.cmp-layer.checker { background: repeating-conic-gradient(#EEF1F6 0 25%, #fff 0 50%) 0 0 / 18px 18px; }
.cmp-layer.white { background: #fff; }
.cmp-before { background: #E4E8EF; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.cmp-layer img { position: absolute; inset: 16px; width: calc(100% - 32px); height: calc(100% - 32px); object-fit: contain; pointer-events: none; }
.cmp-handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 0 1px rgba(14,26,58,.25); z-index: 3; }
.cmp-handle span { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 40px; height: 40px; border-radius: 50%; background: #fff;
  box-shadow: 0 4px 14px rgba(14,26,58,.3); display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--ink); font-size: 15px; letter-spacing: -1px; }
.cmp-handle:focus-visible span { outline: 3px solid var(--blue); outline-offset: 2px; }
.cmp .tag { z-index: 4; pointer-events: none; }
.cmp-tag-l { left: 8px; } .cmp-tag-r { left: auto !important; right: 8px; }

/* spinner outside buttons + upload states */
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; flex-shrink: 0; }
.file-row.busy .file-ic { color: var(--blue); }
.file-row.busy .file-ic .spin { width: 18px; height: 18px; }
.up i, .bar i { transition: width .25s ease; }
.up i.indet, .bar i.indet { width: 40% !important; animation: indet 1.1s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
.up-over { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: rgba(255,255,255,.82); color: var(--ink); font-weight: 700; text-align: center; padding: 16px; }
.up-over .spin { width: 28px; height: 28px; border-width: 3px; color: var(--blue); }
.up-over .up { width: min(260px, 80%); height: 6px; border-radius: 3px; background: var(--soft); overflow: hidden; }
.up-over .up i { display: block; height: 100%; background: var(--blue); }
@media (prefers-reduced-motion: reduce) { .spin, .up i.indet, .bar i.indet { animation-duration: 3s; } }

/* multi-choice chips: the tick is drawn, not part of the label (so the label is the value) */
.fmt[data-multi] > button.on::before, .opt[data-multi][data-k] > button.on::before { content: '✓ '; }
