:root {
  color-scheme: dark;
  --bg: #0b0c0e;
  --panel: #131518;
  --panel-strong: #191c20;
  --line: #292d33;
  --line-soft: #202329;
  --text: #f4f5f6;
  --muted: #949aa3;
  --red: #ff2b2b;
  --red-hover: #e91f1f;
  --green: #36c98f;
  --amber: #f6b94a;
  --focus: #ff6a6a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.review-toolbar { display:flex; gap:12px; align-items:end; flex-wrap:wrap; margin-bottom:12px; }
.review-toolbar label { display:grid; gap:5px; font-size:12px; min-width:160px; max-width:360px; }
.review-toolbar select { width:100%; min-height:36px; background:var(--panel); color:var(--text); border:1px solid var(--line); border-radius:4px; padding:6px; }
.review-toolbar .compact { width:auto; min-height:36px; font-size:13px; padding:8px 12px; gap:6px; overflow:visible; }
.review-company-picker { display:grid; gap:5px; width:360px; max-width:100%; min-width:0; }
.review-company-picker label { min-width:0; }
.review-company-search { position:relative; }
.review-company-search .icon { position:absolute; left:10px; top:10px; width:16px; height:16px; color:var(--muted); pointer-events:none; }
.review-company-search input { width:100%; min-width:0; height:36px; padding:6px 10px 6px 34px; background:var(--panel); color:var(--text); border:1px solid var(--line); border-radius:4px; font:inherit; font-size:13px; }
.review-company-status { min-height:15px; color:var(--muted); font-size:11px; }
.review-layout { display:grid; grid-template-columns:240px minmax(0,1fr); gap:16px; }
.review-tabs { display:flex; flex-wrap:wrap; gap:12px; border-bottom:1px solid var(--line); margin-bottom:16px; }
.review-tabs button { background:transparent; border:0; border-bottom:2px solid transparent; padding:12px 4px; color:var(--muted); font:inherit; font-size:14px; }
.review-tabs button[aria-selected="true"] { color:var(--text); border-bottom-color:var(--red); }
.review-tabs button:focus-visible { outline:2px solid var(--focus); outline-offset:2px; }
.review-list { min-width:0; max-height:75vh; overflow:auto; border-right:1px solid var(--line); padding-right:10px; }
.review-sidebar { min-width:0; display:flex; flex-direction:column; min-height:160px; max-height:calc(100vh - 380px); }
.review-sidebar .review-list { min-height:0; flex:1; }
.review-sidebar .review-save-order { width:100%; flex:none; margin-top:10px; font-size:12px; padding:8px 12px; gap:6px; overflow:visible; }
.review-group { border-bottom:1px solid var(--line); }
.review-group-header { display:flex; align-items:center; gap:2px; padding:8px 0; }
.review-group-toggle { display:flex; align-items:center; gap:5px; flex:1; min-width:0; padding:5px 0; border:0; background:transparent; color:var(--text); text-align:left; font:inherit; font-size:12px; }
.review-group-name { flex:1; min-width:0; overflow-wrap:anywhere; }
.review-group-count { color:var(--muted); font-size:11px; font-variant-numeric:tabular-nums; }
.review-group-toggle .icon { width:14px; height:14px; flex:none; }
.review-group-toggle[aria-expanded="true"] .icon { transform:rotate(90deg); }
.review-group-tools { display:flex; flex:none; gap:1px; }
.review-group-tools .icon-button { width:24px; height:28px; min-width:24px; padding:4px; border:0; }
.review-group-tools .icon { width:14px; height:14px; }
.review-group-up .icon { transform:rotate(90deg); }
.review-group-down .icon { transform:rotate(90deg); }
.review-group-drag { cursor:grab; }
.review-group-drag:active { cursor:grabbing; }
.review-group.drop-target { outline:1px solid var(--focus); outline-offset:-1px; }
.review-group .review-item { padding:10px 8px 10px 20px; }
.review-group .review-item:last-child { border-bottom:0; }
.review-item { display:grid; text-align:left; width:100%; gap:6px; padding:12px; background:transparent; color:var(--text); border:0; border-bottom:1px solid var(--line); }
.review-item strong { overflow-wrap:anywhere; font-size:13px; }
.review-item span { font-size:12px; color:var(--muted); }
.review-item.selected { background:var(--panel-strong); border-left:3px solid var(--red); }
.review-workspace { min-width:0; }
.review-heading { display:flex; gap:12px; align-items:center; flex-wrap:wrap; margin-bottom:10px; }
.review-heading h2 { font-size:17px; margin:0; overflow-wrap:anywhere; }
.review-heading span { color:var(--muted); font-size:12px; }
.review-embed { height:65vh; min-height:420px; background:#f7f8fa; margin-bottom:12px; }
.review-embed:empty { background:var(--panel); }
.review-embed iframe { width:100%; height:100%; border:0; display:block; }
.review-comment { display:flex; gap:10px; align-items:start; }
.review-comment textarea { width:100%; min-width:0; background:var(--panel); color:var(--text); border:1px solid var(--line); border-radius:4px; padding:10px; }
.review-events { font-size:12px; color:var(--muted); margin-top:16px; }
.review-events > div { padding:8px 0; border-bottom:1px solid var(--line); }
.review-events p { white-space:pre-wrap; overflow-wrap:anywhere; margin:5px 0; }
@media(max-width:900px) { .review-layout { grid-template-columns:minmax(0,1fr); } .review-sidebar { max-height:none; } .review-list { max-height:180px; border-right:0; } .review-comment { flex-wrap:wrap; } .review-toolbar label { min-width:0; width:100%; max-width:none; } }

#reviewsPage { display:flex; flex:1; flex-direction:column; min-height:0; overflow:hidden; padding:12px 20px; }
#reviewsPage[hidden] { display:none; }
.workspace:has(#reviewsPage:not([hidden])) .topbar { min-height:72px; padding-top:12px; padding-bottom:12px; }
#reviewsPage .review-tabs { flex:none; margin-bottom:8px; }
#reviewsPage > .review-toolbar { flex:none; margin-bottom:8px; align-items:center; }
#reviewsPage .review-company-picker { width:640px; grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
#reviewsPage .review-company-picker > label { grid-column:1 / -1; }
#reviewsPage .review-company-status { grid-column:1 / -1; min-height:0; }
#reviewError:empty { display:none; }
#reviewsPage .review-layout { flex:1; min-height:0; overflow:hidden; }
#reviewsPage .review-sidebar { min-height:0; max-height:none; overflow:hidden; }
#reviewsPage .review-list { max-height:none; overscroll-behavior:contain; }
#reviewsPage .review-workspace { display:flex; flex-direction:column; min-height:0; overflow:hidden; }
#reviewsPage .review-heading { flex:none; margin-bottom:6px; }
#reviewsPage .review-embed { flex:1; position:relative; min-height:0; height:auto; overflow:hidden; margin-bottom:0; }
#reviewsPage .review-embed iframe { position:absolute; top:0; left:0; transform-origin:top left; }
.review-details { flex:none; margin-top:6px; min-height:0; }
.review-details summary { cursor:pointer; padding:6px 0; font-size:12px; color:var(--muted); }
.review-details-content { max-height:180px; overflow:auto; overscroll-behavior:contain; padding:6px 4px; }
.review-details .review-events { margin-top:6px; }
@media(min-width:1100px) {
  #reviewsPage { display:grid; grid-template-columns:auto minmax(0,1fr); grid-template-rows:auto auto minmax(0,1fr); column-gap:20px; }
  #reviewsPage .review-tabs { grid-column:1; grid-row:1; align-self:end; }
  #reviewsPage > .review-toolbar { grid-column:2; grid-row:1; justify-content:flex-end; }
  #reviewsPage:has(#registerReview:not([hidden])) .review-company-picker { width:360px; }
  #reviewError { grid-column:1 / -1; grid-row:2; }
  #reviewsPage .review-layout { grid-column:1 / -1; grid-row:3; }
}
@media(max-width:900px) {
  #reviewsPage .review-layout { grid-template-rows:minmax(70px, 18%) minmax(0,1fr); gap:8px; }
  #reviewsPage .review-sidebar { flex-direction:row; gap:6px; }
  #reviewsPage .review-list { flex:1; }
  #reviewsPage .review-save-order { width:42px; margin-top:0; font-size:0; padding:8px; }
  #reviewsPage .review-company-picker { width:100%; }
  #reviewsPage > .review-toolbar { gap:6px; }
  #reviewsPage .review-heading h2 { font-size:14px; }
  #reviewsPage { padding:8px 12px; }
  .review-details-content { max-height:140px; }
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
}

.admin-page {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
select {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.landing-page {
  min-height: 100vh;
  overflow: hidden;
}

.brand-stage {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    #090a0c;
  background-size: 100% 80px, auto;
}

.brand-mark {
  position: relative;
  width: min(48vw, 310px);
  padding: 32px 0;
  color: inherit;
  text-decoration: none;
  animation: mark-arrive 900ms cubic-bezier(.2, .8, .2, 1) both;
}

.brand-mark:focus-visible {
  border-radius: 4px;
  outline: 2px solid var(--red);
  outline-offset: 10px;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 16px 32px rgba(255, 43, 43, 0.18));
}

.brand-line {
  position: absolute;
  right: 0;
  bottom: 8px;
  left: 0;
  height: 2px;
  overflow: hidden;
  background: #24272c;
}

.brand-line::after {
  position: absolute;
  width: 34%;
  height: 100%;
  background: var(--red);
  content: "";
  animation: scan-line 1.8s ease-in-out infinite;
}

@keyframes mark-arrive {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scan-line {
  from { transform: translateX(-110%); }
  to { transform: translateX(310%); }
}

.login-shell {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    #0a0b0d;
  background-size: 48px 48px;
}

.login-panel {
  width: min(100%, 390px);
  padding: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(19, 21, 24, 0.96);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
}

.login-logo {
  display: block;
  width: 164px;
  height: auto;
  margin: 0 auto 42px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.field label {
  color: #c6c9ce;
  font-size: 13px;
  font-weight: 600;
}

.field label span {
  color: var(--muted);
  font-weight: 400;
}

.field input,
.field select,
.field textarea,
.search-field input {
  width: 100%;
  height: 44px;
  border: 1px solid #343941;
  border-radius: 4px;
  background: #0d0f12;
  color: var(--text);
}

.field input,
.field select,
.field textarea {
  padding: 0 13px;
}

.field textarea {
  min-height: 100px;
  padding-top: 11px;
  padding-bottom: 11px;
  resize: vertical;
}

.field input:hover,
.field select:hover,
.field textarea:hover,
.search-field:hover {
  border-color: #535a64;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  top: 4px;
  right: 4px;
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: white;
  font-weight: 700;
}

.primary-button {
  background: var(--red);
}

.primary-button:hover {
  background: var(--red-hover);
}

.login-panel .primary-button {
  width: 100%;
  margin-top: 4px;
}

.secondary-button {
  border-color: #3a3f47;
  background: #1a1d21;
}

.secondary-button:hover {
  background: #22262b;
}

a.secondary-button {
  text-decoration: none;
}

.danger-button {
  background: #a71e24;
}

.danger-button:hover {
  background: #bf242a;
}

.form-error {
  min-height: 20px;
  margin: 0 0 12px;
  color: #ff7777;
  font-size: 13px;
}

.app-shell {
  display: grid;
  height: 100vh;
  min-height: 0;
  grid-template-columns: 250px minmax(0, 1fr);
  transition: grid-template-columns 180ms ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  border-right: 1px solid var(--line-soft);
  background: #0e1012;
}

.sidebar-brand {
  display: flex;
  height: 86px;
  align-items: center;
  padding: 0 28px;
  border-bottom: 1px solid var(--line-soft);
}

.sidebar-brand img {
  width: 116px;
}

.sidebar .sidebar-collapse-button {
  position: absolute;
  top: 25px;
  right: 12px;
  z-index: 1;
  border: 1px solid #30343a;
  background: #171a1e;
}

.sidebar-collapse-button:hover {
  background: #24282d;
}

.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  padding: 0;
}

.sidebar-collapsed .sidebar-brand img {
  display: none;
}

.sidebar-collapsed .sidebar-collapse-button {
  right: 20px;
}

.sidebar-collapsed .sidebar-collapse-button .icon {
  transform: rotate(180deg);
}

.sidebar-collapsed .sidebar-nav {
  padding-right: 10px;
  padding-left: 10px;
}

.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 0;
}

.sidebar-collapsed .nav-item span,
.sidebar-collapsed .sidebar-user-copy {
  display: none;
}

.sidebar-collapsed .sidebar-user {
  flex-direction: column;
  padding: 12px 0;
}

.sidebar-nav {
  display: grid;
  gap: 5px;
  padding: 22px 14px;
}

.nav-item {
  display: flex;
  width: 100%;
  height: 46px;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #aeb3ba;
  text-align: left;
}

.nav-item:hover {
  background: #181b1f;
  color: white;
}

.nav-item.active {
  background: #24272c;
  color: white;
  box-shadow: inset 3px 0 var(--red);
}

.sidebar-user {
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 11px;
  margin-top: auto;
  padding: 14px;
  border-top: 1px solid var(--line-soft);
}

.avatar {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 50%;
  background: #343941;
  font-size: 13px;
  font-weight: 800;
}

.sidebar-user-copy {
  display: grid;
  min-width: 0;
  flex: 1;
}

.sidebar-user-copy strong,
.sidebar-user-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-copy strong {
  font-size: 13px;
}

.sidebar-user-copy span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.workspace {
  display: flex;
  height: 100vh;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background: #111316;
}

.topbar {
  display: flex;
  min-height: 106px;
  align-items: center;
  gap: 16px;
  padding: 20px clamp(22px, 4vw, 56px);
  border-bottom: 1px solid var(--line-soft);
  background: #111316;
  flex: 0 0 auto;
}

.topbar h1,
.modal h2,
.empty-state h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 24px;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--red);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.4px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.content-section {
  min-height: 0;
  overflow: auto;
  padding: 34px clamp(22px, 4vw, 56px) 56px;
}

#datasetsPage {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 34px;
}

#datasetsPage > .folder-tabs,
#datasetsPage > .table-tools {
  flex: 0 0 auto;
}

#datasetsTableWrap {
  min-height: 0;
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

#datasetsTableWrap th {
  position: sticky;
  top: 0;
  z-index: 2;
}

