/* BAIHER admin layer.
   Structure follows Shopify's admin (Polaris): dark top bar, light sidebar, grey canvas, white 12px cards,
   pill badges, index tables, two-column editors. Type and accents stay BAIHER: Jost, ink buttons, burgundy accent,
   so the admin reads as the same brand as the storefront. */

body.is-admin {
  --a-bg: #F1F1F1; --a-side: #EBEBEB; --a-card: #FFFFFF; --a-text: #303030; --a-sub: #616161; --a-line: #E3E3E3; --a-soft: #F7F7F7;
  --a-shadow: 0 0 0 1px rgba(0,0,0,.05), 0 1px 0 rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.05);
  background: var(--a-bg); color: var(--a-text); font: 400 14px/1.5 var(--f-body);
}
.is-admin h1, .is-admin h2, .is-admin h3, .is-admin h4 { font-family: var(--f-body); letter-spacing: 0; font-optical-sizing: auto; font-variation-settings: normal; }
.is-admin .muted, .is-admin .sku { color: var(--a-sub); }
.is-admin .sku { font-size: 13px; }
.is-admin .small { font-size: 13px; }
.is-admin .link { color: var(--a-text); text-decoration: underline; text-underline-offset: 3px; border: 0; }
.is-admin .link:hover { color: var(--burgundy); }

