/* Helstify panel — Databases. A workbench, not a page of cards: a status bar,
   the schema tree on the left, and the work area (SQL editor by default). */

.dbw {
    --dbw-h: max(560px, calc(100dvh - 262px));
    --dbw-row: 30px;
    --dbw-k: var(--hp-accent);
    --dbw-s: color-mix(in srgb, var(--hp-ok) 78%, var(--hp-ink));
    display: flex; flex-direction: column; gap: 12px;
}
:where(.dbw) button { font: inherit; color: inherit; }
.dbw-mono { font-family: var(--hp-mono); font-size: 12.5px; letter-spacing: 0; }
.dbw-label { font: 500 10.5px/1.2 var(--hp-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--hp-ink-3); }
.dbw-sep { color: var(--hp-ink-3); margin: 0 6px; opacity: .7; }
.dbw-fine { margin: 0; font-size: 12.5px; color: var(--hp-ink-3); }
.dbw-fine.is-bad, .is-bad { color: var(--hp-err); }
.dbw-link { background: none; border: 0; padding: 0; cursor: pointer; color: var(--hp-ink); text-decoration: underline; text-decoration-color: var(--hp-line-2); text-underline-offset: 3px; }
.dbw-link:hover { color: var(--hp-accent); text-decoration-color: currentColor; }
.dbw-kbd { font: 500 10.5px/1 var(--hp-mono); padding: 2px 4px; border-radius: 4px; border: 1px solid currentColor; opacity: .7; }
.dbw-chip { display: inline-flex; align-items: center; height: 19px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--hp-line-2); font: 500 10.5px/1 var(--hp-mono); letter-spacing: .02em; color: var(--hp-ink-2); white-space: nowrap; }
.dbw-chip--warn { border-color: color-mix(in srgb, var(--hp-warn) 50%, transparent); color: color-mix(in srgb, var(--hp-warn) 70%, var(--hp-ink)); }
.dbw-iconbtn {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 26px; min-width: 26px; padding: 0 8px;
    border: 1px solid transparent; border-radius: 6px; background: none; cursor: pointer; color: var(--hp-ink-2);
    font: 500 12px/1 var(--hp-font) !important; white-space: nowrap;
}
.dbw-iconbtn:hover { background: var(--hp-fill-2); color: var(--hp-ink); }
.dbw-iconbtn:disabled { opacity: .4; pointer-events: none; }
.dbw-iconbtn.is-danger:hover { color: var(--hp-err); background: color-mix(in srgb, var(--hp-err) 9%, transparent); }
.hp-btn--danger-solid { background: var(--hp-err) !important; color: #fff !important; }
.dbw kbd.dbw-kbd { background: none; }
.dbw .hp-btn--accent kbd.dbw-kbd { border-color: rgb(255 255 255 / .5); color: #fff; }

/* ------------------------------------------------------------- bar ------ */
.dbw-bar {
    display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto; align-items: center; gap: 20px;
    padding: 12px 14px 12px 16px; border: 1px solid var(--hp-line-2); border-radius: var(--hp-r-lg); background: var(--hp-surface);
}
.dbw-bar__id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dbw-bar__nav { display: none !important; }
.dbw-bar__ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--hp-line-2); background: var(--hp-bg); flex: none; }
.dbw-bar__name { min-width: 0; }
.dbw-bar__name h1 { margin: 0; font: 600 15px/1.2 var(--hp-display); letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dbw-bar__name p { margin: 3px 0 0; display: flex; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--hp-ink-3); white-space: nowrap; }
.dbw-bar__name .dbw-link { color: var(--hp-ink-2); text-decoration: none; }
.dbw-bar__name .dbw-link:hover { color: var(--hp-accent); }
.dbw-bar__live { display: flex; justify-content: flex-end; margin: 0; min-width: 0; }
.dbw-bar__live > div { padding: 0 18px; border-left: 1px solid var(--hp-line); min-width: 0; }
.dbw-bar__live dt { font: 500 10px/1 var(--hp-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--hp-ink-3); }
.dbw-bar__live dd { display: flex; align-items: center; gap: 7px; margin: 6px 0 0; font-weight: 600; font-size: 13.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dbw-bar__live dd small { font-weight: 400; color: var(--hp-ink-3); margin-left: -4px; }
.dbw-bar__act { display: flex; gap: 6px; align-items: center; }
.dbw-power { position: relative; display: inline-flex; gap: 0; }
.dbw-power > .hp-btn:first-child:not(:only-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.dbw-power__more { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; margin-left: -1px; width: 30px !important; }
.dbw-menu {
    position: absolute; right: 0; top: calc(100% + 4px); z-index: 40; min-width: 190px; padding: 4px;
    border: 1px solid var(--hp-line-2); border-radius: 8px; background: var(--hp-bg-2); box-shadow: 0 12px 32px -12px rgb(0 0 0 / .35);
}
.dbw-menu > *, .dbw-menu > div > button { display: block; width: 100%; padding: 7px 10px; border: 0; border-radius: 5px; background: none; text-align: left; font-size: 13px; cursor: pointer; color: var(--hp-ink); }
.dbw-menu > *:hover, .dbw-menu > div > button:hover { background: var(--hp-fill-2); }
.dbw-menu .is-danger { color: var(--hp-err); }
.dbw-menu hr { border: 0; border-top: 1px solid var(--hp-line); margin: 4px 0; padding: 0; }
.dbw-notice { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border: 1px solid color-mix(in srgb, var(--hp-warn) 45%, transparent); border-radius: 10px; font-size: 13px; background: color-mix(in srgb, var(--hp-warn) 7%, var(--hp-bg)); }
.dbw-notice > span { flex: 1; }

/* ----------------------------------------------------------- frame ------ */
.dbw-frame {
    display: grid; grid-template-columns: 248px minmax(0, 1fr); height: var(--dbw-h);
    border: 1px solid var(--hp-line-2); border-radius: var(--hp-r-lg); background: var(--hp-bg); overflow: hidden;
}
.dbw-main { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.dbw-main > section { flex: 1; min-height: 0; }

/* explorer */
.dbw-nav { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; scrollbar-width: thin; border-right: 1px solid var(--hp-line); background: var(--hp-surface); }
.dbw-nav__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px 14px; }
.dbw-nav__head--server { border-top: 1px solid var(--hp-line); padding-top: 12px; }
.dbw-nav__search { display: flex; align-items: center; gap: 7px; margin: 0 10px 6px; padding: 0 9px; height: 28px; border: 1px solid var(--hp-line-2); border-radius: 6px; background: var(--hp-bg); color: var(--hp-ink-3); }
.dbw-nav__search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--hp-ink); font: 13px var(--hp-font); }
.dbw-tree { flex: 1 0 auto; min-height: 80px; padding: 2px 6px 10px; }
.dbw-tree__wait > div { display: grid; gap: 6px; padding: 6px; }
.dbw-tree__wait .hp-skel { height: 18px; }
.dbw-tree__wait p, .dbw-tree__empty { margin: 4px 8px; font-size: 12.5px; color: var(--hp-ink-3); }
.dbw-tree__empty { padding-left: 28px; }
.dbw-tree__row, .dbw-tree__leaf {
    display: flex; align-items: center; gap: 7px; width: 100%; height: 27px; padding: 0 8px; border: 0; border-radius: 5px;
    background: none; cursor: pointer; text-align: left; font-size: 13px; color: var(--hp-ink-2);
}
.dbw-tree__row:hover, .dbw-tree__leaf:hover { background: var(--hp-fill-2); color: var(--hp-ink); }
.dbw-tree__row { color: var(--hp-ink); font-weight: 500; }
.dbw-tree__row.is-cur .hp-ico { color: var(--hp-accent); }
.dbw-tree__chev { flex: none; color: var(--hp-ink-3); transition: transform .12s; }
.dbw-tree__chev.is-open { transform: rotate(90deg); }
.dbw-tree__leaf { padding-left: 27px; font-family: var(--hp-mono); font-size: 12.5px; }
.dbw-tree__leaf svg { flex: none; color: var(--hp-ink-3); }
.dbw-tree__leaf.is-active { background: var(--hp-accent-soft); color: var(--hp-ink); }
.dbw-tree__leaf.is-active svg { color: var(--hp-accent); }
.dbw-tree__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbw-tree em { font: 500 10.5px/1 var(--hp-mono); font-style: normal; color: var(--hp-ink-3); }
.dbw-sections { display: grid; padding: 0 6px 10px; }
.dbw-sections button { display: flex; align-items: center; gap: 9px; height: 28px; padding: 0 8px; border: 0; border-radius: 5px; background: none; cursor: pointer; font-size: 13px; color: var(--hp-ink-2); text-align: left; }
.dbw-sections button:hover { background: var(--hp-fill-2); color: var(--hp-ink); }
.dbw-sections button.is-active { background: var(--hp-bg); color: var(--hp-ink); box-shadow: inset 0 0 0 1px var(--hp-line-2); }
.dbw-sections button.is-active .hp-ico { color: var(--hp-accent); }
.dbw-iconbtn .hp-ico, .dbw-nav__head .dbw-iconbtn { color: var(--hp-ink-3); }
.dbw-scrim { display: none; }

