:root {
  color-scheme: light;
  --ink: #172333;
  --muted: #64748b;
  --line: #e3e8ef;
  --accent: #087f70;
  --nav: #111e2e;
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 16px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  display: flex;
  background: #f5f7fa;
  color: var(--ink);
  height: 100dvh;
  overflow: hidden;
}
button,
input {
  font: inherit;
}
button,
summary {
  cursor: pointer;
}
button {
  border: 1px solid #d9e0e8;
  background: white;
  border-radius: 7px;
  padding: 0.58rem 0.85rem;
  color: #344256;
  font-size: 0.875rem;
  font-weight: 550;
  white-space: nowrap;
}
button:hover {
  background: #f0f5f5;
  border-color: #aabbbd;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
button:focus-visible,
input:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid #46bba6;
  outline-offset: 3px;
}
input {
  border: 1px solid #d9e0e8;
  border-radius: 6px;
  padding: 0.6rem 0.65rem;
  background: white;
  color: var(--ink);
  min-width: 0;
  font-size: 0.875rem;
}
.sidebar {
  width: clamp(220px, var(--sidebar-width, 280px), min(480px, 40vw));
  flex-shrink: 0;
  background: var(--nav);
  color: #e4ebf4;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 0;
  position: sticky;
  top: 0;
  padding: 1.8rem 1rem 1rem;
}
#sidebar-resizer {
  position: absolute;
  inset: 0 -4px 0 auto;
  width: 8px;
  z-index: 5;
  cursor: col-resize;
  touch-action: none;
}
#sidebar-resizer:hover,
#sidebar-resizer:focus-visible,
.resizing-sidebar #sidebar-resizer {
  background: #46bba666;
}
.resizing-sidebar,
.resizing-sidebar * {
  cursor: col-resize !important;
  user-select: none;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  color: white;
  padding: 0 0.6rem;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.025em;
  margin-bottom: 1.5rem;
}
.brand small {
  display: block;
  font-size: 0.625rem;
  letter-spacing: 0.16em;
  font-weight: 500;
  color: #8e9db0;
  margin-top: 0.45rem;
}
.brand-mark {
  display: block;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}
