/* =====================================================================
   Heaven dashboard: design tokens
   Light is the default; dark applies with the system setting unless the
   user picked a theme (html[data-theme]).
   ===================================================================== */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e3e6eb;
  --border-strong: #cfd4dc;
  --text: #0f1729;
  --text-2: #344054;
  --muted: #667085;
  --accent: #2a78d6;
  --accent-hover: #256abf;
  --accent-soft: #e9f2fc;
  --accent-text: #ffffff;
  --ok: #0ca30c;          /* status: good */
  --ok-text: #067306;
  --ok-soft: #e7f6e7;
  --warn: #fab219;        /* status: warning */
  --warn-text: #8a5a00;
  --warn-soft: #fff5de;
  --bad: #d03b3b;         /* status: critical */
  --bad-text: #b42323;
  --bad-soft: #fdeded;
  --pg: #2a78d6;          /* engine identity (categorical blue) */
  --mongo: #1baf7a;       /* engine identity (categorical aqua) */
  --redis: #eb6834;       /* engine identity (categorical orange) */
  --code-bg: #f2f4f7;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .08), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, .25);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar: 232px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0e12; --surface: #14171c; --surface-2: #191d23; --border: #252a32; --border-strong: #343a44;
    --text: #eef0f4; --text-2: #c7ccd4; --muted: #8a92a0;
    --accent: #3987e5; --accent-hover: #5598e7; --accent-soft: rgba(57, 135, 229, .16); --accent-text: #ffffff;
    --ok-text: #4fc66a; --ok-soft: rgba(12, 163, 12, .16); --warn-text: #f5c451; --warn-soft: rgba(250, 178, 25, .14);
    --bad: #e66767; --bad-text: #f08484; --bad-soft: rgba(230, 103, 103, .14);
    --pg: #3987e5; --mongo: #199e70; --redis: #d95926; --code-bg: #0f1216;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 4px 14px rgba(0, 0, 0, .45); --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0e12; --surface: #14171c; --surface-2: #191d23; --border: #252a32; --border-strong: #343a44;
  --text: #eef0f4; --text-2: #c7ccd4; --muted: #8a92a0;
  --accent: #3987e5; --accent-hover: #5598e7; --accent-soft: rgba(57, 135, 229, .16); --accent-text: #ffffff;
  --ok-text: #4fc66a; --ok-soft: rgba(12, 163, 12, .16); --warn-text: #f5c451; --warn-soft: rgba(250, 178, 25, .14);
  --bad: #e66767; --bad-text: #f08484; --bad-soft: rgba(230, 103, 103, .14);
  --pg: #3987e5; --mongo: #199e70; --redis: #d95926; --code-bg: #0f1216;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 4px 14px rgba(0, 0, 0, .45); --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* =====================================================================
   Base
   ===================================================================== */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14.5px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 10px; }
p { margin: 0; }
a { color: var(--accent); }
code, kbd { font-family: var(--mono); font-size: 12.5px; }
kbd { border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: var(--surface); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--bad-text); font-size: 13.5px; margin-top: 10px; }
.error:empty { display: none; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.fill { fill: currentColor; stroke: none; }
::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }

/* ---------- form controls ---------- */
input, select, textarea, button, label.button, a.button {
  font: inherit; color: inherit; border-radius: var(--radius-sm);
}
input, select, textarea {
  border: 1px solid var(--border-strong); background: var(--surface); padding: 9px 12px; min-height: 40px;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
button, label.button, a.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--border-strong); background: var(--surface); padding: 8px 14px; min-height: 38px;
  font-weight: 550; font-size: 14px; text-decoration: none; box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
