:root {
  /* ---------- Design System: Core Tokens ---------- */
  --bg: #ebecf3;
  --panel: #ffffff;
  --ink: #222734;
  --muted: #5f677b;
  --line: #d7dce8;
  --accent: var(--theme-primary, #415a98);
  --accent-2: var(--theme-secondary, #41c489);
  --message-text: #ffffff;
  --viewport-h: 100vh;
  --surface-bottom-buffer: 14px;
  --dialog-viewport-gap: 24px;

  /* ---------- Design System: Controls ---------- */
  --control-font-size: 14px;
  --control-radius: 8px;
  --control-border: 1px solid var(--line);
  --control-pad-y: 8px;
  --control-pad-x: 10px;

  /* ---------- Design System: Buttons ---------- */
  --btn-font-size: 14px;
  --btn-font-weight: 600;
  --btn-radius: 8px;
  --btn-min-height: 38px;
  --btn-pad-y: 8px;
  --btn-pad-x: 14px;
  --btn-bg: color-mix(in srgb, var(--accent) 92%, #000 8%);
  --btn-bg-hover: color-mix(in srgb, var(--accent) 84%, #000 16%);
  --btn-text: #fff;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@supports (height: 100dvh) {
  :root { --viewport-h: 100dvh; }
}
body {
  margin: 0;
  font-family: "Avenir Next", "Nunito Sans", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 15% -10%, #f7f8fd 0%, #eceef6 45%, #e9ebf2 100%);
  color: var(--ink);
}

.app-shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: var(--viewport-h);
  transition: grid-template-columns 180ms ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 92px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: var(--viewport-h);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, #1d2740 8%) 0%, color-mix(in srgb, var(--accent) 86%, #1a2340 14%) 100%);
  border-right: 1px solid rgba(206, 214, 231, 0.7);
  padding: 12px 8px;
  padding-bottom: 52px;
  overflow-y: auto;
}

.sidebar-toggle {
  position: absolute;
  top: auto;
  right: 10px;
  bottom: 10px;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  z-index: 3;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  transform: rotate(180deg);
}

.brand-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 8px;
  margin: 0 0 10px;
  min-height: 62px;
}

.brand-logo {
  width: auto;
  max-width: 100%;
  max-height: 38px;
  object-fit: contain;
}

.context-card {
  background: rgba(240, 244, 253, 0.22);
  border: 1px solid rgba(199, 210, 236, 0.5);
  border-radius: 12px;
  padding: 8px;
  margin: 0 0 8px;
}

.context-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.context-card-summary {
  width: 100%;
  flex: 1 1 auto;
  display: block;
  text-align: left;
  margin: 0;
  border: 0;
  background: transparent;
  color: #f5f8ff;
  border-radius: 8px;
  padding: 3px 2px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.context-clear-btn {
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #f6f9ff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 24px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.context-clear-btn:hover {
  color: #ffffff;
  text-decoration: none;
}

.context-card select {
  margin-top: 0;
  border-radius: 9px;
  border-color: #c9d0e3;
  background: #fff;
  font-size: 13px;
  height: 38px;
  padding: 6px 10px;
}

.context-card.is-collapsed .context-card-body {
  display: none !important;
}

.context-card.is-collapsed {
  padding-bottom: 6px;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #edf2ff;
  text-decoration: none;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(193, 205, 232, 0.34);
  background: rgba(240, 245, 255, 0.16);
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.34);
  color: #fff;
}

.nav-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(214, 224, 244, 0.3);
  flex: 0 0 34px;
}

.nav-icon svg {
  width: 20px;
  height: 20px;
}

.nav-icon svg * {
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-label {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.app-shell.sidebar-collapsed .context-card,
.app-shell.sidebar-collapsed .nav-label {
  display: none;
}

.app-shell.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 8px;
}

.content {
  padding: 0 16px 22px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 0 -16px 14px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(4px);
}

.topbar-left h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.01em;
}

.top-links {
  display: flex;
  gap: 14px;
  margin-top: 4px;
}

.top-links a {
  color: #6881b4;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.help-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid #b9c6df;
  background: #fff;
  color: var(--accent);
  padding: 0;
  margin: 0;
  font-weight: 700;
}

h1 { margin: 0; font-size: 28px; }
p { margin: 0; color: var(--muted); }

.message {
  padding: 10px 12px;
  border-radius: 8px;
  margin: 14px 0;
  font-weight: 600;
}
.message.success {
  background: var(--accent);
  color: var(--message-text);
}
.message.error {
  background: #c62828;
  color: #fff;
}

.settings-menu {
  position: relative;
}

.settings-menu summary {
  list-style: none;
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-menu summary::-webkit-details-marker { display: none; }

.settings-avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.settings-name {
  color: #5f6f92;
  font-size: 14px;
  font-weight: 600;
  display: none;
}

.menu-panel {
  position: absolute;
  right: 0;
  margin-top: 8px;
  width: 250px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  padding: 10px;
  z-index: 20;
}

.menu-user {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.menu-link {
  display: block;
  width: 100%;
  text-align: left;
  background: #f2f5fb;
  color: #283149;
  border: 1px solid #d5dbea;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  text-decoration: none;
}

.menu-link-disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.open-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 96px;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 0;
  background: var(--btn-bg);
  color: var(--btn-text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.open-link-btn:hover {
  background: var(--btn-bg-hover);
  text-decoration: none;
}

.run-progress {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f9ff;
}

.run-progress-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.run-progress progress {
  width: 100%;
  height: 14px;
}

.run-progress a {
  display: inline-block;
  margin-top: 8px;
}

.app-run-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fff;
}

.app-run-card h3 {
  margin: 0 0 6px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
}

.card h2 {
  margin: 0 0 12px 0;
  font-size: 20px;
  color: #2f364d;
}

label {
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
}

.inline-check-row {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin: 6px 0 10px;
}

.inline-check-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.inline-check-row input[type="checkbox"] {
  width: auto;
  margin-top: 0;
}

small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
  margin-bottom: 8px;
  font-size: 12px;
}

input, select {
  width: 100%;
  margin-top: 4px;
  padding: var(--control-pad-y) var(--control-pad-x);
  border: var(--control-border);
  border-radius: var(--control-radius);
  font-size: var(--control-font-size);
  font: inherit;
}

textarea {
  width: 100%;
  margin-top: 4px;
  padding: var(--control-pad-y) var(--control-pad-x);
  border: var(--control-border);
  border-radius: var(--control-radius);
  font-size: var(--control-font-size);
  font: inherit;
  resize: vertical;
}

button:not(.sidebar-toggle):not(.context-card-summary):not(.context-clear-btn):not(.menu-dot-btn):not(.menu-link):not(.window-close-x):not(.edit-connection-tab):not(.icon-action-btn) {
  width: auto;
  min-width: 96px;
  min-height: var(--btn-min-height);
  margin-top: 8px;
  padding: var(--btn-pad-y) var(--btn-pad-x);
  border: 0;
  border-radius: var(--btn-radius);
  background: var(--btn-bg);
  color: var(--btn-text);
  font-size: var(--btn-font-size);
  font-weight: var(--btn-font-weight);
  line-height: 1.2;
  letter-spacing: 0.01em;
  cursor: pointer;
}

button:not(.sidebar-toggle):not(.context-card-summary):not(.context-clear-btn):not(.menu-dot-btn):not(.menu-link):not(.window-close-x):not(.edit-connection-tab):not(.icon-action-btn):hover {
  background: var(--btn-bg-hover);
}

button.full-width {
  width: 100%;
}

button {
  border: none;
  font: inherit;
}

.menu-panel button { width: 100%; }

.tables {
  margin-top: 14px;
  padding-bottom: 14px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-title h2 {
  margin: 0;
}

.section-title button {
  width: auto;
  margin-top: 0;
}

.add-compact {
  min-width: 112px;
  height: 36px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}

.sql-workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  transition: grid-template-columns 160ms ease;
  align-items: start;
}

.sql-panel { min-width: 0; min-height: 0; }

.sql-workspace.state-connection-selected {
  grid-template-columns: 72% 28%;
}

.sql-workspace.state-table-selected {
  grid-template-columns: 24% 76%;
}

.sql-workspace.state-none-selected {
  grid-template-columns: 1fr 1fr;
}

.sql-panel {
  display: flex;
  flex-direction: column;
}

.table-scroll {
  overflow: auto;
  max-height: calc(var(--viewport-h) - 340px);
  overscroll-behavior: contain;
  padding-bottom: var(--surface-bottom-buffer);
}

.sql-grid-scroll {
  max-height: calc(var(--viewport-h) - 340px);
}

section[data-filter-group="firms"] .table-scroll {
  max-height: calc(var(--viewport-h) - 360px);
}

section[data-filter-group="companies"] .table-scroll,
section[data-filter-group="entities"] .table-scroll {
  max-height: calc(var(--viewport-h) - 380px);
}

section[data-filter-group="users"] .table-scroll {
  max-height: calc(var(--viewport-h) - 350px);
}

section[data-filter-group="activity"] .table-scroll {
  max-height: calc(var(--viewport-h) - 350px);
}

section[data-filter-group="menu-settings"] .table-scroll {
  max-height: calc(var(--viewport-h) - 270px);
}

section[data-filter-group="menu-settings"] .table-scroll table {
  width: 100%;
}

section[data-filter-group="menu-settings"] th:not(:first-child),
section[data-filter-group="menu-settings"] td:not(:first-child) {
  text-align: center;
}

section[data-filter-group="menu-settings"] .menu-vis-cell {
  white-space: nowrap;
}

.menu-vis-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
}

.menu-vis-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

section[data-filter-group="data-models"] .table-scroll {
  max-height: calc(var(--viewport-h) - 370px);
}

.canvas-setup-grid {
  display: grid;
  gap: 10px;
}

.canvas-tool-shell {
  padding: 12px;
}

.canvas-tool-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.canvas-tool-head h3 {
  margin: 0;
}

.canvas-tool-meta {
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

.canvas-tool-grid {
  display: grid;
  grid-template-columns: 1fr 1.55fr 1.2fr;
  gap: 10px;
  min-height: 600px;
}

.canvas-pane {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8f9fd;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.canvas-pane > header {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  background: #f0f3fb;
}

.canvas-pane > header h4 {
  margin: 0;
  font-size: 20px;
}

.canvas-pane-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.canvas-source-search {
  margin: 0;
  width: 100%;
}

.canvas-source-list {
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.canvas-source-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid #e8ebf4;
}

.canvas-source-item:last-child {
  border-bottom: 0;
}

.canvas-source-item.mapped {
  background: #eef6ff;
}

.canvas-source-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.canvas-source-row a,
.canvas-source-row span {
  font-weight: 700;
  color: #2b3b62;
  text-decoration: none;
}

.canvas-source-row small {
  color: #64708e;
  font-size: 12px;
}

.canvas-source-add-form {
  margin: 0;
}

.canvas-source-add-form button {
  margin: 0;
  width: auto;
  min-width: 78px;
}

.canvas-empty {
  padding: 12px;
  color: #5f677b;
}

.canvas-mapped-header,
.canvas-subhead {
  font-weight: 700;
  color: #2b3550;
  font-size: 13px;
}

.canvas-inner-scroll {
  max-height: 260px;
}

.canvas-input-chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.canvas-input-chip {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #bfd0ef;
  background: #ebf2ff;
  color: #2c4577;
}

.canvas-query-preview {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  overflow: auto;
  max-height: 180px;
}

.canvas-binding-form input,
.canvas-binding-form select {
  margin: 0;
  width: 100%;
  min-width: 0;
  font-size: 12px;
  padding: 5px 6px;
}

@media (max-width: 1320px) {
  .canvas-tool-grid {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .canvas-inner-scroll {
    max-height: 220px;
  }
}

section[data-filter-group="products"] .table-scroll {
  max-height: calc(var(--viewport-h) - 370px);
}

section[data-filter-group="connections"] .table-scroll.sql-grid-scroll {
  max-height: calc(var(--viewport-h) - 270px);
}

section.sql-workspace[data-filter-group="connections"] {
  height: calc(var(--viewport-h) - 300px);
  min-height: 520px;
  max-height: calc(var(--viewport-h) - 260px);
  align-items: stretch;
}

section.sql-workspace[data-filter-group="connections"] .sql-panel {
  min-height: 0;
}

section.sql-workspace[data-filter-group="connections"] .table-scroll.sql-grid-scroll {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
}

.bulk-form {
  display: flex;
  align-items: end;
  gap: 8px;
  margin-bottom: 10px;
}

.bulk-form label {
  margin: 0;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}

.status-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
}

.status-filter-row label {
  margin: 0;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}

.status-filter-row select {
  margin-top: 0;
  width: auto;
  min-width: 132px;
  font-size: 13px;
  line-height: 1.2;
  padding: 7px 10px;
}

.bulk-form select,
.bulk-form button {
  margin-top: 0;
  width: auto;
  font-size: 13px;
  line-height: 1.2;
  padding: 7px 10px;
}

.inline-form-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-form-row input,
.inline-form-row select,
.inline-form-row button {
  margin-top: 0;
}

.row-actions {
  width: 1%;
  white-space: nowrap;
  overflow: visible;
}

.row-icon-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.icon-action-form {
  margin: 0;
}

.icon-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  margin: 0;
  padding: 0;
  border: 1px solid #cfd5e2;
  border-radius: 999px;
  background: #fff;
  color: #55607c;
  text-decoration: none;
  line-height: 1;
  cursor: pointer;
  position: relative;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.icon-action-btn:hover,
.icon-action-btn:focus-visible {
  background: #eef2ff;
  border-color: #9aa8cc;
  color: #1f2a4f;
  outline: none;
}

.icon-action-btn::before {
  content: "⚙";
  font-size: 12px;
}

.icon-action-edit::before { content: "✎"; }
.icon-action-delete::before { content: "✕"; }
.icon-action-run::before { content: "⟳"; }
.icon-action-export::before { content: "⤓"; }
.icon-action-view::before { content: "◴"; }
.icon-action-settings::before { content: "⚙"; }

.icon-only-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.icon-action-btn[data-tooltip]:hover::after,
.icon-action-btn[data-tooltip]:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  max-width: 260px;
  padding: 4px 7px;
  border-radius: 6px;
  background: #1f2740;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  z-index: 4200;
  pointer-events: none;
}

.row-menu {
  position: relative;
  display: inline-block;
}

.row-menu summary { list-style: none; }
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu summary::marker { content: ""; }

.menu-dot-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
}

.row-menu-panel {
  position: absolute;
  right: 0;
  top: 34px;
  z-index: 4100;
  width: 280px;
  max-height: min(70vh, 420px);
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  padding: 10px;
}

.row-menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.1);
  z-index: 4000;
}

