/* Search & Filter Lab - one stylesheet, no framework. */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #64748b;
  --accent: #4f46e5;
  --accent-2: #6366f1;
  --accent-soft: #eef2ff;
  --accent-ink: #3730a3;
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --err: #dc2626;
  --err-soft: #fee2e2;
  --mark: #fef08a;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .05);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, .16);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, "SFMono-Regular", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text);
  background: var(--bg); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
code, kbd, pre { font-family: var(--mono); font-size: .86em; }
mark { background: var(--mark); color: inherit; padding: 0 .1em; border-radius: 3px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: middle; }
.i.sm { width: 15px; height: 15px; }
.i.lg { width: 24px; height: 24px; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 24px; }
.wrap.narrow { max-width: 1040px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1320px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; gap: 22px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 1.02rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand b { color: var(--accent); }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #6366f1, #4338ca); box-shadow: 0 4px 12px rgba(79, 70, 229, .35); }
.brand-mark .i { stroke-width: 2.4; }
.mainnav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a { display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 9px; color: var(--text-2); font-weight: 500; font-size: .92rem; white-space: nowrap; }
.mainnav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.mainnav a.active { background: var(--accent-soft); color: var(--accent-ink); }

.usermenu { position: relative; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: 9px; cursor: pointer; padding: 5px 8px 5px 5px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover { border-color: var(--border-strong); }
.usermenu-name { display: flex; flex-direction: column; line-height: 1.15; font-size: .84rem; }
.usermenu-name small { color: var(--muted); font-size: .74rem; }
.usermenu-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 320px; max-height: 70vh; overflow: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 12px; }
.userlist { display: grid; gap: 2px; }
.userlist button { display: flex; align-items: center; gap: 10px; text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: 9px; cursor: pointer; font: inherit; }
.userlist button:hover { background: var(--surface-2); }
.userlist button.current { background: var(--accent-soft); }
.userlist span:last-child { display: flex; flex-direction: column; line-height: 1.2; font-size: .86rem; }
.userlist small { color: var(--muted); font-size: .76rem; }

.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: .78rem; flex: none; letter-spacing: .02em; }
.avatar.sm { width: 26px; height: 26px; font-size: .68rem; }
.avatar.xs { width: 20px; height: 20px; font-size: .58rem; }