/* toolbar */
.dbw-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-height: 46px; padding: 8px 12px; border-bottom: 1px solid var(--hp-line); background: var(--hp-surface); }
.dbw-toolbar__gap { flex: 1; }
.dbw-toolbar__group { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dbw-select { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 4px 0 9px; border: 1px solid var(--hp-line-2); border-radius: 7px; background: var(--hp-bg); color: var(--hp-ink-3); }
.dbw-select select { border: 0; background: none; outline: 0; color: var(--hp-ink); font: 500 12.5px var(--hp-mono); padding-right: 2px; max-width: 200px; }
.dbw-select--quiet { border-color: transparent; background: none; }
.dbw-seg { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--hp-line-2); border-radius: 7px; background: var(--hp-fill); }
.dbw-seg button { height: 24px; padding: 0 10px; border: 0; border-radius: 5px; background: none; cursor: pointer; font-size: 12.5px; color: var(--hp-ink-2); white-space: nowrap; }
.dbw-seg button.is-active { background: var(--hp-bg); color: var(--hp-ink); box-shadow: 0 0 0 1px var(--hp-line-2); }
.dbw-crumb { display: flex; align-items: center; gap: 6px; min-width: 0; margin-right: 6px; font-family: var(--hp-mono); font-size: 12.5px; color: var(--hp-ink-2); }
.dbw-crumb strong { color: var(--hp-ink); font-weight: 600; }
.dbw-crumb .dbw-sep { margin: 0; }