#datasetsEmpty {
  min-height: 0;
  flex: 1;
}

#catalogPage {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 34px;
}

.catalog-toolbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.catalog-schema-filter select {
  width: 220px;
  height: 42px;
  padding: 0 34px 0 13px;
  border: 1px solid #353a42;
  border-radius: 5px;
  background: #0f1114;
  color: var(--text);
}

.catalog-toolbar .count-label {
  margin-left: auto;
}

.catalog-explorer {
  display: grid;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  grid-template-columns: 320px minmax(0, 1fr);
}

.catalog-table-pane {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: #0f1114;
}

.catalog-pane-heading {
  display: flex;
  min-height: 52px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--line-soft);
  color: #8f959e;
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.catalog-pane-heading span:last-child,
.catalog-position {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.catalog-table-list {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
  scrollbar-gutter: stable;
}

.catalog-table-group h3 {
  margin: 14px 9px 7px;
  overflow: hidden;
  color: #737a84;
  font-size: 10px;
  font-weight: 750;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.catalog-table-group:first-child h3 {
  margin-top: 6px;
}

.catalog-table-item {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 50px;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #b7bdc5;
  grid-template-columns: 20px minmax(0, 1fr);
  text-align: left;
}

.catalog-table-item:hover,
.catalog-table-item.active {
  background: #24282d;
  color: white;
}

.catalog-table-item.active {
  box-shadow: inset 2px 0 var(--red);
}

.catalog-table-item > .icon {
  width: 17px;
  height: 17px;
  color: #ff6565;
}

.catalog-table-item > span,
.catalog-column-name {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.catalog-table-item strong,
.catalog-table-item small,
.catalog-column-name strong,
.catalog-column-name small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-table-item small,
.catalog-column-name small {
  color: var(--muted);
  font-size: 11px;
}

.catalog-list-empty {
  padding: 28px 14px;
  color: var(--muted);
  text-align: center;
}

.catalog-structure {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  padding: 20px;
}

.catalog-table-header {
  display: flex;
  min-height: 70px;
  flex: 0 0 auto;
  align-items: flex-start;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.catalog-table-path {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
}

.catalog-table-path .icon {
  width: 12px;
  height: 12px;
}

.catalog-table-header h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: 0;
}

.catalog-table-header p {
  max-width: 760px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.catalog-table-stats {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
}

.catalog-table-stats span,
.data-kind,
.nullable-badge,
.catalog-marker {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border: 1px solid #343941;
  border-radius: 3px;
  background: #171a1e;
  color: #b8bec6;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

#catalogColumnsWrap {
  min-height: 0;
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

#catalogColumnsWrap th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.catalog-columns-table {
  min-width: 1080px;
}

.catalog-columns-table th:first-child,
.catalog-columns-table td:first-child {
  width: 56px;
  padding-right: 8px;
  padding-left: 14px;
}

.catalog-columns-table th:nth-child(2) { width: 230px; }
.catalog-columns-table th:nth-child(3) { width: 230px; }
.catalog-columns-table th:nth-child(4) { width: 135px; }
.catalog-columns-table th:nth-child(5) { width: 92px; }
.catalog-columns-table th:nth-child(6) { width: 170px; }

.catalog-position {
  color: #777e88;
  font-size: 11px;
}

.database-type {
  color: #8fd7ff;
  font-size: 12px;
}

.nullable-badge.nullable {
  border-color: #715a2d;
  color: #f3c86c;
}

.nullable-badge.required {
  border-color: #285844;
  color: #70d9ac;
}

.catalog-markers {
  display: flex;
  align-items: center;
  gap: 5px;
}

.catalog-marker.primary {
  border-color: #7b3237;
  color: #ff8388;
}

#metabasePage {
  display: flex;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 34px;
}

.table-tools {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.metabase-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  flex: 0 0 auto;
}

.metabase-create-actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.metabase-explorer {
  display: grid;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  grid-template-columns: 286px minmax(0, 1fr);
}

.collection-pane {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  padding: 14px 10px 20px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: #0f1114;
}

.collection-pane-heading {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  color: #8f959e;
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.collection-pane-heading span:last-child {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.collection-tree {
  display: grid;
  min-height: 0;
  flex: 1;
  gap: 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.tree-node {
  display: grid;
  min-width: 0;
  height: 38px;
  align-items: center;
  grid-template-columns: 26px minmax(0, 1fr);
}

.tree-depth-1 { padding-left: 14px; }
.tree-depth-2 { padding-left: 28px; }
.tree-depth-3 { padding-left: 42px; }
.tree-depth-4 { padding-left: 56px; }
.tree-depth-5 { padding-left: 70px; }
.tree-depth-6 { padding-left: 84px; }
.tree-depth-7 { padding-left: 98px; }
.tree-depth-8 { padding-left: 112px; }

.tree-toggle,
.tree-toggle-placeholder {
  display: grid;
  width: 26px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 0;
  background: transparent;
  color: #747b85;
}

.tree-toggle .icon {
  width: 14px;
  height: 14px;
  transition: transform 150ms ease;
}

.tree-toggle.expanded .icon {
  transform: rotate(90deg);
}

.tree-label {
  display: flex;
  min-width: 0;
  height: 34px;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #b4bac2;
  text-align: left;
}

.tree-label:hover,
.tree-label.active {
  background: #24282d;
  color: white;
}

.tree-label.active {
  box-shadow: inset 2px 0 var(--red);
}

.tree-label .icon {
  width: 15px;
  height: 15px;
  color: #ff6565;
}

.tree-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-browser {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  padding: 20px;
}

.collection-browser-header {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.collection-browser-header .count-label {
  flex: 0 0 auto;
}

.breadcrumb {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 3px;
  overflow: hidden;
}

.breadcrumb button {
  max-width: 230px;
  padding: 5px 7px;
  overflow: hidden;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #a9afb7;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb button:hover,
.breadcrumb button[aria-current="page"] {
  background: #24282d;
  color: white;
}

.breadcrumb-separator {
  display: grid;
  color: #636a74;
  place-items: center;
}

.breadcrumb-separator .icon {
  width: 13px;
  height: 13px;
}

.folder-section {
  display: flex;
  max-height: 42%;
  min-height: 0;
  flex: 0 1 auto;
  flex-direction: column;
  margin-bottom: 22px;
  overflow: hidden;
}

.folder-section h2 {
  margin: 0 0 10px;
  color: #8f959e;
  font-size: 11px;
  text-transform: uppercase;
}

.folder-table-scroll {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.folder-table {
  min-width: 620px;
}

.folder-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.folder-table th:nth-child(2),
.folder-table td:nth-child(2),
.folder-table th:nth-child(3),
.folder-table td:nth-child(3) {
  width: 130px;
  text-align: center;
}

.folder-table th:last-child,
.folder-table td:last-child {
  width: 58px;
  padding-right: 10px;
  padding-left: 10px;
}

.collection-folder-link {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  gap: 11px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #d9dce1;
  text-align: left;
}

.collection-folder-link:hover strong {
  color: white;
}

.collection-folder-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 4px;
  background: rgba(255, 43, 43, 0.1);
  color: #ff6868;
}

.collection-folder-link strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-empty {
  min-height: 390px;
  flex: 1;
}

.collection-browser > .table-wrap {
  min-height: 0;
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.collection-browser > .table-wrap th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.folder-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.folder-tab {
  min-height: 36px;
  flex: 0 0 auto;
  padding: 0 13px;
  border: 1px solid #343941;
  border-radius: 4px;
  background: #15181c;
  color: #aeb3ba;
  font-size: 12px;
  font-weight: 650;
}

.folder-tab:hover,
.folder-tab.active {
  border-color: #555c65;
  background: #24282d;
  color: white;
}

.folder-tab.active {
  box-shadow: inset 0 -2px var(--red);
}

.search-field {
  position: relative;
  display: flex;
  width: min(100%, 350px);
  height: 42px;
  align-items: center;
  border: 1px solid #343941;
  border-radius: 4px;
  background: #0d0f12;
}

.search-field input {
  height: 40px;
  padding: 0 13px 0 41px;
  border: 0;
  background: transparent;
}

.search-icon {
  position: absolute;
  left: 15px;
  width: 17px;
  height: 17px;
  color: #838992;
}

.count-label {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.dataset-name {
  display: flex;
  min-width: 280px;
  align-items: center;
  gap: 12px;
}

.dataset-name strong {
  font-weight: 650;
}

.dataset-id {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

.datasets-table {
  min-width: 1480px;
}

.datasets-table th:last-child,
.datasets-table td:last-child {
  position: sticky;
  right: 0;
  width: 174px;
  min-width: 174px;
  background: var(--panel);
  box-shadow: -10px 0 18px rgba(8, 9, 11, 0.28);
}

.datasets-table th:last-child {
  z-index: 2;
  background: #17191d;
}

.datasets-table td:last-child {
  z-index: 1;
}

.datasets-table tbody tr:hover td:last-child {
  background: #171a1e;
}

.tag-list {
  display: flex;
  max-width: 300px;
  flex-wrap: wrap;
  gap: 5px;
}

.tag-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border: 1px solid #3a4049;
  border-radius: 3px;
  background: #22262b;
  color: #d8dbe0;
  font-size: 11px;
  font-weight: 650;
}

.folder-badge,
.query-type-badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  border: 1px solid #394049;
  border-radius: 3px;
  background: #20242a;
  color: #d9dce1;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.folder-badge .icon {
  width: 14px;
  height: 14px;
  color: #ff6b6b;
}

.query-type-badge {
  border-color: #365349;
  background: rgba(54, 201, 143, 0.09);
  color: #76ddb7;
}

.filter-field select {
  width: min(100%, 310px);
  height: 42px;
  padding: 0 36px 0 12px;
  border: 1px solid #343941;
  border-radius: 4px;
  background: #0d0f12;
  color: var(--text);
}

.metabase-table {
  min-width: 900px;
}

.metabase-table th:last-child,
.metabase-table td:last-child {
  position: sticky;
  right: 0;
  width: 216px;
  min-width: 216px;
  background: var(--panel);
  box-shadow: -10px 0 18px rgba(8, 9, 11, 0.28);
}

.metabase-table th:last-child {
  z-index: 2;
  background: #17191d;
}

.metabase-table td:last-child {
  z-index: 1;
}

.metabase-table tbody tr:hover td:last-child {
  background: #171a1e;
}

.query-name {
  display: grid;
  min-width: 240px;
  gap: 4px;
}

.query-name-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.query-name-main .icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: #ff6b6b;
}

.query-name span {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
}

.action-modal {
  width: min(calc(100% - 32px), 500px);
}

.muted-value {
  color: var(--muted);
}

.refresh-icon {
  width: 17px;
  height: 17px;
}

.loading .refresh-icon {
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  height: 64px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
}

th {
  height: 46px;
  background: #17191d;
  color: #858b94;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #171a1e;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 650;
}

.role-badge,
.status-badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 0 9px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
}

.role-badge {
  background: #272b31;
  color: #d5d8dc;
}

.status-badge.active {
  background: rgba(54, 201, 143, 0.12);
  color: var(--green);
}

.status-badge.inactive {
  background: rgba(246, 185, 74, 0.11);
  color: var(--amber);
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
}

.icon-button {
  position: relative;
  display: inline-grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #aeb3ba;
}

.icon-button:hover {
  background: #272b31;
  color: white;
}

.delete-button:hover {
  color: #ff7373;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.empty-database {
  width: 54px;
  height: 54px;
  color: #555c65;
}

.empty-state {
  display: grid;
  min-height: 420px;
  place-items: center;
  align-content: center;
  border: 1px dashed #353a42;
  border-radius: 6px;
  color: var(--muted);
  text-align: center;
}

.empty-state h2 {
  margin-top: 22px;
  color: var(--text);
  font-size: 21px;
}

.empty-state p {
  max-width: 430px;
  margin: 9px 20px 0;
  line-height: 1.6;
}

.modal {
  width: min(calc(100% - 32px), 560px);
  padding: 0;
  border: 1px solid #373c44;
  border-radius: 6px;
  background: #15171a;
  color: var(--text);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.7);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(3px);
}

.modal form {
  padding: 28px;
}

.dataset-dialog-body {
  padding: 28px;
}

.dataset-modal {
  width: min(calc(100% - 32px), 720px);
}

.dataset-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 28px;
  margin: 0;
}

.dataset-details > div {
  min-width: 0;
}

.dataset-details dt {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.dataset-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.dataset-details pre {
  max-height: 260px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #0d0f12;
  color: #d9dde2;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
}

.preserve-text {
  line-height: 1.55;
  white-space: pre-wrap;
}

.code-input {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace !important;
  font-size: 12px !important;
  line-height: 1.55;
}

.form-note,
.delete-relations,
.danger-copy {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.danger-copy {
  color: #ff8b8f;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 26px;
}

.modal h2 {
  font-size: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.full-width {
  grid-column: 1 / -1;
}

.switch-row {
  display: grid;
  min-height: 64px;
  align-items: center;
  grid-template-columns: 1fr auto;
  margin-bottom: 15px;
  padding: 0 2px;
}

.switch-row > span:first-child {
  display: grid;
  gap: 4px;
}

.switch-row small {
  color: var(--muted);
}

.switch-row input {
  position: absolute;
  opacity: 0;
}

.switch {
  position: relative;
  width: 42px;
  height: 23px;
  border-radius: 12px;
  background: #3a3f47;
  transition: background 160ms ease;
}

.switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: white;
  content: "";
  transition: transform 160ms ease;
}

.switch-row input:checked + .switch {
  background: var(--green);
}

.switch-row input:checked + .switch::after {
  transform: translateX(19px);
}

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

.confirm-modal {
  width: min(calc(100% - 32px), 440px);
  text-align: center;
}

.confirm-modal p {
  color: var(--muted);
  line-height: 1.55;
}

.confirm-modal .modal-actions {
  justify-content: center;
  margin-top: 24px;
}

.danger-mark {
  display: grid;
  width: 44px;
  height: 44px;
  margin: 0 auto 18px;
  place-items: center;
  border: 1px solid #a63136;
  border-radius: 50%;
  color: #ff6d73;
  font-size: 22px;
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 48px));
  padding: 13px 16px;
  border: 1px solid #3a3f47;
  border-left: 3px solid var(--green);
  border-radius: 4px;
  background: #1b1e22;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.menu-button {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

@media (max-width: 760px) {
  .login-panel {
    padding: 34px 24px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    z-index: 10;
    width: 250px;
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  .sidebar-collapse-button {
    display: none;
  }

  .sidebar-collapsed .sidebar-brand {
    justify-content: flex-start;
    padding: 0 28px;
  }

  .sidebar-collapsed .sidebar-brand img {
    display: block;
  }

  .sidebar-collapsed .sidebar-nav {
    padding: 22px 14px;
  }

  .sidebar-collapsed .nav-item {
    justify-content: flex-start;
    padding: 0 14px;
  }

  .sidebar-collapsed .nav-item span,
  .sidebar-collapsed .sidebar-user-copy {
    display: initial;
  }

  .sidebar-collapsed .sidebar-user-copy {
    display: grid;
  }

  .sidebar-collapsed .sidebar-user {
    flex-direction: row;
    padding: 14px;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 20px 0 70px rgba(0, 0, 0, 0.5);
  }

  .menu-button {
    display: inline-grid;
    flex: 0 0 36px;
  }

  .topbar {
    min-height: 88px;
  }

  .topbar h1 {
    font-size: 19px;
  }

  .compact {
    width: 42px;
    padding: 0;
    overflow: hidden;
    gap: 0;
    color: white;
    font-size: 0;
  }

  .compact .icon {
    color: white;
  }

  .content-section {
    padding-top: 24px;
  }

  #catalogPage,
  #datasetsPage,
  #metabasePage {
    padding-bottom: 24px;
  }

  .catalog-toolbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .catalog-toolbar .search-field {
    width: 100%;
    max-width: none;
  }

  .catalog-schema-filter {
    min-width: 0;
    flex: 1;
  }

  .catalog-schema-filter select {
    width: 100%;
  }

  .catalog-toolbar .count-label {
    align-self: center;
    margin-left: 0;
  }

  .catalog-explorer {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(150px, 38%) minmax(0, 1fr);
  }

  .catalog-table-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .catalog-structure {
    padding: 14px 10px;
  }

  .catalog-table-header {
    min-height: 84px;
    flex-direction: column;
    gap: 10px;
  }

  .catalog-table-header h2 {
    font-size: 18px;
  }

  .metabase-toolbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .metabase-toolbar .search-field {
    width: 100%;
    max-width: none;
  }

  .metabase-create-actions {
    width: 100%;
    margin-left: 0;
  }

  .metabase-create-actions .compact {
    width: 42px;
  }

  .metabase-explorer {
    display: grid;
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(150px, 36%) minmax(0, 1fr);
  }

  .collection-pane {
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .collection-browser {
    padding: 14px 10px;
  }

  .collection-browser-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .collection-browser-header .count-label {
    margin-left: 7px;
  }

  .folder-section {
    max-height: 36%;
  }

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

  .folder-table th:nth-child(2),
  .folder-table th:nth-child(3),
  .folder-table td:nth-child(2),
  .folder-table td:nth-child(3) {
    display: none;
  }

  .folder-table th,
  .folder-table td {
    padding-right: 10px;
    padding-left: 10px;
  }

  .folder-table th:last-child,
  .folder-table td:last-child {
    width: 54px;
  }

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

  .metabase-table th:nth-child(2),
  .metabase-table th:nth-child(3),
  .metabase-table th:nth-child(4),
  .metabase-table td:nth-child(2),
  .metabase-table td:nth-child(3),
  .metabase-table td:nth-child(4) {
    display: none;
  }

  .metabase-table th,
  .metabase-table td {
    padding-right: 10px;
    padding-left: 10px;
  }

  .metabase-table th:last-child,
  .metabase-table td:last-child {
    position: static;
    width: 200px;
    min-width: 200px;
    box-shadow: none;
  }

  .metabase-table th:first-child {
    width: auto;
  }

  .query-name {
    min-width: 0;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .dataset-details {
    grid-template-columns: 1fr;
  }

  .full-width {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