button:hover, label.button:hover, a.button:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--accent) 40%, var(--border-strong)); }
button:focus-visible, label.button:focus-visible, a.button:focus-visible, a:focus-visible {
  outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
}
button:disabled { opacity: .55; cursor: default; }
button.primary, label.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.primary:hover, label.button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
button.ghost:hover { background: color-mix(in srgb, var(--text) 6%, transparent); border-color: transparent; }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.danger:hover { background: color-mix(in srgb, var(--bad) 88%, #000); border-color: transparent; }
button.block { width: 100%; }
.small-btn, .actions button, .actions a.button { min-height: 32px; padding: 5px 11px; font-size: 13px; }
.small-btn .ic { width: 16px; height: 16px; }
.icon-btn { min-height: 36px; width: 36px; padding: 0; background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.icon-btn:hover { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); border-color: transparent; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin: 14px 0 6px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.check { display: inline-flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; min-height: 0; padding: 0; margin: 2px 0 0; accent-color: var(--accent); box-shadow: none; }
.toggle-row { display: flex; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); margin-top: 14px; width: 100%; }
.toggle-row small, .engine-choice small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; }

/* Segmented control (time ranges, zoom) */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px; }
.segmented button { min-height: 28px; padding: 3px 11px; font-size: 13px; border: none; background: transparent; box-shadow: none; color: var(--muted); border-radius: 7px; }
.segmented button:hover { color: var(--text); background: transparent; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* =====================================================================
   Login
   ===================================================================== */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background:
    radial-gradient(800px 400px at 20% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%),
    radial-gradient(600px 400px at 110% 110%, color-mix(in srgb, var(--mongo) 14%, transparent), transparent 70%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 30px; box-shadow: var(--shadow-lg);
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.login-brand h1 { font-size: 22px; }
.login-card input { width: 100%; }
.login-card button { margin-top: 16px; }
.logo-mark {
  display: block; width: 52px; height: 52px; border-radius: 14px; flex: none;
  box-shadow: 0 8px 20px -8px rgba(31, 99, 224, .65);
}
.logo-mark.small { width: 32px; height: 32px; border-radius: 9px; box-shadow: none; }

/* =====================================================================
   App shell: sidebar + content
   ===================================================================== */
#app-view { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
  padding: 18px 14px; background: var(--surface); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16.5px; padding: 4px 8px 18px; letter-spacing: -0.01em; }
.tabs { display: flex; flex-direction: column; gap: 2px; }
.tabs a, .nav-button {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; text-decoration: none;
  color: var(--text-2); font-weight: 550; justify-content: flex-start; min-height: 0; width: 100%;
}
.tabs a:hover { background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text); }
.tabs a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.tabs a .ic { color: currentColor; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.theme-switch { display: flex; padding: 3px; background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px; }
.theme-switch button { flex: 1; min-height: 30px; padding: 0; border: none; background: transparent; box-shadow: none; color: var(--muted); border-radius: 7px; }
.theme-switch button:hover { color: var(--text); background: transparent; }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.theme-switch .ic { width: 16px; height: 16px; }
.main-area { min-width: 0; }
.container { max-width: 1200px; margin: 0 auto; padding: 32px 36px 64px; }

.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.subtitle { color: var(--muted); margin-top: 6px; max-width: 620px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; margin: 28px 0 12px; flex-wrap: wrap; }
.section-head h2 { white-space: nowrap; }
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-sm);
}
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.panel-head p { margin-top: 4px; }
.panel-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- stat tiles ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow-sm); min-width: 0;
}
.stat .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat .value { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; margin-top: 4px; line-height: 1.2; }
.stat .value small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.stat .sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- cards (databases, buckets) ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card {
  display: flex; flex-direction: column; align-items: stretch; gap: 12px; text-align: left; white-space: normal;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow-sm); cursor: pointer; min-height: 0; font-weight: 400;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow-md); transform: translateY(-1px); background: var(--surface); }