/* ------------------------------------------------------------ SQL ------- */
.dbw-sql { display: flex; flex-direction: column; }
.dbw-sql__body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 252px; }
.dbw-sql__split { display: grid; min-height: 0; }
.dbw-sql__handle { cursor: row-resize; background: var(--hp-surface); border-top: 1px solid var(--hp-line); border-bottom: 1px solid var(--hp-line); position: relative; touch-action: none; }
.dbw-sql__handle::after { content: ''; position: absolute; left: 50%; top: 2px; width: 28px; height: 1px; margin-left: -14px; background: var(--hp-ink-3); opacity: .5; box-shadow: 0 2px 0 var(--hp-ink-3); }
.dbw-editor { display: grid; grid-template-columns: 44px minmax(0, 1fr); min-height: 0; background: var(--hp-bg); }
.dbw-editor__gutter { overflow: hidden; padding: 12px 8px 12px 0; text-align: right; font: 12px/20px var(--hp-mono); color: var(--hp-ink-3); opacity: .6; user-select: none; border-right: 1px solid var(--hp-line); }
.dbw-editor__gutter span { display: block; }
.dbw-editor__wrap { position: relative; min-width: 0; min-height: 0; }
.dbw-editor__hl, .dbw-editor__wrap textarea {
    position: absolute; inset: 0; margin: 0; padding: 12px 14px; border: 0; overflow: auto;
    font: 13px/20px var(--hp-mono); letter-spacing: 0; tab-size: 4; white-space: pre; word-wrap: normal;
}
.dbw-editor__hl { pointer-events: none; color: var(--hp-ink); overflow: hidden; }
.dbw-editor__wrap textarea:focus-visible { outline: none; }
.dbw-editor__wrap textarea { resize: none; outline: none; background: transparent; color: transparent; caret-color: var(--hp-ink); }
.dbw-editor__wrap textarea::selection { background: color-mix(in srgb, var(--hp-accent) 28%, transparent); color: transparent; }
.dbw-editor__hl i { font-style: normal; }
.dbw-editor__hl .k { color: var(--dbw-k); font-weight: 600; }
.dbw-editor__hl .s { color: var(--dbw-s); }
.dbw-editor__hl .n { color: var(--hp-ink-2); }
.dbw-editor__hl .c { color: var(--hp-ink-3); font-style: italic; }
.dbw-editor__hl .b { color: var(--hp-ink); text-decoration: underline dotted var(--hp-line-2); text-underline-offset: 3px; }

.dbw-results { display: flex; flex-direction: column; min-height: 0; background: var(--hp-bg); }
.dbw-results__bar { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 8px 0 4px; border-bottom: 1px solid var(--hp-line); background: var(--hp-surface); flex: none; }
.dbw-results__tabs { display: flex; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; align-self: stretch; }
.dbw-results__tabs button { padding: 0 12px; border: 0; border-bottom: 2px solid transparent; background: none; cursor: pointer; font-size: 12.5px; color: var(--hp-ink-2); white-space: nowrap; }
.dbw-results__tabs button.is-active { color: var(--hp-ink); border-bottom-color: var(--hp-accent); }
.dbw-results__title { align-self: center; padding: 0 10px; font: 500 10.5px var(--hp-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--hp-ink-3); }
.dbw-results__meta { display: flex; align-items: center; gap: 4px; color: var(--hp-ink-3); white-space: nowrap; }
.dbw-results__meta > span { margin-right: 6px; }
.dbw-results__body { flex: 1; min-height: 0; overflow: auto; position: relative; }

.dbw-sql__side { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--hp-line); background: var(--hp-surface); }
.dbw-sql__side > .dbw-seg { margin: 8px; display: grid; grid-template-columns: repeat(4, 1fr); }
.dbw-sql__side > .dbw-seg button { padding: 0 4px; font-size: 11.5px; }
.dbw-sql__list { flex: 1; overflow: auto; padding: 0 6px 10px; scrollbar-width: thin; }
.dbw-snip { display: flex; flex-direction: column; gap: 3px; width: 100%; padding: 8px; border: 0; border-radius: 6px; background: none; text-align: left; cursor: pointer; }
.dbw-snip + .dbw-snip { border-top: 1px solid var(--hp-line); border-radius: 0; }
.dbw-snip:hover { background: var(--hp-fill-2); border-radius: 6px; }
.dbw-snip code { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font: 11.5px/1.45 var(--hp-mono); color: var(--hp-ink-2); white-space: pre-wrap; word-break: break-word; }
.dbw-snip strong { font-size: 12.5px; font-weight: 600; }
.dbw-snip small { display: flex; align-items: center; gap: 7px; font: 10.5px var(--hp-mono); color: var(--hp-ink-3); }
.dbw-snip small .hp-dot { width: 6px; height: 6px; box-shadow: none; }
div.dbw-snip { flex-direction: row; align-items: flex-start; }
div.dbw-snip > button:first-child { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; }
.dbw-snip--row { flex-direction: row; align-items: center; justify-content: space-between; }
.dbw-side__empty { margin: 8px; font-size: 12.5px; color: var(--hp-ink-3); }