.month-folder {
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.month-folder > summary {
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 600;
}

.month-folder > .table-scroll {
  border-top: 1px solid var(--line);
  padding: 6px 8px 8px;
}

.monthly-reporting-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 14px;
  min-height: 620px;
}

.monthly-explorer {
  border: 1px solid #d7dce8;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8f9fc 0%, #f2f4f9 100%);
  padding: 10px;
  min-width: 0;
  box-shadow: inset 0 1px 0 #fff, 0 8px 18px rgba(28, 39, 78, 0.04);
}

.monthly-explorer h3 {
  margin: 0 0 10px;
  padding: 2px 4px;
  font-size: 15px;
  font-weight: 700;
  color: #38405b;
}

.monthly-explorer-scroll {
  max-height: 560px;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.monthly-file-list {
  list-style: none;
  margin: 0;
  padding: 2px 6px 8px;
}

.monthly-file-list li {
  margin: 2px 0;
}

.monthly-file-list a {
  display: block;
  padding: 6px 8px 6px 26px;
  border-radius: 8px;
  color: #2c3350;
  text-decoration: none;
  border: 1px solid transparent;
  position: relative;
  font-size: 13px;
}

.monthly-file-list a::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  width: 12px;
  height: 14px;
  transform: translateY(-50%);
  border: 1px solid #86a0d9;
  border-radius: 2px;
  background: linear-gradient(180deg, #ffffff 0%, #eef3ff 100%);
}

.monthly-file-list a:hover,
.monthly-file-list a.active {
  background: #e9eefb;
  border-color: #ced9f5;
}

.monthly-preview {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  box-shadow: inset 0 1px 0 #fff, 0 10px 20px rgba(28, 39, 78, 0.04);
}

.monthly-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  background: linear-gradient(180deg, #f8faff 0%, #f1f5ff 100%);
}

.monthly-preview-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.monthly-preview-actions a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.monthly-preview-actions a:hover {
  text-decoration: underline;
}

.monthly-preview-frame-wrap {
  min-height: 0;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 12px;
}

.monthly-preview-frame-wrap .hint {
  font-size: 14px;
  color: #4e5673;
  padding: 10px 12px;
  border: 1px dashed #cfd8ee;
  border-radius: 10px;
  background: #f8faff;
}

.monthly-preview-frame-wrap iframe {
  width: 100%;
  min-height: 560px;
  border: 0;
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

th {
  font-weight: 700;
  background: #f3f6fb;
}

.current-user-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 20%, #edf2ff 80%);
  color: color-mix(in srgb, var(--accent) 88%, #1e2438 12%);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.save-status {
  display: inline-block;
  min-width: 56px;
  margin-left: 8px;
  font-size: 12px;
  color: #3e5a9f;
}

.selected-row { background: #f1f7ff; }

tr[data-row-href] { cursor: pointer; }

tr[data-row-href]:hover {
  background: #eef6ff;
}

.sql-config-table {
  table-layout: fixed;
  min-width: 100%;
}

.sql-config-table th,
.sql-config-table td {
  font-size: 12px;
  padding: 7px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sql-grid-scroll .sql-config-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.table-scroll table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.sql-config-table th:first-child,
.sql-config-table td:first-child {
  width: 34px;
  text-align: center;
}

.sql-tables-table th,
.sql-tables-table td {
  padding-top: 9px;
  padding-bottom: 9px;
}

.sql-tables-table th:first-child,
.sql-tables-table td:first-child,
.sql-tables-table .col-table {
  width: auto;
  text-align: left;
}

.sql-tables-table .col-table {
  padding-left: 10px;
}

.sql-config-table input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  vertical-align: middle;
}

.sql-config-table td:nth-child(4) input,
.sql-config-table td:nth-child(5) input {
  max-width: 230px;
}

.sql-config-table .inline-form-row {
  gap: 6px;
  flex-wrap: nowrap;
}

.sql-config-table .inline-form-row input,
.sql-config-table .inline-form-row select,
.sql-config-table .inline-form-row button {
  font-size: 12px;
  padding: 5px 6px;
}

.sql-columns-table th,
.sql-columns-table td {
  padding: 2px 5px;
  line-height: 1.15;
  vertical-align: middle;
}

.sql-columns-table .inline-form-row {
  gap: 4px;
  align-items: center;
}

.sql-columns-table .inline-form-row input,
.sql-columns-table .inline-form-row select,
.sql-columns-table .inline-form-row button {
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 4px 6px;
  min-height: 28px;
}

.sql-columns-table .inline-form-row button {
  min-width: 56px;
  white-space: nowrap;
}

.sql-columns-table td:nth-child(4) input {
  max-width: 180px;
}

.sql-columns-table td:last-child {
  overflow: visible;
  text-overflow: clip;
}

.sql-columns-table .inline-form-row {
  gap: 4px;
  flex-wrap: nowrap;
}

.sql-columns-table .inline-form-row select {
  min-width: 94px;
}

.sql-columns-table .inline-form-row button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.sql-workspace.state-table-selected .sql-panel:first-child .sql-tables-table th,
.sql-workspace.state-table-selected .sql-panel:first-child .sql-tables-table td {
  display: none !important;
}

.sql-workspace.state-table-selected .sql-panel:first-child .sql-tables-table .col-table {
  display: table-cell !important;
  width: 100%;
  text-align: left !important;
  padding-left: 12px;
  padding-right: 12px;
}

.sql-workspace.state-table-selected .sql-panel:first-child .bulk-form {
  display: none;
}

.sql-workspace.state-connection-selected .sql-panel:first-child .sql-config-table th,
.sql-workspace.state-connection-selected .sql-panel:first-child .sql-config-table td {
  display: table-cell;
}

.overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.overview-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.overview-card h3 {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.overview-card p {
  margin: 8px 0 0;
  font-size: 24px;
  color: var(--accent);
  font-weight: 700;
}

.login-wrap {
  min-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card { width: min(420px, 92vw); }

.firm-dialog {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  max-height: calc(var(--viewport-h) - var(--dialog-viewport-gap));
}

.firm-dialog form { padding: 14px; min-width: 320px; }

.edit-connection-dialog {
  width: min(1080px, 96vw);
  max-width: 96vw;
}

.edit-table-properties-dialog {
  width: min(980px, 95vw);
}

.edit-connection-dialog form {
  padding: 0;
  min-width: 0;
  max-height: calc(var(--viewport-h) - var(--dialog-viewport-gap));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.edit-connection-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--line);
}

.edit-connection-header h3 {
  margin: 0;
}

.edit-connection-subtitle {
  margin: 6px 0 0;
  color: #5f677b;
  font-size: 14px;
}

.edit-connection-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  min-height: 420px;
  max-height: calc(var(--viewport-h) - 220px);
  overflow: hidden;
}

.edit-connection-nav {
  border-right: 1px solid var(--line);
  background: #f7f9fd;
  padding: 10px;
  display: grid;
  gap: 6px;
  align-content: start;
}

.edit-connection-tab {
  width: 100%;
  min-height: 38px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
  background: transparent !important;
  color: #283149 !important;
  font-weight: 600;
  cursor: pointer;
}

.edit-connection-tab.active {
  background: #ffffff !important;
  border-color: #d6ddeb;
  box-shadow: inset 3px 0 0 var(--accent);
}

.edit-connection-tab:hover {
  background: #eef3fb !important;
  color: #283149;
}

.edit-connection-tab.active:hover {
  background: #ffffff !important;
}

.edit-connection-content {
  padding: 14px 18px;
  overflow: auto;
  padding-bottom: calc(var(--surface-bottom-buffer) + 4px);
}

.edit-connection-pane {
  display: none;
}

.edit-connection-pane.active {
  display: block;
}

.edit-connection-pane h4 {
  margin: 0 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 20px;
}

.reveal-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reveal-field input {
  flex: 1 1 auto;
}

.reveal-field-toggle {
  min-width: 76px;
  min-height: 34px;
  margin: 0;
  padding: 6px 10px;
  border: 1px solid #cfd8ea;
  border-radius: 8px;
  background: #f4f7fe !important;
  color: #2d3750 !important;
  font-weight: 600;
}

.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 10px;
}

.edit-connection-dialog .dialog-actions {
  margin: 0;
  padding: 10px 18px 14px;
  border-top: 1px solid var(--line);
}

.qbo-refresh-progress-dialog {
  width: min(760px, 94vw);
  max-width: 94vw;
}

.qbo-refresh-progress-dialog form {
  min-width: 0;
}

#qbo-refresh-progress-bar {
  width: 100%;
  height: 14px;
  margin: 8px 0 10px;
}

.qbo-refresh-progress-log {
  min-height: 260px;
  max-height: 420px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1320;
  color: #dbe7ff;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
}

.report-filters-dialog {
  width: min(860px, 96vw);
}

.report-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 12px;
  margin: 8px 0 12px;
}