.search-label {
  font-size: 0.75rem;
  color: #9cadc1;
  margin: 0 0.6rem 0.6rem;
}
.sidebar input {
  background: #1b2a3c;
  border-color: #2e3d50;
  color: #e9f0f9;
  margin: 0 0.45rem 1.2rem;
  width: calc(100% - 0.9rem);
}
.sidebar input::placeholder {
  color: #8697ac;
}
#relations {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: #52677e transparent;
}
#relations::-webkit-scrollbar {
  width: 8px;
}
#relations::-webkit-scrollbar-track {
  background: transparent;
}
#relations::-webkit-scrollbar-thumb {
  background: #52677e;
  border: 2px solid var(--nav);
  border-radius: 8px;
}
#relations::-webkit-scrollbar-thumb:hover {
  background: #8298ae;
}
.source-group {
  margin-bottom: 0.75rem;
}
.source-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.4rem;
  color: #e9f0f9;
  font-size: 0.875rem;
  font-weight: 650;
  border-radius: 6px;
}
.source-heading::before {
  content: "›";
  font-size: 1.2rem;
  line-height: 1;
}
.source-group[open] > .source-heading::before {
  transform: rotate(90deg);
}
.source-heading:hover {
  background: #1e3042;
}
.source-heading:focus-visible {
  outline: 2px solid #72d4bb;
  outline-offset: -2px;
}
.schema-group {
  margin-bottom: 1rem;
  margin-left: 0.5rem;
}
.schema-heading {
  padding: 0.55rem 0.65rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.7rem;
  font-weight: 650;
  color: #a8b8cb;
}
.schema-heading small,
.source-heading small {
  margin-left: auto;
  background: #253346;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  color: #aab9cc;
  font-size: 0.7rem;
}
.schema-dot {
  height: 7px;
  width: 7px;
  border-radius: 2px;
  background: #b98c56;
}
.schema-dot.silver {
  background: #b4c4d6;
}
.schema-dot.gold {
  background: #d2b450;
}
.relation-link {
  width: 100%;
  display: flex;
  gap: 0.6rem;
  text-align: left;
  white-space: normal;
  background: none;
  border: 1px solid transparent;
  color: #9eafc3;
  padding: 0.65rem 0.7rem;
  font-size: 0.875rem;
  line-height: 1.45;
  align-items: flex-start;
  border-radius: 6px;
  margin: 0.15rem 0;
}
.relation-link .relation-symbol {
  color: #718ba2;
  flex-shrink: 0;
}
.relation-link .relation-name {
  overflow-wrap: anywhere;
  min-width: 0;
}
.relation-link:hover {
  background: #1e3042;
  border-color: transparent;
  color: #e7f7f2;
}
.relation-link.active {
  background: #163c3c;
  color: #9fe7d5;
  border-color: #27554f;
}
.relation-link.active .relation-symbol {
  color: #72d4bb;
}
.sidebar-footer {
  margin: 0.8rem 0.4rem 0;
  padding-top: 1rem;
  border-top: 1px solid #2a3748;
  font-size: 0.875rem;
  color: #b3c3d5;
}
.sidebar-count {
  margin-bottom: 0.9rem;
  color: #9cadc1;
  font-size: 0.875rem;
}
.access-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.75rem;
}
.lock-icon {
  color: #79baa8;
  font-size: 1.2rem;
}
.nav-message {
  font-size: 0.8125rem;
  line-height: 1.7;
  color: #9cadc1;
  padding: 0.5rem 0.6rem;
}
main {
  flex: 1;
  min-width: 0;
  padding: 1rem;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.data-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 4px 15px #16304704;
  overflow: hidden;
}
.data-panel > :not(.grid-area) {
  flex-shrink: 0;
}
.relation-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.5rem;
}
.relation-info {
  min-width: 0;
}
.relation-info h1 {
  margin: 0.6rem 0 0;
  min-width: 0;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}
.relation-path {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
#schema-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 650;
  color: #6f8392;
}
.kind-label {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.4rem;
  border: 1px solid #e1e6ec;
  border-radius: 4px;
  color: #8a97a7;
}
.relation-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  min-width: 0;
}
.utc-clock {
  display: inline-flex;
  align-items: stretch;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  font-size: 0.8125rem;
  color: var(--ink);
}
.utc-label {
  display: flex;
  align-items: center;
  padding: 0.45rem 0.6rem;
  background: #e9f5f2;
  color: var(--accent);
  border-right: 1px solid var(--line);
  font-weight: 600;
}
#utc-time {
  padding: 0.45rem 0.65rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.refresh-controls {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}