.card-top { display: flex; align-items: center; gap: 12px; }
.card-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.card-name { font-weight: 650; font-size: 15.5px; overflow-wrap: anywhere; line-height: 1.3; }
.card-sub { font-size: 12.5px; color: var(--muted); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-metric { display: flex; align-items: baseline; gap: 6px; }
.card-latency { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; }
.card-latency small, .card-metric .unit { font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.card-meta { display: flex; gap: 6px 16px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 10px; }
.card-meta b { color: var(--text); font-weight: 600; }
.spark { width: 100%; height: 40px; display: block; }
.engine-mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; flex: none;
  color: var(--pg); background: color-mix(in srgb, var(--pg) 13%, transparent);
}
.engine-mark[data-engine="mongo"] { color: var(--mongo); background: color-mix(in srgb, var(--mongo) 14%, transparent); }
.engine-mark[data-engine="redis"] { color: var(--redis); background: color-mix(in srgb, var(--redis) 14%, transparent); }
.engine-mark.bucket { color: var(--warn-text); background: var(--warn-soft); }
.engine-mark .ic { width: 20px; height: 20px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  background: var(--code-bg); border: 1px solid var(--border); color: var(--text-2); white-space: nowrap;
}
.badge.engine[data-engine="postgres"] { color: var(--pg); background: color-mix(in srgb, var(--pg) 10%, transparent); border-color: color-mix(in srgb, var(--pg) 30%, transparent); }
.badge.engine[data-engine="mongo"] { color: var(--mongo); background: color-mix(in srgb, var(--mongo) 10%, transparent); border-color: color-mix(in srgb, var(--mongo) 30%, transparent); }
.badge.engine[data-engine="redis"] { color: var(--redis); background: color-mix(in srgb, var(--redis) 10%, transparent); border-color: color-mix(in srgb, var(--redis) 30%, transparent); }
.badge.public { color: var(--warn-text); background: var(--warn-soft); border-color: transparent; }
.badge.tiny { font-size: 10.5px; padding: 0 6px; }

/* Status pill: always an icon + a word, never color alone */
.status {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
  padding: 3px 10px 3px 4px; border-radius: 999px; background: var(--code-bg); color: var(--muted);
}
.status::before {
  content: "…"; display: grid; place-items: center; width: 17px; height: 17px; border-radius: 50%;
  font-size: 11px; font-weight: 800; line-height: 1; background: var(--border-strong); color: var(--surface);
}
.status.up { background: var(--ok-soft); color: var(--ok-text); }
.status.up::before { content: "✓"; background: var(--ok); color: #fff; }
.status.slow { background: var(--warn-soft); color: var(--warn-text); }
.status.slow::before { content: "!"; background: var(--warn); color: #1a1300; }
.status.down { background: var(--bad-soft); color: var(--bad-text); }
.status.down::before { content: "✕"; background: var(--bad); color: #fff; }

/* Empty states */
.empty-card {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 48px 20px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface);
}
.empty-card h3 { text-transform: none; letter-spacing: -0.01em; font-size: 17px; color: var(--text); margin: 6px 0 0; }
.empty-card p { max-width: 420px; margin-bottom: 8px; }
.empty-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); }
.empty-icon .ic { width: 24px; height: 24px; }

/* =====================================================================
   Modals, drawers, toasts
   ===================================================================== */
dialog { color: var(--text); }
dialog::backdrop { background: rgba(8, 10, 16, .5); backdrop-filter: blur(2px); }
dialog.modal {
  width: min(560px, calc(100vw - 32px)); border: 1px solid var(--border); border-radius: 16px; padding: 22px 24px 20px;
  background: var(--surface); box-shadow: var(--shadow-lg);
}
dialog.modal input:not([type]), dialog.modal input[type="text"] { width: 100%; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.modal-head h2 { font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.engine-choice { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.engine-choice label {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border-strong);
  border-radius: 10px; cursor: pointer; transition: border-color .15s, background .15s;
}
.engine-choice input { margin: 3px 0 0; min-height: 0; accent-color: var(--accent); }
.engine-choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

dialog.drawer {
  margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(620px, 100vw); max-width: 100vw;
  border: none; border-left: 1px solid var(--border); padding: 22px 24px 40px; background: var(--surface);
  overflow-y: auto; box-shadow: var(--shadow-lg);
}
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
.drawer-head h2 { font-size: 20px; overflow-wrap: anywhere; margin-bottom: 6px; }
.drawer-head .badge { margin-right: 8px; }

.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; font-size: 14px; font-weight: 500;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); max-width: 360px;
  animation: toast-in .2s ease-out;
}
.toast::before { content: "✓"; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 11px; font-weight: 800; flex: none; }
.toast.error::before { content: "!"; background: var(--bad); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* =====================================================================
   Database page
   ===================================================================== */
.page-head { display: flex; flex-direction: column; gap: 8px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 13.5px; font-weight: 500; width: fit-content; }
.back .ic { width: 16px; height: 16px; }
.back:hover { color: var(--accent); }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.title-row h1 { font-size: 26px; overflow-wrap: anywhere; }
.subtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 18px 0 22px; overflow-x: auto; scrollbar-width: none; }
.subtabs a {
  display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; color: var(--muted); text-decoration: none;
  font-weight: 550; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
}
.subtabs a .ic { width: 16px; height: 16px; }
.subtabs a:hover { color: var(--text); }
.subtabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.pane.overview { display: flex; flex-direction: column; gap: 16px; }
.card-section:empty { display: none; }
.card-section h3 { margin-top: 0; }

/* Latency chart */
.chart { width: 100%; position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .grid-line { stroke: var(--border); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: url(#chart-fill); }
.chart .fail { fill: var(--bad); }
.chart .xhair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .xhair-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow-md); padding: 8px 10px; font-size: 12.5px; min-width: 150px; z-index: 2;
}
.chart-tip .t { color: var(--muted); margin-bottom: 4px; }
.chart-tip .r { display: flex; justify-content: space-between; gap: 14px; font-variant-numeric: tabular-nums; }
.chart-tip .r b { font-weight: 600; }
.chart-tip .bad { color: var(--bad-text); }

.conn { display: flex; flex-direction: column; gap: 6px; }
.conn label { font-size: 13px; font-weight: 600; color: var(--text-2); margin-top: 6px; }
.conn label .muted { font-weight: 400; }
.conn-row { display: flex; gap: 8px; align-items: stretch; }
.conn-row code {
  flex: 1; min-width: 0; background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 12px; overflow-x: auto; white-space: nowrap; display: flex; align-items: center;
}
.row-buttons { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.failures { list-style: none; padding: 0; margin: 0; font-size: 13.5px; }
.failures li { padding: 8px 0; border-bottom: 1px solid var(--border); display: flex; gap: 12px; }
.failures li:last-child { border-bottom: none; }
.failures time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }
.danger-zone h2, .danger-zone h3 { color: var(--bad-text); }
.danger-zone.inset { margin-top: 26px; padding: 16px; border: 1px solid color-mix(in srgb, var(--bad) 35%, var(--border)); border-radius: var(--radius); }
.danger-zone.inset h3 { margin-top: 0; }
.danger-zone.inset p { margin-bottom: 12px; }
.delete-form { display: flex; gap: 8px; flex-wrap: wrap; }
.delete-form input { flex: 1 1 220px; min-width: 0; }

/* =====================================================================
   Explorer: tables pane
   ===================================================================== */
.pad { padding: 12px; margin: 0; }
.warn-text { color: var(--warn-text); }
.ok-text { color: var(--ok-text); }
.null { color: var(--muted); font-style: italic; font-size: 12px; }
.explorer { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.t-side { padding: 10px; position: sticky; top: 16px; }
.t-side-head { display: flex; gap: 6px; margin-bottom: 8px; }
.search { position: relative; flex: 1; min-width: 0; }
.search .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search input { width: 100%; padding-left: 32px; min-height: 36px; }
.t-list { display: flex; flex-direction: column; gap: 1px; max-height: 70vh; overflow-y: auto; }
.t-item {
  display: flex; justify-content: space-between; gap: 8px; text-align: left; border: none; background: transparent; box-shadow: none;
  padding: 7px 10px; border-radius: 7px; font-size: 14px; font-weight: 500; min-height: 0; color: var(--text-2);
}
.t-item:hover { background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text); }
.t-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.t-name { overflow-wrap: anywhere; white-space: normal; }
.t-count { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12.5px; font-weight: 500; }
.t-detail { min-width: 0; }
.t-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.t-head h2 { font-size: 20px; margin-bottom: 2px; overflow-wrap: anywhere; }
.keys { white-space: nowrap; }
.key { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 5px; margin-right: 4px; text-decoration: none; }
.key.pk { background: var(--warn-soft); color: var(--warn-text); }
.key.fk { background: var(--accent-soft); color: var(--accent); }
.key.uq { background: var(--code-bg); color: var(--muted); border: 1px solid var(--border); }
.rels { margin: 4px 0 8px; padding-left: 18px; font-size: 14px; }
.rels li { margin: 5px 0; }
.rels a { margin-left: 6px; font-size: 13px; }
.rel-label { margin: 8px 0 0; }
.empty-state { padding: 12px 4px; }
.empty-state h2 { font-size: 18px; margin-bottom: 6px; }

/* Result grids */
.grid-wrap { overflow: auto; max-height: 60vh; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.data-grid { border-collapse: collapse; width: 100%; font-size: 13px; }
.data-grid th, .data-grid td { padding: 7px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; white-space: nowrap; }
.data-grid tbody tr:last-child td { border-bottom: none; }
.data-grid td { font-family: var(--mono); font-size: 12.5px; max-width: 420px; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.data-grid.cols td { font-family: inherit; font-size: 13.5px; }
.data-grid th { position: sticky; top: 0; background: var(--surface-2); z-index: 1; font-weight: 600; font-size: 12.5px; color: var(--text-2); }
.data-grid th small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; font-family: var(--mono); }
.data-grid tbody tr:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.result { margin-bottom: 18px; }
.result-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 14px; flex-wrap: wrap; }
.empty-result { margin: 4px 0; }
pre.doc, pre.snippet {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 0 0 8px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; overflow-x: auto; white-space: pre;
}
pre.snippet code { font-size: inherit; }
.q-error { border: 1px solid color-mix(in srgb, var(--bad) 45%, transparent); background: var(--bad-soft); border-radius: 10px; padding: 12px 14px; }
.q-error b { color: var(--bad-text); }
.q-error .small { margin-top: 6px; color: var(--text-2); }
pre.caret { margin: 8px 0 0; font-family: var(--mono); font-size: 12.5px; color: var(--bad-text); overflow-x: auto; }

/* Query console */
.console { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.console-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.console-top select { max-width: 280px; min-height: 34px; padding: 5px 10px; font-size: 13px; }
#q-input {
  width: 100%; min-height: 160px; resize: vertical; tab-size: 2;
  font: 13.5px/1.6 var(--mono); background: var(--code-bg); border-radius: 10px; padding: 14px;
  border-color: var(--border);
}
.console-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips:empty { display: none; }
.chip { font-size: 12.5px; padding: 4px 11px; min-height: 28px; border-radius: 999px; background: var(--surface-2); box-shadow: none; font-weight: 500; color: var(--text-2); }

/* ER diagram */
.er-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.er-buttons { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.er-canvas {
  height: 70vh; min-height: 380px; overflow: auto; padding: 0; cursor: grab; touch-action: none;
  background-color: var(--surface-2);
  background-image: radial-gradient(color-mix(in srgb, var(--muted) 30%, transparent) 1px, transparent 1px);
  background-size: 18px 18px;
}
.er-canvas.panning { cursor: grabbing; }
.er-canvas svg { display: block; font-family: var(--font); }
.er-table { cursor: move; }
.er-table.dragging .er-box { stroke: var(--accent); stroke-width: 2; }
.er-box { fill: var(--surface); stroke: var(--border-strong); filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .08)); }
.er-head { fill: var(--accent); }
.er-title { fill: var(--accent-text); font-weight: 700; font-size: 13px; }
.er-count { fill: var(--accent-text); font-size: 11px; opacity: .85; }
.er-stripe { fill: var(--surface-2); }
.er-col { fill: var(--text); font-size: 12px; }
.er-col.pk { font-weight: 700; }
.er-type { fill: var(--muted); font-size: 11px; font-family: var(--mono); }
.er-pk { fill: var(--warn-text); font-size: 9px; font-weight: 700; }
.er-fk { fill: var(--accent); font-size: 9px; font-weight: 700; }
/* Lines are drawn above the boxes (a line hidden behind a box would look like it starts there). */
.er-halo { fill: none; stroke: var(--surface); stroke-width: 5; opacity: .85; pointer-events: none; }
.er-edge { fill: none; stroke: var(--muted); stroke-width: 1.5; transition: stroke .15s; pointer-events: none; }
.er-edge.guessed { stroke-dasharray: 5 4; }
.er-edge.hot { stroke: var(--accent); stroke-width: 2.5; }
.er-marker { fill: none; stroke: var(--muted); stroke-width: 1.5; }

/* =====================================================================
   Storage: file browser
   ===================================================================== */
#buckets-view, #browser-view { display: flex; flex-direction: column; gap: 0; }
#browser-view { gap: 14px; }
.browser-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; min-width: 0; }
.crumbs a { color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.crumbs a:hover { color: var(--accent); }
.crumbs a:first-child { color: var(--muted); font-weight: 500; font-size: 15px; }
.crumbs .sep { color: var(--border-strong); font-weight: 400; }
.crumbs .badge { margin-left: 6px; font-size: 11.5px; letter-spacing: 0; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }

.files {
  position: relative; padding: 4px 0; overflow: hidden;
  display: grid; grid-template-columns: 28px minmax(0, 1fr) max-content max-content max-content; column-gap: 16px;
}
.files > * { grid-column: 1 / -1; }
#file-list, .file-row { display: grid; grid-template-columns: subgrid; }
.file-row { grid-column: 1 / -1; align-items: center; padding: 9px 18px; border-bottom: 1px solid var(--border); }
#file-list .file-row:last-child { border-bottom: none; }
#file-list .file-row:hover { background: var(--surface-2); }
.file-head { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; padding-top: 12px; }
.file-row .icon { width: 22px; height: 22px; color: var(--muted); display: inline-flex; }
.file-row .icon.folder { color: var(--accent); }
.file-row .icon svg { width: 100%; height: 100%; }
.fname { color: var(--text); text-decoration: none; font-weight: 550; overflow-wrap: anywhere; }
.fname:hover { color: var(--accent); }
.num { font-variant-numeric: tabular-nums; font-size: 13.5px; }
.actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
/* With a mouse, row actions appear on hover/focus to keep the list calm; touch screens always show them. */
@media (hover: hover) and (min-width: 721px) {
  #file-list .actions { opacity: 0; transition: opacity .12s; }
  #file-list .file-row:hover .actions, #file-list .file-row:focus-within .actions { opacity: 1; }
}
.actions button, .actions a.button { box-shadow: none; }
.danger-text { color: var(--bad-text); }
.empty-folder { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 16px; text-align: center; }
.drop-hint {
  display: none; position: absolute; inset: 0; align-items: center; justify-content: center; gap: 10px; font-weight: 600; font-size: 15px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border: 2px dashed var(--accent); border-radius: var(--radius); color: var(--accent);
}
.files.dragging .drop-hint { display: flex; }

.uploads { display: flex; flex-direction: column; gap: 6px; }
.uploads:empty { display: none; }
.upload {
  display: grid; grid-template-columns: minmax(0, 1fr) 180px 140px; gap: 12px; align-items: center; font-size: 13.5px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px;
}
.upload .uname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.upload progress { width: 100%; height: 6px; accent-color: var(--accent); }
.upload.failed { border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.upload.failed .ustatus { color: var(--bad-text); }

/* =====================================================================
   Server page, Activity page, warning banner
   ===================================================================== */
.panel.flush { padding: 0; overflow: hidden; }
.pad { padding: 18px 20px; }
.banner {
  display: flex; align-items: center; gap: 10px; padding: 10px 36px; font-size: 13.5px;
  background: var(--warn-soft); color: var(--warn-text); border-bottom: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
}
.banner[data-level="critical"] { background: var(--bad-soft); color: var(--bad-text); border-bottom-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.banner span { flex: 1; min-width: 0; }
.banner a { color: inherit; font-weight: 600; white-space: nowrap; }

.meter { height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--text) 8%, transparent); margin-top: 10px; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: inherit; background: var(--ok); }
.meter[data-level="warn"] span { background: var(--warn); }
.meter[data-level="critical"] span { background: var(--bad); }

.engine-mark.sm { width: 32px; height: 32px; border-radius: 9px; }
.engine-mark.sm .ic { width: 17px; height: 17px; }
.usage-row {
  display: grid; grid-template-columns: 32px minmax(0, 1.2fr) minmax(80px, 1fr) 84px; align-items: center; gap: 14px;
  padding: 11px 20px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none;
}
.usage-row:last-child { border-bottom: none; }
.usage-row:hover { background: color-mix(in srgb, var(--text) 3%, transparent); }
.u-name { display: flex; flex-direction: column; min-width: 0; }
.u-name b { font-weight: 600; overflow-wrap: anywhere; }
.u-name small { color: var(--muted); font-size: 12.5px; }
.u-bar { height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--text) 6%, transparent); overflow: hidden; }
.u-bar span { display: block; height: 100%; min-width: 2px; border-radius: inherit; background: var(--accent); }
.u-size { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

.activity { list-style: none; margin: 0; padding: 0; }
.act-day {
  position: sticky; top: 0; padding: 8px 20px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.act { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.act:last-child { border-bottom: none; }
.act-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; background: var(--border-strong); }
.act[data-level="warn"] .act-dot { background: var(--warn); }
.act[data-level="error"] .act-dot { background: var(--bad); }
.act[data-level="error"] .act-msg { color: var(--bad-text); }
.act-msg { font-size: 14px; overflow-wrap: anywhere; }
.act-meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; font-size: 12.5px; color: var(--muted); font-family: var(--mono); }
.act-meta .badge { font-family: var(--font); }
.act time { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; margin-top: 2px; }
.load-more { display: flex; justify-content: center; margin-top: 14px; }

/* =====================================================================
   Accounts: login steps, profile, Team page
   ===================================================================== */
.no-perm { display: none !important; }
.login-card.wide { max-width: 440px; }
.login-card form + form, .login-card #otp-back { margin-top: 0; }
.login-card #otp-back { margin-top: 6px; }
.step-title { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 15px; }
.step-title .ic { color: var(--accent); }
.otp-input { font-family: var(--mono); font-size: 20px; letter-spacing: .25em; text-align: center; }
.spacer { flex: 1; }
.center { text-align: center; }

.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
}
.avatar.big { width: 46px; height: 46px; font-size: 16px; }
.me-chip {
  display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; padding: 8px 12px; min-height: 0; text-align: left;
  background: transparent; border-color: transparent; box-shadow: none;
}
.me-chip:hover { background: color-mix(in srgb, var(--text) 5%, transparent); border-color: transparent; }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.me-text b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { font-size: 12px; color: var(--muted); }

