/* ELK4CX – Discover look-alike. Palette & metrics follow EUI (Amsterdam, light). */
:root {
  --primary: #07c; --primary-text: #006bb8; --primary-bg: #e6f1fa; --accent: #f04e98; --success: #00bfb3; --success-text: #007e77; --warning: #fec514; --warning-bg: #fff9e8; --danger: #bd271e; --danger-bg: #f8e9e9;
  --text: #343741; --text-subdued: #69707d; --title: #1a1c21; --border: #d3dae6; --light: #d3dae6; --lightest: #f5f7fa; --empty: #fafbfd; --page: #f7f8fc; --white: #fff; --focus: rgba(0, 119, 204, .3);
  --hdr-h: 48px; --sidebar-w: 304px; --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; --mono: "Roboto Mono", Menlo, Consolas, monospace;
  --vis-bar: #54b399; --vis-bar-hl: #6dccb1;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--page); overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* icons */
.i { width: 16px; height: 16px; fill: currentColor; flex: none; vertical-align: middle; }
.i.s { width: 12px; height: 12px; }
.i.l { width: 20px; height: 20px; }
.ibtn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 6px; color: var(--text); }
.ibtn:hover { background: rgba(0, 119, 204, .1); color: var(--primary-text); }
.ibtn.xs { width: 24px; height: 24px; }
.ibtn.pri { color: var(--primary-text); }
.ibtn[disabled] { opacity: .4; cursor: default; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 6px; font-weight: 500; border: 1px solid transparent; white-space: nowrap; }
.btn.sm { height: 32px; font-size: 14px; }
.btn.empty { color: var(--primary-text); }
.btn.empty:hover { background: var(--primary-bg); text-decoration: none; }
.btn.empty.text { color: var(--text); }
.btn.empty.text:hover { background: rgba(105, 112, 125, .12); }
.btn.base { background: var(--primary-bg); color: var(--primary-text); }
.btn.base:hover { background: #cfe3f3; }
.btn.base.text { background: var(--lightest); color: var(--text); border-color: var(--border); }
.btn.fill { background: var(--primary); color: #fff; }
.btn.fill:hover { background: #0068b3; }
.btn.danger { color: var(--danger); }
.btn.danger.fill { background: var(--danger); color: #fff; }
.btn.danger.empty:hover { background: var(--danger-bg); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn .i { flex: none; }

/* form controls */
.field { height: 40px; width: 100%; padding: 0 12px; border: none; border-radius: 6px; background: #fbfcfd; box-shadow: 0 0 transparent, inset 0 0 0 1px rgba(17, 42, 66, .1); color: var(--text); }
.field:focus { outline: none; background: #fff; box-shadow: inset 0 0 0 1px rgba(17, 42, 66, .1), 0 0 0 0 transparent; background-image: linear-gradient(to top, var(--primary), var(--primary) 2px, transparent 2px, transparent 100%); background-size: 100% 100%; }
.field.sm { height: 32px; }
.field.sm.icon { padding-left: 32px; }
.field::placeholder { color: var(--text-subdued); }
.fwrap { position: relative; width: 100%; }
.fwrap > .i.pre { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-subdued); pointer-events: none; }
select.field { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 10.5 3.5 6h9z' fill='%23343741'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 16px; padding-right: 32px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch .tr { width: 28px; height: 16px; border-radius: 8px; background: #98a2b3; position: relative; transition: .15s; }
.switch .tr::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: .15s; }
.switch.on .tr { background: var(--primary); } .switch.on .tr::after { left: 14px; }
.label { display: block; font-weight: 600; font-size: 12px; margin-bottom: 4px; color: var(--title); }
.help { font-size: 12px; color: var(--text-subdued); }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1 1 auto; min-width: 0; }
.subdued { color: var(--text-subdued); }
.small { font-size: 12px; }
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 3px; font-size: 12px; font-weight: 500; background: #e0e5ee; color: var(--text); white-space: nowrap; }
.badge.hollow { background: #fff; border: 1px solid var(--border); }
.badge.pri { background: var(--primary-bg); color: var(--primary-text); }
.badge.warn { background: #fff1c2; color: #8a6a0a; }
.badge.ok { background: #d9f3f1; color: var(--success-text); }
.callout { padding: 12px 16px; border-radius: 6px; font-size: 14px; }
.callout.danger { background: var(--danger-bg); color: var(--danger); border-left: 3px solid var(--danger); }
.callout.warn { background: var(--warning-bg); color: #6d5400; border-left: 3px solid var(--warning); }
.callout.pri { background: var(--primary-bg); color: var(--primary-text); border-left: 3px solid var(--primary); }
.callout code { background: rgba(0, 0, 0, .06); padding: 1px 4px; border-radius: 3px; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }

/* ---------- header ---------- */
#hdr { position: fixed; top: 0; left: 0; right: 0; height: var(--hdr-h); background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 8px 0 0; z-index: 50; }
#hdr .sec { display: flex; align-items: center; height: 100%; }
#hdr .sec.l { flex: 1; }
#hdr .sec.l > * { height: 100%; display: flex; align-items: center; padding: 0 12px; border-right: 1px solid var(--border); }
#hdr .sec.l > *:last-child { border-right: 0; }
#logo { gap: 8px; font-weight: 700; color: var(--title); letter-spacing: -.01em; }
#logo .mark { width: 24px; height: 24px; }
#crumbs { font-size: 14px; }
#crumbs .crumb { color: var(--text-subdued); display: inline-flex; align-items: center; gap: 6px; }
#crumbs .crumb.cur { color: var(--text); font-weight: 500; }
#crumbs .crumb + .crumb::before { content: ""; display: inline-block; width: 7px; height: 7px; border-right: 1.5px solid var(--text-subdued); border-top: 1.5px solid var(--text-subdued); transform: rotate(45deg); margin-right: 8px; }
#crumbs .badge { margin-left: 8px; }
#hdr .sec.r { gap: 4px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #c7a2ff; color: #000; font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
#topnav { position: fixed; top: var(--hdr-h); left: 0; right: 0; height: var(--hdr-h); background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: flex-end; padding: 0 16px; gap: 2px; z-index: 40; }
#topnav .btn.sm { padding: 0 8px; }
#topnav .btn.sm .i { width: 16px; }

/* ---------- query bar ---------- */
#qbar { position: fixed; top: calc(var(--hdr-h) * 2); left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--border); z-index: 30; padding: 8px 16px 0; }
#qbar .qrow { display: flex; gap: 8px; align-items: center; }
#dvpick { height: 40px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 6px; background: var(--lightest); border: 1px solid transparent; box-shadow: inset 0 0 0 1px rgba(17, 42, 66, .1); font-weight: 600; max-width: 260px; }
#dvpick .i.pre { color: var(--text-subdued); }
#dvpick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#qwrap { position: relative; flex: 1; }
#query { padding-left: 36px; padding-right: 48px; font-family: var(--mono); font-size: 14px; }
#qwrap .i.pre { position: absolute; left: 12px; top: 12px; color: var(--text-subdued); pointer-events: none; }
#qlang { position: absolute; right: 8px; top: 8px; height: 24px; padding: 0 8px; font-size: 12px; font-weight: 600; color: var(--primary-text); border-radius: 4px; }
#qlang:hover { background: var(--primary-bg); }
#qsuggest { position: absolute; left: 0; right: 0; top: 44px; background: #fff; border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 6px 12px -1px rgba(0, 0, 0, .1), 0 4px 4px -1px rgba(0, 0, 0, .08); max-height: 300px; overflow: auto; z-index: 60; }
#qsuggest .sg { display: flex; align-items: center; gap: 8px; padding: 6px 12px; cursor: pointer; font-family: var(--mono); font-size: 13px; }
#qsuggest .sg:hover, #qsuggest .sg.act { background: var(--primary-bg); }
#qsuggest .sg .d { font-family: var(--font); color: var(--text-subdued); margin-left: auto; font-size: 12px; }
#datebtn { height: 40px; display: inline-flex; align-items: stretch; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(17, 42, 66, .1); background: #fbfcfd; overflow: hidden; }
#datebtn > button { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; }
#datebtn > button:hover { background: var(--lightest); }
#dquick { border-right: 1px solid var(--border); color: var(--text-subdued); }
#dquick:hover { color: var(--primary-text); }
#dlabel { font-weight: 500; }
#dlabel.rel .sub { color: var(--text-subdued); font-weight: 400; margin-left: 6px; }
#dates { display: inline-flex; align-items: center; }
#dates .d { padding: 0 10px; display: inline-flex; align-items: center; }
#dates .d:hover { background: var(--lightest); }
#dates .arrow { color: var(--text-subdued); }
#refreshbtn { height: 40px; }
#refreshbtn.dirty { background: var(--success); color: #fff; }
#refreshbtn.dirty:hover { background: #00a79d; }
#fbar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 8px 0; min-height: 44px; }
.pill { display: inline-flex; align-items: center; height: 28px; max-width: 420px; border-radius: 4px; border: 1px solid var(--border); background: var(--lightest); font-size: 13px; }
.pill > button.body { padding: 0 8px; display: inline-flex; align-items: center; gap: 4px; height: 100%; overflow: hidden; }
.pill .fn { font-weight: 400; }
.pill .fv { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill .neg { color: var(--danger); font-weight: 700; margin-right: 2px; }
.pill.negated { background: #fdf2f2; border-color: #e7c6c6; }
.pill.disabled { opacity: .6; border-style: dashed; }
.pill.disabled .fv, .pill.disabled .fn { text-decoration: line-through; }
.pill.pinned { background: #e6f1fa; border-color: #b9d5ee; }
.pill .x { width: 24px; height: 100%; display: inline-flex; align-items: center; justify-content: center; color: var(--text-subdued); border-left: 1px solid transparent; }
.pill .x:hover { color: var(--danger); background: rgba(0, 0, 0, .04); }
#addfilter { color: var(--primary-text); font-size: 13px; display: inline-flex; align-items: center; gap: 4px; padding: 0 4px; height: 28px; border-radius: 4px; }
#addfilter:hover { text-decoration: underline; }
#fmenu { color: var(--text-subdued); }

/* ---------- layout ---------- */
#page { position: fixed; top: calc(var(--hdr-h) * 2 + 92px); left: 0; right: 0; bottom: 0; display: flex; }
#page.nofilters { top: calc(var(--hdr-h) * 2 + 92px); }
#sidebar { width: var(--sidebar-w); flex: none; background: var(--page); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
#sidebar.collapsed { width: 0; border: 0; overflow: hidden; }
#sbhead { padding: 12px 8px 8px 12px; display: flex; gap: 8px; align-items: center; }
#sbhead .fwrap { flex: 1; }
#sbbody { flex: 1; overflow: auto; padding: 0 8px 16px 8px; }
.acc { margin-top: 4px; }
.acc > .acch { width: 100%; display: flex; align-items: center; gap: 6px; padding: 6px 4px; font-size: 12px; font-weight: 600; color: var(--title); border-radius: 4px; }
.acc > .acch:hover { background: rgba(0, 0, 0, .04); }
.acc > .acch .i { transition: transform .15s; }
.acc.closed > .acch .i.chev { transform: rotate(-90deg); }
.acc.closed > .accb { display: none; }
.acc .cnt { margin-left: auto; }
.fld { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 4px 0 6px; border-radius: 4px; cursor: pointer; position: relative; }
.fld:hover { background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.fld .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.fld .nm mark { background: transparent; font-weight: 700; color: inherit; }
.fld .act { display: none; gap: 2px; }
.fld:hover .act, .fld.open .act { display: inline-flex; }
.fld .ibtn.xs { color: var(--primary-text); }
.fld .ibtn.xs.rm { color: var(--danger); }
.tok { width: 16px; height: 16px; border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.tok .i { width: 11px; height: 11px; }
.tok.date { background: #ffe0c0; color: #a3480c; } .tok.keyword { background: #d9e8ff; color: #1b4ea3; } .tok.text { background: #ffe9f5; color: #a0287a; } .tok.number { background: #e4e9f6; color: #3c4a8c; } .tok.ip { background: #e7d9f2; color: #6a2a99; } .tok.boolean { background: #d9f3f1; color: #0b6b63; } .tok.geo_point { background: #e3f4d6; color: #3a6f1b; } .tok.meta { background: #e0e5ee; color: #555; }
.empty-msg { padding: 8px; font-size: 12px; color: var(--text-subdued); }

#main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #fff; }
#toggleSb { position: absolute; left: var(--sidebar-w); top: 8px; margin-left: -12px; width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; z-index: 5; color: var(--text-subdued); }
#toggleSb.c { left: 0; margin-left: 4px; }
#hitsbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px 4px 32px; }
#hitsbar h2 { margin: 0; font-size: 16px; font-weight: 400; }
#hitsbar h2 b { font-weight: 700; }
#hitsbar .right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
#chartwrap { padding: 0 16px 0 24px; border-bottom: 1px solid var(--border); }
#chart { height: 150px; width: 100%; display: block; user-select: none; }
#chart .bar { fill: var(--vis-bar); }
#chart .bar:hover, #chart .bar.hl { fill: var(--vis-bar-hl); }
#chart .grid { stroke: #eef0f3; }
#chart .ax { fill: var(--text-subdued); font-size: 10px; }
#chart .brush { fill: rgba(0, 119, 204, .15); stroke: var(--primary); stroke-width: 1; }
#chart .nowline { stroke: var(--accent); stroke-dasharray: 3 3; }
#chartcap { text-align: center; font-size: 12px; color: var(--text-subdued); padding: 4px 0 8px; }
#chartcap select { font-size: 12px; border: 0; background: transparent; color: var(--primary-text); font-weight: 600; cursor: pointer; }
.ctip { position: fixed; z-index: 100; background: #343741; color: #fff; font-size: 12px; padding: 6px 10px; border-radius: 4px; pointer-events: none; box-shadow: 0 4px 8px rgba(0, 0, 0, .2); white-space: nowrap; }
.ctip b { color: #fff; }

#tabs { display: flex; align-items: center; padding: 0 16px 0 24px; border-bottom: 1px solid var(--border); }
#tabs .tab { height: 40px; padding: 0 8px; margin-right: 8px; font-weight: 500; color: var(--text-subdued); border-bottom: 2px solid transparent; display: inline-flex; align-items: center; gap: 6px; }
#tabs .tab.act { color: var(--primary-text); border-bottom-color: var(--primary); }
#tabs .tab:hover { text-decoration: underline; }
#tabs .gtools { margin-left: auto; display: flex; align-items: center; gap: 2px; }
#tabs .gtools .btn.sm { height: 28px; padding: 0 8px; font-size: 13px; color: var(--text); gap: 4px; }
#tabs .gtools .btn.sm:hover { background: rgba(0, 0, 0, .05); }
#tabs .gtools .btn.sm .n { color: var(--primary-text); }

#gridwrap { flex: 1; min-height: 0; overflow: auto; position: relative; }
table.grid { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 13px; table-layout: fixed; }
table.grid th { position: sticky; top: 0; z-index: 2; background: #fff; text-align: left; font-weight: 600; font-size: 13px; color: var(--title); height: 34px; padding: 0 6px; border-bottom: 1px solid var(--border); border-right: 1px solid #eef0f3; white-space: nowrap; overflow: hidden; }
table.grid th .hb { width: 100%; display: flex; align-items: center; gap: 4px; height: 34px; text-align: left; overflow: hidden; }
table.grid th .hb .nm { overflow: hidden; text-overflow: ellipsis; }
table.grid th .hb .i.srt { color: var(--primary-text); }
table.grid th .hb .i.more { margin-left: auto; color: var(--text-subdued); opacity: 0; }
table.grid th:hover .hb .i.more, table.grid th.open .hb .i.more { opacity: 1; }
table.grid th.ctl { width: 36px; padding: 0; }
table.grid th.ts { width: 220px; }
table.grid th .rs { position: absolute; right: 0; top: 0; bottom: 0; width: 5px; cursor: col-resize; }
table.grid th .rs:hover { background: var(--primary); }
table.grid td { height: 34px; padding: 0 6px; border-bottom: 1px solid #eef0f3; border-right: 1px solid #f5f7fa; vertical-align: middle; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; }
table.grid td.ctl { padding: 0; text-align: center; }
table.grid td.ctl .ibtn.xs { color: var(--text-subdued); }
table.grid tr:hover td { background: #f7f8fc; }
table.grid tr.open td { background: var(--primary-bg); }
table.grid td .v { display: block; overflow: hidden; text-overflow: ellipsis; }
table.grid td .v.multi { white-space: normal; max-height: 68px; line-height: 17px; }
table.grid td.ts { color: var(--text); }
table.grid td .doc .k { color: var(--text-subdued); font-size: 12px; margin-right: 4px; }
table.grid td .doc .kv { margin-right: 10px; }
table.grid td .doc .kv b { font-weight: 600; }
table.grid td .ca { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: none; gap: 0; background: #fff; border: 1px solid var(--border); border-radius: 4px; box-shadow: 0 2px 4px rgba(0, 0, 0, .1); }
table.grid td:hover .ca { display: inline-flex; }
table.grid td .ca .ibtn.xs { width: 22px; height: 22px; color: var(--primary-text); }
table.grid .num { font-variant-numeric: tabular-nums; }
table.grid .nil { color: var(--text-subdued); }
table.grid tr.expanded td { white-space: normal; }
#gridempty { padding: 48px 24px; text-align: center; color: var(--text-subdued); }
#gridempty h3 { margin: 0 0 8px; color: var(--title); }
#gridfoot { display: flex; align-items: center; gap: 12px; padding: 6px 16px; border-top: 1px solid var(--border); font-size: 13px; }
#gridfoot .pages { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; }
#gridfoot .pg { min-width: 28px; height: 28px; padding: 0 6px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; }
#gridfoot .pg:hover { background: rgba(0, 0, 0, .05); }
#gridfoot .pg.act { background: var(--primary); color: #fff; font-weight: 600; }
#gridfoot .pg[disabled] { opacity: .4; }
#rpp { color: var(--primary-text); font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
#samplenote { font-size: 12px; color: var(--text-subdued); }

/* field stats */
#fstats { flex: 1; overflow: auto; padding: 8px 16px 24px; }
table.fs { width: 100%; border-collapse: collapse; font-size: 13px; }
table.fs th { text-align: left; font-weight: 600; padding: 8px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #fff; }
table.fs td { padding: 6px 8px; border-bottom: 1px solid #eef0f3; vertical-align: top; }
table.fs td.nm { white-space: nowrap; }
table.fs td.nm .row { gap: 6px; }
table.fs .pb { height: 6px; background: var(--lightest); border-radius: 3px; overflow: hidden; width: 120px; display: inline-block; vertical-align: middle; margin-right: 8px; }
table.fs .pb i { display: block; height: 100%; background: var(--vis-bar); }
table.fs .tv { display: grid; grid-template-columns: 1fr 48px 60px; gap: 2px 8px; max-width: 480px; align-items: center; }
table.fs .tv .val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.fs .tv .val button { color: var(--primary-text); font-family: var(--mono); font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.fs .tv .val button:hover { text-decoration: underline; }
table.fs .tv .pct { font-size: 12px; color: var(--text-subdued); text-align: right; }
table.fs .mini { display: grid; grid-template-columns: auto auto; gap: 0 12px; font-size: 12px; }
table.fs .mini span:nth-child(odd) { color: var(--text-subdued); }

/* ---------- popovers / flyouts / modals ---------- */
.pop { position: fixed; z-index: 90; background: #fff; border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 6px 12px -1px rgba(0, 0, 0, .1), 0 4px 4px -1px rgba(0, 0, 0, .08), 0 2px 2px 0 rgba(0, 0, 0, .08); min-width: 200px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow: auto; }
.pop .ptitle { padding: 10px 16px; font-weight: 600; font-size: 12px; text-transform: none; border-bottom: 1px solid var(--border); background: var(--lightest); border-radius: 6px 6px 0 0; display: flex; align-items: center; gap: 8px; }
.pop .pbody { padding: 12px 16px; }
.pop .pfoot { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--lightest); border-radius: 0 0 6px 6px; }
.menu { padding: 4px; }
.menu .mi { width: 100%; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 4px; text-align: left; font-size: 14px; }
.menu .mi:hover { background: var(--primary-bg); color: var(--primary-text); }
.menu .mi.sel { background: var(--primary-bg); font-weight: 600; }
.menu .mi.danger { color: var(--danger); }
.menu .mi .i { color: var(--text-subdued); }
.menu .mi:hover .i { color: inherit; }
.menu .mi[disabled] { opacity: .5; cursor: default; }
.menu .mhead { padding: 6px 10px; font-size: 12px; font-weight: 600; color: var(--text-subdued); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

/* field details popover */
.fdp { width: 320px; }
.fdp .fdname { display: flex; align-items: center; gap: 6px; font-weight: 600; word-break: break-all; }
.fdp h5 { margin: 12px 0 6px; font-size: 12px; font-weight: 600; }
.tv-row { display: grid; grid-template-columns: 1fr 44px 48px; gap: 6px; align-items: center; margin-bottom: 4px; }
.tv-row .val { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-row .bar { height: 4px; background: var(--lightest); border-radius: 2px; overflow: hidden; grid-column: 1 / 3; }
.tv-row .bar i { display: block; height: 100%; background: var(--primary); }
.tv-row .pct { font-size: 12px; text-align: right; color: var(--text-subdued); }
.tv-row .acts { display: inline-flex; gap: 0; grid-row: 1 / 3; grid-column: 3; justify-self: end; }
.tv-row .acts .ibtn.xs { color: var(--primary-text); }
.tv-row .acts .ibtn.xs.out { color: var(--danger); }
.fdp .fdfoot { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }

.mask { position: fixed; inset: 0; background: rgba(255, 255, 255, .75); z-index: 80; }
.flyout { position: fixed; top: 0; right: 0; bottom: 0; width: 560px; max-width: 90vw; background: #fff; box-shadow: 0 0 24px rgba(0, 0, 0, .15); z-index: 85; display: flex; flex-direction: column; border-left: 1px solid var(--border); }
.flyout.l { right: auto; left: 0; width: 320px; border-left: 0; border-right: 1px solid var(--border); }
.flyout.m { width: 720px; }
.flyout.xl { width: 960px; }
.flyout .fh { padding: 20px 24px 12px; border-bottom: 1px solid var(--border); position: relative; }
.flyout .fh h2 { margin: 0; font-size: 20px; font-weight: 700; color: var(--title); line-height: 1.3; }
.flyout .fh .close { position: absolute; right: 16px; top: 16px; }
.flyout .fb { flex: 1; overflow: auto; padding: 16px 24px 24px; }
.flyout .ff { padding: 12px 24px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: space-between; align-items: center; background: var(--lightest); }
.ftabs { display: flex; gap: 16px; margin-top: 12px; }
.ftabs .ft { padding: 6px 2px; font-weight: 500; color: var(--text-subdued); border-bottom: 2px solid transparent; }
.ftabs .ft.act { color: var(--primary-text); border-bottom-color: var(--primary); }
.ftabs .ft:hover { text-decoration: underline; }
.doclinks { display: flex; gap: 16px; margin-top: 10px; font-size: 13px; }
.doclinks a { display: inline-flex; align-items: center; gap: 4px; }
pre.json { margin: 0; font-family: var(--mono); font-size: 12px; line-height: 1.5; background: var(--lightest); padding: 12px; border-radius: 6px; overflow: auto; white-space: pre; color: var(--text); }
pre.json .k { color: #5c3ac2; } pre.json .s { color: #0b7a4e; } pre.json .n { color: #c33; } pre.json .b { color: #a36d00; }
table.dv { width: 100%; border-collapse: collapse; font-size: 13px; }
table.dv td { padding: 6px 4px; border-bottom: 1px solid #eef0f3; vertical-align: top; }
table.dv td.acts { width: 104px; white-space: nowrap; }
table.dv td.acts .ibtn.xs { color: var(--primary-text); opacity: .35; }
table.dv tr:hover td.acts .ibtn.xs { opacity: 1; }
table.dv td.fname { width: 240px; word-break: break-all; }
table.dv td.fname .row { gap: 6px; align-items: flex-start; }
table.dv td.fval { font-family: var(--mono); font-size: 12px; word-break: break-all; white-space: pre-wrap; }
table.dv td.fval mark { background: #fff1c2; }
table.dv tr.pinned td { background: #fffbea; }
.dvtools { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }

/* open flyout */
.olist .oi { display: flex; align-items: flex-start; gap: 10px; padding: 10px 8px; border-bottom: 1px solid #eef0f3; border-radius: 4px; }
.olist .oi:hover { background: var(--lightest); }
.olist .oi .t { font-weight: 500; color: var(--primary-text); text-align: left; }
.olist .oi .t:hover { text-decoration: underline; }
.olist .oi .d { font-size: 12px; color: var(--text-subdued); margin-top: 2px; }
.olist .oi .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.olist .oi .tags .badge { height: 18px; font-size: 11px; }
.olist .oi .ibtn.xs { color: var(--danger); margin-left: auto; }
.olist .oi.cur { background: var(--primary-bg); }

/* modal */
.modal { position: fixed; z-index: 95; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 520px; max-width: 95vw; background: #fff; border-radius: 6px; box-shadow: 0 12px 24px rgba(0, 0, 0, .2); }
.modal .mh { padding: 20px 24px 8px; } .modal .mh h2 { margin: 0; font-size: 20px; font-weight: 700; color: var(--title); }
.modal .mb { padding: 8px 24px; display: flex; flex-direction: column; gap: 14px; }
.modal .mf { padding: 16px 24px 20px; display: flex; justify-content: flex-end; gap: 8px; }
.modal .close { position: absolute; right: 12px; top: 12px; }

/* date picker popover */
.dpop { width: 480px; }
.dpop .pbody { padding: 12px 16px 16px; }
.dpop h5 { margin: 10px 0 6px; font-size: 12px; font-weight: 600; color: var(--title); }
.dpop .qs { display: grid; grid-template-columns: 90px 70px 1fr 80px; gap: 8px; align-items: center; }
.dpop .qs .field { height: 32px; padding: 0 8px; }
.dpop .cu { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.dpop .cu button, .dpop .ru button { text-align: left; color: var(--primary-text); padding: 3px 0; font-size: 13px; }
.dpop .cu button:hover, .dpop .ru button:hover { text-decoration: underline; }
.dpop .ru { display: flex; flex-direction: column; }
.dpop .rf { display: grid; grid-template-columns: 90px 80px 1fr; gap: 8px; align-items: center; }
.dpop .rf .field { height: 32px; padding: 0 8px; }
.abs { padding: 12px; width: 360px; }
.abs .tabs { display: flex; gap: 12px; margin-bottom: 10px; }
.abs .tabs button { font-weight: 500; color: var(--text-subdued); padding: 4px 0; border-bottom: 2px solid transparent; }
.abs .tabs button.act { color: var(--primary-text); border-bottom-color: var(--primary); }

/* toasts */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #fff; border-radius: 6px; padding: 12px 36px 12px 16px; min-width: 280px; max-width: 420px; box-shadow: 0 6px 12px -1px rgba(0, 0, 0, .15), 0 4px 4px -1px rgba(0, 0, 0, .08); border-top: 3px solid var(--success); position: relative; font-size: 13px; }
.toast.warn { border-top-color: var(--warning); } .toast.danger { border-top-color: var(--danger); } .toast.pri { border-top-color: var(--primary); }
.toast b { display: block; font-weight: 600; margin-bottom: 2px; color: var(--title); }
.toast .close { position: absolute; right: 6px; top: 6px; }

/* nav flyout */
.nav h4 { margin: 12px 0 4px; font-size: 12px; font-weight: 600; color: var(--text-subdued); text-transform: none; }
.nav .ni { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 4px; color: var(--text); width: 100%; text-align: left; }
.nav .ni.act { background: var(--primary-bg); color: var(--primary-text); font-weight: 600; }
.nav .ni.dis { color: var(--text-subdued); cursor: default; }
.nav .ni .badge { margin-left: auto; }

/* help flyout */
.ex { padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 8px; }
.ex b { display: block; margin-bottom: 2px; }
.ex p { margin: 0; font-size: 13px; color: var(--text); }
.cheat { width: 100%; border-collapse: collapse; font-size: 13px; }
.cheat td { padding: 5px 6px; border-bottom: 1px solid #eef0f3; vertical-align: top; }
.cheat td:first-child { white-space: nowrap; }
.cheat code { background: var(--lightest); padding: 1px 5px; border-radius: 3px; cursor: pointer; }
.cheat code:hover { background: var(--primary-bg); color: var(--primary-text); }

/* single doc / context pages */
#docpage { position: fixed; top: var(--hdr-h); left: 0; right: 0; bottom: 0; background: #fff; overflow: auto; z-index: 20; padding: 16px 24px; }
#docpage .top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
#docpage h1 { font-size: 22px; margin: 0; }
.ctxbar { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 13px; }
.ctxbar .field { width: 70px; height: 32px; padding: 0 8px; }
table.grid tr.anchor td { background: #fff7d6; font-weight: 500; }

@media (max-width: 900px) { :root { --sidebar-w: 240px; } #crumbs { display: none !important; } }