#refresh-status {
  color: var(--muted);
  font-size: 0.875rem;
  white-space: nowrap;
  min-width: 8.5rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.primary:hover {
  background: #066d61;
  border-color: #066d61;
}
.text-button {
  border-color: transparent;
  background: transparent;
  color: #8390a0;
}
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  font-size: 0.7rem;
  gap: 0.5rem;
}
.table-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #8491a2;
  flex-wrap: wrap;
  min-width: 0;
  font-size: 0.875rem;
}
.table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  flex-shrink: 0;
  margin-left: auto;
}
.divider {
  color: #ccd4dd;
}
details {
  position: relative;
}
summary {
  list-style: none;
  color: #64748b;
  font-size: 0.75rem;
  padding: 0.35rem;
}
summary::-webkit-details-marker {
  display: none;
}
#column-options {
  position: absolute;
  right: 0;
  top: 2rem;
  z-index: 20;
  min-width: 240px;
  max-height: min(300px, 35dvh);
  overflow: auto;
  background: white;
  box-shadow: 0 8px 25px #18334922;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.5rem;
}
#column-options label {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  padding: 0.4rem;
  font-size: 0.875rem;
  white-space: nowrap;
}
#column-options input {
  accent-color: var(--accent);
}
.notice {
  font-size: 0.8125rem;
  padding: 0.65rem 1rem;
  color: #688093;
  background: #f5f9fb;
  border-top: 1px solid #edf1f5;
  line-height: 1.5;
}
.notice[hidden] {
  display: none;
}
.notice.error {
  color: #9b4e30;
  background: #fff4ed;
  border-color: #f8dfd1;
}
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
  color: #627285;
}
.table-footer small {
  display: block;
  color: #9aa5b3;
  font-size: 0.875rem;
  margin-top: 0.35rem;
}
.pagination {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.pagination button {
  font-size: 0.75rem;
  padding: 0.45rem 0.65rem;
}
.pagination span {
  color: #7e8b9c;
  font-size: 0.875rem;
  white-space: nowrap;
}
.tabulator {
  border: 0;
  background: #fff;
  font-size: 0.8125rem;
  font-family: inherit;
}
.tabulator .tabulator-header {
  background: #f7f9fb;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-weight: 550;
  color: #5b6b7c;
}
.tabulator .tabulator-header .tabulator-col {
  background: #f7f9fb;
  border-right: 1px solid #edf0f4;
  min-height: 43px;
}
.tabulator .tabulator-header .tabulator-col .tabulator-col-content {
  padding: 13px 12px;
}
.tabulator-row {
  border-bottom: 1px solid #edf1f5;
  min-height: 39px;
  background: white;
  color: #465669;
}
.tabulator-row.tabulator-row-even {
  background: #fcfdfe;
}
.tabulator-row.tabulator-selectable:hover {
  background: #f0f8f6;
}
.tabulator-row .tabulator-cell {
  border-right: 1px solid #f2f4f7;
  padding: 11px 12px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.875rem;
}
.tabulator
  .tabulator-tableholder
  .tabulator-placeholder
  .tabulator-placeholder-contents {
  color: #96a3b1;
  font-size: 0.875rem;
  font-weight: 400;
}
.null-value {
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  color: #aab5c2;
  font-style: italic;
}
.empty-value {
  color: #aab5c2;
  font-size: 0.65rem;
  font-style: italic;
}
.column-type {
  display: block;
  font-weight: 400;
  font-size: 0.75rem;
  color: #98a5b4;
  margin-top: 0.25rem;
}
.sort-indicator {
  color: #098877;
  margin-left: 0.4rem;
}
.grid-area {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
#grid {
  min-height: 0;
}
.tabulator .tabulator-footer {
  display: none;
}

.column-sort {
  display: block;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 0;
  width: 100%;
  font-size: 0.875rem;
  white-space: normal;
}
.column-sort:hover {
  background: transparent;
  color: var(--accent);
}
.table-actions #clear-sort,
.table-actions #clear-filters {
  padding: 0.25rem 0.4rem;
  font-size: 0.75rem;
}
.header-value-filter {
  display: block;
  width: 100%;
  text-align: left;
  min-height: 33px;
  font-size: 0.875rem;
  background: white;
  padding: 0.4rem 0.55rem;
}
.header-value-filter.filtered {
  border-color: var(--accent);
  background: #edf8f4;
  color: var(--accent);
}
#filter-popup {
  position: fixed;
  inset: auto;
  margin: 0;
  width: min(320px, calc(100vw - 16px));
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  padding: 1rem;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 8px 30px #18334933;
  font-size: 0.875rem;
}
#filter-popup header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
#filter-popup header button {
  font-size: 0.75rem;
  padding: 0.25rem 0.4rem;
}
.value-search {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: var(--muted);
}
.value-search input {
  width: 100%;
}
.value-option {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0.25rem;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.value-option:hover {
  background: #f0f8f5;
}
.value-option input {
  flex-shrink: 0;
  margin-top: 0.1rem;
  accent-color: var(--accent);
}
.all-values {
  border-bottom: 1px solid var(--line);
  margin-top: 0.5rem;
  font-weight: 600;
}
#value-options {
  max-height: 190px;
  overflow-y: auto;
  margin-top: 0.3rem;
}
#value-summary {
  margin: 0.6rem 0 0;
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.5;
}