/* ----------------------------------------------------------- grids ------ */
.dbw-gridwrap { overflow: auto; height: 100%; }
.dbw-gridwrap--static { height: auto; }
.dbw-gridwrap.is-loading { opacity: .55; transition: opacity .15s; }
.dbw-grid { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 12.5px; }
.dbw-grid th {
    position: sticky; top: 0; z-index: 2; height: var(--dbw-row); padding: 0 10px; text-align: left; white-space: nowrap;
    font: 500 11.5px/1 var(--hp-mono); color: var(--hp-ink-2); background: var(--hp-surface); border-bottom: 1px solid var(--hp-line-2); border-right: 1px solid var(--hp-line);
}
.dbw-grid th button { display: inline-flex; align-items: center; gap: 5px; height: var(--dbw-row); width: 100%; border: 0; background: none; cursor: pointer; font: inherit; color: inherit; padding: 0; }
.dbw-grid th button:hover { color: var(--hp-ink); }
.dbw-grid th .hp-ico { color: var(--hp-accent); }
.dbw-sort { font-style: normal; color: var(--hp-accent); }
.dbw-grid td {
    height: var(--dbw-row); max-width: 360px; padding: 0 10px; border-bottom: 1px solid var(--hp-line); border-right: 1px solid var(--hp-line);
    font-family: var(--hp-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle;
}
.dbw-grid tbody tr:hover td { background: var(--hp-fill); }
.dbw-grid tr.is-sel td { background: var(--hp-accent-soft); }
.dbw-grid .is-null { color: var(--hp-ink-3); font-style: italic; }
.dbw-grid .is-bin { color: var(--hp-ink-3); }
.dbw-grid .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.dbw-grid__n, .dbw-grid__check { width: 1%; text-align: right; color: var(--hp-ink-3); background: var(--hp-surface); position: sticky; left: 0; z-index: 1; }
th.dbw-grid__n, th.dbw-grid__check { z-index: 3; }
.dbw-grid__check { text-align: center; padding: 0 8px !important; }
.dbw-grid__check input { accent-color: var(--hp-accent); vertical-align: middle; }
.dbw-grid--edit td { cursor: cell; }
.dbw-grid--edit td.dbw-grid__check { cursor: default; }
.dbw-grid__more { margin: 0; padding: 14px; font-size: 12.5px; color: var(--hp-ink-3); }
.dbw-grid--list { font-size: 13px; }
.dbw-grid--list td { font-family: var(--hp-font); height: 40px; max-width: 320px; border-right: 0; }
.dbw-grid--list th { border-right: 0; background: var(--hp-surface); }
.dbw-grid--list td.dbw-mono { font-family: var(--hp-mono); font-size: 12.5px; }
.dbw-grid--list tr:last-child td { border-bottom: 0; }
.dbw-grid--list tr.is-hot td { background: color-mix(in srgb, var(--hp-accent) 5%, transparent); }
.dbw-q { max-width: 420px !important; }
.dbw-q code { display: block; overflow: hidden; text-overflow: ellipsis; font: 12px var(--hp-mono); color: var(--hp-ink-2); }
.dbw-row-actions { text-align: right; white-space: nowrap; width: 1%; }
.dbw-gridskel { display: grid; gap: 8px; padding: 16px; }
.dbw-gridskel .hp-skel { height: 22px; }

.dbw-celledit { position: absolute; z-index: 10; width: 340px; margin: -6px 0 0 -11px; padding: 8px; border: 1px solid var(--hp-accent-line); border-radius: 8px; background: var(--hp-bg-2); box-shadow: 0 16px 36px -14px rgb(0 0 0 / .4); white-space: normal; }
.dbw-grid td:has(.dbw-celledit) { overflow: visible; position: relative; }
.dbw-celledit textarea { width: 100%; min-height: 70px; padding: 8px; border: 1px solid var(--hp-line-2); border-radius: 6px; background: var(--hp-bg); color: var(--hp-ink); font: 12.5px/1.5 var(--hp-mono); resize: vertical; outline: 0; }
.dbw-celledit > div { display: flex; align-items: center; gap: 6px; margin-top: 6px; font: 12px var(--hp-font); }
.dbw-celledit label { display: inline-flex; gap: 5px; align-items: center; font-family: var(--hp-mono); }

/* data pane */
.dbw-data { display: flex; flex-direction: column; }
.dbw-data__inner { display: flex; flex-direction: column; height: 100%; min-height: 0; position: relative; }
.dbw-data__body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.dbw-data__body > .dbw-gridwrap { flex: 1; }
.dbw-struct { overflow: auto; padding: 4px 16px 20px; display: block; }
.dbw-struct .dbw-gridwrap { border: 1px solid var(--hp-line); border-radius: 8px; }
.dbw-struct .dbw-grid td { font-family: var(--hp-font); }
.dbw-struct .dbw-grid td.dbw-mono { font-family: var(--hp-mono); }
.dbw-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--hp-line); background: var(--hp-fill); }
.dbw-filter { display: inline-flex; align-items: center; gap: 4px; }
.dbw-filter .hp-input { height: 28px; width: auto; min-width: 0; max-width: 170px; padding: 0 8px; font-size: 12.5px; border-radius: 6px; }
.dbw-maint { display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--hp-line); }
.dbw-maint > template + * , .dbw-maint p { margin: 0; flex: 1; }
.dbw-pager { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 12px; border-top: 1px solid var(--hp-line); background: var(--hp-surface); color: var(--hp-ink-2); flex: none; }
.dbw-pager__hint { font-size: 12px; color: var(--hp-ink-3); }
.dbw-pager__per { height: 26px; border: 1px solid var(--hp-line-2); border-radius: 6px; background: var(--hp-bg); color: var(--hp-ink); font: 12px var(--hp-mono); }
.dbw-pager .dbw-iconbtn { font-size: 16px !important; }