.report-filter-field {
  display: grid;
  gap: 6px;
}

#qbo-refresh-cancel-btn:disabled,
#qbo-refresh-complete-btn:disabled {
  background: #d7dde8 !important;
  color: #6f7b90 !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
}

#qbo-refresh-cancel-btn:not(:disabled),
#qbo-refresh-complete-btn:not(:disabled) {
  background: var(--btn-bg) !important;
  color: var(--btn-text) !important;
  cursor: pointer !important;
}

#qbo-refresh-cancel-btn:not(:disabled):hover,
#qbo-refresh-complete-btn:not(:disabled):hover {
  background: var(--btn-bg-hover) !important;
}

.dialog-actions button,
.form-action-right button {
  width: auto !important;
  min-width: 98px;
}

.form-action-right {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.inline-check-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-check-row.stacked {
  display: grid;
  gap: 8px;
}

.connection-type-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 88px));
  justify-content: start;
  gap: 10px;
}

button.btn-connection-tile {
  width: 88px;
  min-width: 88px;
  min-height: 88px;
  height: 88px;
  border: 1px solid #d9e1ec;
  border-radius: 12px;
  background: #f7f9fc !important;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

button.btn-connection-tile:hover {
  border-color: #9cb2ce;
  box-shadow: 0 4px 12px rgba(21, 34, 56, 0.12);
  transform: translateY(-1px);
}

.btn-connection-logo {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.03em;
}

.btn-connection-label {
  font-weight: 600;
  font-size: 13px;
  text-align: center;
}

.qbo-logo {
  background: #2ca01c;
  color: #fff;
}

.sql-logo {
  background: #00758f;
  color: #fff;
}

.connection-auth-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.connection-auth-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.connection-auth-dot.is-connected {
  background: #22c55e;
}

.connection-auth-dot.is-disconnected {
  background: #ef4444;
}

.column-filter-label {
  display: inline-block;
  color: #626a79;
  font-weight: 700;
  font-size: 14px;
  vertical-align: middle;
}

.column-filter-trigger {
  margin-top: 0 !important;
  margin-left: 10px;
  padding: 0 !important;
  width: 18px !important;
  min-width: 18px !important;
  height: 18px !important;
  min-height: 18px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #666d79;
  cursor: pointer;
  opacity: 1;
  vertical-align: middle;
  min-width: 0;
  box-shadow: none !important;
  position: relative;
}

.column-filter-trigger::before {
  content: "";
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 3h13M4.2 8h7.6M6.5 13h3' stroke='%23666d79' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.column-filter-trigger:hover {
  color: #4c5565;
}

.column-filter-trigger.is-active {
  color: #2f374d;
}

.column-filter-trigger:hover::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 3h13M4.2 8h7.6M6.5 13h3' stroke='%234c5565' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.column-filter-trigger.is-active::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 3h13M4.2 8h7.6M6.5 13h3' stroke='%232f374d' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.sql-config-table th.has-column-filter {
  color: #626a79;
  font-size: 14px;
}

.column-filter-head {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sql-config-table th.has-column-filter .column-filter-label {
  min-width: 0;
}

.sql-columns-table th:nth-child(2),
.sql-columns-table td:nth-child(2) {
  width: 36%;
}

.sql-columns-table th:nth-child(3),
.sql-columns-table td:nth-child(3) {
  width: 14%;
}

.sql-columns-table th:nth-child(4),
.sql-columns-table td:nth-child(4) {
  width: 22%;
}

.sql-columns-table th:nth-child(5),
.sql-columns-table td:nth-child(5) {
  width: 28%;
}

.column-filter-menu {
  position: fixed;
  z-index: 4500;
  width: min(280px, 86vw);
  max-height: min(62vh, 420px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
  padding: 8px;
}

.column-filter-backdrop {
  position: fixed;
  inset: 0;
  z-index: 4400;
  background: transparent;
}

.column-filter-title {
  font-weight: 700;
  font-size: 13px;
  color: #2a3248;
  margin-bottom: 6px;
}

.column-filter-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.column-filter-actions-left,
.column-filter-actions-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.column-filter-actions button {
  margin: 0 !important;
  width: auto !important;
  min-width: 72px !important;
  min-height: 32px !important;
  padding: 5px 11px !important;
  border-radius: 8px !important;
  font-size: 12px;
  font-weight: 600;
}

.column-filter-apply-btn {
  border: 0 !important;
  background: var(--btn-bg) !important;
  color: var(--btn-text) !important;
}

.column-filter-apply-btn:hover {
  background: var(--btn-bg-hover) !important;
}

.column-filter-secondary-btn {
  border: 1px solid var(--line) !important;
  background: #fff !important;
  color: #2f374d !important;
}

.column-filter-secondary-btn:hover {
  background: #f7f9fd !important;
}

.column-filter-search {
  margin-bottom: 6px;
}

.column-filter-search input {
  margin: 0 !important;
  width: 100%;
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.column-filter-options {
  overflow: auto;
  border-top: 1px solid #edf0f7;
  padding-top: 6px;
}

.column-filter-option {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  padding: 4px 2px;
  margin: 0;
  color: #2f374d;
}

.column-filter-option input[type="checkbox"] {
  margin: 0;
  width: 14px;
  height: 14px;
}

.column-filter-empty {
  font-size: 12px;
  color: #6f7891;
  padding: 6px 2px;
}

.sample-status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sample-status-pill.is-sampled {
  background: #eafaf1;
  color: #166534;
  border: 1px solid #86efac;
}

.sample-status-pill.is-empty {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fdba74;
}

.sample-status-pill.is-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.sample-status-pill.is-unknown {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #cbd5e1;
}

select[data-status-tone='IGNORED'] {
  background: #eceff3;
  color: #5b6472;
  border-color: #c7ced8;
}

.settings-grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 8px 12px;
  margin-bottom: 10px;
}

.schema-editor-dialog {
  width: min(96vw, 1600px);
  max-width: 96vw;
  height: min(94vh, 1100px);
  max-height: 94vh;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
}

.schema-editor-dialog::backdrop {
  background: rgba(12, 18, 34, 0.35);
}

.schema-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.schema-editor-header h3 {
  margin: 0;
  font-size: 18px;
}

.schema-editor-close {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  margin: 0;
  padding: 0;
}

.window-close-x {
  position: relative;
  border: 0 !important;
  background: transparent !important;
  cursor: pointer;
  color: #666d79 !important;
  border-radius: 0;
  transition: color 120ms ease;
  box-shadow: none !important;
  min-width: 34px !important;
  min-height: 34px !important;
  width: 34px !important;
  height: 34px !important;
  margin: 0 !important;
  padding: 0 !important;
}

.window-close-x::before,
.window-close-x::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  top: 50%;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transform-origin: center;
}

.window-close-x::before {
  transform: translateY(-50%) rotate(45deg);
}

.window-close-x::after {
  transform: translateY(-50%) rotate(-45deg);
}

.window-close-x:hover {
  color: #555c69 !important;
  background: transparent !important;
}

#schema-editor-frame {
  width: 100%;
  height: calc(100% - 52px);
  border: 0;
  display: block;
  background: #fff;
}

body.schema-editor-mode-page {
  margin: 0;
  padding: 10px;
  background: #eef2f8;
}

.schema-only-workspace {
  width: 100%;
  min-height: calc(100vh - 20px);
}

body.schema-editor-mode-page .sql-workspace {
  height: calc(100vh - 20px);
  min-height: calc(100vh - 20px);
  max-height: calc(100vh - 20px);
  align-items: stretch;
}

body.schema-editor-mode-page .sql-panel {
  height: 100%;
  max-height: 100%;
}

body.schema-editor-mode-page .table-scroll.sql-grid-scroll {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: auto;
}

.data-explorer-window {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  min-height: 220px;
}

.data-explorer-window h3 {
  margin: 0;
  padding: 10px 12px;
  font-size: 16px;
  border-bottom: 1px solid var(--line);
}

.data-explorer-frame {
  width: 100%;
  min-height: 240px;
  height: 360px;
  border: 0;
  display: block;
  background: #fff;
}

.schema-data-preview-card {
  margin-top: 10px;
}

.schema-data-preview-card h2 {
  margin: 0 0 10px;
}

.schema-data-preview-frame {
  height: 360px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.table-detail-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding-bottom: var(--surface-bottom-buffer);
}

.table-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.table-detail-header h2 {
  margin: 0;
}

.table-detail-refresh-form {
  margin: 0;
}

.table-detail-refresh-btn {
  margin-top: 0 !important;
}

.table-detail-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  margin: 4px -14px 0;
  padding: 0 14px;
}

