:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e6e8ef;
  --border-strong: #d5d9e2;
  --text: #111827;
  --text-2: #4b5563;
  --muted: #8a93a3;
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-50: #eef2ff;
  --success: #059669;
  --success-50: #ecfdf5;
  --warning: #b45309;
  --warning-50: #fffbeb;
  --danger: #dc2626;
  --danger-50: #fef2f2;
  --info: #0369a1;
  --info-50: #f0f9ff;
  --sidebar: #0f172a;
  --sidebar-2: #1e293b;
  --sidebar-text: #cbd5e1;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, .25);
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
button { font: inherit; }
.hidden { display: none !important; }

/* ---------- boot / spinner ---------- */
.boot { display: grid; place-items: center; height: 100vh; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- login ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { background: radial-gradient(1200px 600px at -10% -10%, #312e81 0%, #0f172a 55%); color: #e2e8f0; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-hero h1 { font-size: 34px; color: #fff; line-height: 1.2; max-width: 460px; }
.auth-hero p { color: #94a3b8; max-width: 440px; font-size: 15px; }
.auth-hero .feat { display: grid; gap: 14px; margin-top: 28px; }
.auth-hero .feat div { display: flex; gap: 10px; align-items: center; color: #cbd5e1; }
.auth-hero .feat i { width: 26px; height: 26px; border-radius: 8px; background: rgba(99, 102, 241, .25); display: grid; place-items: center; font-style: normal; color: #a5b4fc; font-size: 13px; }
.auth-panel { display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 24px; margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); margin-bottom: 26px; }
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } .auth-hero { display: none; } }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; color: #fff; }
.brand .logo { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, #6366f1, #4f46e5); display: grid; place-items: center; box-shadow: 0 4px 12px rgba(79, 70, 229, .4); }
.brand small { display: block; font-weight: 500; color: #94a3b8; font-size: 11.5px; }

/* ---------- forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--text); }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 5px; }
.input, select.input, textarea.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff;
  font: inherit; color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
.input[readonly] { background: var(--surface-2); }
.check { display: flex; align-items: flex-start; gap: 9px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; background: #fff; }
.check:hover { border-color: var(--border-strong); }
.check input { margin-top: 3px; accent-color: var(--primary); }
.check b { font-weight: 600; display: block; font-size: 13px; }
.check span { color: var(--muted); font-size: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 640px) { .grid-2, .grid-checks { grid-template-columns: 1fr; } }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; cursor: pointer; color: var(--text-2); font-weight: 600; font-size: 13px; }
.seg button.on { background: #fff; color: var(--primary); box-shadow: var(--shadow); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; justify-content: center; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border-strong); background: #fff; color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(79, 70, 229, .3); }
.btn-primary:hover { background: var(--primary-600); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; padding: 10px 14px; }
.icon-btn { width: 30px; height: 30px; padding: 0; display: inline-grid; place-items: center; border-radius: 7px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--text-2); }
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-50); border-color: #fecaca; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .top { padding: 18px 18px 14px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.nav { padding: 12px 10px; display: grid; gap: 2px; }
.nav .label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: 12px 10px 6px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--sidebar-text); font-weight: 500; text-decoration: none; }
.nav a:hover { background: var(--sidebar-2); color: #fff; }
.nav a.active { background: rgba(99, 102, 241, .18); color: #fff; }
.nav a.active svg { color: #a5b4fc; }
.nav a .count { margin-left: auto; background: rgba(255, 255, 255, .08); color: #cbd5e1; font-size: 11.5px; padding: 1px 8px; border-radius: 99px; }
.sidebar .bottom { margin-top: auto; padding: 14px; border-top: 1px solid rgba(255, 255, 255, .06); }
.me { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: linear-gradient(135deg, #6366f1, #8b5cf6); flex-shrink: 0; }
.me .who { min-width: 0; flex: 1; }
.me .who b { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who span { font-size: 11.5px; color: #94a3b8; }
.me .icon-btn { color: #94a3b8; }
.me .icon-btn:hover { background: var(--sidebar-2); border-color: transparent; color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 60px; background: rgba(255, 255, 255, .85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; padding: 0 28px; position: sticky; top: 0; z-index: 5; }
.topbar .crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 500; }
.topbar .crumbs b { color: var(--text); font-weight: 600; }
.topbar .spacer { flex: 1; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); padding: 4px 10px; border-radius: 99px; }
.live .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(5, 150, 105, .15); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.menu-btn { display: none; }
.content { padding: 26px 28px 48px; max-width: 1320px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .menu-btn { display: inline-grid; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
}

/* ---------- cards / stats ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 15px; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.card-body { padding: 18px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.stat .ico { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.stat .v { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.stat .k { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.ico.indigo { background: var(--primary-50); color: var(--primary); }
.ico.green { background: var(--success-50); color: var(--success); }
.ico.amber { background: var(--warning-50); color: var(--warning); }
.ico.sky { background: var(--info-50); color: var(--info); }
.ico.rose { background: var(--danger-50); color: var(--danger); }
.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }
.stack { display: grid; gap: 16px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 10px 18px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.t td { padding: 11px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover td { background: #fafbff; }
.t .num { text-align: right; font-variant-numeric: tabular-nums; }
.t .act { text-align: right; white-space: nowrap; }
.t tr.click { cursor: pointer; }
.cell-main { display: flex; align-items: center; gap: 10px; }
.cell-main .ico { width: 32px; height: 32px; border-radius: 8px; }
.cell-main b { font-weight: 600; }
.cell-main small { display: block; color: var(--muted); font-size: 12px; }
.empty { padding: 42px 18px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 99px; border: 1px solid transparent; white-space: nowrap; }
.badge.gray { background: #f3f4f6; color: #4b5563; border-color: #e5e7eb; }
.badge.indigo { background: var(--primary-50); color: var(--primary); border-color: #c7d2fe; }
.badge.green { background: var(--success-50); color: var(--success); border-color: #a7f3d0; }
.badge.amber { background: var(--warning-50); color: var(--warning); border-color: #fde68a; }
.badge.red { background: var(--danger-50); color: var(--danger); border-color: #fecaca; }
.badge.sky { background: var(--info-50); color: var(--info); border-color: #bae6fd; }
.badge .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .n { background: var(--surface-2); border: 1px solid var(--border); font-size: 11px; padding: 0 7px; border-radius: 99px; color: var(--text-2); }

/* ---------- key/value + copy ---------- */
.kv { display: grid; gap: 12px; }
.kv .row { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: center; }
.kv .k { color: var(--muted); font-weight: 500; font-size: 13px; }
@media (max-width: 640px) { .kv .row { grid-template-columns: 1fr; gap: 4px; } }
.copy { display: flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 6px 6px 11px; min-width: 0; }
.copy code { flex: 1; overflow-x: auto; white-space: nowrap; color: var(--text); }
.copy.secret code { color: var(--danger); font-weight: 600; }

.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: 9px; font-size: 13px; }
.callout.warn { background: var(--warning-50); color: #92400e; border: 1px solid #fde68a; }
.callout.info { background: var(--info-50); color: #075985; border: 1px solid #bae6fd; }
.callout.danger { background: var(--danger-50); color: #991b1b; border: 1px solid #fecaca; }

/* ---------- schema cards ---------- */
.schema-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.schema-card { padding: 16px 18px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.schema-card:hover { border-color: #c7d2fe; box-shadow: 0 6px 18px -8px rgba(79, 70, 229, .35); transform: translateY(-1px); }
.schema-card .h { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.schema-card .h b { font-size: 15px; }
.schema-card .h small { display: block; color: var(--muted); font-size: 12px; font-family: var(--mono); }
.schema-card .m { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; border-top: 1px dashed var(--border); padding-top: 12px; }
.schema-card .m div { text-align: center; }
.schema-card .m b { display: block; font-size: 16px; }
.schema-card .m span { color: var(--muted); font-size: 11.5px; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.search { position: relative; flex: 1; max-width: 340px; min-width: 200px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 34px; }

/* ---------- toggle ---------- */
.switch { position: relative; width: 36px; height: 20px; display: inline-block; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d1d5db; border-radius: 99px; cursor: pointer; transition: background .15s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:disabled + span { opacity: .5; cursor: not-allowed; }

select.mini { padding: 4px 8px; border: 1px solid var(--border-strong); border-radius: 7px; background: #fff; font: inherit; font-size: 12.5px; }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 520px; box-shadow: var(--shadow-lg); max-height: calc(100vh - 32px); display: flex; flex-direction: column; animation: pop .18s; }
.modal.wide { max-width: 680px; }
.modal-head { padding: 18px 22px 6px; display: flex; align-items: flex-start; gap: 12px; }
.modal-head h3 { font-size: 17px; }
.modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 14px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px 18px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- toasts ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 60; }
.toast { background: #111827; color: #fff; padding: 11px 15px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13px; display: flex; gap: 9px; align-items: center; max-width: 380px; animation: pop .18s; }
.toast.err { background: #991b1b; }
.toast.ok svg { color: #34d399; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; }
.right { text-align: right; }
.flex { display: flex; gap: 8px; align-items: center; }
.bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #6366f1, #8b5cf6); border-radius: 99px; }
.skeleton { background: linear-gradient(90deg, #eef0f4 25%, #f6f7fa 50%, #eef0f4 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 6px; height: 14px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- v2: prefixed input, data grid, SQL editor ---------- */
.modal.xwide { max-width: 960px; }
.prefixed { display: flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; background: #fff; }
.prefixed:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
.prefixed .pre { background: var(--surface-2); color: var(--text-2); padding: 9px 4px 9px 12px; border-right: 1px solid var(--border); white-space: nowrap; display: flex; align-items: center; }
.prefixed .input { border: 0; box-shadow: none !important; border-radius: 0; }
.select-sm { width: auto; padding: 6px 30px 6px 10px; font-size: 13px; max-width: 360px; }
.grid-toolbar { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.grid-toolbar .spacer, .pager .spacer { flex: 1; }
.grid-wrap { overflow: auto; max-height: calc(100vh - 330px); min-height: 160px; transition: opacity .15s; }
.grid-wrap.loading { opacity: .45; pointer-events: none; }
table.grid { border-collapse: separate; border-spacing: 0; min-width: 100%; }
table.grid th { position: sticky; top: 0; z-index: 2; text-transform: none; letter-spacing: 0; font-size: 12.5px; color: var(--text); padding: 8px 12px; background: var(--surface-2); }
table.grid tr.filters th { top: 46px; padding: 4px 6px 8px; background: var(--surface-2); }
table.grid th.sortable { cursor: pointer; user-select: none; }
table.grid th.sortable:hover { background: #eef0f6; }
.th-in { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.th-in small { color: var(--muted); font-weight: 500; font-family: var(--mono); font-size: 11px; }
.th-in svg { color: var(--primary); }
.filter-in { width: 100%; min-width: 90px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: 12px; background: #fff; outline: none; }
.filter-in:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79, 70, 229, .15); }
table.grid td { padding: 7px 12px; font-family: var(--mono); font-size: 12.5px; white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; cursor: pointer; border-right: 1px solid #f1f2f6; }
table.grid td:hover { background: var(--primary-50) !important; }
table.grid tbody tr:nth-child(even) td { background: #fcfcfe; }
.null { color: #b0b6c3; font-style: italic; font-family: var(--mono); font-size: 12px; }
.empty-cell { text-align: center; color: var(--muted); padding: 34px !important; font-family: inherit !important; cursor: default !important; }
.pager { display: flex; align-items: center; gap: 6px; padding: 10px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pager .icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.page-in { width: 56px; padding: 4px 6px; text-align: center; display: inline-block; font-size: 12.5px; }
.sql-card { overflow: hidden; }
.sql-editor { display: block; width: 100%; min-height: 220px; resize: vertical; border: 0; outline: none; padding: 16px 18px; font-family: var(--mono); font-size: 13.5px; line-height: 1.6; color: #e2e8f0; background: #0f172a; tab-size: 2; }
.sql-editor::placeholder { color: #64748b; }
.value-pre { margin: 0; padding: 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-word; max-height: 60vh; overflow: auto; }
a.flex { color: inherit; text-decoration: none; }
a.flex:hover .mono { color: var(--primary); }

/* ---------- v2.1: filter bar + draggable headers ---------- */
.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--border); background: #fbfbfe; min-height: 52px; transition: background .15s, box-shadow .15s; }
.filter-bar.drop-ready { background: var(--primary-50); box-shadow: inset 0 0 0 2px #c7d2fe; }
.filter-bar.drop-over { background: #e0e7ff; box-shadow: inset 0 0 0 2px var(--primary); }
.fb-ico { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.fb-ico b { background: var(--primary); color: #fff; font-size: 11px; border-radius: 99px; padding: 0 6px; }
.fb-hint { color: var(--muted); font-size: 12.5px; border: 1px dashed var(--border-strong); border-radius: 7px; padding: 5px 12px; }
.fchip { display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 1px solid #c7d2fe; border-radius: 8px; padding: 3px 3px 3px 6px; box-shadow: var(--shadow); }
.fsel { border: 0; background: transparent; font: inherit; font-size: 12.5px; padding: 3px 2px; color: var(--text); outline: none; cursor: pointer; }
.fsel.mono { font-family: var(--mono); color: var(--primary); font-weight: 600; }
.fval { border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; font-size: 12.5px; width: 140px; outline: none; }
.fval:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79, 70, 229, .15); }
.fchip .fx { width: 24px; height: 24px; }
table.grid th[draggable="true"] { cursor: grab; }
table.grid th.dragging { opacity: .45; }
table.grid th.drop-target { box-shadow: inset 3px 0 0 var(--primary); background: var(--primary-50); }
.th-in .grip { color: #c3c8d4; font-size: 10px; letter-spacing: -2px; margin-right: 2px; }
.th-in .fdot { color: var(--primary); display: inline-flex; }

/* table editor */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.tb-cols { display: grid; gap: 8px; }
.tb-col { display: grid; grid-template-columns: minmax(130px, 1.3fr) minmax(130px, 1fr) auto auto auto 120px minmax(110px, 1fr) auto; gap: 8px; align-items: center; }
@media (max-width: 900px) { .tb-col { grid-template-columns: 1fr 1fr; } }
.code-block { white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 10px; overflow-x: auto; }
.mt { margin-top: 12px; }
.sel-col { width: 64px; white-space: nowrap; }
.sel-col input { vertical-align: middle; }
.row-edit { width: 26px; height: 26px; margin-left: 4px; vertical-align: middle; opacity: .55; }
tr:hover .row-edit { opacity: 1; }
.rm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; max-height: 62vh; overflow-y: auto; padding-right: 4px; }
@media (max-width: 720px) { .rm-grid { grid-template-columns: 1fr; } }
.rm-field textarea { resize: vertical; }
.rm-field .input:disabled { opacity: .45; }

th.add-col, td.add-col { width: 44px; text-align: center; }