/* drawers */
.dbw-drawer { position: absolute; inset: 0; z-index: 30; display: flex; justify-content: flex-end; background: rgb(0 0 0 / .18); }
.dbw-drawer__panel, .dbw-drawer__inner { display: flex; flex-direction: column; width: min(420px, 100%); height: 100%; background: var(--hp-bg-2); border-left: 1px solid var(--hp-line-2); }
.dbw-drawer__inner { width: 100%; border: 0; }
.dbw-drawer header, .dbw-drawer footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--hp-line); }
.dbw-drawer footer { border-top: 1px solid var(--hp-line); border-bottom: 0; justify-content: flex-end; }
.dbw-drawer__body { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.dbw-addfield label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 5px; font: 600 12.5px var(--hp-mono); }
.dbw-addfield label small { font-weight: 400; color: var(--hp-ink-3); font-size: 11px; }
.dbw-addfield > div { display: flex; gap: 6px; }
.dbw-addfield select { height: 34px; border: 1px solid var(--hp-line-2); border-radius: 8px; background: var(--hp-bg); color: var(--hp-ink); font-size: 12.5px; padding: 0 6px; }
.dbw-addfield .hp-input { height: 34px; font-family: var(--hp-mono); font-size: 12.5px; }

/* --------------------------------------------------------- pages -------- */
.dbw-page { overflow: auto; padding: 20px 22px 32px; display: flex; flex-direction: column; gap: 16px; scrollbar-width: thin; }
.dbw-page > * { flex-shrink: 0; }
.dbw-page--fill { overflow: hidden; }
.dbw-page--fill > .dbw-console { flex-shrink: 1; }
.dbw-page__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.dbw-page__head h2 { margin: 0; font: 600 18px/1.2 var(--hp-display); letter-spacing: -0.02em; }
.dbw-page__head p { margin: 4px 0 0; max-width: 72ch; font-size: 13px; color: var(--hp-ink-3); }
.dbw-block { border: 1px solid var(--hp-line); border-radius: 10px; background: var(--hp-surface); padding: 16px; min-width: 0; }
.dbw-block > p { margin: 0 0 8px; font-size: 13.5px; color: var(--hp-ink-2); }
.dbw-block--flush { padding: 0; overflow: hidden; }
.dbw-blockbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px 10px 16px; margin: 0; border-bottom: 1px solid var(--hp-line); }
.dbw-h { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font: 600 13.5px/1.2 var(--hp-display); letter-spacing: -0.01em; }
.dbw-h small { font: 500 11.5px var(--hp-mono); color: var(--hp-ink-3); }
.dbw-h .dbw-link, .dbw-h .dbw-iconbtn { margin-left: auto; font: 500 12px var(--hp-font); }
.dbw-blockbar.dbw-h, .dbw-blockbar .dbw-h { margin: 0; }
.dbw-struct .dbw-h { margin: 18px 0 8px; }
.dbw-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.dbw-cols--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dbw-stack { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.dbw-stack > .hp-btn { align-self: flex-start; }
.dbw-plain { margin: 6px 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 13px; }
.dbw-code { margin: 0; padding: 12px 14px; border: 1px solid var(--hp-line); border-radius: 8px; background: var(--hp-bg); font: 12.5px/1.6 var(--hp-mono); color: var(--hp-ink); overflow: auto; white-space: pre; }
.dbw-code--snippet { border: 0; border-radius: 0; min-height: 150px; padding: 16px 18px; }
.dbw-empty { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 28px 24px; color: var(--hp-ink-3); font-size: 13px; }
.dbw-empty p { margin: 0; max-width: 60ch; }
.dbw-empty strong { color: var(--hp-ink); font-weight: 600; }
.dbw-empty--pane { height: 100%; align-items: center; text-align: center; }
.dbw-error { margin: 12px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--hp-err) 40%, transparent); border-left-width: 3px; border-radius: 6px; background: color-mix(in srgb, var(--hp-err) 5%, var(--hp-bg)); }
.dbw-page > .dbw-error { margin: 0; }
.dbw-error pre { margin: 4px 0 0; font: 12.5px/1.5 var(--hp-mono); white-space: pre-wrap; color: var(--hp-ink); }
.dbw-error p { margin: 6px 0 0; font-size: 12px; color: var(--hp-ink-3); }
.dbw-warnings { margin: 0 12px 12px; padding: 8px 12px; border-left: 3px solid var(--hp-warn); font-size: 12.5px; }
.dbw-warnings p { margin: 2px 0; }

