/* =========================================================================
   My Database Manager — design system
   Palette: primary #2B6CB0 · black #111111 · white #FAFAFA
   ========================================================================= */

:root {
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Red Hat Display', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --primary: #2B6CB0;
  --primary-2: #3B7FC7;
  --primary-3: #1F5590;
  --primary-soft: rgba(43, 108, 176, 0.16);
  --primary-soft-2: rgba(43, 108, 176, 0.28);
  --on-primary: #FAFAFA;

  --success: #34D399;
  --success-soft: rgba(52, 211, 153, 0.14);
  --warning: #FBBF24;
  --warning-soft: rgba(251, 191, 36, 0.14);
  --danger: #F87171;
  --danger-soft: rgba(248, 113, 113, 0.14);
  --info: #60A5FA;

  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --rail-w: 68px;
  --tree-w: 300px;
  --row-h: 34px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.25);
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #111111;
  --bg-2: #0d0d0d;
  --panel: #171717;
  --panel-2: #1c1c1c;
  --card: #1f1f1f;
  --card-2: #262626;
  --hover: rgba(255, 255, 255, 0.045);
  --active: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --border-2: rgba(255, 255, 255, 0.14);
  --text: #FAFAFA;
  --text-2: rgba(250, 250, 250, 0.74);
  --muted: rgba(250, 250, 250, 0.52);
  --muted-2: rgba(250, 250, 250, 0.34);
  --inverse: #FAFAFA;
  --on-inverse: #111111;
  --plate: #2a2a2a;
  --plate-text: #e8e8e8;
  --grid-line: rgba(255, 255, 255, 0.06);
  --grid-stripe: rgba(255, 255, 255, 0.015);
  --selection: rgba(43, 108, 176, 0.35);
  --overlay: rgba(0, 0, 0, 0.6);
  --code-bg: #141414;
  --scroll: rgba(255, 255, 255, 0.16);
}

:root[data-theme='light'] {
  color-scheme: light;
  --bg: #FAFAFA;
  --bg-2: #F1F2F4;
  --panel: #FFFFFF;
  --panel-2: #F6F7F8;
  --card: #F1F2F4;
  --card-2: #E9EBEE;
  --hover: rgba(17, 17, 17, 0.04);
  --active: rgba(17, 17, 17, 0.08);
  --border: rgba(17, 17, 17, 0.09);
  --border-2: rgba(17, 17, 17, 0.16);
  --text: #111111;
  --text-2: rgba(17, 17, 17, 0.74);
  --muted: rgba(17, 17, 17, 0.52);
  --muted-2: rgba(17, 17, 17, 0.36);
  --inverse: #111111;
  --on-inverse: #FAFAFA;
  --plate: #E6E8EB;
  --plate-text: #222;
  --grid-line: rgba(17, 17, 17, 0.07);
  --grid-stripe: rgba(17, 17, 17, 0.02);
  --selection: rgba(43, 108, 176, 0.18);
  --overlay: rgba(17, 17, 17, 0.4);
  --code-bg: #FFFFFF;
  --scroll: rgba(17, 17, 17, 0.2);
  --shadow-lg: 0 24px 64px rgba(17, 17, 17, 0.16), 0 2px 8px rgba(17, 17, 17, 0.06);
  --shadow: 0 10px 30px rgba(17, 17, 17, 0.12);
  --shadow-sm: 0 2px 6px rgba(17, 17, 17, 0.08);
  --success: #15A66B;
  --warning: #C98A00;
  --danger: #DC2626;
  --success-soft: rgba(21, 166, 107, 0.12);
  --warning-soft: rgba(201, 138, 0, 0.12);
  --danger-soft: rgba(220, 38, 38, 0.1);
}