.table-detail-tab {
  margin-top: 0 !important;
  min-width: 0 !important;
  min-height: 0 !important;
  padding: 10px 2px 9px !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #48516a !important;
  font-weight: 700;
  border-bottom: 3px solid transparent !important;
}

.table-detail-tab.active {
  color: #1f2f65 !important;
  border-bottom-color: #1f2f65 !important;
}

.table-detail-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  color: #334155;
  font-size: 14px;
}

.table-detail-meta-sep {
  color: #94a3b8;
}

.table-detail-pane {
  display: none;
}

.table-detail-pane.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

.table-detail-pane .table-scroll.sql-grid-scroll {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
}

.table-detail-empty {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 14px;
  color: #5b6472;
  font-size: 14px;
  background: #f8fafc;
}

.table-detail-sample-actions {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 8px;
}

.table-detail-pane[data-table-detail-pane="sample"] .data-explorer-window {
  flex: 1 1 auto;
  min-height: 0;
}

.table-detail-pane[data-table-detail-pane="sample"] .data-explorer-frame {
  height: 100%;
  min-height: 260px;
}

.parameter-readonly-scroll {
  max-height: calc(var(--viewport-h) - 420px);
  min-height: 180px;
}

.parameter-readonly-table th,
.parameter-readonly-table td {
  font-size: 12px;
  vertical-align: top;
}