/* overview */
.dbw-charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--hp-line); border-radius: 10px; overflow: hidden; background: var(--hp-surface); }
.dbw-chart { margin: 0; padding: 14px 16px 10px; border-right: 1px solid var(--hp-line); border-bottom: 1px solid var(--hp-line); min-width: 0; }
.dbw-chart:nth-child(3n) { border-right: 0; }
.dbw-chart:nth-last-child(-n+3) { border-bottom: 0; }
.dbw-chart figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.dbw-chart figcaption strong { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dbw-chart__svg { display: block; width: 100%; height: 64px; margin: 10px 0 6px; overflow: visible; }
.dbw-chart__line { fill: none; stroke: var(--hp-accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.dbw-chart__area { fill: var(--hp-accent-soft); stroke: none; }
.dbw-chart__base { stroke: var(--hp-line-2); vector-effect: non-scaling-stroke; }
.dbw-chart__grid { stroke: var(--hp-line); stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.dbw-chart__foot { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--hp-ink-3); }
.dbw-meters { display: grid; gap: 14px; margin: 0 0 12px; }
.dbw-meters dt { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 13px; color: var(--hp-ink-2); }
.dbw-meters dt span { color: var(--hp-ink-3); }
.dbw-meters dd { margin: 0; }
.dbw-kv { display: grid; margin: 0; }
.dbw-kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--hp-line); font-size: 13px; }
.dbw-kv > div:last-child { border-bottom: 0; }
.dbw-kv dt { color: var(--hp-ink-3); }
.dbw-kv dd { margin: 0; text-align: right; min-width: 0; }
.dbw-copyable { border: 0; background: none; padding: 0; cursor: copy; color: var(--hp-ink); }
.dbw-copyable:hover { color: var(--hp-accent); }
.dbw-trunc { display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbw-checks { list-style: none; margin: 0; padding: 0; }
.dbw-checks li { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--hp-line); }
.dbw-checks li:last-child { border-bottom: 0; }
.dbw-checks .hp-dot { margin-top: 6px; box-shadow: none; }
.dbw-checks div { flex: 1; min-width: 0; }
.dbw-checks strong { font-size: 13px; font-weight: 600; }
.dbw-checks p { margin: 2px 0 0; font-size: 12.5px; color: var(--hp-ink-3); }

/* connect */
.dbw-connect { display: flex; flex-direction: column; gap: 12px; }
.dbw-fields { display: grid; grid-template-columns: 2fr 1fr 1.2fr 1.2fr; gap: 12px; }
.dbw-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.dbw-field--wide { grid-column: 1 / -1; }
.dbw-field--grow { flex: 1; }
.dbw-field small { font-size: 11.5px; color: var(--hp-ink-3); }
.dbw-value { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 36px; padding: 0 10px; border: 1px solid var(--hp-line-2); border-radius: 8px; background: var(--hp-bg); color: var(--hp-ink); cursor: pointer; min-width: 0; font: 500 13px var(--hp-mono); }
select.dbw-value { cursor: default; }
.dbw-value .hp-ico { color: var(--hp-ink-3); }
.dbw-value > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbw-value--pw { cursor: default; justify-content: flex-start; }
.dbw-value--pw > span { flex: 1; }
.dbw-langs { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 0 10px 0 4px; border-bottom: 1px solid var(--hp-line); }
.dbw-langs__tabs { display: flex; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.dbw-langs__tabs button { height: 40px; padding: 0 11px; border: 0; border-bottom: 2px solid transparent; background: none; cursor: pointer; font-size: 12.5px; color: var(--hp-ink-2); white-space: nowrap; }
.dbw-langs__tabs button.is-active { color: var(--hp-ink); border-bottom-color: var(--hp-accent); }
.dbw-langs__opts { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.dbw-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--hp-ink-2); cursor: pointer; white-space: nowrap; }
.dbw-check input { accent-color: var(--hp-accent); }
.dbw-inline { display: inline-flex; align-items: center; gap: 6px; }

/* forms */
.dbw-form { display: flex; flex-direction: column; gap: 12px; }
.dbw-form__row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.dbw-form__row > .dbw-field { min-width: 180px; }
.dbw-form__row--end { align-items: flex-end; }
.dbw-form__go { display: flex; gap: 6px; justify-content: flex-end; margin-left: auto; }
.dbw-form__go--split { justify-content: space-between; margin: 12px 0 10px; flex-wrap: wrap; width: 100%; }
.dbw-form__go--split > div { display: flex; gap: 6px; flex-wrap: wrap; }
.dbw-form__go--left { justify-content: flex-start; margin: 10px 0 0; flex-wrap: wrap; }
.dbw .hp-input { height: 34px; font-size: 13px; border-radius: 8px; }
.dbw-grants { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; align-items: flex-start; }
.dbw-grant { display: flex; gap: 6px; align-items: center; width: 100%; max-width: 520px; }
.dbw-grant .hp-input { flex: 1; }
.dbw-levels { display: grid; gap: 6px; margin: 0; padding: 10px 12px; border: 1px solid var(--hp-line); border-radius: 8px; font-size: 12.5px; }
.dbw-levels dt { font-weight: 600; }
.dbw-levels dd { margin: 0 0 4px; color: var(--hp-ink-3); }
.dbw-secret { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--hp-accent-line); border-radius: 10px; background: var(--hp-bg); }
.dbw-secret > div { flex: 1; min-width: 0; }
.dbw-secret code { display: block; margin: 4px 0; font-size: 15px; font-weight: 600; word-break: break-all; }
.dbw-secret p { margin: 0; font-size: 12px; color: var(--hp-ink-3); }
.dbw-size { min-width: 130px; }
.dbw-size__bar { display: block; height: 3px; margin-top: 5px; border-radius: 2px; background: var(--hp-fill-2); overflow: hidden; }
.dbw-size__bar i { display: block; height: 100%; background: var(--hp-ink-2); }
.dbw-banner { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--hp-line-2); font-size: 13px; }
.dbw-banner.is-warn { border-color: color-mix(in srgb, var(--hp-warn) 45%, transparent); }
.dbw-banner > span { flex: 1; }
.dbw-banner .hp-dot { box-shadow: none; }
.dbw-allow { border: 1px solid var(--hp-line); border-radius: 8px; overflow: hidden; }
.dbw-allow td { padding: 6px 8px; }
.dbw-num { width: 70px; height: 28px !important; }
.dbw-search { width: 180px; height: 28px !important; font-size: 12.5px !important; }
.dbw-wide { min-width: 320px; }