.profile-head { display: flex; gap: 12px; align-items: center; margin: 10px 0 4px; }
#profile-dialog form input { width: 100%; }
#p-password-form { display: grid; gap: 8px; justify-items: start; }
#p-2fa-form input { flex: 1; min-width: 0; }
.inline-form .conn-row input { flex: 1; }

.secret-box {
  margin-top: 14px; padding: 14px; border-radius: var(--radius-sm); font-size: 13.5px;
  background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
}
.secret-box code { font-size: 14px; }
.codes { list-style: none; padding: 0; margin: 12px 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 14px; }
.codes code { font-size: 15px; letter-spacing: .04em; }
.secret-box .primary.block { margin-top: 12px; }

.totp-steps { margin: 6px 0 12px; padding-left: 20px; font-size: 13.5px; color: var(--text-2); }
.totp-steps li + li { margin-top: 4px; }
.totp-qr { width: 200px; margin: 0 auto; padding: 10px; background: #fff; border-radius: 12px; border: 1px solid var(--border); }
.totp-qr svg { display: block; width: 100%; height: auto; }
.totp-key { font-size: 13px; word-break: break-all; }
.totp-confirm .conn-row input { flex: 1; min-width: 0; }

.tm-row {
  display: grid; grid-template-columns: 32px minmax(0, 1.4fr) auto 70px minmax(150px, 1fr); align-items: center; gap: 14px;
  width: 100%; padding: 12px 20px; text-align: left; border: none; border-bottom: 1px solid var(--border); border-radius: 0;
  background: transparent; box-shadow: none; min-height: 0;
}
.tm-row:last-child { border-bottom: none; }
.tm-row:hover { background: color-mix(in srgb, var(--text) 3%, transparent); border-color: var(--border); }
.tm-who { display: flex; flex-direction: column; min-width: 0; }
.tm-who b { font-weight: 600; overflow-wrap: anywhere; }
.tm-who small { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.tm-2fa { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tm-2fa.on { color: var(--ok-text); font-weight: 600; }
.tm-meta { text-align: right; }
.role-badge[data-builtin="super_admin"] { color: var(--bad-text); background: var(--bad-soft); border-color: transparent; }
.role-badge[data-builtin="admin"] { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.role-card { gap: 10px; }
.role-card[data-builtin] { cursor: default; }
.role-card p { margin: 0; }
.chips.static .chip { display: inline-block; min-height: 24px; padding: 3px 10px; font-size: 12px; border-radius: 12px; line-height: 1.45; }
.chips.static .chip b { font-weight: 650; color: var(--text); }
.chip.muted-chip { background: transparent; color: var(--muted); border: 1px dashed var(--border-strong); }
.toggle-row.disabled { opacity: .7; cursor: default; }

dialog.modal.wide { width: min(760px, calc(100vw - 32px)); }
#u-role, #user-form input { width: 100%; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.two-col input { width: 100%; }
.perm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.perm-group { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px 12px; margin: 0; min-width: 0; display: grid; gap: 8px; align-content: start; }
.perm-group legend { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0 4px; }
.perm { display: flex; gap: 9px; align-items: flex-start; cursor: pointer; font-size: 13.5px; }
.perm input { width: 16px; height: 16px; min-height: 0; padding: 0; margin: 2px 0 0; accent-color: var(--accent); box-shadow: none; flex: none; }
.perm small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; }
.scope-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.scope-choice label {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border-strong); border-radius: 10px; cursor: pointer;
}
.scope-choice input { margin: 3px 0 0; min-height: 0; accent-color: var(--accent); }
.scope-choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.scope-choice small { display: block; color: var(--muted); font-size: 12.5px; }
.resource-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; max-height: 260px; overflow: auto; }

/* =====================================================================
   Small screens: the sidebar becomes a top bar
   ===================================================================== */
@media (max-width: 880px) {
  #app-view { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; align-items: center; gap: 8px;
    padding: 8px 12px; border-right: none; border-bottom: 1px solid var(--border);
  }
  .brand { padding: 0 4px 0 0; }
  .brand > span:last-child { display: none; }
  .tabs { flex-direction: row; }
  .tabs a { padding: 7px 10px; width: auto; }
  .sidebar-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; gap: 6px; }
  .theme-switch { display: none; }
  .nav-button { width: auto; padding: 7px 8px; }
  .nav-button span { display: none; }
  .me-chip { width: auto; padding: 4px; }
  .me-text { display: none; }
  .container { padding: 22px 16px 48px; }
  .explorer { grid-template-columns: 1fr; }
  .t-side { position: static; }
  .t-list { max-height: 220px; }
  .title-row h1 { font-size: 22px; }
  h1 { font-size: 22px; }
  .banner { padding: 10px 16px; }
}
@media (max-width: 600px) {
  /* Four sections don't fit as words next to the logo: icons only. */
  .tabs a span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tabs a { padding: 8px 11px; }
  .usage-row { grid-template-columns: 32px minmax(0, 1fr) auto; padding: 11px 16px; }
  .u-bar { grid-column: 2 / -1; grid-row: 2; }
  .act { padding: 12px 16px; gap: 10px; }
  .act-day { padding: 8px 16px; }
  .tabs a { padding: 8px 9px; }
  .sidebar { gap: 4px; padding: 8px; }
}
@media (max-width: 720px) {
  .tm-row { grid-template-columns: 32px minmax(0, 1fr) auto; grid-template-areas: "av who role" "av meta twofa"; padding: 12px 16px; row-gap: 4px; }
  .tm-row .avatar { grid-area: av; align-self: start; }
  .tm-who { grid-area: who; }
  .role-badge { grid-area: role; }
  .tm-2fa { grid-area: twofa; text-align: right; }
  .tm-meta { grid-area: meta; text-align: left; }
  .perm-grid, .two-col, .scope-choice, .resource-pick { grid-template-columns: 1fr; }
  .codes { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .files, #file-list { display: block; }
  .file-head { display: none; }
  .file-row[data-kind="folder"] > .muted { display: none; }
  .file-row { column-gap: 10px; grid-template-columns: 24px minmax(0, 1fr) auto; grid-template-areas: "icon name size" "icon date date" "actions actions actions"; row-gap: 4px; padding: 10px 14px; }
  .file-row .icon { grid-area: icon; align-self: start; }
  .file-row .fname { grid-area: name; }
  .file-row > :nth-child(3) { grid-area: size; }
  .file-row > :nth-child(4) { grid-area: date; }
  .file-row .actions { grid-area: actions; justify-content: flex-start; }
  .upload { grid-template-columns: minmax(0, 1fr) 90px; }
  .upload .ustatus { grid-column: 1 / -1; }
  .conn-row { flex-direction: column; }
  .engine-choice { grid-template-columns: 1fr; }
  .page-header > .primary { width: 100%; }
  .stat .sub { white-space: normal; }
  .grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