.parameter-readonly-table th:nth-child(1),
.parameter-readonly-table td:nth-child(1) {
  min-width: 140px;
}

.parameter-readonly-table th:nth-child(2),
.parameter-readonly-table td:nth-child(2) {
  min-width: 74px;
  text-align: center;
}

.parameter-readonly-table th:nth-child(3),
.parameter-readonly-table td:nth-child(3) {
  min-width: 88px;
}

.parameter-readonly-table th:nth-child(4),
.parameter-readonly-table td:nth-child(4),
.parameter-readonly-table th:nth-child(5),
.parameter-readonly-table td:nth-child(5) {
  white-space: normal;
  min-width: 260px;
}

.btn-danger {
  background: #a72222 !important;
}

.btn-danger:hover {
  background: #8f1e1e !important;
}

.btn-inline-danger {
  margin-top: 0;
  margin-left: 8px;
  min-height: 28px;
  padding: 4px 10px;
  min-width: 74px;
  font-size: 12px;
  background: #a72222 !important;
  color: #fff;
}

.btn-inline-danger:hover {
  background: #8f1e1e !important;
}

.btn-cancel-primary {
  background: var(--btn-bg) !important;
  color: var(--btn-text) !important;
}

.btn-cancel-primary:hover {
  background: var(--btn-bg-hover) !important;
}

.btn-proceed-muted {
  background: #d7dde8 !important;
  color: #344054 !important;
}

.btn-proceed-muted:hover {
  background: #c6cedc !important;
}

@media (max-width: 980px) {
  .app-shell,
  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .sidebar-toggle,
  .brand-wrap,
  .context-card {
    grid-column: 1 / -1;
  }

  .sidebar-toggle {
    position: absolute;
    top: auto;
    right: 10px;
    bottom: 10px;
    justify-self: auto;
  }

  .sidebar-nav {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-label,
  .settings-name {
    display: none;
  }

  .top-links {
    display: none;
  }

  .sql-workspace {
    grid-template-columns: 1fr;
  }

  section.sql-workspace[data-filter-group="connections"] {
    height: auto;
    min-height: 0;
    max-height: none;
  }

  section.sql-workspace[data-filter-group="connections"] .table-scroll.sql-grid-scroll {
    max-height: calc(var(--viewport-h) - 360px);
  }

  .monthly-reporting-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .monthly-explorer-scroll {
    max-height: 260px;
  }

  .settings-grid-two {
    grid-template-columns: 1fr;
  }
}