/* ----------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
img, svg { display: block; }
code, pre, kbd, .mono { font-family: var(--font-mono); }
::selection { background: var(--selection); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--radius-xs); }
* { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

.icon { flex: 0 0 auto; }
.mono { font-family: var(--font-mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.center { justify-content: center; }
.gap-4 { gap: 4px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

/* ------------------------------------------------------------------ boot */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); }
.boot-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border-2); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm + 2px);
  border-radius: 10px; font-weight: 600; font-size: 14px; white-space: nowrap;
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease), color .15s;
  user-select: none;
}
.btn:hover:not(:disabled) { background: var(--card-2); border-color: var(--border-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: transparent; box-shadow: 0 6px 20px rgba(43,108,176,.28); }
.btn.primary:hover:not(:disabled) { background: var(--primary-2); }
.btn.inverse { background: var(--inverse); color: var(--on-inverse); border-color: transparent; }
.btn.inverse:hover:not(:disabled) { background: var(--inverse); opacity: .9; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { background: var(--hover); color: var(--text); border-color: transparent; }
.btn.outline { background: transparent; }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn.danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.btn.danger.solid { background: var(--danger); color: #fff; }
.btn.success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; gap: 6px; }
.btn.xs { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; gap: 5px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn.icon { width: 40px; padding: 0; }
.btn.icon.sm { width: 34px; }
.btn.icon.xs { width: 28px; }
.btn.pill { border-radius: 999px; }
.btn.block { width: 100%; }
.btn .spin { animation: spin .8s linear infinite; }
.btn-group { display: inline-flex; gap: 6px; }

/* ---------------------------------------------------------------- inputs */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.label .opt { color: var(--muted-2); font-weight: 500; }
.hint { font-size: 12px; color: var(--muted); }
.err { font-size: 12.5px; color: var(--danger); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-2); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: var(--panel); }
.input.invalid, .select.invalid { border-color: var(--danger); }
.input.sm { height: 34px; padding: 0 10px; font-size: 13px; border-radius: 9px; }
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-inline-end: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; cursor: pointer; }
[dir='rtl'] .select { background-position: left 10px center; }
.select option { background: var(--panel); color: var(--text); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > svg.icon { position: absolute; inset-inline-start: 12px; color: var(--muted); pointer-events: none; }
.input-wrap .input { padding-inline-start: 38px; }
.input-wrap.no-lead .input { padding-inline-start: 12px; }
.input-wrap .trail { position: absolute; inset-inline-end: 6px; pointer-events: auto; }
.input-wrap.has-trail .input { padding-inline-end: 40px; }
.input-prefix { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 10px; background: var(--card); height: 40px; overflow: hidden; }
.input-prefix span { padding: 0 10px; color: var(--muted); font-size: 12.5px; font-weight: 600; border-inline-end: 1px solid var(--border); height: 100%; display: flex; align-items: center; }
.input-prefix .input { border: 0; background: transparent; border-radius: 0; height: 100%; }
.input-prefix:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.span-12 { grid-column: span 12; } .span-10 { grid-column: span 10; } .span-9 { grid-column: span 9; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; } .span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; } .span-3 { grid-column: span 3; } .span-2 { grid-column: span 2; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }

/* toggle switch (JG style, filled when on) */
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .track { width: 38px; height: 22px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--border-2); position: relative; transition: background .2s, border-color .2s; flex: 0 0 auto; }
.toggle .track::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .2s var(--ease), background .2s; }
.toggle input:checked + .track { background: var(--primary); border-color: var(--primary); }
.toggle input:checked + .track::after { transform: translateX(16px); background: #fff; }
[dir='rtl'] .toggle input:checked + .track::after { transform: translateX(-16px); }
.toggle input:focus-visible + .track { outline: 2px solid var(--primary); outline-offset: 2px; }
.toggle .toggle-label { font-weight: 500; }

/* ----------------------------------------------------------------- chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: 999px; background: var(--card); border: 1px solid transparent; color: var(--text-2);
  font-weight: 600; font-size: 13px; transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { background: var(--card-2); color: var(--text); }
.chip.active { background: var(--inverse); color: var(--on-inverse); }
.chip .count { font-size: 11.5px; font-weight: 600; opacity: .6; }
.chip.active .count { opacity: .7; }
.chip.sm { height: 28px; padding: 0 10px; font-size: 12px; }

/* --------------------------------------------------------------- badges */
.plate {
  display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 5px;
  background: var(--plate); color: var(--plate-text); font-family: var(--font-mono); font-size: 10.5px;
  font-weight: 600; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap;
}
.plate.lower { text-transform: none; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--card); color: var(--text-2);
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.success { background: var(--success-soft); color: var(--success); }
.pill.warning { background: var(--warning-soft); color: var(--warning); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.primary { background: var(--primary-soft); color: var(--primary-2); }
:root[data-theme='light'] .pill.primary { color: var(--primary); }
.pill.sm { height: 20px; padding: 0 8px; font-size: 11px; }
.pill .icon { width: 13px; height: 13px; }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--card); color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.tag .icon { width: 13px; height: 13px; color: var(--muted); }
.db-badge { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px; font-family: var(--font-mono); font-weight: 700; font-size: 11px; letter-spacing: .04em; color: #fff; flex: 0 0 auto; }
.db-badge.lg { width: 44px; height: 44px; font-size: 13px; border-radius: 12px; }
.db-badge.sm { width: 26px; height: 26px; font-size: 9.5px; border-radius: 7px; }
.color-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.color-blue { background: #3B82F6; } .color-green { background: #22C55E; } .color-yellow { background: #EAB308; } .color-red { background: #EF4444; }
.color-purple { background: #A855F7; } .color-pink { background: #EC4899; } .color-orange { background: #F97316; } .color-teal { background: #14B8A6; }

/* ---------------------------------------------------------------- panels */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.panel-body { padding: 20px; }
.panel-foot { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.card.hover:hover { background: var(--card-2); border-color: var(--border-2); }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat .k { display: flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stat .v { margin-top: 6px; font-size: 22px; font-weight: 700; font-family: var(--font-display); letter-spacing: -.02em; }
.stat .v small { font-size: 12px; color: var(--muted); margin-inline-start: 4px; font-family: var(--font); font-weight: 500; }
.stat .bar { margin-top: 10px; height: 3px; border-radius: 3px; background: var(--border-2); overflow: hidden; }
.stat .bar i { display: block; height: 100%; background: var(--text); border-radius: 3px; }
.divider { height: 1px; background: var(--border); margin: 8px 0; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.section-title { font-size: 15px; font-weight: 700; }

/* ---------------------------------------------------------------- tables */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: start; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--hover); }
.table .actions { text-align: end; white-space: nowrap; }
.table .actions .btn { color: var(--muted); }
.table .actions .btn:hover { color: var(--text); }
.table .actions .btn.del:hover { color: var(--danger); background: var(--danger-soft); }
.table.compact td, .table.compact th { padding: 7px 10px; }
.table td.mono, .table th.mono { font-family: var(--font-mono); font-size: 12.5px; }

/* ------------------------------------------------------------------ tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 6px; }
.tab { display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 14px; font-weight: 600; font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s; position: relative; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--primary); }
.tab .badge { font-size: 11px; background: var(--card); padding: 1px 6px; border-radius: 999px; color: var(--muted); }
.tab .close { display: inline-flex; width: 18px; height: 18px; border-radius: 5px; align-items: center; justify-content: center; color: var(--muted); }
.tab .close:hover { background: var(--hover); color: var(--text); }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; min-width: 34px; padding: 0 10px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 13px; transition: background .15s, color .15s; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--inverse); color: var(--on-inverse); }
.seg.lg button { height: 38px; padding: 0 16px; }

/* ---------------------------------------------------------------- modals */
.modal-backdrop { position: fixed; inset: 0; z-index: 90; background: var(--overlay); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .15s var(--ease); }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: popIn .2s var(--ease); }
.modal.lg { max-width: 760px; }
.modal.xl { max-width: 980px; }
.modal.sm { max-width: 440px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 14px; }
.modal-head h3 { font-size: 18px; flex: 1; display: flex; align-items: center; gap: 10px; }
.modal-body { padding: 4px 20px 20px; overflow: auto; }
.modal-foot { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }
.modal-foot .grow { flex: 1; }

/* ----------------------------------------------------------------- menus */
.menu-wrap { position: relative; display: inline-flex; }
.menu { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; min-width: 190px; padding: 6px; background: var(--panel); border: 1px solid var(--border-2); border-radius: 12px; box-shadow: var(--shadow); z-index: 60; animation: popIn .12s var(--ease); }
.menu.start { inset-inline-end: auto; inset-inline-start: 0; }
.menu.up { top: auto; bottom: calc(100% + 6px); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 500; color: var(--text-2); text-align: start; }
.menu-item:hover { background: var(--hover); color: var(--text); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-soft); }
.menu-item.active { color: var(--text); background: var(--active); }
.menu-item .icon { color: var(--muted); }
.menu-item.danger .icon { color: inherit; }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu-title { padding: 6px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ---------------------------------------------------------------- toasts */
.toasts { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 120; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 40px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--border-2); border-radius: 12px; box-shadow: var(--shadow); animation: popIn .2s var(--ease); font-size: 13.5px; }
.toast .icon { margin-top: 1px; }
.toast.success .icon { color: var(--success); } .toast.error .icon { color: var(--danger); } .toast.warning .icon { color: var(--warning); } .toast.info .icon { color: var(--primary-2); }
.toast .t-title { font-weight: 700; margin-bottom: 2px; }
.toast .t-msg { color: var(--text-2); word-break: break-word; }
.toast .x { color: var(--muted); margin-inline-start: auto; }

/* ------------------------------------------------------------- empty state */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 48px 24px; color: var(--muted); }
.empty .ico { width: 56px; height: 56px; border-radius: 16px; background: var(--card); display: grid; place-items: center; color: var(--muted); margin-bottom: 6px; }
.empty h4 { font-size: 16px; color: var(--text); font-family: var(--font); font-weight: 700; }
.empty p { max-width: 380px; font-size: 13.5px; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-2); border-top-color: var(--primary); animation: spin .8s linear infinite; }
.spinner.lg { width: 30px; height: 30px; }
.loading-center { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px; color: var(--muted); }
.skeleton { background: linear-gradient(90deg, var(--card) 25%, var(--card-2) 50%, var(--card) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; font-size: 13px; background: var(--card); border: 1px solid var(--border); }
.alert.error { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.alert.warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.alert.success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.alert.info { background: var(--primary-soft); color: var(--text); border-color: transparent; }
.alert pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: 12.5px; }
kbd { display: inline-block; padding: 1px 6px; border-radius: 5px; background: var(--card); border: 1px solid var(--border-2); font-size: 11px; font-family: var(--font-mono); color: var(--text-2); }

/* ------------------------------------------------------------ pagination */
.pager { display: flex; align-items: center; gap: 6px; }
.pager .page-num { min-width: 34px; height: 34px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; background: var(--card); font-weight: 600; font-size: 13px; }
.pager input { width: 60px; text-align: center; }

/* =========================================================== landing page */
.landing { min-height: 100vh; display: flex; flex-direction: column; }
.landing-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.landing-bg::before { content: ''; position: absolute; width: 900px; height: 900px; left: 50%; top: -520px; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(closest-side, rgba(43,108,176,.28), transparent 70%); }
.landing-bg::after { content: ''; position: absolute; inset: 0; background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(ellipse at 50% 0%, #000 10%, transparent 60%); -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 10%, transparent 60%); }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.topbar { position: sticky; top: 0; z-index: 40; backdrop-filter: blur(14px); background: color-mix(in srgb, var(--bg) 78%, transparent); border-bottom: 1px solid var(--border); }
.topbar .container { display: flex; align-items: center; gap: 12px; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 17px; letter-spacing: -.02em; white-space: nowrap; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--primary); display: grid; place-items: center; color: #fff; box-shadow: 0 6px 18px rgba(43,108,176,.35); }
.brand-mark.lg { width: 44px; height: 44px; border-radius: 13px; }
.topnav { display: flex; align-items: center; gap: 4px; margin-inline-start: 24px; }
.topnav a { padding: 8px 12px; border-radius: 8px; color: var(--text-2); font-weight: 500; font-size: 14px; white-space: nowrap; }
.topnav a:hover { background: var(--hover); color: var(--text); }
.topbar .spacer { flex: 1; }
.hero { padding: 88px 0 56px; display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; }
.hero-kicker { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px 0 6px; border-radius: 999px; background: var(--card); border: 1px solid var(--border); font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.hero-kicker .dot { width: 18px; height: 18px; border-radius: 50%; background: var(--primary-soft); display: grid; place-items: center; color: var(--primary-2); }
.hero h1 { font-size: clamp(38px, 5.2vw, 60px); font-weight: 800; margin-top: 22px; letter-spacing: -.035em; }
.hero h1 em { font-style: normal; color: var(--primary-2); }
:root[data-theme='light'] .hero h1 em { color: var(--primary); }
.hero .lead { margin-top: 18px; font-size: 17px; line-height: 1.6; color: var(--text-2); max-width: 540px; }
.hero-actions { margin-top: 30px; display: flex; gap: 10px; flex-wrap: wrap; }
.hero-meta { margin-top: 26px; display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta .icon { color: var(--success); }

/* mock app preview (pure CSS) */
.mock { position: relative; }
.mock-window { background: var(--panel); border: 1px solid var(--border-2); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; animation: fadeUp .6s var(--ease); }
.mock-top { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.mock-top .dots { display: flex; gap: 6px; }
.mock-top .dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--card-2); }
.mock-top .addr { flex: 1; height: 26px; border-radius: 7px; background: var(--card); display: flex; align-items: center; padding: 0 10px; font-size: 11.5px; color: var(--muted); font-family: var(--font-mono); }
.mock-body { display: grid; grid-template-columns: 150px 1fr; min-height: 330px; }
.mock-tree { border-inline-end: 1px solid var(--border); padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; }
.mock-tree .ti { display: flex; align-items: center; gap: 7px; height: 26px; padding: 0 8px; border-radius: 7px; font-size: 11.5px; color: var(--text-2); }
.mock-tree .ti.act { background: var(--primary-soft); color: var(--text); }
.mock-tree .ti .icon { width: 12px; height: 12px; color: var(--muted); }
.mock-tree .ti.sub { padding-inline-start: 22px; }
.mock-main { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.mock-tabs { display: flex; gap: 4px; }
.mock-tabs span { height: 24px; padding: 0 10px; display: inline-flex; align-items: center; border-radius: 7px; font-size: 11px; font-weight: 600; color: var(--muted); }
.mock-tabs span.act { background: var(--card); color: var(--text); }
.mock-grid { flex: 1; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; font-size: 11px; font-family: var(--font-mono); }
.mock-grid .r { display: grid; grid-template-columns: 40px 1fr 1.2fr .8fr; }
.mock-grid .r > span { padding: 6px 8px; border-bottom: 1px solid var(--grid-line); border-inline-end: 1px solid var(--grid-line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mock-grid .r.h > span { background: var(--card); color: var(--muted); font-family: var(--font); font-weight: 600; }
.mock-grid .r > span:first-child { color: var(--muted); text-align: center; }
.mock-grid .r .n { color: var(--warning); }
.mock-grid .r .s { color: var(--success); }
.mock-grid .r .null { color: var(--muted-2); font-style: italic; }
.mock-foot { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--muted); }
.mock-foot .pill { height: 20px; font-size: 10.5px; }
.mock-float { position: absolute; inset-inline-end: -18px; bottom: 34px; background: var(--panel); border: 1px solid var(--border-2); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 10px; animation: fadeUp .8s var(--ease) .2s backwards; }
.mock-float .ok { width: 30px; height: 30px; border-radius: 9px; background: var(--success-soft); color: var(--success); display: grid; place-items: center; }
.mock-float b { display: block; font-size: 12.5px; }
.mock-float small { color: var(--muted); font-size: 11.5px; }

.section { padding: 56px 0; }
.section-head { max-width: 640px; margin-bottom: 32px; }
.section-head h2 { font-size: clamp(26px, 3.2vw, 36px); margin-top: 10px; }
.section-head p { margin-top: 12px; color: var(--text-2); font-size: 15.5px; line-height: 1.6; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feature { padding: 22px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); transition: transform .2s var(--ease), border-color .2s; }
.feature:hover { transform: translateY(-2px); border-color: var(--border-2); }
.feature .fi { width: 40px; height: 40px; border-radius: 11px; background: var(--primary-soft); color: var(--primary-2); display: grid; place-items: center; margin-bottom: 14px; }
:root[data-theme='light'] .feature .fi { color: var(--primary); }
.feature h3 { font-size: 16px; font-family: var(--font); font-weight: 700; }
.feature p { margin-top: 8px; color: var(--text-2); font-size: 13.5px; line-height: 1.6; }
.dbs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.dbcard { display: flex; align-items: center; gap: 12px; padding: 16px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; }
.dbcard b { display: block; font-size: 14px; }
.dbcard small { color: var(--muted); font-family: var(--font-mono); font-size: 11.5px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; counter-reset: step; }
.step { padding: 22px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); position: relative; }
.step::before { counter-increment: step; content: counter(step, decimal-leading-zero); font-family: var(--font-display); font-weight: 800; font-size: 32px; color: var(--primary-soft-2); line-height: 1; display: block; margin-bottom: 10px; }
:root[data-theme='light'] .step::before { color: rgba(43,108,176,.35); }
.step h3 { font-size: 16px; font-family: var(--font); }
.step p { margin-top: 8px; color: var(--text-2); font-size: 13.5px; line-height: 1.6; }
.security { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; padding: 36px; background: var(--panel); border: 1px solid var(--border); border-radius: 24px; }
.security ul { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-direction: column; gap: 12px; }
.security li { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); font-size: 14px; line-height: 1.55; }
.security li .icon { color: var(--success); margin-top: 2px; }
.security-art { display: grid; gap: 10px; }
.security-art .stat .v { font-size: 18px; }
.cta { text-align: center; padding: 60px 24px; background: linear-gradient(180deg, var(--primary-soft), transparent); border: 1px solid var(--border); border-radius: 28px; }
.cta h2 { font-size: clamp(26px, 3.2vw, 38px); }
.cta p { margin: 12px auto 0; max-width: 520px; color: var(--text-2); font-size: 15px; }
.footer { border-top: 1px solid var(--border); padding: 28px 0; margin-top: 40px; color: var(--muted); font-size: 13px; }
.footer .container { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer a:hover { color: var(--text); }

/* =============================================================== auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { position: relative; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; background: var(--panel); border-inline-end: 1px solid var(--border); overflow: hidden; }
.auth-side::before { content: ''; position: absolute; width: 700px; height: 700px; left: -200px; bottom: -420px; border-radius: 50%; background: radial-gradient(closest-side, rgba(43,108,176,.35), transparent 70%); }
.auth-side > * { position: relative; }
.auth-side h2 { font-size: clamp(28px, 3vw, 40px); max-width: 460px; }
.auth-side p { margin-top: 14px; color: var(--text-2); max-width: 440px; font-size: 15px; line-height: 1.6; }
.auth-points { margin-top: 26px; display: flex; flex-direction: column; gap: 10px; }
.auth-points span { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 14px; }
.auth-points .icon { color: var(--success); }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 420px; animation: fadeUp .35s var(--ease); }
.auth-card h1 { font-size: 28px; margin-top: 22px; }
.auth-card .sub { margin-top: 8px; color: var(--muted); }
.auth-card form { margin-top: 28px; display: flex; flex-direction: column; gap: 16px; }
.auth-alt { margin-top: 22px; color: var(--muted); font-size: 13.5px; text-align: center; }
.auth-alt a { color: var(--primary-2); font-weight: 600; }
:root[data-theme='light'] .auth-alt a { color: var(--primary); }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pw-meter { display: flex; gap: 4px; margin-top: 4px; }
.pw-meter i { flex: 1; height: 3px; border-radius: 3px; background: var(--border-2); }
.pw-meter i.on { background: var(--success); }
.pw-meter i.on.weak { background: var(--danger); } .pw-meter i.on.mid { background: var(--warning); }

/* =============================================================== shell */
.shell { display: flex; min-height: 100vh; height: 100vh; overflow: hidden; }
.rail { width: var(--rail-w); flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; padding: 14px 0; gap: 6px; background: var(--panel); border-inline-end: 1px solid var(--border); }
.rail .brand-mark { margin-bottom: 14px; }
.rail-btn { position: relative; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); transition: background .15s, color .15s; }
.rail-btn:hover { background: var(--hover); color: var(--text); }
.rail-btn.active { background: var(--primary-soft); color: var(--primary-2); }
:root[data-theme='light'] .rail-btn.active { color: var(--primary); }
.rail-btn .tip { position: absolute; inset-inline-start: calc(100% + 10px); top: 50%; transform: translateY(-50%); background: var(--inverse); color: var(--on-inverse); font-size: 12px; font-weight: 600; padding: 5px 9px; border-radius: 7px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 70; }
.rail-btn:hover .tip { opacity: 1; }
.rail .spacer { flex: 1; }
.rail .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.rail-sep { width: 28px; height: 1px; background: var(--border); margin: 6px 0; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.page { flex: 1; overflow: auto; padding: 28px 32px 40px; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.page-head h1 { font-size: 26px; }
.page-head .sub { margin-top: 4px; color: var(--muted); font-size: 14px; }
.page-head .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.page-narrow { max-width: 860px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search { flex: 1 1 260px; max-width: 460px; }

/* ------------------------------------------------------- connections list */
.conn-list { display: flex; flex-direction: column; gap: 6px; }
.conn-row { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; transition: border-color .15s, background .15s; overflow: hidden; }
.conn-row:hover { border-color: var(--border-2); }
.conn-row.open { border-color: var(--border-2); background: var(--panel-2); }
.conn-main { display: flex; align-items: center; gap: 14px; padding: 12px 14px; cursor: pointer; user-select: none; }
.conn-main .info { flex: 1; min-width: 0; }
.conn-main .name { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.conn-main .meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.conn-main .right { display: flex; align-items: center; gap: 8px; }
.conn-main .fav { color: var(--muted-2); }
.conn-main .fav.on { color: var(--warning); }
.conn-main .fav:hover { color: var(--warning); }
.conn-main .chev { color: var(--muted); transition: transform .2s var(--ease); }
.conn-row.open .chev { transform: rotate(180deg); }
.conn-detail { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 12px; animation: fadeIn .2s; }
.conn-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.conn-stats .stat .v { font-size: 15px; font-family: var(--font-mono); font-weight: 600; word-break: break-all; }
.conn-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.conn-card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; transition: border-color .15s, transform .15s var(--ease); cursor: pointer; }
.conn-card:hover { border-color: var(--border-2); transform: translateY(-2px); }
.conn-card .top { display: flex; align-items: flex-start; gap: 12px; }
.conn-card .name { font-weight: 700; font-size: 15px; }
.conn-card .host { color: var(--muted); font-size: 12.5px; font-family: var(--font-mono); margin-top: 2px; word-break: break-all; }
.conn-card .foot { display: flex; align-items: center; gap: 6px; margin-top: auto; }

/* ------------------------------------------------------------ workspace */
.ws { flex: 1; display: flex; min-height: 0; }
.ws-tree { width: var(--tree-w); flex: 0 0 auto; display: flex; flex-direction: column; background: var(--panel); border-inline-end: 1px solid var(--border); min-height: 0; }
.ws-tree-head { padding: 14px 14px 10px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--border); }
.ws-tree-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ws-tree-title .name { font-weight: 700; font-size: 14px; }
.ws-tree-title .host { color: var(--muted); font-size: 11.5px; font-family: var(--font-mono); }
.ws-tree-body { flex: 1; overflow: auto; padding: 8px; }
.ws-tree-foot { padding: 8px 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 8px; }
.tree-db { border-radius: 9px; }
.tree-item { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px; border-radius: 8px; color: var(--text-2); font-size: 13px; cursor: pointer; user-select: none; white-space: nowrap; }
.tree-item:hover { background: var(--hover); color: var(--text); }
.tree-item.active { background: var(--primary-soft); color: var(--text); }
.tree-item .tw { width: 16px; height: 16px; display: grid; place-items: center; color: var(--muted); flex: 0 0 auto; transition: transform .15s var(--ease); }
.tree-item.open .tw { transform: rotate(90deg); }
[dir='rtl'] .tree-item .tw { transform: rotate(180deg); }
[dir='rtl'] .tree-item.open .tw { transform: rotate(90deg); }
.tree-item .ti { color: var(--muted); flex: 0 0 auto; }
.tree-item.active .ti { color: var(--primary-2); }
.tree-item .tn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tree-item .tm { font-size: 11px; color: var(--muted-2); font-family: var(--font-mono); }
.tree-item .more { opacity: 0; color: var(--muted); }
.tree-item:hover .more { opacity: 1; }
.tree-item.db { font-weight: 600; }
.tree-item.db.sys { color: var(--muted); font-weight: 500; }
.tree-children { padding-inline-start: 14px; }
.tree-children .tree-item { height: 28px; font-size: 12.5px; }
.tree-loading { display: flex; align-items: center; gap: 8px; padding: 6px 12px; color: var(--muted); font-size: 12px; }
.tree-empty { padding: 6px 12px 6px 30px; color: var(--muted-2); font-size: 12px; font-style: italic; }
.tree-group { padding: 6px 10px 2px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); }

.ws-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.ws-top { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); min-height: 56px; }
.ws-top .crumb { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13.5px; }
.ws-top .crumb .sep { color: var(--muted-2); }
.ws-top .crumb b { font-weight: 700; }
.ws-top .crumb .icon { color: var(--muted); }
.ws-top .actions { margin-inline-start: auto; display: flex; gap: 6px; align-items: center; }
.ws-tabs { padding: 0 8px; }
.ws-content { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ws-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.ws-toolbar .filter { flex: 1 1 280px; }
.ws-status { display: flex; align-items: center; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; min-height: 42px; flex-wrap: wrap; }
.ws-status .grow { flex: 1; }
.ws-status b { color: var(--text-2); font-weight: 600; }

/* --------------------------------------------------------------- grid */
.dg { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.dg-scroll { flex: 1; overflow: auto; position: relative; outline: none; }
.dg-canvas { position: relative; min-width: 100%; }
.dg-head { position: sticky; top: 0; z-index: 3; display: flex; background: var(--panel); border-bottom: 1px solid var(--border-2); height: var(--row-h); }
.dg-row { display: flex; height: var(--row-h); border-bottom: 1px solid var(--grid-line); }
.dg-row:nth-child(even) { background: var(--grid-stripe); }
.dg-row:hover { background: var(--hover); }
.dg-row.selected { background: var(--selection); }
.dg-cell, .dg-hcell { flex: 0 0 auto; height: 100%; padding: 0 10px; display: flex; align-items: center; border-inline-end: 1px solid var(--grid-line); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12.5px; font-family: var(--font-mono); }
.dg-cell { cursor: default; }
.dg-cell span { overflow: hidden; text-overflow: ellipsis; }
.dg-cell.num { justify-content: flex-end; color: var(--warning); }
.dg-cell.bool { color: var(--info); }
.dg-cell.date { color: var(--success); }
.dg-cell.null span { color: var(--muted-2); font-style: italic; font-family: var(--font); }
.dg-cell.json { color: var(--text-2); }
.dg-cell.binary { color: var(--muted); }
.dg-cell.pk { font-weight: 600; }
.dg-cell.editing { padding: 0; }
.dg-cell.editing input { width: 100%; height: 100%; border: 2px solid var(--primary); background: var(--panel); padding: 0 8px; font: inherit; color: var(--text); outline: none; }
.dg-cell.dirty { box-shadow: inset 0 0 0 1px var(--warning); }
.dg-cell.focus { box-shadow: inset 0 0 0 2px var(--primary); }
.dg-hcell { font-family: var(--font); font-weight: 600; font-size: 12.5px; color: var(--text-2); cursor: pointer; user-select: none; position: relative; gap: 6px; }
.dg-hcell:hover { background: var(--hover); color: var(--text); }
.dg-hcell .hn { overflow: hidden; text-overflow: ellipsis; }
.dg-hcell .ht { font-size: 10px; color: var(--muted-2); font-weight: 500; font-family: var(--font-mono); }
.dg-hcell .key { color: var(--warning); width: 12px; height: 12px; }
.dg-hcell .sort { color: var(--primary-2); }
.dg-hcell .rz { position: absolute; inset-inline-end: -3px; top: 0; bottom: 0; width: 6px; cursor: col-resize; z-index: 2; }
.dg-hcell .rz:hover, .dg-hcell .rz.on { background: var(--primary); }
.dg-gutter { flex: 0 0 auto; width: 52px; justify-content: center; color: var(--muted-2); font-family: var(--font-mono); font-size: 11px; background: var(--panel); position: sticky; inset-inline-start: 0; z-index: 2; cursor: pointer; user-select: none; }
.dg-row .dg-gutter { background: var(--bg); }
.dg-row.selected .dg-gutter { background: var(--primary-soft-2); color: var(--text); }
.dg-row:hover .dg-gutter { color: var(--text-2); }
.dg-head .dg-gutter { z-index: 4; }
.dg-empty { position: absolute; inset: var(--row-h) 0 0 0; display: grid; place-items: center; color: var(--muted); font-size: 13.5px; pointer-events: none; }
.dg-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 60%, transparent); z-index: 5; }
.dg-msg { padding: 24px; }

/* cell editor popover */
.cell-editor { position: fixed; z-index: 95; width: min(560px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--border-2); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 12px; display: flex; flex-direction: column; gap: 10px; animation: popIn .12s var(--ease); }
.cell-editor textarea { min-height: 120px; font-family: var(--font-mono); font-size: 12.5px; }
.cell-editor .ce-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.cell-editor .ce-head b { color: var(--text); font-family: var(--font-mono); }

/* --------------------------------------------------------- query editor */
.qe { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.qe-tabs { display: flex; align-items: center; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
.qe-tabs .tab { height: 36px; font-size: 13px; padding: 0 10px 0 12px; }
.qe-tabs .add { color: var(--muted); }
.qe-editor { position: relative; min-height: 120px; height: 42%; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; }
.qe-editor.full { height: auto; flex: 1; }
.qe-editor .cm-host { flex: 1; min-height: 0; }
.qe-resize { height: 6px; cursor: row-resize; background: transparent; position: relative; }
.qe-resize::after { content: ''; position: absolute; left: 50%; top: 2px; width: 40px; height: 2px; border-radius: 2px; background: var(--border-2); transform: translateX(-50%); }
.qe-resize:hover::after { background: var(--primary); }
.qe-results { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.qe-result-tabs { display: flex; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.qe-result-tabs .tab { height: 36px; font-size: 12.5px; padding: 0 10px; }
.qe-message { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.qe-hint { color: var(--muted); font-size: 12px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* CodeMirror theme */
.CodeMirror { height: 100%; font-family: var(--font-mono); font-size: 13px; line-height: 1.55; background: var(--code-bg); color: var(--text); }
.CodeMirror-gutters { background: var(--code-bg); border-inline-end: 1px solid var(--border); }
.CodeMirror-linenumber { color: var(--muted-2); padding: 0 8px 0 12px; }
.CodeMirror-cursor { border-left: 2px solid var(--text); }
.CodeMirror-selected, .CodeMirror-focused .CodeMirror-selected { background: var(--selection); }
.CodeMirror-activeline-background { background: var(--hover); }
.CodeMirror-matchingbracket { color: var(--primary-2) !important; text-decoration: underline; }
.CodeMirror pre.CodeMirror-placeholder { color: var(--muted-2); }
.cm-s-default .cm-keyword { color: #7CB1EA; font-weight: 600; }
:root[data-theme='light'] .cm-s-default .cm-keyword { color: #1F5590; }
.cm-s-default .cm-builtin, .cm-s-default .cm-atom { color: #C084FC; }
:root[data-theme='light'] .cm-s-default .cm-builtin, :root[data-theme='light'] .cm-s-default .cm-atom { color: #7E22CE; }
.cm-s-default .cm-number { color: #FBBF24; }
:root[data-theme='light'] .cm-s-default .cm-number { color: #B45309; }
.cm-s-default .cm-string, .cm-s-default .cm-string-2 { color: #6EE7B7; }
:root[data-theme='light'] .cm-s-default .cm-string, :root[data-theme='light'] .cm-s-default .cm-string-2 { color: #047857; }
.cm-s-default .cm-comment { color: var(--muted); font-style: italic; }
.cm-s-default .cm-variable-2, .cm-s-default .cm-variable-3, .cm-s-default .cm-def { color: var(--text); }
.cm-s-default .cm-operator { color: var(--text-2); }
.cm-s-default .cm-property { color: #93C5FD; }
:root[data-theme='light'] .cm-s-default .cm-property { color: #1D4ED8; }
.cm-s-default .cm-bracket { color: var(--text-2); }
.CodeMirror-hints { background: var(--panel); border: 1px solid var(--border-2); border-radius: 10px; box-shadow: var(--shadow); font-family: var(--font-mono); font-size: 12.5px; padding: 4px; }
.CodeMirror-hint { color: var(--text-2); border-radius: 6px; padding: 4px 8px; }
li.CodeMirror-hint-active { background: var(--primary); color: #fff; }

/* -------------------------------------------------------- structure tab */
.structure { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 18px; }
.structure .panel-head { padding: 12px 16px; }
.structure .panel-head h3 { font-size: 14px; font-family: var(--font); display: flex; align-items: center; gap: 8px; }
.structure .panel-head .icon { color: var(--muted); }
.structure pre { margin: 0; padding: 16px; font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; color: var(--text-2); max-height: 480px; overflow: auto; }
.code-block { position: relative; background: var(--code-bg); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.code-block .copy { position: absolute; top: 8px; inset-inline-end: 8px; }

/* -------------------------------------------------------- server tab */
.server { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 18px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.kv .stat .v { font-size: 14px; font-family: var(--font-mono); font-weight: 500; word-break: break-all; }

/* ---------------------------------------------------------- history */
.hist-item { display: flex; gap: 12px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; align-items: flex-start; }
.hist-item:hover { border-color: var(--border-2); }
.hist-item pre { margin: 0; flex: 1; min-width: 0; font-size: 12.5px; white-space: pre-wrap; word-break: break-word; max-height: 92px; overflow: hidden; color: var(--text-2); cursor: pointer; }
.hist-item .meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.hist-item .acts { display: flex; gap: 4px; }
.snip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.snip { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.snip:hover { border-color: var(--border-2); }
.snip pre { margin: 0; font-size: 12px; color: var(--text-2); white-space: pre-wrap; word-break: break-word; max-height: 110px; overflow: hidden; background: var(--code-bg); border-radius: 8px; padding: 10px; }
.snip .name { font-weight: 700; display: flex; align-items: center; gap: 8px; }

/* ------------------------------------------------------------ settings */
.settings-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
.settings-section { padding: 22px; }
.settings-section h3 { font-size: 16px; font-family: var(--font); margin-bottom: 4px; }
.settings-section .desc { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.settings-row:first-of-type { border-top: 0; }
.settings-row .l b { display: block; font-size: 14px; }
.settings-row .l span { color: var(--muted); font-size: 12.5px; }
.theme-pick { display: flex; gap: 10px; }
.theme-pick button { width: 92px; padding: 8px; border-radius: 12px; border: 2px solid var(--border); background: var(--card); display: flex; flex-direction: column; gap: 6px; align-items: center; font-size: 12px; font-weight: 600; color: var(--muted); }
.theme-pick button.active { border-color: var(--primary); color: var(--text); }
.theme-pick .sw { width: 100%; height: 40px; border-radius: 8px; border: 1px solid var(--border-2); }
.theme-pick .sw.dark { background: linear-gradient(135deg, #111 40%, #2B6CB0); }
.theme-pick .sw.light { background: linear-gradient(135deg, #FAFAFA 40%, #2B6CB0); }
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.lang-grid button { height: 40px; padding: 0 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.lang-grid button.active { border-color: var(--primary); background: var(--primary-soft); }

/* ------------------------------------------------------------ mobile */
.drawer-backdrop { display: none; }
.mobile-only { display: none !important; }
@media (max-width: 1100px) {
  .features, .steps { grid-template-columns: repeat(2, 1fr); }
  .dbs { grid-template-columns: repeat(3, 1fr); }
  .conn-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 48px; gap: 36px; }
  .mock-float { inset-inline-end: 0; }
  .security { grid-template-columns: 1fr; padding: 24px; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .ws-tree { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; z-index: 80; width: min(320px, 86vw); transform: translateX(-105%); transition: transform .22s var(--ease); box-shadow: var(--shadow-lg); }
  [dir='rtl'] .ws-tree { transform: translateX(105%); }
  .ws-tree.open { transform: none !important; }
  .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 79; background: var(--overlay); animation: fadeIn .2s; }
  .mobile-only { display: inline-flex !important; }
  .desktop-only { display: none !important; }
  .page { padding: 20px 16px 32px; }
  .topnav { display: none; }
  .exp-grid { grid-template-columns: 1fr; }
  .um { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .um-list { border-inline-end: 0; border-bottom: 1px solid var(--border); max-height: 40vh; }
}
@media (max-width: 640px) {
  :root { --rail-w: 56px; }
  .features, .steps, .dbs { grid-template-columns: 1fr; }
  .form-grid [class*='span-'] { grid-column: span 12; }
  .rail-btn { width: 40px; height: 40px; }
  .rail-btn .tip { display: none; }
  .page-head { flex-direction: column; }
  .page-head .actions { margin-inline-start: 0; }
  .conn-stats { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 34px; }
  .modal { max-height: calc(100vh - 20px); }
  .modal-backdrop { padding: 10px; align-items: flex-end; }
  .toasts { inset-inline-end: 10px; bottom: 10px; }
  .ws-top { flex-wrap: wrap; min-height: 0; }
  .ws-top .actions { margin-inline-start: 0; width: 100%; }
  .topbar .brand span, .footer .brand span { display: none; }
  .container { padding: 0 16px; }
}
/* ------------------------------------------------------------ additions */
/* anchor targets: the section's own top padding overlaps the sticky bar so its heading lands just under it */
section[id], [id].section { scroll-margin-top: 48px; }
html.smooth-scroll { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html.smooth-scroll { scroll-behavior: auto; } }

/* browsers' own password reveal / autofill styling */
input::-ms-reveal, input::-ms-clear { display: none; }
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus, textarea:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--card) inset; -webkit-text-fill-color: var(--text); caret-color: var(--text); transition: background-color 9999s ease-out;
}
.input.masked, .textarea.masked { -webkit-text-security: disc; }

/* menus */
.menu.side { top: auto; bottom: 0; inset-inline-end: auto; inset-inline-start: calc(100% + 10px); min-width: 210px; }
.menu.wide { min-width: 260px; }
.menu-scroll { max-height: min(60vh, 420px); overflow: auto; }
.menu-user { padding: 8px 10px 6px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.menu-item.hl { background: var(--hover); color: var(--text); }
.menu-item:disabled { opacity: .45; }
.rail .menu-wrap { display: flex; }
.rail-btn.active .avatar { box-shadow: 0 0 0 2px var(--primary-soft-2); }
.menu-wrap:has(.menu) .rail-btn .tip { display: none; }

/* themed tooltip (js/tooltip.js) — same look as the rail's .tip, shown under any element with a title / icon-only aria-label */
.tooltip { position: fixed; z-index: 200; max-width: 320px; padding: 5px 9px; border-radius: 7px; background: var(--inverse); color: var(--on-inverse); font-size: 12px; font-weight: 600; line-height: 1.35; white-space: pre-line; pointer-events: none; opacity: 0; transition: opacity .12s; }
.tooltip.show { opacity: 1; }

/* styled select */
.selbox { position: relative; display: inline-flex; min-width: 0; }
.selbox.block { display: flex; width: 100%; }
.selbox-btn { display: flex; align-items: center; gap: 8px; text-align: start; cursor: pointer; width: 100%; }
.selbox-btn.sm { height: 34px; padding-inline-start: 10px; font-size: 13px; border-radius: 9px; }
.selbox.open .selbox-btn { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.selbox-label { flex: 1; min-width: 0; }
.selbox-menu { inset-inline-start: 0; inset-inline-end: auto; width: 100%; min-width: 0; max-width: 100%; padding: 6px; }
.selbox-search { padding: 2px 2px 6px; }
.selbox-list { max-height: min(50vh, 320px); overflow: auto; }
.selbox-list .menu-item { white-space: nowrap; }
.selbox-opt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.selbox-hint { font-size: 11px; font-weight: 500; color: var(--muted); }

/* snippets */
.snip-foot { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.snip-foot .menu-wrap { width: 100%; }
.btn.block { width: 100%; }

/* database picker (connection form) */
.dbpick { position: relative; display: flex; flex-direction: column; gap: 6px; }
.dbpick-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 40px; padding: 4px 6px 4px 8px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); cursor: text; }
.dbpick-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.dbpick-box .chip { height: 26px; padding: 0 6px 0 10px; gap: 4px; }
.dbpick-box .chip .x { display: inline-flex; width: 18px; height: 18px; border-radius: 50%; align-items: center; justify-content: center; opacity: .7; }
.dbpick-box .chip .x:hover { opacity: 1; background: rgba(0,0,0,.15); }
.dbpick-input { flex: 1 1 120px; min-width: 120px; height: 30px; border: 0; background: transparent; outline: none; padding: 0 4px; }
.dbpick-menu { position: absolute; top: calc(100% + 6px); inset-inline-start: 0; width: 100%; max-width: 100%; }
.dbpick-menu .selbox-list { max-height: 240px; }

/* tree groups (Tables / Views / Procedures ...) */
.tree-group-row { display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px 0 4px; border-radius: 7px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; user-select: none; margin-top: 2px; }
.tree-group-row:hover { background: var(--hover); color: var(--text-2); }
.tree-group-row .tw { width: 14px; height: 14px; display: grid; place-items: center; transition: transform .15s var(--ease); }
.tree-group-row.open .tw { transform: rotate(90deg); }
[dir='rtl'] .tree-group-row .tw { transform: rotate(180deg); }
[dir='rtl'] .tree-group-row.open .tw { transform: rotate(90deg); }
.tree-group-row .tn { flex: 1; }
.tree-group-row .tm { font-family: var(--font-mono); font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted-2); }
.tree-children .tree-item.sub { padding-inline-start: 22px; }
.tree-item .tw:hover { color: var(--text); background: var(--active); border-radius: 4px; }

/* database tab */
.dbtab { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 14px; padding-bottom: 20px; }
.dbtab-table { padding: 0 14px; }
.dbtab-table .table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.dbtab-table .table th.sortable:hover { color: var(--text); }
.dbtab-table .table th.num, .dbtab-table .table td.num { text-align: end; white-space: nowrap; }
.dbtab-table .table td .plate { white-space: nowrap; }
.dbtab-table .table tr.selected td { background: var(--selection); }
.dbtab-table .table td a b { font-weight: 600; }
.dbtab-table .table td a:hover b { color: var(--primary-2); text-decoration: underline; }
.dbtab-table input[type='checkbox'] { accent-color: var(--primary); width: 15px; height: 15px; }
.dbtab-objects { display: flex; flex-direction: column; gap: 14px; padding: 0 14px; }
.dbtab-objects .panel-head { padding: 10px 14px; }
.dbtab-objects .section-title { font-family: var(--font); display: flex; align-items: center; gap: 8px; }
.dbtab-objects .section-title .icon { color: var(--muted); }
.dbtab-objects td a:hover b { color: var(--primary-2); text-decoration: underline; }

/* two-row workspace tabs */
.ws-tabs-wrap { border-bottom: 1px solid var(--border); }
.ws-tabs.top { border-bottom: 1px solid var(--border); }
.ws-tabs.bottom { background: var(--card); min-height: 38px; align-items: center; }
.ws-tabs.bottom .tab { height: 36px; font-size: 13px; }
.tab-badge { margin-inline-start: 6px; font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--muted); background: var(--card-2); padding: 1px 6px; border-radius: 6px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.tab.active .tab-badge { color: var(--text-2); }
.tab-label { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px 0 8px; font-size: 12.5px; color: var(--text-2); max-width: 320px; min-width: 0; border-inline-end: 1px solid var(--border); margin-inline-end: 4px; height: 24px; }
.tab-label .icon { color: var(--muted); flex: 0 0 auto; }
.tab-label .muted { text-transform: capitalize; }
.tab-label b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab-hint { padding: 0 12px; font-size: 12.5px; color: var(--muted-2); font-style: italic; }

/* tree head: title / tool row / full-width search box */
.ws-tree-head { gap: 8px; }
.ws-tree-tools { display: flex; gap: 6px; }
.ws-tree-tools > * { flex: 1 1 0; min-width: 0; }
.ws-tree-tools .menu-wrap { display: flex; }
.ws-tree-tools .btn { width: 100%; padding: 0; }
.menu-item.off { color: var(--muted-2); }
.menu-item.off .icon { color: var(--muted-2); }
.menu-item .menu-check { color: var(--primary-2); }
.tree-warn { display: flex; align-items: center; gap: 6px; padding: 4px 8px 4px 10px; color: var(--warning); font-size: 11.5px; min-width: 0; }
.tree-warn .icon { flex: 0 0 auto; }

/* tree search box: the options open in a popover over the tree instead of pushing it down */
.search-box { position: relative; width: 100%; min-width: 0; }
.search-box .input { padding-inline-end: 62px; width: 100%; }
.search-box .trail { inset-inline-end: 4px; }
.search-box .btn.active { background: var(--primary-soft); color: var(--primary-2); }
.dot-badge { position: absolute; top: 3px; inset-inline-end: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.btn.has-badge { position: relative; }
.btn.active { background: var(--primary-soft); color: var(--primary-2); border-color: transparent; }
.search-opts { position: absolute; top: calc(100% + 6px); inset-inline: 0; z-index: 60; display: flex; flex-direction: column; gap: 10px; padding: 10px; border: 1px solid var(--border-2); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); max-height: min(70vh, 560px); overflow: auto; animation: popIn .12s var(--ease); }
.search-opt-group { display: flex; flex-direction: column; gap: 2px; }
.search-opt-label { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 8px; margin-bottom: 4px; }
.check-row { display: flex; align-items: center; gap: 9px; height: 30px; padding: 0 8px; border-radius: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; min-width: 0; }
.check-row:hover { background: var(--hover); color: var(--text); }
.check-row input { width: 15px; height: 15px; accent-color: var(--primary); margin: 0; flex: 0 0 auto; }
.check-row .icon { color: var(--muted); }
.check-row .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-opts .chips { padding: 0 6px; gap: 5px; }
.search-opts .chip { cursor: pointer; }
.search-opts .chip .icon { margin-inline-end: 2px; }
.search-opts .chip.active { background: var(--primary-soft); color: var(--primary-2); border-color: transparent; }
.search-opts .chip.mono { font-family: var(--font-mono); font-size: 11.5px; }
.search-dbs { max-height: 108px; overflow: auto; }
.search-opt-foot { display: flex; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.search-results { display: flex; flex-direction: column; gap: 2px; }
.search-toolbar { display: flex; align-items: center; gap: 2px; padding: 2px 4px 6px; border-bottom: 1px solid var(--border); margin-bottom: 4px; color: var(--muted); position: sticky; top: -8px; background: var(--panel); z-index: 1; }
.search-toolbar b { color: var(--text); }
.tree-item.result .hit { background: var(--warning-soft); color: var(--text); border-radius: 3px; padding: 0 1px; }
.tree-item.result.flat { padding-inline-start: 8px; }
.tree-children.flat .tree-item.sub { padding-inline-start: 10px; }

/* object editor */
.object-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 8px 14px; border-bottom: 1px solid var(--border); font-size: 12px; }
.kvp { display: inline-flex; gap: 6px; align-items: baseline; min-width: 0; }
.kvp .k { color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.kvp .v { font-family: var(--font-mono); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 360px; }
.object-editor { flex: 1; min-height: 160px; position: relative; display: flex; flex-direction: column; }
.object-editor .cm-host { flex: 1; min-height: 0; }
.object-editor .CodeMirror { height: 100%; }

/* grid extras */
.dg-cell.hit { background: var(--warning-soft); box-shadow: inset 0 0 0 1px var(--warning); }
.dg-cols { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; color: var(--muted-2); }
.dg-cols:hover { background: var(--active); color: var(--text); }
.dg-head .dg-gutter { position: sticky; }
.dg-head .dg-gutter .menu-wrap { position: static; }
.ctx-menu { position: fixed; z-index: 96; min-width: 230px; }
.ctx-menu .menu-title { max-width: 260px; }

/* export / import dialogs */
.exp-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; }
.exp-list { max-height: 360px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; padding: 4px; background: var(--card); }
.exp-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.exp-item:hover { background: var(--hover); }
.exp-item.on { color: var(--text); }
.exp-item input { accent-color: var(--primary); width: 15px; height: 15px; margin: 0; }
.exp-item .icon { color: var(--muted); }
.btn.disabled, a.btn.disabled { opacity: .45; pointer-events: none; }
.imp-file { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px; border: 1px dashed var(--border-2); border-radius: 10px; background: var(--card); }
.imp-map { max-height: 300px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.progress { height: 8px; border-radius: 6px; background: var(--card-2); overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; background: var(--primary); border-radius: 6px; transition: width .2s; }
.progress i.bad { background: var(--danger); }
.imp-errors { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; max-height: 240px; overflow: auto; }
.imp-errors .alert { align-items: flex-start; }
.imp-errors pre { margin: 0; white-space: pre-wrap; word-break: break-word; color: var(--text-2); }

/* user manager */
.um { flex: 1; min-height: 0; display: grid; grid-template-columns: 280px minmax(0, 1fr); }
.um-list { border-inline-end: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.um-list-head { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--border); }
.um-items { flex: 1; overflow: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.um-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border-radius: 9px; text-align: start; font-size: 13px; color: var(--text-2); }
.um-item:hover { background: var(--hover); color: var(--text); }
.um-item.active { background: var(--primary-soft); color: var(--text); }
.um-item .icon { color: var(--muted); flex: 0 0 auto; }
.um-foot { padding: 8px 12px; border-top: 1px solid var(--border); }
.um-editor { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.um-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.um-body { flex: 1; overflow: auto; padding: 16px; }
.um-actions { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.priv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; }
.priv-grid .checkbox { padding: 5px 8px; border-radius: 7px; font-size: 12.5px; color: var(--text-2); }
.priv-grid .checkbox:hover { background: var(--hover); }
.priv-grid .checkbox.on { color: var(--text); }
.priv-block { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--card); display: flex; flex-direction: column; gap: 8px; }
.form-section .btn { text-transform: none; letter-spacing: 0; }

/* server tab */
.sv-tabs { flex-wrap: wrap; }
.sv-table td.sv-val { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-pct { height: 8px; border-radius: 6px; background: var(--card-2); overflow: hidden; min-width: 80px; }
.bar-pct i { display: block; height: 100%; background: var(--primary); border-radius: 6px; }

/* table designer */
.design-scroll { overflow: auto; }
.design-table td { vertical-align: middle; padding: 6px 8px; }
.design-table .input.sm { min-width: 90px; }
.design-table tr.dropped td { opacity: .45; text-decoration: line-through; }
.design-table tr.dropped td .input, .design-table tr.dropped td .selbox { text-decoration: line-through; }
.design-table tr.added td { box-shadow: inset 3px 0 0 var(--success); }
.design-table .chip.sm { height: 24px; font-size: 11.5px; padding: 0 4px 0 8px; }
.design-table .chip .x { display: inline-flex; width: 16px; height: 16px; border-radius: 50%; align-items: center; justify-content: center; opacity: .7; }
.design-table .checkbox.tiny { font-size: 11px; color: var(--muted); }

/* form sections */
.form-section { grid-column: span 12; display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.form-section::after { content: ''; flex: 1; height: 1px; background: var(--border); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
