/* Mattering QR on the Soft system.
   soft.css (shared tokens, identical to the Sales and Contracts sheets) loads first;
   this file holds what QR adds on top. Ported from planning/qr-redesign-mock/qr.css.
   The app sidebar itself (.mx-sb) is styled by the platform runtime
   /ui/mattering-ui.js (templates/APP_SIDEBAR_TEMPLATE.md): QR only positions the
   aside and styles the contents it owns (brand, workspace switcher, me block). */

[hidden] { display: none !important; }

/* ── Shell ─────────────────────────────────────────────────────────────── */
.qr-app { display: flex; min-height: 100vh; }
.qr-sb { position: sticky; top: 0; height: 100vh; z-index: 30; }
.qr-main { flex: 1 1 auto; min-width: 0; }
.page-head .ph-text { min-width: 0; }
.page-head h1:empty { display: none; }

.qr-sb-head { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 10px; }
.qr-brand { display: flex; align-items: center; gap: 10px; padding: 6px 6px 2px; color: var(--ink); font-weight: 600; font-size: 19px; letter-spacing: -.02em; }
.qr-brand:hover { text-decoration: none; color: var(--ink); }
.qr-brand-mark { width: 32px; height: 32px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; color: #fff; font-size: 14px; flex-shrink: 0; }
.qr-brand-logo { width: 32px; height: 32px; border-radius: 10px; object-fit: contain; flex-shrink: 0; }
html.mx-sb-collapsed .qr-brand-word, html.mx-sb-collapsed .workspace-switcher, html.mx-sb-collapsed .qr-me-meta,
html.mx-sb-collapsed .qr-me-out, html.mx-sb-collapsed .qr-back span { display: none; }
html.mx-sb-collapsed .qr-brand { justify-content: center; padding: 6px 0 2px; }

/* Workspace switcher */
.workspace-switcher { position: relative; }
.workspace-switcher-btn { display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--surface-2); color: var(--ink); font-size: 13px; font-weight: 500; cursor: pointer; text-align: left; }
.workspace-switcher-btn:hover { background: var(--chip); }
/* The shared workspace icon: letters in white on the workspace colour (set
   inline by the switcher script), covered by the uploaded image when there is
   one. The letters stay underneath so a failed image still reads as this
   workspace. Sized inside the row's line box, so rows keep their height. */