/* config */
.dbw-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.dbw-preset { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--hp-line-2); border-radius: 10px; background: var(--hp-surface); text-align: left; cursor: pointer; }
.dbw-preset:hover { border-color: var(--hp-ink-3); }
.dbw-preset strong { font-size: 13.5px; }
.dbw-preset span { font-size: 12.5px; color: var(--hp-ink-3); }
.dbw-knobs > div { border-bottom: 1px solid var(--hp-line); }
.dbw-knobs > div:last-child { border-bottom: 0; }
.dbw-knob { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; align-items: center; padding: 12px 16px; }
.dbw-knob.is-dirty { box-shadow: inset 3px 0 0 var(--hp-accent); }
.dbw-knob__text strong { font-size: 13.5px; font-weight: 600; margin-right: 8px; }
.dbw-knob__text code { font: 11.5px var(--hp-mono); color: var(--hp-ink-3); }
.dbw-knob__text p { margin: 3px 0 0; font-size: 12.5px; color: var(--hp-ink-3); max-width: 64ch; }
.dbw-knob__text .dbw-chip { margin-top: 6px; }
.dbw-knob__ctl { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.dbw-knob__ctl .hp-input { width: 180px; text-align: right; }
.dbw-knob__ctl select.hp-input { text-align: left; }
.dbw-knob__ctl .dbw-wide { width: 260px; min-width: 0; text-align: left; }
.dbw-result { padding: 10px 14px; border: 1px solid var(--hp-line-2); border-radius: 8px; font-size: 13px; }
.dbw-result p { margin: 2px 0; }
.dbw-savebar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--hp-line-2); border-radius: 10px; background: var(--hp-bg-2); box-shadow: 0 -10px 30px -18px rgb(0 0 0 / .4); }
.dbw-savebar > span { flex: 1; font-size: 13px; font-weight: 500; }

/* import/export */
.dbw-picklist { display: flex; flex-direction: column; gap: 2px; max-height: 190px; overflow: auto; padding: 6px 8px; border: 1px solid var(--hp-line-2); border-radius: 8px; background: var(--hp-bg); }
.dbw-drop { position: relative; display: grid; place-items: center; min-height: 112px; padding: 16px; border: 1px dashed var(--hp-line-2); border-radius: 10px; background: var(--hp-bg); text-align: center; cursor: pointer; }
.dbw-drop:hover, .dbw-drop.is-drag { border-color: var(--hp-accent); }
.dbw-drop.has-file { border-style: solid; }
.dbw-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dbw-drop span { display: flex; flex-direction: column; gap: 4px; }
.dbw-drop small { font: 11.5px var(--hp-mono); color: var(--hp-ink-3); }
.dbw-progress small { display: block; margin-top: 6px; font-size: 12px; color: var(--hp-ink-3); }