/* ---------- top bar ---------- */
.sp-top { position: sticky; top: 0; z-index: 60; height: 56px; background: #1A1A1A; color: #E3E3E3; display: grid; grid-template-columns: 240px 1fr 240px; align-items: center; padding: 0 12px 0 16px; }
.sp-brand { color: #fff; display: inline-flex; }
.sp-brand .logo { color: #fff; gap: 10px; }
.sp-burger { display: none; color: #fff; width: 36px; height: 36px; place-items: center; border-radius: 8px; }
.sp-search { justify-self: center; width: min(560px, 100%); display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; background: #303030; border: 1px solid #4a4a4a; border-radius: 10px; color: #b5b5b5; cursor: text; }
.sp-search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: #fff; font-size: 14px; }
.sp-search input::placeholder { color: #a8a8a8; }
.sp-search:focus-within { border-color: #8a8a8a; }
.sp-search kbd { font: 500 11px var(--f-body); color: #a8a8a8; border: 1px solid #4a4a4a; border-radius: 6px; padding: 1px 6px; }
.sp-top-r { justify-self: end; display: flex; align-items: center; gap: 8px; }
.sp-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; color: #E3E3E3; }
.sp-icon:hover, .sp-burger:hover { background: #303030; }
.sp-store { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 10px; font-size: 13px; font-weight: 500; color: #fff; }
.sp-store:hover { background: #303030; }
.sp-store i { width: 28px; height: 28px; border-radius: 8px; background: var(--burgundy); color: #fff; display: grid; place-items: center; font: 600 11px var(--f-body); letter-spacing: .04em; font-style: normal; }

/* ---------- sidebar ---------- */
.sp-wrap { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 56px); }
.sp-side { position: sticky; top: 56px; height: calc(100vh - 56px); background: var(--a-side); padding: 12px 8px; display: flex; flex-direction: column; justify-content: space-between; overflow: auto; }
.sp-ni { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: 8px; color: var(--a-text); font-size: 13.5px; font-weight: 500; }
.sp-ni svg { color: #4a4a4a; flex: none; }
.sp-ni:hover { background: #F7F7F7; }
.sp-ni.on { background: #fff; font-weight: 600; box-shadow: 0 1px 0 rgba(0,0,0,.05); }
.sp-ni.on svg { color: var(--a-text); }
.sp-cnt { margin-left: auto; font-style: normal; font-size: 12px; font-weight: 600; background: #fff; border-radius: 8px; padding: 0 7px; line-height: 20px; box-shadow: 0 0 0 1px var(--a-line); }
.sp-ni.on .sp-cnt { background: var(--a-bg); }
.sp-sub { display: grid; padding: 2px 0 6px 38px; }
.sp-sub a { height: 30px; display: flex; align-items: center; padding: 0 10px; border-radius: 8px; font-size: 13.5px; color: var(--a-sub); }
.sp-sub a:hover { background: #F7F7F7; color: var(--a-text); }
.sp-sub a.on { color: var(--a-text); font-weight: 600; background: #F7F7F7; }
.sp-group { font-size: 12px; font-weight: 600; color: var(--a-sub); padding: 18px 10px 6px; }
.sp-side-b { border-top: 1px solid #DADADA; padding-top: 8px; }

/* ---------- page ---------- */
.sp-main { min-width: 0; }
.sp-page { max-width: 1000px; margin: 0 auto; padding: 24px 32px 80px; }
.sp-page.wide { max-width: 1320px; }
.sp-page.narrow { max-width: 760px; }
.sp-ph { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 18px; min-height: 34px; }
.sp-back { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--a-text); flex: none; }
.sp-back:hover { background: #E3E3E3; }
.sp-ph-t { flex: 1; min-width: 0; }
.sp-ph-r { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 32px; }
.sp-ph h1 { font: 700 20px/1.3 var(--f-body); color: var(--a-text); }
.sp-ph p { margin: 2px 0 0; color: var(--a-sub); font-size: 13px; }
.sp-ph-a { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.sp-2col { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.sp-foot { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid #DADADA; margin-top: 8px; padding-top: 16px; }
.sp-note { font-size: 12.5px; color: var(--a-sub); margin: -8px 0 16px; }
.sp-cardnote { font-size: 13px; color: var(--a-sub); padding: 10px 16px 6px; margin: 0; }

/* ---------- cards ---------- */
.is-admin .card, .is-admin .sect { background: var(--a-card); border: 0; border-radius: 12px; box-shadow: var(--a-shadow); margin-bottom: 16px; overflow: hidden; }
.is-admin .card-h { padding: 14px 16px 6px; border: 0; }
.is-admin .card-h h3 { font: 600 14px/1.4 var(--f-body); }
.is-admin .card-b { padding: 8px 16px 16px; }
.is-admin .sect > h4 { display: flex; align-items: center; gap: 8px; font: 600 14px/1.4 var(--f-body); text-transform: none; letter-spacing: 0; color: var(--a-text); padding: 14px 16px 0; border: 0; }
.is-admin .sect > .in-b { padding: 12px 16px 16px; }
.is-admin .sect > .in-b > p:last-child { margin-bottom: 0; }
.h4-sub { font-weight: 400; color: var(--a-sub); font-size: 13px; }
.sect-f { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-top: 1px solid var(--a-line); margin: 14px -16px -16px; padding: 12px 16px; background: var(--a-soft); }
.sect-f .hint { margin: 0; }
.is-admin .cols { gap: 16px; margin-bottom: 0; }
.is-admin .cols > .card, .is-admin .cols > .sect, .is-admin .cols > div > .sect { margin-bottom: 16px; }
.sp-page.narrow .cols, .sp-page.narrow .cols.even { grid-template-columns: 1fr; gap: 0; }

/* ---------- home ---------- */
.is-admin .kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; background: var(--a-card); border-radius: 12px; box-shadow: var(--a-shadow); padding: 6px; margin-bottom: 12px; }
.is-admin .kpi { background: transparent; border: 0; border-radius: 8px; padding: 10px 14px; }
.is-admin .kpi:hover { background: var(--a-soft); }
.is-admin .kpi .l { font-size: 13px; letter-spacing: 0; text-transform: none; color: var(--a-sub); text-decoration: underline dotted #b5b5b5; text-underline-offset: 3px; }
.is-admin .kpi .v { font: 700 20px/1.3 var(--f-body); color: var(--a-text); margin: 4px 0 0; }
.is-admin .kpi .d { font-size: 12.5px; color: var(--a-sub); }
.is-admin .kpi .up { color: #0C5132; font-weight: 500; }
.is-admin .bars { height: 200px; gap: 6px; }
.is-admin .bars .b { font-size: 11.5px; color: var(--a-sub); }
.is-admin .bars .b i { background: #D4D4D4; border: 0; border-radius: 4px 4px 0 0; }
.is-admin .bars .b:hover i { background: #B5B5B5; }
.is-admin .bars .b.today i { background: var(--burgundy); }
.todos { display: grid; gap: 6px; }
.todo { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--a-soft); font-size: 13.5px; }
.todo:hover { background: #EBEBEB; }
.todo-i { width: 24px; height: 24px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: 0 0 0 1px var(--a-line); flex: none; }
.is-admin .mini-list li { padding: 10px 16px; border-color: var(--a-line); font-size: 13.5px; }
.is-admin .mini-list li.click { cursor: pointer; }
.is-admin .mini-list li.click:hover { background: var(--a-soft); }
.is-admin .thumb { width: 40px; height: 40px; border-radius: 8px; overflow: hidden; background: var(--a-soft); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); flex: none; }
.is-admin .thumb.sm { width: 32px; height: 32px; }
.is-admin .thumb .art { object-position: 50% 12%; }

/* ---------- index tables ---------- */
.sp-index { padding: 0; }
.sp-tabs { display: flex; gap: 4px; padding: 8px 8px 6px; overflow-x: auto; border-bottom: 1px solid var(--a-line); }
.sp-tabs button, .is-admin .tabs .tab { height: 28px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--a-sub); white-space: nowrap; border: 0; margin: 0; }
.sp-tabs button:hover, .is-admin .tabs .tab:hover { background: var(--a-soft); color: var(--a-text); }
.sp-tabs button.on, .is-admin .tabs .tab.on { background: #E3E3E3; color: var(--a-text); font-weight: 600; }
.sp-tabs .c, .is-admin .tabs .tab .c { color: var(--a-sub); font-size: 12px; font-weight: 500; margin-left: 2px; }
.is-admin .tabs { border: 0; gap: 4px; margin-bottom: 16px; background: var(--a-card); border-radius: 12px; box-shadow: var(--a-shadow); padding: 6px; width: max-content; max-width: 100%; }
.is-admin .toolbar { padding: 10px 12px; border-bottom: 1px solid var(--a-line); gap: 8px; }
.is-admin .toolbar .in { min-height: 32px; height: 32px; }
.is-admin .toolbar .search { padding-left: 32px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23616161' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-5-5'/%3E%3C/svg%3E") no-repeat 10px center; }
.is-admin table.tbl { font-size: 13.5px; }
.is-admin .tbl th { background: var(--a-soft); font-size: 12.5px; font-weight: 600; color: var(--a-sub); letter-spacing: 0; text-transform: none; padding: 8px 12px; border-bottom: 1px solid var(--a-line); }
.is-admin .tbl td { padding: 10px 12px; border-bottom: 1px solid #EBEBEB; }
.is-admin .tbl tbody tr:last-child td { border-bottom: 0; }
.is-admin .tbl tbody tr.click:hover td { background: var(--a-soft); }
.is-admin .tbl tr.sel-on td { background: #F1F1F1; }
.is-admin .tbl td.sel, .is-admin .tbl th.sel { width: 36px; padding-right: 0; }
.is-admin .tbl .row { gap: 12px; }
.is-admin .empty-row { text-align: center; color: var(--a-sub); padding: 48px 16px !important; }
.crit { color: #8E0B21; font-weight: 500; }
.is-admin .bulk { background: var(--a-soft); color: var(--a-text); padding: 8px 12px; border-bottom: 1px solid var(--a-line); font-size: 13px; font-weight: 600; gap: 8px; }
.is-admin .bulk .btn.line { color: var(--a-text); border-color: #D4D4D4; }
.is-admin .bulk .btn.line:hover { background: #fff; color: var(--a-text); }
.is-admin .ia { width: 30px; height: 30px; border-radius: 8px; color: #4a4a4a; }
.is-admin .ia:hover { background: #EBEBEB; color: var(--a-text); }
.is-admin .move button { color: #8a8a8a; }

/* ---------- badges (Shopify tones) ---------- */
.bd { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 8px; font-size: 12.5px; font-weight: 500; white-space: nowrap; background: #E3E3E3; color: #616161; vertical-align: middle; }
.bd::before { content: ''; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid currentColor; box-sizing: border-box; }
.bd.neutral::before { display: none; }
.bd.success { background: #CDFEE1; color: #0C5132; } .bd.success::before { background: currentColor; }
.bd.info { background: #E0F0FF; color: #00527C; }
.bd.warning { background: #FFEB78; color: #4F4700; }
.bd.attention { background: #FFD6A4; color: #5E4200; }
.bd.critical { background: #FEE9E8; color: #8E0B21; }
.sp-ph .bd { height: 24px; }

/* ---------- buttons ---------- */
.is-admin .btn { min-height: 32px; height: auto; padding: 5px 12px; border-radius: 8px; font: 600 13px/1.4 var(--f-body); letter-spacing: 0; text-transform: none; gap: 6px;
  background: linear-gradient(#3a3735, #1C1A19); border: 1px solid #000; color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 1px 0 rgba(0,0,0,.2); }
.is-admin .btn:hover { background: #1C1A19; border-color: #000; }
.is-admin .btn.line { background: #fff; color: var(--a-text); border: 1px solid #D4D4D4; border-bottom-color: #B5B5B5; box-shadow: 0 1px 0 rgba(0,0,0,.05); }
.is-admin .btn.line:hover { background: var(--a-soft); color: var(--a-text); }
.is-admin .btn.danger { background: #fff; color: #8E0B21; border: 1px solid #D4D4D4; border-bottom-color: #B5B5B5; box-shadow: 0 1px 0 rgba(0,0,0,.05); }
.is-admin .btn.danger:hover { background: #FEE9E8; }
.is-admin .btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--a-text); }
.is-admin .btn.sm { min-height: 28px; padding: 3px 10px; font-size: 12.5px; }
.is-admin .btn.block { width: 100%; }

/* ---------- forms ---------- */
.is-admin .field { margin-bottom: 14px; }
.is-admin .field > span.lbl, .is-admin span.lbl, .is-admin .lbl { display: block; font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--a-text); margin-bottom: 4px; }
.is-admin .field .hint, .is-admin .hint { display: block; font-size: 12.5px; color: var(--a-sub); margin-top: 4px; }
.is-admin .in { min-height: 34px; padding: 6px 12px; border: 1px solid #8A8A8A; border-radius: 8px; background: #fff; font-size: 14px; box-shadow: none; }
.is-admin textarea.in { min-height: 0; line-height: 1.5; }
.is-admin .in:hover { border-color: #616161; }
.is-admin .in:focus { border-color: var(--a-text); box-shadow: 0 0 0 2px rgba(110,31,43,.28); }
.is-admin select.in { padding-right: 32px; background-position: right 12px center; }
.is-admin .in:disabled, .is-admin .in[readonly] { background: var(--a-soft); border-color: #D4D4D4; color: var(--a-sub); opacity: 1; }
.is-admin .in-color { width: 40px; height: 34px; padding: 2px; border: 1px solid #8A8A8A; border-radius: 8px; background: #fff; }
.is-admin .chk { align-items: flex-start; gap: 8px; font-size: 13.5px; }
.is-admin .chk input, .is-admin .rad input { width: 16px; height: 16px; margin-top: 2px; border-color: #8A8A8A; border-radius: 4px; }
.is-admin .rad input { border-radius: 50%; }
.is-admin .chk input:checked { background: var(--a-text); border-color: var(--a-text); }
.is-admin .chk input:checked::after { width: 4px; height: 8px; border-width: 0 2px 2px 0; }
.is-admin .sw { width: 36px; height: 20px; }
.is-admin .sw i::after { width: 16px; height: 16px; left: 2px; top: 2px; }
.is-admin .sw input:checked + i { background: var(--a-text); }
.is-admin .sw input:checked + i::after { transform: translateX(16px); }
.is-admin .chip { min-width: 40px; height: 32px; border-radius: 8px; border: 1px solid #D4D4D4; font-size: 13px; background: #fff; }
.is-admin .chip.on { background: var(--a-text); border-color: var(--a-text); color: #fff; }
.is-admin .tag { border-radius: 8px; border-color: #D4D4D4; background: var(--a-soft); font-size: 13px; padding: 2px 4px 2px 10px; }
.is-admin .matrix table { border-radius: 8px; overflow: hidden; }
.is-admin .matrix th, .is-admin .matrix td { border-color: var(--a-line); font-size: 13px; padding: 6px 8px; }
.is-admin .matrix th { background: var(--a-soft); font-weight: 600; }
.is-admin .matrix input { width: 64px; min-height: 30px; border: 1px solid #B5B5B5; border-radius: 6px; background: #fff; }
.is-admin .drop { border: 1px dashed #8A8A8A; border-radius: 10px; background: #fff; color: var(--a-sub); padding: 20px; display: grid; justify-items: center; gap: 4px; }
.is-admin .drop:hover { background: var(--a-soft); color: var(--a-text); border-color: var(--a-text); }
.is-admin .imgs .im { border-radius: 8px; border: 1px solid var(--a-line); background: var(--a-soft); }
.is-admin .imgs .im .art { object-position: 50% 14%; }
.is-admin .imgs .im .m { border-radius: 6px; letter-spacing: 0; text-transform: none; font-size: 11.5px; }
.is-admin .imgs .im .x { border-radius: 6px; }
.seo { display: grid; gap: 2px; padding: 12px 14px; border-radius: 10px; background: var(--a-soft); margin-bottom: 14px; }
.seo-u { font-size: 12.5px; color: #4a4a4a; }
.seo-t { font-size: 17px; color: #1a0dab; }
.seo-d { font-size: 13px; color: #4d5156; }
.is-admin .alert { border-radius: 10px; border: 0; background: #FEE9E8; color: #8E0B21; font-size: 13.5px; padding: 12px 14px; }
.is-admin .note { border-radius: 10px; border: 0; background: var(--a-soft); font-size: 13.5px; }
.is-admin .grid2, .is-admin .grid3, .is-admin .grid4 { gap: 0 12px; }

/* ---------- order page ---------- */
.ship-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--a-sub); padding: 8px 12px; border-radius: 8px; background: var(--a-soft); margin-bottom: 8px; }
.oi { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #EBEBEB; font-size: 13.5px; }
.oi:last-of-type { border-bottom: 0; }
.is-admin .sum-row { font-size: 13.5px; padding: 4px 0; }
.is-admin .sum-row.total { font: 600 14px var(--f-body); border-top: 0; padding-top: 8px; margin-top: 4px; }
.is-admin .tl li { padding-bottom: 18px; font-size: 13.5px; }
.is-admin .tl li::before { border-color: #8A8A8A; width: 11px; height: 11px; left: 7px; top: 5px; }
.is-admin .tl li.done::before { background: var(--a-text); border-color: var(--a-text); }

/* ---------- settings pages, CMS ---------- */
.is-admin .toggle-row { padding: 12px 16px; border-color: #EBEBEB; font-size: 13.5px; }
.is-admin .toggle-row .grow span { font-size: 13px; color: var(--a-sub); }
.grp-h { padding: 10px 16px 4px; font-size: 12.5px; font-weight: 600; color: var(--a-sub); background: var(--a-soft); border-top: 1px solid var(--a-line); }
.is-admin .ord-row { padding: 10px 16px; border-color: #EBEBEB; font-size: 13.5px; }
.is-admin .preview-frame { border: 0; border-radius: 12px; box-shadow: var(--a-shadow); top: 72px; }
.is-admin .preview-frame .bar { background: var(--a-soft); border-color: var(--a-line); font-size: 12px; }
.is-admin .rte-bar { border-color: #8A8A8A; border-radius: 8px 8px 0 0; background: var(--a-soft); }
.is-admin .rte { border-color: #8A8A8A; border-radius: 0 0 8px 8px; background: #fff; font-size: 14px; }
.is-admin .label { color: #000; }

/* ---------- overlays ---------- */
.is-admin .scrim { background: rgba(0,0,0,.4); }
.is-admin .modal { border: 0; border-radius: 12px; background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.is-admin .modal-h { padding: 16px 16px 0; }
.is-admin .modal-h h3 { font: 600 16px var(--f-body); }
.is-admin .modal-b { padding: 12px 16px 4px; font-size: 14px; }
.is-admin .modal-f { padding: 12px 16px; border-top: 1px solid var(--a-line); background: var(--a-soft); gap: 8px; margin-top: 8px; }
.is-admin .drawer { background: #fff; }
.is-admin .drawer-h { padding: 14px 16px; }
.is-admin .drawer-h h3 { font: 600 16px var(--f-body); text-transform: none; letter-spacing: 0; }
.is-admin .drawer-b { padding: 16px; }
.is-admin .drawer-f { padding: 12px 16px; background: var(--a-soft); border-color: var(--a-line); }
.is-admin .toast { background: #1A1A1A; border-radius: 10px; font-size: 13.5px; padding: 10px 16px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .sp-top { grid-template-columns: auto 1fr auto; gap: 12px; }
  .is-admin .kpis { grid-template-columns: repeat(2, 1fr); }
  .sp-2col { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sp-top { padding: 0 8px; }
  .sp-burger { display: grid; }
  .sp-search kbd, .sp-store span { display: none; }
  .sp-wrap { grid-template-columns: 1fr; }
  .sp-side { position: fixed; z-index: 70; left: 0; top: 56px; width: 260px; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
  .sp-side.open { transform: none; }
  .sp-page { padding: 16px 12px 80px; }
  .sp-ph { flex-wrap: wrap; }
  .sp-ph-a { width: 100%; justify-content: flex-start; }
  .is-admin .tbl-wrap { overflow-x: auto; }
}

/* ---------- fixes after visual review ---------- */
.is-admin select.in { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23303030' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 12px center; }
.is-admin .sw i { background: #C9C9C9; }
.is-admin .tl li::after { background: #D4D4D4; }
.is-admin .imgs .im .x { width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.92); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.is-admin .mocknav { left: auto; right: 14px; }
.is-admin .mocknav-menu { left: auto; right: 0; }
@media (max-width: 860px) {
  .sp-top { grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 6px; }
  .sp-brand .wordmark { display: none; }
  .sp-search { width: 100%; }
  .sp-top-r .sp-icon { display: none; }
  .oi { flex-wrap: wrap; }
  .oi .grow { flex-basis: calc(100% - 60px); }
  .oi > .muted { margin-left: 52px; }
  .oi > span:last-child { margin-left: auto; }
  .sect-f { flex-wrap: wrap; }
}
@media (max-width: 860px) {
  /* phone: keep the columns that matter, like Shopify's mobile index lists */
  table:has(#prod-tbody) th:nth-child(n+5), #prod-tbody td:nth-child(n+5), #prod-tbody td:nth-child(4) .muted { display: none; }
  table:has(#ord-tbody) th:nth-child(2), #ord-tbody td:nth-child(2), table:has(#ord-tbody) th:nth-child(n+7), #ord-tbody td:nth-child(n+7) { display: none; }
  .is-admin .tbl td, .is-admin .tbl th { padding-left: 8px; padding-right: 8px; }
}

/* ================================================================ theme editor (Shopify pattern) */
body:has(.ed) { overflow: hidden; }
body:has(.ed) .mocknav { display: none; }
.ed { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-columns: 300px minmax(0, 1fr) 320px; grid-template-rows: 52px minmax(0, 1fr); background: var(--a-bg); }
.ed-top { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 0 12px; background: #fff; border-bottom: 1px solid var(--a-line); }
.ed-exit, .ed-undo, .ed-close { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; color: var(--a-text); flex: none; }
.ed-exit:hover, .ed-undo:hover:not([disabled]), .ed-close:hover { background: var(--a-soft); }
.ed-undo[disabled] { opacity: .35; cursor: default; }
.ed-theme { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.ed-page { margin: 0 auto; min-height: 32px; height: 32px; padding: 0 32px 0 12px; border: 1px solid #D4D4D4; border-radius: 8px; font: 500 13.5px var(--f-body); appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23303030' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 10px center; cursor: pointer; }
.ed-r { display: flex; align-items: center; gap: 8px; }
.ed-dev { display: flex; background: var(--a-soft); border-radius: 8px; padding: 2px; }
.ed-dev button { width: 32px; height: 28px; display: grid; place-items: center; border-radius: 6px; color: var(--a-sub); }
.ed-dev button.on { background: #fff; color: var(--a-text); box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.ed .btn[disabled] { opacity: .45; pointer-events: none; }

.ed-left, .ed-right { background: #fff; overflow: auto; min-height: 0; }
.ed-left { border-right: 1px solid var(--a-line); padding: 8px 8px 40px; }
.ed-right { border-left: 1px solid var(--a-line); display: flex; flex-direction: column; }
.ed-lh { font: 600 14px var(--f-body); padding: 10px 10px 4px; }
.ed-grp { font-size: 12.5px; font-weight: 600; color: var(--a-sub); padding: 16px 10px 4px; }
.ed-row { display: flex; align-items: center; gap: 2px; border-radius: 8px; min-height: 34px; padding: 0 4px 0 0; }
.ed-row:hover { background: var(--a-soft); }
.ed-row.on { background: #EBEBEB; }
.ed-row.off .ed-name { color: #8A8A8A; }
.ed-row.drag { opacity: .4; }
.ed-row.over { box-shadow: inset 0 2px 0 #2C6ECB; }
.ed-grip { width: 18px; display: grid; place-items: center; color: #B5B5B5; cursor: grab; flex: none; }
.ed-row:not(:hover) .ed-grip svg { opacity: 0; }
.ed-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 34px; font-size: 13.5px; text-align: left; color: var(--a-text); }
.ed-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-name svg { color: #616161; flex: none; }
.ed-mv { display: none; }
.ed-row:hover .ed-mv { display: flex; }
.ed-mv button, .ed-eye { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; color: #616161; }
.ed-mv button:hover:not([disabled]), .ed-eye:hover { background: #E3E3E3; color: var(--a-text); }
.ed-mv button[disabled] { opacity: .3; }
.ed-row:not(:hover):not(.off) .ed-eye { opacity: 0; }
.ed-blocks { display: grid; padding: 2px 0 6px 44px; }
.ed-blk { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px; border-radius: 8px; font-size: 13px; color: var(--a-text); text-align: left; }
.ed-blk span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-blk:hover { background: var(--a-soft); }
.ed-blk.on { background: #EBEBEB; font-weight: 600; }
.ed-blk.add { color: #2C6ECB; }
.ed-addwrap { position: relative; }
.ed-add { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px 0 24px; font-size: 13.5px; color: #2C6ECB; border-radius: 8px; width: 100%; }
.ed-add:hover { background: var(--a-soft); }
.ed-pop { position: absolute; z-index: 5; left: 8px; right: 8px; top: 36px; background: #fff; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.06); padding: 6px; }
.ed-pop button { display: flex; align-items: center; gap: 8px; width: 100%; height: 34px; padding: 0 10px; border-radius: 8px; font-size: 13.5px; }
.ed-pop button:hover { background: var(--a-soft); }
.ed-fixed { font-size: 13px; color: var(--a-sub); padding: 6px 10px; margin: 0; }

.ed-rh { display: flex; align-items: center; gap: 6px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--a-line); position: sticky; top: 0; background: #fff; z-index: 2; }
.ed-rh > div { flex: 1; min-width: 0; display: grid; }
.ed-rh b { font: 600 14px var(--f-body); }
.ed-rh span { font-size: 12.5px; color: var(--a-sub); }
.ed-close { display: none; }
.ed-rb { padding: 16px; flex: 1; font-size: 13.5px; }
.ed-rb p { color: var(--a-sub); }
.ed-rf { padding: 12px 16px; border-top: 1px solid var(--a-line); }
.ed-sub { font-size: 12.5px; font-weight: 600; color: var(--a-sub); text-transform: uppercase; letter-spacing: .04em; margin: 6px 0 10px; }
.ed-img { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid #D4D4D4; border-radius: 10px; }
.ed-img-p { width: 72px; height: 72px; border-radius: 8px; overflow: hidden; background: var(--a-soft); flex: none; display: grid; place-items: center; font-size: 12px; color: var(--a-sub); }
.ed-img-p .art { object-position: 50% 25%; }
.ed-img > div:last-child { display: grid; gap: 6px; min-width: 0; justify-items: start; }
.ed-img-n { font-size: 12.5px; color: var(--a-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }
.ed-card { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 8px; border-radius: 10px; border: 1px solid var(--a-line); margin-bottom: 8px; font-size: 13.5px; }
.ed-card:hover { background: var(--a-soft); }
.ed-card-i { width: 64px; height: 40px; border-radius: 6px; overflow: hidden; flex: none; background: var(--a-soft); }
.ed-card-i .art { object-position: 40% 30%; }

.ed-canvas { overflow: hidden; display: grid; place-items: stretch; padding: 12px; min-height: 0; }
.ed-stage { width: 100%; height: 100%; margin: 0 auto; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 1px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.08); transition: width .3s; }
.ed-stage.mobile { width: 390px; border-radius: 28px; box-shadow: 0 0 0 8px #1A1A1A, 0 20px 50px rgba(0,0,0,.25); margin: 8px auto; height: calc(100% - 16px); }
.ed-stage iframe { width: 100%; height: 100%; border: 0; display: block; }

.modal.wide { width: min(880px, calc(100% - 32px)); }
.ed-lib .ed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 18px; }
.ed-lib-i { display: grid; gap: 6px; text-align: left; border-radius: 10px; padding: 4px; border: 2px solid transparent; }
.ed-lib-i span { aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--a-soft); display: block; }
.ed-lib-i .art { object-position: 50% 22%; }
.ed-lib-i em { font-style: normal; font-size: 12px; color: var(--a-sub); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ed-lib-i:hover { background: var(--a-soft); }
.ed-lib-i.on { border-color: #2C6ECB; }

/* themes page */
.th-card { display: grid; grid-template-columns: 420px 1fr; gap: 0; }
.th-frame { height: 270px; overflow: hidden; background: var(--a-soft); border-right: 1px solid var(--a-line); position: relative; }
.th-frame iframe { width: 1440px; height: 930px; border: 0; transform: scale(.2917); transform-origin: 0 0; pointer-events: none; }
.th-meta { padding: 20px; display: flex; flex-direction: column; justify-content: space-between; gap: 16px; }
.th-sw { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.th-sw div { display: grid; justify-items: center; gap: 4px; font-size: 12px; color: var(--a-sub); }
.th-sw i { width: 40px; height: 40px; border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); }

@media (max-width: 1200px) {
  .ed { grid-template-columns: 260px minmax(0, 1fr); }
  .ed-right { position: absolute; top: 52px; right: 0; bottom: 0; width: 320px; z-index: 3; box-shadow: -10px 0 30px rgba(0,0,0,.12); transform: translateX(100%); transition: transform .2s; }
  .ed-right.open { transform: none; }
  .ed-close { display: grid; }
  .th-card { grid-template-columns: 1fr; }
  .th-frame { border-right: 0; border-bottom: 1px solid var(--a-line); }
}
@media (max-width: 760px) {
  .ed { grid-template-columns: 1fr; }
  .ed-left { display: none; }
  .ed-theme { display: none; }
}
/* product media: cover + hover slots */
.is-admin .pe-imgs { grid-template-columns: repeat(2, minmax(0, 200px)); gap: 16px; }
.is-admin .im-w .im { aspect-ratio: 4 / 5; }
.is-admin .im-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #8a8a8a; }
.is-admin .im-a { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