/* ---------- buttons, inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid rgba(99, 102, 241, .35); outline-offset: 1px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(79, 70, 229, .3); }
.btn.primary:hover { background: #4338ca; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--err); }
.btn.danger:hover { background: var(--err-soft); border-color: #fca5a5; }
.btn.sm { height: 31px; padding: 0 11px; font-size: .84rem; border-radius: 8px; }
.btn.icon { width: 34px; padding: 0; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

input[type=text], input[type=search], input[type=date], input[type=number], select, textarea {
  font: inherit; font-size: .92rem; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 8px; height: 36px; padding: 0 10px; min-width: 0; }
textarea { height: auto; padding: 8px 10px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-2); outline: none; box-shadow: 0 0 0 3px rgba(99, 102, 241, .18); }
label { cursor: pointer; }
.field { display: grid; gap: 5px; }
.field > span { font-size: .8rem; font-weight: 600; color: var(--text-2); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.section-title { display: flex; align-items: center; gap: 8px; font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; margin: 0 0 10px; }

.flash-area { max-width: 1320px; margin: 0 auto; padding: 0 24px; }
.flash { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 11px 14px; border-radius: 10px; font-weight: 500; font-size: .92rem; }
.flash.ok { background: var(--ok-soft); color: #14532d; border: 1px solid #bbf7d0; }
.flash.err { background: var(--err-soft); color: #7f1d1d; border: 1px solid #fecaca; }

/* ---------- search box ---------- */
.searchbox { position: relative; }
.searchbox-field { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: 14px;
  padding: 6px 6px 6px 14px; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.searchbox-field:focus-within { border-color: var(--accent-2); box-shadow: 0 0 0 4px rgba(99, 102, 241, .15), var(--shadow); }
.searchbox-field .lead { color: var(--muted); width: 20px; height: 20px; }
.searchbox-field input { flex: 1; border: 0; height: 42px; font-size: 1.05rem; padding: 0 4px; background: transparent; box-shadow: none !important; }
.searchbox-field input::-webkit-search-cancel-button { cursor: pointer; }
.hint-key { border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; padding: 1px 7px; color: var(--muted); font-size: .78rem; background: var(--surface-2); }
.searchbox-field .btn { height: 42px; padding: 0 20px; border-radius: 10px; }
.modes { display: flex; align-items: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.modes-label { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-right: 2px; }
.modes label input { position: absolute; opacity: 0; pointer-events: none; }
.modes label span { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: .86rem; font-weight: 500; color: var(--text-2); }
.modes label:hover span { border-color: var(--border-strong); }
.modes label input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.modes label input:focus-visible + span { outline: 3px solid rgba(99, 102, 241, .35); }

/* auto-complete drop-down */
.ac { position: absolute; z-index: 40; left: 0; right: 0; top: 60px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 8px; max-height: 70vh; overflow: auto; }
.ac-group { padding: 4px 0; }
.ac-group + .ac-group { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 8px; }
.ac-title { display: flex; align-items: center; gap: 6px; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; padding: 2px 10px 6px; }
.ac-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--text); cursor: pointer; }
.ac-item:hover, .ac-item.active { background: var(--accent-soft); text-decoration: none; }
.ac-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-item .hint { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.ac-item .code { font-family: var(--mono); font-size: .78rem; color: var(--muted); }
.ac-item b { font-weight: 700; }
.ac-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.ac-foot { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px 2px; font-size: .76rem; color: var(--muted); border-top: 1px solid var(--border); margin-top: 6px; }
.ac-empty { padding: 14px 10px; color: var(--muted); font-size: .9rem; }

/* ---------- dashboard ---------- */
.hero { background: radial-gradient(1200px 300px at 10% -20%, #e0e7ff 0, transparent 60%), radial-gradient(900px 300px at 100% 0, #fae8ff 0, transparent 55%), var(--surface);
  border: 1px solid var(--border); border-radius: 20px; padding: 36px 36px 28px; box-shadow: var(--shadow); }
.hero h1 { font-size: 2.1rem; }
.hero p.lead { font-size: 1.05rem; color: var(--text-2); max-width: 720px; }
.hero form { margin-top: 20px; max-width: 860px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-size: .86rem; }
.pill:hover { border-color: var(--accent-2); color: var(--accent-ink); text-decoration: none; }
.pill small { color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 20px 0; }
.stat { padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.stat-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.stat b { font-size: 1.45rem; display: block; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .84rem; }
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; padding: 16px; }
.feature { display: flex; gap: 12px; padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); transition: border-color .15s, transform .15s, box-shadow .15s; }
.feature:hover { border-color: #c7d2fe; box-shadow: 0 6px 20px rgba(79, 70, 229, .12); transform: translateY(-1px); text-decoration: none; }
.feature-no { font-family: var(--mono); font-size: .72rem; color: var(--accent); font-weight: 700; }
.feature-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.feature h3 { margin: 0 0 3px; font-size: .94rem; }
.feature p { margin: 0; font-size: .8rem; color: var(--muted); line-height: 1.4; }
.side-list { list-style: none; margin: 0; padding: 6px; }
.side-list li a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--text); }
.side-list li a:hover { background: var(--surface-2); text-decoration: none; }
.side-list .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-list small { color: var(--muted); }