/* logs */
.dbw-console { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.dbw-console .hp-console__bar { flex-wrap: wrap; }
.dbw-console__body { flex: 1; height: auto; min-height: 240px; }
.dbw-console__q { height: 26px; width: 160px; padding: 0 8px; border: 1px solid rgb(255 255 255 / .12); border-radius: 6px; background: rgb(255 255 255 / .04); color: inherit; font: 12px var(--hp-mono); outline: 0; }
.dbw-console .dbw-check, .dbw-console .dbw-iconbtn { color: rgb(233 230 225 / .7); }
.dbw-console .dbw-iconbtn:hover { background: rgb(255 255 255 / .08); color: #fff; }
.dbw-seg--dark { background: rgb(255 255 255 / .04); border-color: rgb(255 255 255 / .1); }
.dbw-seg--dark button { color: rgb(233 230 225 / .6); }
.dbw-seg--dark button.is-active { background: rgb(255 255 255 / .1); color: #fff; box-shadow: none; }
.dbw-log { padding: 1px 0; }
.dbw-log--err { color: #ff9b8f; }
.dbw-log--warn { color: #f2c66d; }
.dbw-log--note { color: rgb(233 230 225 / .62); }

/* dialog + toasts */
.dbw-dialog { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgb(0 0 0 / .42); }
.dbw-dialog__box { width: min(440px, 100%); padding: 20px; border: 1px solid var(--hp-line-2); border-radius: 12px; background: var(--hp-bg-2); box-shadow: var(--hp-shadow-lg); display: flex; flex-direction: column; gap: 12px; }
.dbw-dialog__box h2 { margin: 0; font: 600 16px/1.3 var(--hp-display); letter-spacing: -0.015em; }
.dbw-dialog__box p { margin: 0; font-size: 13.5px; color: var(--hp-ink-2); }
.dbw-dialog__go { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.dbw-toasts { position: fixed; right: 18px; bottom: 44px; z-index: 110; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.dbw-toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 420px; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--hp-line-2); background: var(--hp-bg-2); color: var(--hp-ink); font-size: 13px; box-shadow: 0 12px 30px -14px rgb(0 0 0 / .45); cursor: pointer; }
.dbw-toast.is-err { border-color: color-mix(in srgb, var(--hp-err) 45%, transparent); }
.dbw-toast .hp-dot { box-shadow: none; }

/* ------------------------------------------------------- responsive ----- */
@media (max-width: 1280px) {
    .dbw-bar { grid-template-columns: minmax(0, 1fr) auto; }
    .dbw-bar__live { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; padding-top: 10px; border-top: 1px solid var(--hp-line); }
    .dbw-bar__live > div:first-child { border-left: 0; padding-left: 0; }
    .dbw-sql__body { grid-template-columns: minmax(0, 1fr) 220px; }
    .dbw-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
    .dbw-sql__body { grid-template-columns: minmax(0, 1fr); }
    .dbw-sql__side { display: none; }
    .dbw-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dbw-chart:nth-child(3n) { border-right: 1px solid var(--hp-line); }
    .dbw-chart:nth-child(2n) { border-right: 0; }
    .dbw-chart:nth-last-child(-n+3) { border-bottom: 1px solid var(--hp-line); }
    .dbw-chart:nth-last-child(-n+2) { border-bottom: 0; }
    .dbw-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    .dbw { --dbw-h: max(520px, calc(100dvh - 240px)); }
    .dbw-frame { grid-template-columns: minmax(0, 1fr); position: relative; }
    .dbw-bar__nav { display: inline-flex !important; }
    .dbw-nav { position: absolute; inset: 0 auto 0 0; z-index: 50; width: min(290px, 86%); transform: translateX(-102%); transition: transform .2s var(--hp-ease); box-shadow: 0 0 40px rgb(0 0 0 / .3); }
    .dbw-nav.is-open { transform: none; }
    .dbw-scrim { display: block; position: absolute; inset: 0; z-index: 45; background: rgb(0 0 0 / .3); }
    .dbw-frame:has(.dbw-nav.is-open) .dbw-scrim { display: block; }
    .dbw-cols, .dbw-cols--2, .dbw-presets { grid-template-columns: minmax(0, 1fr); }
    .dbw-knob { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .dbw-knob__ctl { align-items: flex-start; }
    .dbw-knob__ctl .hp-input { text-align: left; }
}
@media (max-width: 560px) {
    .dbw-bar { grid-template-columns: minmax(0, 1fr); padding: 10px 12px; gap: 10px; }
    .dbw-bar__act { grid-row: 2; }
    .dbw-bar__live { grid-row: 3; }
    .dbw-bar__live > div { flex: none; }
    .dbw-bar__live dt { white-space: nowrap; }
    .dbw-bar__ico { display: none; }
    .dbw-bar__addr { display: none; }
    .dbw-bar__live { overflow-x: auto; scrollbar-width: none; }
    .dbw-bar__live > div { padding: 0 12px; }
    .dbw-bar__up { display: none; }
    .dbw-bar__act .hp-btn:not(.hp-btn--icon) { padding: 0 9px; }
    .dbw-charts { grid-template-columns: minmax(0, 1fr); }
    .dbw-chart { border-right: 0 !important; border-bottom: 1px solid var(--hp-line) !important; }
    .dbw-chart:last-child { border-bottom: 0 !important; }
    .dbw-fields { grid-template-columns: minmax(0, 1fr); }
    .dbw-page { padding: 16px 14px 28px; }
    .dbw-editor { grid-template-columns: 32px minmax(0, 1fr); }
    .dbw-toolbar .dbw-kbd, .dbw-select--quiet, .dbw-pager__hint { display: none; }
    .dbw-form__row > .dbw-field { min-width: 100%; }
    .dbw-wide, .dbw-knob__ctl .dbw-wide { min-width: 0; width: 100%; }
    .dbw-grid--list .dbw-row-actions { white-space: normal; }
    .dbw-toasts { left: 12px; right: 12px; align-items: stretch; }
}

/* ----------------------------------------------------- panel frame ------ */
/* Sections are the rail's buttons, live readouts the frame's strip; the
   schema tree and the editor fill the body edge to edge. */
.dbw .dbw-frame { flex: 1; height: auto; min-height: 520px; border: 0; border-radius: 0; }
@media (min-width: 901px) { .dbw .dbw-frame { min-height: 0; } }
.dbw .dbw-notice { margin: 12px 16px; }
.dbw-act { display: flex; align-items: center; gap: 6px; }

.hpf-stats:has(> .dbw-live) { display: block; }
.hpf-stats > .dbw-live { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 0; padding: 0; border: 0; }
.dbw-live > div { padding: 11px 20px 12px; border-left: 1px solid var(--hp-line); min-width: 0; }
.dbw-live > div:first-child { border-left: 0; padding-left: 24px; }
.dbw-live dt { font: 500 10.5px/1 var(--hp-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--hp-ink-3); }
.dbw-live dd { display: flex; align-items: center; gap: 7px; margin: 8px 0 0; font-size: 15px; font-weight: 600; white-space: nowrap; }
.dbw-live dd.dbw-mono { font-size: 15px; }
.dbw-live dd small { color: var(--hp-ink-3); font-weight: 500; font-size: 12px; }
@media (max-width: 900px) {
    .hpf-stats > .dbw-live { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dbw-live > div { padding: 10px 16px; }
    .dbw-live > div:nth-child(4) { border-left: 0; padding-left: 16px; }
    .dbw-live > div:nth-child(n+4) { border-top: 1px solid var(--hp-line); }
    .dbw-live > div:first-child { padding-left: 16px; }
}