.ws-icon-dot, .ws-active-dot, .ws-item-dot { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 5px; background: var(--accent); flex-shrink: 0; color: #fff; font-size: 9px; font-weight: 700; line-height: 1; letter-spacing: .02em; }
.ws-icon-dot img, .ws-active-dot img, .ws-item-dot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ws-active-dot { width: 26px; height: 26px; border-radius: 6px; font-size: 12px; }
.ws-current-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-switch-chevron { color: var(--muted); font-size: 10px; transition: transform .15s; }
.workspace-dropdown { display: none; position: fixed; z-index: 19500; background: #fff; border-radius: 14px; box-shadow: var(--sh-pop); padding: 6px; max-height: 70vh; overflow-y: auto; }
.workspace-dropdown.open { display: block; }
.ws-dropdown-active-header { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.ws-active-info { flex: 1; min-width: 0; }
.ws-active-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-active-sub, .ws-dropdown-label { font-size: 11px; color: var(--muted); }
.ws-dropdown-label { font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 6px 10px 4px; }
.ws-dropdown-divider { height: 1px; background: var(--border-soft); margin: 4px 0; }
.ws-dropdown-empty { font-size: 12.5px; color: var(--muted); padding: 6px 10px 8px; }
.ws-item-row { display: flex; align-items: center; gap: 2px; }
.workspace-dropdown-item, .ws-dropdown-action { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: transparent; border-radius: 9px; font: inherit; font-size: 13.5px; color: var(--ink-2); cursor: pointer; text-align: left; width: 100%; }
.workspace-dropdown-item:hover, .ws-dropdown-action:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.ws-dropdown-action i { width: 14px; text-align: center; color: var(--muted); font-size: 12px; }
.ws-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-item-delete, .ws-active-delete { width: 30px; height: 30px; border: 0; background: transparent; border-radius: 8px; color: var(--faint); cursor: pointer; flex-shrink: 0; }
.ws-item-delete:hover, .ws-active-delete:hover { background: #FEF2F2; color: var(--red); }
.workspace-create-form { display: none; padding: 8px 10px 6px; }
.workspace-create-form.open { display: block; }
.workspace-create-form input { width: 100%; height: 36px; border-radius: 9px; border: 1px solid transparent; background: var(--surface-2); padding: 0 10px; font: inherit; font-size: 13.5px; outline: none; }
.workspace-create-form input:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px var(--tint-16); }
.ws-create-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 8px; }

/* Me block */
.qr-sb-me { border-top: 1px solid var(--border-soft); margin-top: 6px; padding-top: 8px; }
.qr-me { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.qr-me-av { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #0099CC); color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.qr-me-meta { flex: 1; min-width: 0; }
.qr-me-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-me-sub { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-me-out { margin: 0; }
.qr-me-out button { width: 30px; height: 30px; border: 0; background: transparent; border-radius: 8px; color: var(--muted); cursor: pointer; }
.qr-me-out button:hover { background: var(--surface-2); color: var(--ink); }
.qr-back { display: flex; align-items: center; gap: 10px; padding: 8px 8px 2px; font-size: 12.5px; color: var(--ink-2); }
.qr-back:hover { color: var(--ink); text-decoration: none; }

/* Phone top bar extras (soft.css owns .m-top / .m-tabs) */
.qr-mtop .ws { border: 0; background: transparent; padding: 0; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; min-width: 0; }
.qr-mtop-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46vw; }
.qr-mtop a.ib { color: var(--ink-2); }

/* Flash fallback (converted to toasts when the runtime loads) */
.qr-flash { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.qr-flash li { padding: 10px 14px; border-radius: 12px; background: var(--tint-8); color: var(--accent-deep); font-size: 13px; }
.qr-flash .qr-flash-success { background: #ECFDF5; color: #047857; }
.qr-flash .qr-flash-error { background: #FEF2F2; color: #B91C1C; }
.qr-flash .qr-flash-warning { background: #FFFBEB; color: #B45309; }

/* Chat launcher sits above the phone tabs */
@media (max-width: 768px) { .chat-toggle-fab { bottom: 84px !important; } }

/* ── Form controls (real inputs on the Soft .inp look) ──────────────────── */
.inp { font: inherit; outline: none; transition: border-color .12s, box-shadow .12s, background .12s; }
input.inp, select.inp, textarea.inp { display: block; width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid transparent; font-size: 14px; color: var(--ink); }
textarea.inp { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
select.inp { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat; background-position: right 12px center; }
input.inp:focus, select.inp:focus, textarea.inp:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px var(--tint-16); }
input.inp::placeholder, textarea.inp::placeholder { color: var(--muted); }
.inp.is-invalid, input.inp[aria-invalid="true"] { border-color: color-mix(in srgb, var(--red) 55%, transparent); background: #fff; }
.inp-group { display: flex; align-items: center; gap: 0; border-radius: 10px; background: var(--surface-2); border: 1px solid transparent; }
.inp-group:focus-within { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px var(--tint-16); }
.inp-group .pre { padding: 0 2px 0 12px; color: var(--muted); font-size: 13px; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.inp-group input.inp { background: transparent; border: 0; box-shadow: none; padding-left: 4px; }
.err { font-size: 12px; color: #B91C1C; margin-top: 5px; }
.frow { margin-bottom: 14px; min-width: 0; }
.frow:last-child { margin-bottom: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
/* Switch (real checkbox) */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .tr { width: 40px; height: 22px; border-radius: 999px; background: #d1d5db; position: relative; flex-shrink: 0; transition: background .15s; }
.switch .tr::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + .tr { background: var(--accent); }
.switch input:checked + .tr::after { transform: translateX(18px); }
.switch input:focus-visible + .tr { box-shadow: 0 0 0 3px var(--tint-16); }
/* Segmented control on real radio inputs */
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; flex-wrap: wrap; max-width: 100%; }
.seg label { position: relative; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.seg label i { font-size: 11px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked), .seg label.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15,23,42,.12); }
.seg label:has(input:disabled) { opacity: .45; cursor: not-allowed; }

/* ── Chips ─────────────────────────────────────────────────────────────── */
.chip.k-link { background: var(--tint-12); color: var(--accent-deep); }
.chip.k-qr { background: #f5f0ff; color: #6d28d9; }
.chip.k-both { background: #ECFDF5; color: #047857; }
.chip.st-on { background: #ECFDF5; color: #047857; }
.chip.st-off { background: var(--chip); color: var(--muted); }
.chip.st-sched { background: #FFF7ED; color: #b45309; }
.chip.st-lock { background: var(--chip); color: var(--ink-2); }
.chip i { font-size: 9px; }
button.chip { border: 0; cursor: pointer; font-family: inherit; }

/* ── Thumbnails (real renders) ─────────────────────────────────────────── */
.qrthumb { width: 40px; height: 40px; border-radius: 9px; background: #fff; border: 1px solid var(--border-soft); display: grid; place-items: center; overflow: hidden; flex-shrink: 0; padding: 3px; }
.qrthumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.qrthumb.sm { width: 24px; height: 24px; border-radius: 6px; padding: 2px; }
.qrthumb.md { width: 52px; height: 52px; border-radius: 14px; padding: 4px; }
.qrthumb.lg { width: 220px; height: 220px; border-radius: 16px; padding: 12px; }
.qrthumb.link { background: var(--tint-12); color: var(--accent-ink); font-size: 14px; border-color: transparent; padding: 0; }
.qrthumb.sm.link { font-size: 10px; }
.qrthumb.md.link { font-size: 18px; }
.qrthumb.lg.link { font-size: 54px; }
.paper { display: grid; place-items: center; padding: 18px; background: var(--surface-2); border-radius: 14px; width: 100%; }

/* ── Short link pill with copy ─────────────────────────────────────────── */
.slink { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px; border-radius: 999px; background: var(--surface-2); font-size: 12.5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink); max-width: 100%; min-width: 0; white-space: nowrap; }
.slink .dom { color: var(--muted); overflow: hidden; text-overflow: ellipsis; flex: 0 1000 auto; min-width: 0; }
.slink b { color: var(--accent-deep); font-weight: 600; overflow: hidden; text-overflow: ellipsis; min-width: 2.5em; flex: 0 1 auto; }
.slink .dom + b { margin-left: -8px; }
.slink .cp { width: 24px; height: 24px; border-radius: 999px; background: #fff; border: 1px solid var(--border-soft); display: grid; place-items: center; font-size: 10px; color: var(--ink-2); font-family: Inter, sans-serif; cursor: pointer; flex-shrink: 0; padding: 0; }
.slink .cp:hover { color: var(--accent-ink); border-color: var(--tint-16); }
.dest { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; display: block; }

/* ── Sparklines, scans and deltas ──────────────────────────────────────── */
.spark { display: inline-flex; align-items: flex-end; gap: 2px; height: 22px; }
.spark i { width: 4px; border-radius: 2px; background: color-mix(in srgb, var(--accent) 55%, #fff); display: block; min-height: 2px; }
.spark i.hi { background: var(--accent); }
.scans { display: flex; align-items: center; gap: 10px; }
.scans b { font-size: 14px; font-variant-numeric: tabular-nums; }
.scans .d { font-size: 11px; color: var(--green); font-weight: 600; }
.scans .d.down { color: var(--red); }

/* ── Analytics ─────────────────────────────────────────────────────────── */
.chart { height: 220px; border-radius: 12px; background: var(--surface-2); position: relative; overflow: hidden; padding: 10px 8px 4px; }
.chart.sm { height: 180px; }
.chart canvas { width: 100% !important; height: 100% !important; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; pointer-events: none; }
.barlist { display: flex; flex-direction: column; gap: 10px; }
.barlist .r { display: grid; grid-template-columns: 110px minmax(0,1fr) 44px; gap: 10px; align-items: center; font-size: 13px; }
.barlist .r .l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; gap: 8px; align-items: center; min-width: 0; }
.barlist .r .l i { width: 18px; text-align: center; color: var(--muted); font-size: 11px; flex-shrink: 0; }
.barlist .r .l .cc { width: 22px; height: 16px; border-radius: 4px; background: var(--chip); color: var(--ink-2); font-size: 9.5px; font-weight: 700; display: inline-grid; place-items: center; flex-shrink: 0; letter-spacing: .02em; }
.barlist .r .b { height: 8px; border-radius: 999px; background: var(--chip); overflow: hidden; }
.barlist .r .b i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.barlist .r .n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12.5px; }
.barnote { font-size: 12px; color: var(--muted); margin-top: 10px; }
.seg-range { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.seg-range a, .seg-range button { padding: 5px 12px; border-radius: 999px; font-size: 12.5px; color: var(--ink-2); border: 0; background: transparent; cursor: pointer; font-family: inherit; }
.seg-range a.on, .seg-range button.on { background: #fff; color: var(--ink); box-shadow: var(--sh-card); font-weight: 600; }
.geo { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.geo > * { min-width: 0; }
.visit { display: grid; grid-template-columns: 28px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.visit:last-child { border-bottom: 0; }
.visit > div { min-width: 0; }
.visit > div > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visit .ic { width: 28px; height: 28px; border-radius: 8px; background: var(--chip); color: var(--ink-2); display: grid; place-items: center; font-size: 11px; }
.visit .s { font-size: 12px; color: var(--muted); }
.visit .t { text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; }
.visit.is-new { animation: qrFadeIn .6s ease; }
@keyframes qrFadeIn { from { opacity: 0; transform: translateY(-4px); background: var(--tint-8); } to { opacity: 1; transform: none; background: transparent; } }

/* ── Codes and links: gallery (default) and list ───────────────────────── */
.views-tabs a { cursor: pointer; }
.views-tabs a:hover { color: var(--ink); text-decoration: none; }
.views-tabs .saved { display: inline-flex; align-items: center; gap: 6px; }
.views-tabs .saved .x { border: 0; background: transparent; color: var(--faint); cursor: pointer; padding: 0 0 0 2px; font-size: 10px; }
.views-tabs .saved .x:hover { color: var(--red); }
button.tb-btn { font-family: inherit; }
.tb-pop { position: relative; }
.menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 19400; background: #fff; border-radius: 14px; box-shadow: var(--sh-pop); padding: 6px; min-width: 220px; display: none; }
.menu.right { left: auto; right: 0; }
.menu.open { display: block; }
.menu .h { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 6px 10px 6px; }
.menu .o { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border-radius: 9px; font-size: 13.5px; cursor: pointer; border: 0; background: transparent; color: var(--ink); text-align: left; font-family: inherit; }
.menu .o:hover { background: var(--surface-2); text-decoration: none; }
.menu .o.on { background: var(--tint-12); color: var(--accent-deep); font-weight: 500; }
.menu .o i { width: 14px; text-align: center; font-size: 12px; color: var(--muted); }
.menu .o .ck { margin-left: auto; font-size: 10px; color: var(--accent-ink); }
.menu .o.danger { color: #B91C1C; } .menu .o.danger i { color: #B91C1C; }
.menu .sep { height: 1px; background: var(--border-soft); margin: 4px 0; }
.menu form { margin: 0; }
.menu .fgrid { padding: 6px 10px 10px; display: flex; flex-direction: column; gap: 10px; min-width: 240px; }
.menu .fgrid .lbl { margin-bottom: 4px; }
.bulkbar { display: none; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 10px; border-radius: 12px; background: var(--tint-6); }
.bulkbar.on { display: flex; }
.bulkbar .tb-right { margin-left: auto; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(224px, 1fr)); gap: 14px; padding: 16px; }
.gcard { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border-soft); border-radius: 14px; background: #fff; color: inherit; min-width: 0; transition: box-shadow .15s, transform .15s, border-color .15s; }
.gcard:hover { box-shadow: var(--sh-pop); transform: translateY(-1px); border-color: var(--border); text-decoration: none; color: inherit; }
.gcard.dim { opacity: .7; }
.gcard.sel-on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--tint-12); }
.gcard .sel { position: absolute; top: 10px; left: 10px; z-index: 2; width: 16px; height: 16px; accent-color: var(--accent); opacity: 0; margin: 0; }
.gcard:hover .sel, .gcard .sel:checked, .has-sel .gcard .sel { opacity: 1; }
.gcard .acts { position: absolute; top: 6px; right: 6px; z-index: 2; display: inline-flex; gap: 2px; background: #fff; border-radius: 10px; box-shadow: var(--sh-card); padding: 2px; opacity: 0; transition: opacity .12s; }
.gcard:hover .acts, .gcard .acts:focus-within { opacity: 1; }
.gcard .art { display: grid; place-items: center; padding: 14px; background: var(--surface-2); border-radius: 12px; }
.gcard .art .qrthumb { width: 124px; height: 124px; padding: 8px; border: 0; border-radius: 12px; }
.gcard .art .qrthumb.link { font-size: 34px; }
.gcard .t { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.gcard .slink { max-width: 100%; overflow: hidden; align-self: flex-start; }
.gcard .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.gcard .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border-soft); }
.gcard .last { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.gcard .last .v { max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcard .last .v .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tbl .name-cell > div { min-width: 0; }
.tbl tr.dim td { opacity: .7; }
.tbl tr.sel-on td { background: var(--tint-6); }
.tbl .chk input { margin: 0; }
.tbl .row-actions form { display: inline; margin: 0; }
.tbl .row-actions { position: relative; }
.tbl-foot .pg a, .tbl-foot .pg span.cur { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border-soft); background: #fff; color: var(--ink-2); display: inline-grid; place-items: center; font-size: 12.5px; }
.tbl-foot .pg span.cur { background: var(--tint-12); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.tbl-foot .pg a.off { pointer-events: none; opacity: .4; }
.col-off { display: none !important; }
.list-empty { padding: 56px 20px; text-align: center; }
.list-empty .ico { width: 56px; height: 56px; border-radius: 16px; background: var(--tint-12); color: var(--accent-ink); display: grid; place-items: center; font-size: 22px; margin: 0 auto 14px; }
.list-empty h3 { margin: 0 0 6px; font-size: 16px; }
.list-empty p { color: var(--muted); margin: 0 0 16px; font-size: 13.5px; }
.list-empty .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }


/* Gallery / list switch (set on <html> before paint from qr.codes.view) */
html[data-qr-view="list"] .codes-gallery { display: none; }
html:not([data-qr-view="list"]) .codes-list-scroll { display: none; }
html:not([data-qr-view="list"]) .only-list { display: none; }
.view-seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15,23,42,.12); }
.gcard-hit { position: absolute; inset: 0; z-index: 1; border-radius: 14px; }
.gcard-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gcard .slink .cp, .gcard [data-set-lf], .gcard .acts .tb-pop { position: relative; z-index: 2; }
.gcard .acts .menu { top: calc(100% + 4px); }
.codes-list-scroll { overflow-x: auto; }
.gcard:has(.menu.open) { transform: none; z-index: 5; }
.gcard .acts:has(.menu.open), .tbl .row-actions:has(.menu.open) { opacity: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.menu label.o { cursor: pointer; }
.menu label.o input { width: 15px; height: 15px; accent-color: var(--accent); margin: 0; }

/* ── Detail ────────────────────────────────────────────────────────────── */
.detail-head > div:nth-child(2) { min-width: 0; }
.detail-head .meta > * { min-width: 0; }
.alias { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; min-width: 0; }
.alias > code { flex: 1 1 auto; }
.alias > code, .alias > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alias .btn { flex-shrink: 0; }
.alias:last-child { border-bottom: 0; }
.alias code, .mono { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.field .v.edit { cursor: pointer; }
.field .v.static { cursor: default; }
.field .v.static:hover { background: transparent; }
.field .v .chip + .chip { margin-left: 4px; }
.field.wide { grid-template-columns: 120px minmax(0,1fr); align-items: start; }
.field.wide .k { padding-top: 8px; }
.inline-ed { display: flex; flex-direction: column; gap: 8px; width: 100%; padding: 4px 0; grid-column: 1 / -1; min-width: 0; }
.inline-ed .acts { display: flex; gap: 6px; justify-content: flex-end; }
.inline-ed .utm { gap: 8px; }
.rule { display: grid; grid-template-columns: 130px 1fr 24px 1fr auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.rule:last-child { border-bottom: 0; }
.rule .arrow { text-align: center; color: var(--faint); font-size: 11px; }
.rule .dst { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rule > * { min-width: 0; }
.rule form { margin: 0; }
.rule-add { display: grid; grid-template-columns: 130px 1fr 1fr auto; gap: 8px; align-items: center; padding-top: 10px; }
.rule-add > * { min-width: 0; }
.split { display: inline-flex; position: relative; }
.tab-pane { display: none; }
.tab-pane.on { display: block; }
.tabs a { cursor: pointer; }
.tabs a:hover { text-decoration: none; }
.cf-panel .mcf-fields { width: 100%; }

/* ── Wizard (create / edit) ────────────────────────────────────────────── */
.wiz2 { display: grid; grid-template-columns: minmax(0,1fr) 360px; gap: 18px; align-items: start; }
.wiz2 > * { min-width: 0; }
.wiz2 .preview { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 14px; }
.wsteps { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.wsteps a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.wsteps a:hover { background: var(--surface-2); text-decoration: none; }
.wsteps a .n { width: 24px; height: 24px; border-radius: 50%; background: var(--chip); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--ink-2); flex-shrink: 0; }
.wsteps a.done .n { background: #ECFDF5; color: #047857; }
.wsteps a.on { background: var(--tint-8); color: var(--accent-ink); font-weight: 600; }
.wsteps a.on .n { background: var(--accent); color: #fff; }
.wsteps a .s { margin-left: auto; font-size: 11.5px; color: var(--muted); font-weight: 400; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wlayout { display: grid; grid-template-columns: 220px minmax(0,1fr); gap: 18px; align-items: start; }
.wlayout > * { min-width: 0; }
.wpane { display: none; }
.wpane.on { display: block; }
.wpane .card-b { display: flex; flex-direction: column; gap: 18px; }
.tip { padding: 12px 14px; font-size: 12.5px; color: var(--muted); }
.tip i { color: var(--amber); margin-right: 6px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatches .sw { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border); cursor: pointer; padding: 0; position: relative; }
.swatches .sw.on { box-shadow: 0 0 0 2px var(--accent); }
.swatches .sw.pick { background: #fff; display: grid; place-items: center; font-size: 11px; color: var(--muted); overflow: hidden; }
.swatches .sw.pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.swatches .sw.transparent { background-color: #fff; background-image: linear-gradient(45deg,#e2e8f0 25%,transparent 25%,transparent 75%,#e2e8f0 75%),linear-gradient(45deg,#e2e8f0 25%,transparent 25%,transparent 75%,#e2e8f0 75%); background-size: 8px 8px; background-position: 0 0,4px 4px; }
.swatches .hex { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--muted); margin-left: 4px; }
.shapes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.shapes label { aspect-ratio: 1; border-radius: 12px; border: 1px solid var(--border-soft); display: grid; place-items: center; background: #fff; cursor: pointer; position: relative; }
.shapes label input { position: absolute; opacity: 0; pointer-events: none; }
.shapes label:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--tint-12); }
.shapes label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.shapes .m { width: 22px; height: 22px; background: #0f172a; }
.shapes .m.r { border-radius: 6px; } .shapes .m.c { border-radius: 50%; }
.shapes .m.g { background: repeating-linear-gradient(90deg,#0f172a 0 4px,transparent 4px 7px); }
.shapes .m.v { background: repeating-linear-gradient(0deg,#0f172a 0 4px,transparent 4px 7px); }
.shapes .m.h { background: repeating-linear-gradient(90deg,#0f172a 0 8px,transparent 8px 11px); }
.shapes .nm { position: absolute; bottom: -18px; left: 0; right: 0; text-align: center; font-size: 10.5px; color: var(--muted); display: none; }
.logo-tile { display: flex; align-items: center; gap: 8px; width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 13.5px; cursor: pointer; position: relative; overflow: hidden; }
.logo-tile input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.logo-tile .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.contrast { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; font-size: 12.5px; }
.contrast.ok { background: #ECFDF5; color: #065f46; }
.contrast.warn { background: #FFFBEB; color: #92400e; }
.contrast.bad { background: #FEF2F2; color: #991b1b; }
.utm { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.utm > * { min-width: 0; }
.wrule { display: grid; grid-template-columns: 130px 1fr 24px 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.wrule > * { min-width: 0; }
.wrule .arrow { text-align: center; color: var(--faint); font-size: 11px; }
.wiz-foot { display: flex; align-items: center; gap: 8px; padding: 0 18px 16px; }
.wiz-foot .grow { flex: 1; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.wpane .grid2 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.wpane .grid2 > * { min-width: 0; }
.preview .card-b { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.preview .pt { font-size: 12px; color: var(--muted); text-align: center; word-break: break-word; max-width: 100%; }
.preview .fields { width: 100%; margin-top: 6px; }
.preview .slink .cp { cursor: pointer; }
.preview .qrthumb.lg { transition: opacity .2s; }
.preview .qrthumb.lg.loading { opacity: .55; }
.fmt { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.review-list .field .v { cursor: default; }
.review-list .field .v:hover { background: transparent; }

/* ── Import ────────────────────────────────────────────────────────────── */
.colspec { display: grid; grid-template-columns: 140px minmax(0,1fr) 72px; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; align-items: center; }
.colspec > * { min-width: 0; }
.colspec code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: var(--chip); border-radius: 5px; padding: 1px 6px; }
.drop { position: relative; cursor: pointer; }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop.has-file { border-color: var(--accent); background: var(--tint-6); }
.tbl tr.row-warn td { background: #FFFBEB; }
.tbl tr.row-bad td { background: #FEF2F2; }

/* ── Settings hub ──────────────────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 220px minmax(0,1fr); gap: 22px; align-items: start; }
.settings-grid > * { min-width: 0; }
.settings-rail { padding: 8px; position: sticky; top: 16px; }
.settings-cards { display: flex; flex-direction: column; gap: 16px; }
.settings-cards .card { scroll-margin-top: 16px; }
.settings-cards .card-b { display: flex; flex-direction: column; gap: 16px; }
.sform-foot { display: flex; gap: 8px; justify-content: flex-end; }
.dd-design { display: grid; grid-template-columns: 120px minmax(0,1fr); gap: 18px; align-items: center; }
.dd-design .qrthumb.lg { width: 120px; height: 120px; padding: 8px; }
.dd-panel { display: none; border-top: 1px solid var(--border-soft); padding-top: 16px; flex-direction: column; gap: 16px; }
.dd-panel.on { display: flex; }
.member-row, .domain-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; }
.member-row:last-child, .domain-row:last-child { border-bottom: 0; }
.member-row .nm, .domain-row .nm { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-row .em { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-row > div { min-width: 0; flex: 1; }
.member-row .chip, .domain-row .chip { margin-left: auto; flex-shrink: 0; }
.note { font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.note i { color: var(--accent-ink); margin-right: 6px; }

/* ── Fields page wrapper (the runtime renders the manager) ─────────────── */
.fields-host { min-height: 420px; }
.fields-host > .card { overflow: hidden; }

/* ── Public and gate pages ─────────────────────────────────────────────── */
.pub { min-height: 100vh; background: var(--page); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 16px; }
.pub .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; font-weight: 600; font-size: 14px; color: var(--ink-2); flex-wrap: wrap; justify-content: center; text-align: center; }
.pub .brand .mark { width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 14px; overflow: hidden; }
.pub .brand .mark img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.gate { width: 100%; max-width: 440px; background: #fff; border: 1px solid var(--border-soft); border-radius: 20px; box-shadow: 0 12px 40px rgba(15,23,42,.08); padding: 28px; text-align: center; }
.gate h2 { font-size: 19px; font-weight: 700; margin: 0 0 6px; }
.gate p { font-size: 13.5px; color: var(--ink-2); margin: 0 0 16px; line-height: 1.55; }
.gate form { margin: 0; }
.gate .lbl { text-align: left; }
.gate input.inp { height: 44px; }
.gate .btn { height: 44px; }
.gate .gate-err { font-size: 12.5px; color: #B91C1C; margin-top: 8px; text-align: left; }
.gate .gate-path { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--muted); word-break: break-all; }
.state-ico { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; font-size: 24px; margin: 0 auto 14px; }
.state-ico.n { background: var(--chip); color: var(--ink-2); }
.state-ico.am { background: #FFF7ED; color: #b45309; }
.state-ico.a { background: var(--tint-12); color: var(--accent-ink); }
.state-ico.r { background: #FEF2F2; color: #B91C1C; }
.pub-foot { margin-top: 22px; font-size: 12px; color: var(--muted); text-align: center; }

/* ── Mobile (max-width 768px) ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .in-mattering-shell body { padding-top: 0; }
  .main { padding-left: 16px; padding-right: 16px; }
  .wiz2, .wlayout, .geo, .utm, .settings-grid, .dd-design { grid-template-columns: minmax(0,1fr); }
  .wiz2 > *, .wlayout > *, .card, .fact, .fact .v, .fact .v > * { min-width: 0; }
  .fact .v { flex-wrap: wrap; }
  .facts { grid-template-columns: 1fr 1fr !important; }
  .detail-grid { grid-template-columns: minmax(0,1fr) !important; }
  .detail-grid > .col:first-child { order: 0; }
  .page-head .actions .seg-range { display: none; }
  .page-head .actions { flex-wrap: wrap; }
  .wiz2 .preview { position: static; order: -1; }
  .wsteps { flex-direction: row; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 12px; padding: 0 16px; }
  .wsteps::-webkit-scrollbar { display: none; }
  .wsteps a { flex-shrink: 0; white-space: nowrap; }
  .wsteps a .s { display: none; }
  .wlayout .tip { display: none; }
  .rule, .wrule, .rule-add { grid-template-columns: 1fr 1fr; }
  .rule .arrow, .wrule .arrow { display: none; }
  .rule .dst, .wrule > input[type=url], .rule-add > input[type=url] { grid-column: 1 / -1; }
  .shapes { grid-template-columns: repeat(3, 1fr); }
  .barlist .r { grid-template-columns: 90px minmax(0,1fr) 40px; }
  .qrthumb.lg { width: 180px; height: 180px; }
  .wiz-foot { flex-wrap: wrap; }
  .wiz-foot .grow { width: 100%; flex-basis: 100%; }
  .wiz-foot .btn { flex: 1; justify-content: center; }
  .dest { max-width: 100%; }
  .visit .t { display: none; }
  .visit { grid-template-columns: 28px minmax(0,1fr); }
  .settings-rail { display: none; }
  .colspec { grid-template-columns: 110px minmax(0,1fr); }
  .colspec > :last-child { display: none; }
  .import-grid { grid-template-columns: minmax(0,1fr) !important; }
  .detail-head .actions { display: flex !important; flex-wrap: wrap; gap: 8px; width: 100%; margin-left: 0; }
  .detail-head .actions > .split { order: 1; flex: 1 1 auto; min-width: 0; }
  .detail-head .actions > .split > .btn { width: 100%; }
  .detail-head .actions > .tb-pop:not(.split) { order: 2; flex: 0 0 44px; }
  .detail-head .actions > .tb-pop:not(.split) > .btn { width: 44px; }
  .detail-head .actions > form, .detail-head .actions > a.btn { order: 3; flex: 1 1 40%; min-width: 0; }
  .detail-head .actions > form .btn { width: 100%; }
  .detail-head .meta .slink { max-width: calc(100vw - 32px); }
  .menu { max-width: calc(100vw - 32px); }
  .bulkbar .tb-btn { padding: 0 8px; }
  .tbl-foot { flex-wrap: wrap; }
  body:not(:has(.m-top)) { padding-top: 0; padding-bottom: 0; }
  .pub .gate { padding: 22px 18px; }
  .gate { max-width: none; }
  .tb-right .view-seg { display: inline-flex; }
  .gallery { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; padding: 10px; }
  .gcard { padding: 10px; gap: 6px; }
  .gcard .art { padding: 10px; }
  .gcard .art .qrthumb { width: 96px; height: 96px; padding: 6px; }
  .gcard .art .qrthumb.link { font-size: 26px; }
  .gcard .sel { opacity: 1; }
  .gcard .acts { opacity: 1; }
  .gcard .acts > :not(:first-child) { display: none; }
  .gcard .slink { display: none; }
  .gcard .foot .spark { display: none; }
  .gcard .last .v { display: none; }
  .gcard .meta .chip { font-size: 10.5px; padding: 2px 7px; }
  .toolbar .tb-pop:not(.keep) { display: none; }
}

/* ── Agents side panel ──────────────────────────────────────────────────
   html.in-mattering-panel is set by the platform runtime before first paint
   when the page is framed in the Agents chat panel (?chrome=0 or
   window.name === 'mattering-panel'). The runtime hides .mx-sb, .m-top,
   .m-tabs and [data-shell-hide] and zeroes body padding; QR adds only
   what it does not know about: the Create With Agents launcher/panel and
   the desktop page padding sized for a full window, not a 480px panel. */
html.in-mattering-panel #chatToggleFab,
html.in-mattering-panel .chat-panel { display: none !important; }
html.in-mattering-panel .main { padding: 16px 16px 32px; }