#mobile-tables {
  display: none;
}

.button-icon {
  display: none;
}
#refresh .button-icon {
  display: inline;
}

@media (max-width: 760px) {
  body {
    flex-direction: column;
  }
  #sidebar-resizer,
  .brand small,
  .sidebar-footer,
  .search-label,
  .sidebar #relation-search,
  .sidebar nav {
    display: none;
  }
  .sidebar {
    position: relative;
    width: 100%;
    height: 64px;
    padding: 10px 16px;
  }
  .brand {
    min-height: 44px;
    padding: 0 80px 0 0;
    font-size: 1rem;
  }
  #mobile-tables {
    display: block;
    position: absolute;
    top: 10px;
    right: 16px;
    min-height: 44px;
    background: #1e3445;
    border-color: #365063;
    color: white;
  }
  .sidebar.mobile-open {
    position: fixed;
    inset: 0;
    height: 100dvh;
    z-index: 30;
  }
  .sidebar.mobile-open #relation-search {
    display: block;
    margin: 16px 0;
    width: 100%;
  }
  .sidebar.mobile-open nav {
    display: block;
    overflow-y: auto;
    flex: 1;
    max-height: none;
  }
  .schema-group {
    min-width: 0;
    margin: 0 0 12px;
  }
  main {
    padding: 0;
    height: auto;
  }
  .data-panel {
    border: 0;
    border-radius: 0;
  }
  .relation-heading {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--line);
  }
  .relation-info,
  .relation-controls {
    display: contents;
  }
  .relation-path {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    gap: 6px;
  }
  .relation-info h1 {
    grid-column: 1 / -1;
    grid-row: 2;
    font-size: 1.125rem;
    margin: 0;
    padding-right: 88px;
    align-self: center;
  }
  .utc-clock {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    margin: 0;
    font-size: 0.625rem;
  }
  .utc-label {
    padding: 6px;
  }
  #utc-time {
    padding: 6px;
  }
  .refresh-controls {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    display: grid;
    grid-template-columns: 32px 32px;
    gap: 4px;
  }
  #pause,
  #refresh {
    grid-row: 1;
    width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
  }
  .button-icon {
    display: inline;
    font-size: 1rem;
  }
  .button-label {
    display: none;
  }
  #refresh-status {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    text-align: left;
    font-size: 0.625rem;
  }
  .table-toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 6px 12px 8px;
    gap: 8px;
  }
  .table-actions {
    display: flex;
    justify-content: space-between;
    margin: 0;
    gap: 6px;
    width: 100%;
  }
  .table-actions > button,
  .table-actions > details {
    flex: 1;
  }
  .table-actions > button,
  #column-menu > summary {
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 6px;
    font-size: 0.6875rem;
    white-space: nowrap;
  }
  .table-meta {
    font-size: 0.625rem;
    gap: 4px;
  }
  #column-options {
    right: 0;
    width: min(280px, calc(100vw - 24px));
    max-height: 40dvh;
    overflow-y: auto;
  }
  button:not(#pause):not(#refresh),
  summary,
  .header-value-filter {
    min-height: 44px;
  }
  input {
    font-size: 16px;
  }
  .grid-area {
    flex: 1;
    min-height: 0;
  }
  .table-footer {
    padding: 6px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .table-footer > div:first-child {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px;
    font-size: 0.6875rem;
  }
  .table-footer small {
    font-size: 0.625rem;
    margin: 0;
  }
  .pagination {
    justify-content: space-between;
  }
}
@media (min-width: 761px) and (max-height: 850px) {
  .relation-heading {
    padding: 0.75rem 1rem;
  }
  .table-toolbar,
  .table-footer {
    padding: 0.6rem 1rem;
  }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .sidebar {
    padding-left: 0.7rem;
    padding-right: 0.7rem;
  }
}