/* ---------- search page ---------- */
.search-top { display: grid; gap: 14px; margin-bottom: 18px; }
.quickbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.quick { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: .85rem; font-weight: 500; }
.quick:hover { border-color: var(--border-strong); text-decoration: none; }
.quick .dot { width: 9px; height: 9px; border-radius: 50%; }
.quick.add { border-style: dashed; color: var(--accent); background: transparent; cursor: pointer; font: inherit; font-size: .85rem; font-weight: 600; }
.layout { display: grid; grid-template-columns: 290px 1fr; gap: 20px; align-items: start; }
.filters { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow: auto; padding: 4px 0; }
.filters-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 6px; }
.filters-head h2 { margin: 0; font-size: 1rem; display: flex; gap: 8px; align-items: center; }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700; }
.badge.soft { background: var(--accent-soft); color: var(--accent-ink); }
.fgroup { border-top: 1px solid var(--border); padding: 12px 16px; }
.fgroup:first-of-type { border-top: 0; }
.fgroup > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-weight: 600; font-size: .9rem; gap: 8px; }
.fgroup > summary::-webkit-details-marker { display: none; }
.fgroup > summary .i.chev { transition: transform .15s; color: var(--muted); }
.fgroup[open] > summary .i.chev { transform: rotate(180deg); }
.fgroup > summary .ttl { display: flex; align-items: center; gap: 8px; }
.fgroup > summary .ttl .i { color: var(--muted); }
.fgroup-body { margin-top: 10px; display: grid; gap: 2px; }
.check { display: flex; align-items: center; gap: 9px; padding: 5px 6px; border-radius: 7px; font-size: .88rem; }
.check:hover { background: var(--surface-2); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; flex: none; }
.check .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check .count { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; background: var(--surface-2); border-radius: 999px; padding: 0 7px; }
.check.zero { opacity: .5; }
.check .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.tagcloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tagtoggle input { position: absolute; opacity: 0; pointer-events: none; }
.tagtoggle span { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: .8rem; background: var(--surface); }
.tagtoggle span em { font-style: normal; color: var(--muted); font-size: .72rem; }
.tagtoggle input:checked + span { border-color: currentColor; background: color-mix(in srgb, currentColor 12%, white); font-weight: 600; }
.tagtoggle input:focus-visible + span { outline: 3px solid rgba(99, 102, 241, .35); }
.tagtoggle.zero span { opacity: .45; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.seg label input { position: absolute; opacity: 0; pointer-events: none; }
.seg label span { display: block; padding: 3px 10px; font-size: .78rem; font-weight: 600; color: var(--text-2); }
.seg label input:checked + span { background: var(--accent); color: #fff; }
.seg label + label span { border-left: 1px solid var(--border-strong); }
.daterow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.daterow input { width: 100%; }
.presets { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.presets button { border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px; padding: 2px 9px; font: inherit; font-size: .76rem; cursor: pointer; color: var(--text-2); }
.presets button:hover { border-color: var(--accent-2); color: var(--accent-ink); }
.ownerfind { width: 100%; margin-bottom: 6px; height: 32px !important; }
.more-link { border: 0; background: none; color: var(--accent); font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; padding: 4px 6px; text-align: left; }
.filters-foot { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.filters-foot .btn { flex: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 4px 0 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border-strong); font-size: .84rem; }
.chip small { color: var(--muted); font-size: .74rem; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.chip a { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.chip a:hover { background: var(--err-soft); color: var(--err); }
.chip a .i { width: 13px; height: 13px; stroke-width: 2.4; }
.clear-all { display: inline-flex; align-items: center; gap: 5px; font-size: .84rem; font-weight: 600; color: var(--err); padding: 0 8px; }

.result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.result-head h1 { font-size: 1.25rem; margin: 0; }
.result-head .meta { color: var(--muted); font-size: .84rem; }
.result-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.result-tools select { height: 34px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 10px; background: #fffbeb; border: 1px solid #fde68a; color: #78350f; margin-bottom: 12px; font-size: .9rem; }
.notice.info { background: var(--accent-soft); border-color: #c7d2fe; color: var(--accent-ink); }
.notice .i { margin-top: 2px; }
.notice code { background: rgba(255, 255, 255, .7); padding: 0 5px; border-radius: 4px; }

.results { display: grid; gap: 10px; }
.hit { display: grid; grid-template-columns: 46px 1fr auto; gap: 14px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); transition: border-color .15s, box-shadow .15s; }
.hit:hover { border-color: #c7d2fe; box-shadow: 0 6px 20px rgba(15, 23, 42, .07); }
.hit-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; }
.hit-icon .i { width: 22px; height: 22px; }
.hit-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hit-title a { font-weight: 650; font-size: 1rem; color: var(--text); }
.hit-title a:hover { color: var(--accent); }
.code-badge { font-family: var(--mono); font-size: .74rem; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.hit-desc { color: var(--text-2); font-size: .88rem; margin: 4px 0 8px; }
.hit-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .8rem; color: var(--muted); align-items: center; }
.hit-meta span { display: inline-flex; align-items: center; gap: 5px; }
.hit-meta .i { width: 14px; height: 14px; }
.hit-side { text-align: right; display: grid; gap: 6px; align-content: start; justify-items: end; }
.price { font-weight: 700; font-variant-numeric: tabular-nums; }
.score { font-size: .72rem; color: var(--muted); font-family: var(--mono); }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tagchip { display: inline-block; padding: 0 8px; border-radius: 999px; font-size: .72rem; font-weight: 600; line-height: 1.7; }

.empty { text-align: center; padding: 50px 20px; }
.empty-icon { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty-icon .i { width: 30px; height: 30px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 4px; margin: 18px 0 6px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 36px; height: 36px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 9px; color: var(--text-2); font-weight: 600; font-size: .88rem; }
.pager a:hover { background: var(--surface); text-decoration: none; box-shadow: var(--shadow); }
.pager .current { background: var(--accent); color: #fff; }
.pager .gap { color: var(--muted); }

.sqlbox { margin-top: 16px; }
.sqlbox summary { cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; padding: 12px 16px; list-style: none; }
.sqlbox summary::-webkit-details-marker { display: none; }
.sqlbox pre { margin: 0; padding: 16px 18px; background: #0f172a; color: #e2e8f0; overflow: auto; font-size: .8rem; line-height: 1.55; border-radius: 0 0 var(--radius) var(--radius); }
.sql-kw { color: #93c5fd; font-weight: 600; }
.sql-p { color: #fcd34d; }
.sql-s { color: #86efac; }
.params { width: 100%; border-collapse: collapse; font-size: .82rem; }
.params td { padding: 6px 16px; border-top: 1px solid var(--border); font-family: var(--mono); }
.params td:first-child { color: #b45309; width: 90px; }

/* ---------- dialogs ---------- */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(460px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.dlg-head { padding: 18px 20px 6px; }
.dlg-head h2 { margin: 0 0 4px; }
.dlg-body { padding: 10px 20px; display: grid; gap: 14px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; }
.colors { display: flex; gap: 8px; }
.colors label input { position: absolute; opacity: 0; }
.colors label span { display: block; width: 26px; height: 26px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--border-strong); }
.colors label input:checked + span { box-shadow: 0 0 0 2px var(--text); }
.summary-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 9px 12px; font-size: .85rem; color: var(--text-2); }

/* ---------- tables (history, saved) ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.table td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fafbff; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.table .actions form { margin: 0; }
.mode-tag { font-size: .7rem; font-weight: 700; padding: 1px 7px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.zero-tag { color: var(--err); font-weight: 700; }
.bars { display: grid; gap: 10px; padding: 16px 20px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 34px; gap: 10px; align-items: center; font-size: .86rem; }
.bar-row a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #818cf8, #4f46e5); }
.two-col { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
.stack { display: grid; gap: 18px; }
.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toolbar form { display: flex; gap: 8px; }
.inline-rename { display: flex; gap: 6px; }
.inline-rename input { height: 31px; }

/* ---------- advanced search ---------- */
.cond-list { display: grid; gap: 10px; }
.cond { display: grid; grid-template-columns: 34px 200px 200px 1fr 34px; gap: 8px; align-items: center; padding: 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.cond .joiner { font-size: .7rem; font-weight: 800; color: var(--accent); text-align: center; }
.cond select, .cond input { width: 100%; }
.cond-value-wrap { display: flex; gap: 6px; align-items: center; }
.cond-value-wrap > * { flex: 1; }
.adv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.preview-qs { font-family: var(--mono); font-size: .78rem; word-break: break-all; color: var(--text-2); background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 8px; padding: 8px 10px; }

/* ---------- asset page ---------- */
.asset-head { display: flex; gap: 18px; align-items: flex-start; }
.asset-icon { width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center; flex: none; }
.asset-icon .i { width: 30px; height: 30px; }
.dl { display: grid; grid-template-columns: 150px 1fr; margin: 0; }
.dl dt { color: var(--muted); font-size: .84rem; padding: 9px 0; border-bottom: 1px solid var(--border); }
.dl dd { margin: 0; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: .92rem; }
.codes { display: grid; gap: 14px; justify-items: center; padding: 20px; }
.codes img { max-width: 100%; border: 1px solid var(--border); border-radius: 10px; background: #fff; padding: 6px; }
.codes .qr { width: 180px; height: 180px; }
.crumbs { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: .86rem; margin-bottom: 14px; }

/* ---------- scan page ---------- */
.scan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.scan-card h2 { display: flex; align-items: center; gap: 10px; }
.scan-card .step-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.video-box { position: relative; aspect-ratio: 4 / 3; background: #0f172a; border-radius: 12px; overflow: hidden; display: grid; place-items: center; color: #94a3b8; font-size: .88rem; text-align: center; }
.video-box video { width: 100%; height: 100%; object-fit: cover; }
.video-box .frame { position: absolute; inset: 18% 12%; border: 2px solid rgba(255, 255, 255, .8); border-radius: 14px; box-shadow: 0 0 0 9999px rgba(15, 23, 42, .35); }
.video-box .laser { position: absolute; left: 14%; right: 14%; top: 50%; height: 2px; background: #f43f5e; box-shadow: 0 0 12px #f43f5e; animation: laser 1.6s ease-in-out infinite alternate; }
@keyframes laser { from { top: 24%; } to { top: 76%; } }
.dropzone { border: 2px dashed var(--border-strong); border-radius: 12px; padding: 26px 16px; text-align: center; color: var(--muted); transition: border-color .15s, background .15s; cursor: pointer; display: block; }
.dropzone.over, .dropzone:hover { border-color: var(--accent-2); background: var(--accent-soft); color: var(--accent-ink); }
.scan-result { margin-top: 14px; }
.result-card { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; border: 1px solid #bbf7d0; background: var(--ok-soft); }
.result-card.bad { border-color: #fecaca; background: var(--err-soft); }
.samples { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.samples button { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 8px; cursor: pointer; font: inherit; font-size: .74rem; color: var(--text-2); }
.samples button:hover { border-color: var(--accent-2); }
.samples img { height: 46px; }

/* ---------- learn page ---------- */
.learn-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 22px; }
.learn-nav a { font-size: .8rem; padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); }
.learn-card { scroll-margin-top: 80px; }
.learn-card + .learn-card { margin-top: 14px; }
.learn-card .card-head { justify-content: flex-start; }
.learn-card .feature-no { font-size: .8rem; background: var(--accent-soft); padding: 3px 8px; border-radius: 6px; }
.learn-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.learn-body > div { padding: 16px 20px; }
.learn-body > div + div { border-left: 1px solid var(--border); }
.learn-body pre { margin: 0; background: #0f172a; color: #e2e8f0; padding: 12px 14px; border-radius: 10px; font-size: .78rem; overflow: auto; white-space: pre-wrap; }
.codepath { display: inline-flex; gap: 6px; align-items: center; font-family: var(--mono); font-size: .78rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; color: var(--text-2); }

/* ---------- labels (print) ---------- */
.label-sheet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.label { border: 1px dashed var(--border-strong); border-radius: 10px; padding: 10px; display: grid; grid-template-columns: 90px 1fr; gap: 10px; background: #fff; break-inside: avoid; }
.label img.qr { width: 90px; height: 90px; }
.label img.bar { width: 100%; max-width: 190px; }
.label b { font-size: .82rem; display: block; }
.label code { font-size: .74rem; }

.footer { max-width: 1320px; margin: 30px auto 0; padding: 20px 24px 32px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: .82rem; border-top: 1px solid var(--border); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) { .brand-text { display: none; } }
@media (max-width: 1000px) { .mainnav span { display: none; } .mainnav a { padding: 8px 10px; } }
@media (max-width: 1100px) {
  .dash-grid, .two-col { grid-template-columns: 1fr; }
  .scan-grid { grid-template-columns: 1fr 1fr; }
  .usermenu-name { display: none; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .filters { position: static; max-height: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .mainnav span { display: none; }
  .brand-text { display: none; }
  .cond { grid-template-columns: 1fr 1fr; }
  .cond .joiner { display: none; }
  .learn-body, .adv-grid, .scan-grid { grid-template-columns: 1fr; }
  .learn-body > div + div { border-left: 0; border-top: 1px solid var(--border); }
  .label-sheet { grid-template-columns: 1fr 1fr; }
  .hit { grid-template-columns: 40px 1fr; }
  .hit-side { grid-column: 2; justify-items: start; text-align: left; grid-auto-flow: column; justify-content: start; align-items: center; }
  .wrap { padding: 16px; }
  .hero { padding: 24px 20px; }
}

@media print {
  .topbar, .footer, .no-print { display: none !important; }
  body { background: #fff; }
  .wrap { padding: 0; max-width: none; }
  .label-sheet { gap: 8px; }
}
