@import url("./studio-tokens.css");
:root {
  --bg: hsl(var(--background-default));
  --surface: hsl(var(--background-surface-75));
  --raised: hsl(var(--background-surface-100));
  --muted-bg: hsl(var(--background-surface-200));
  --fg: hsl(var(--foreground-default));
  --secondary: hsl(var(--foreground-light));
  --muted: hsl(var(--foreground-lighter));
  --line: hsl(var(--border-default));
  --strong-line: hsl(var(--border-strong));
  --accent: hsl(var(--brand-default));
  --accent-link: hsl(var(--brand-link));
  --accent-soft: hsl(var(--brand-200));
  --danger: #db3d42;
  --mono: Consolas, "Liberation Mono", monospace;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font:
    12px/1.7 Tahoma,
    Arial,
    system-ui,
    sans-serif;
  -webkit-font-smoothing: antialiased;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
a,
input,
select,
textarea {
  outline-offset: 2px;
}
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 30px;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--strong-line);
  border-radius: 5px;
  padding: 4px 10px;
  box-shadow: 0 1px 2px #00000008;
  transition: none;
}
button:hover {
  background: var(--muted-bg);
  border-color: hsl(var(--border-stronger));
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent-link);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button svg {
  flex-shrink: 0;
}
.primary {
  background: hsl(var(--brand-button));
  border-color: hsl(var(--brand-button));
  color: white;
  box-shadow: inset 0 1px 0 #ffffff20;
}
.primary:hover {
  background: hsl(var(--brand-button) / 0.9);
  border-color: hsl(var(--brand-button));
}
.danger {
  color: var(--danger);
  background: transparent;
  border-color: var(--line);
}
.danger:hover {
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
  border-color: var(--danger);
}
input,
select,
textarea {
  background: var(--surface);
  border: 1px solid var(--strong-line);
  border-radius: 5px;
  padding: 6px 9px;
  max-width: 100%;
}
input:not([type="checkbox"]),
select {
  min-height: 32px;
}
input:disabled,
textarea:disabled {
  opacity: 0.55;
}
textarea {
  width: 100%;
  resize: vertical;
}
input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: hsl(var(--brand-button));
  vertical-align: middle;
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
}
label {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}
a {
  color: var(--accent-link);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
h1,
h2,
h3,
p {
  margin: 0 0 12px;
}
h1 {
  font-size: 20px;
  font-weight: 600;
}
h2 {
  font-size: 17px;
  font-weight: 600;
}
h3 {
  font-size: 13px;
  font-weight: 600;
}
small,
.small {
  font-size: 11px;
}
.muted {
  color: var(--muted);
}
.shell {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background: hsl(var(--background-dash-sidebar));
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 12px 14px;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  min-width: 0;
}
.brand {
  height: 49px;
  display: flex;
  align-items: center;
  direction: ltr;
  justify-content: flex-end;
  font:
    700 17px/1 system-ui,
    sans-serif;
  letter-spacing: -0.7px;
  border-bottom: 1px solid var(--line);
  margin: 0 -12px;
  padding: 0 14px;
  gap: 3px;
  color: var(--fg);
}
.brand:before {
  content: "";
  display: block;
  width: 13px;
  height: 18px;
  background: var(--accent);
  clip-path: polygon(55% 0, 0 58%, 44% 58%, 39% 100%, 100% 36%, 57% 36%);
  margin-right: 5px;
}
.brand span {
  color: var(--fg);
}
.sidebar-caption {
  color: var(--muted);
  font-size: 10px;
  padding-top: 2px;
}
.sidebar > label {
  margin: 0;
}
.sidebar select {
  width: 100%;
  background: var(--bg);
}
.sidebar > .primary {
  width: 100%;
  margin-bottom: 5px;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.nav button {
  justify-content: flex-start;
  text-align: right;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--secondary);
  padding: 7px 8px;
  white-space: nowrap;
}
.nav button:hover {
  background: var(--muted-bg);
  color: var(--fg);
}
.nav button.active {
  background: hsl(var(--background-selection));
  color: var(--fg);
  border-color: transparent;
}
.nav button.active svg {
  color: var(--accent-link);
}
.sidebar footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}
.sidebar footer button {
  margin-top: 8px;
  min-height: 25px;
  padding: 2px 7px;
  font-size: 10px;
}
.sidebar footer button + button {
  margin-right: 5px;
}
.main {
  display: grid;
  grid-template-rows: 49px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  min-width: 0;
  width: 100%;
  padding: 0;
  margin: 0;
  max-width: none;
}
.topbar,
.toolbar,
.row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.topbar {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: 0 20px;
  margin: 0;
  min-width: 0;
  gap: 10px;
}
.topbar > div:first-child {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.topbar h1 {
  font-size: 13px;
  font-weight: 500;
  margin: 0;
  white-space: nowrap;
}
.topbar p {
  font-size: 10px;
  direction: ltr;
  margin: 0;
  line-height: 1.3;
  color: var(--muted);
}
.topbar > div:first-child > p:after {
  content: "/";
  margin: 0 10px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.theme-toggle {
  min-height: 28px;
  font-size: 10px;
  white-space: nowrap;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--secondary);
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 10px;
  line-height: 1.8;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-name:before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-link);
}
#view {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 24px;
}
.shell[data-section="tables"] #view,
.shell[data-section="storage"] #view {
  padding: 0;
}
.shell[data-section="sql"] #view {
  padding: 0 16px 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 18px;
  min-width: 0;
}
.card:last-child {
  margin-bottom: 0;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.metric {
  font: 500 28px/1.4 system-ui;
  color: var(--fg);
  margin-bottom: 5px;
}
.toolbar {
  margin-bottom: 12px;
}
.spacer {
  flex: 1;
}
.ltr {
  direction: ltr;
  text-align: left;
}
.code {
  font: 12px/1.8 var(--mono);
  direction: ltr;
  text-align: left;
  tab-size: 2;
  white-space: pre;
  min-height: 260px;
  background: var(--bg);
  color: var(--fg);
  padding: 14px 16px;
  outline-offset: -2px;
}
.result {
  direction: ltr;
  text-align: left;
  white-space: pre-wrap;
  overflow: auto;
  max-height: 480px;
  background: var(--bg);
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font: 12px/1.7 var(--mono);
}
.table-wrap {
  overflow: auto;
  max-height: 65vh;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  direction: ltr;
}
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  white-space: nowrap;
  direction: ltr;
  font-size: 12px;
}
th {
  background: var(--muted-bg);
  color: var(--fg);
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  font-weight: 500;
}
td,
th {
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
tr:last-child td {
  border-bottom: 0;
}
td:last-child,
th:last-child {
  border-right: 0;
}
tbody tr:hover {
  background: hsl(var(--background-overlay-hover));
}
td button {
  font-size: 10px;
  min-height: 23px;
  padding: 1px 6px;
  margin: 0 3px;
  box-shadow: none;
}
.login {
  max-width: 410px;
  margin: 12vh auto;
  padding: 28px;
  box-shadow: 0 8px 40px #00000008;
}
.login .brand {
  height: 45px;
  border: 0;
  margin: 0 0 16px;
  padding: 0;
  justify-content: flex-start;
}
.login input,
.login .primary {
  width: 100%;
}
.login .primary {
  margin-top: 10px;
}
.error {
  color: var(--danger);
  white-space: pre-wrap;
}
.empty {
  padding: 38px 20px;
  text-align: center;
  color: var(--muted);
}
.tabs {
  display: flex;
  gap: 4px;
  overflow: auto;
  margin-bottom: 12px;
  direction: ltr;
}
.tabs .active {
  border-color: var(--accent-link);
  color: var(--accent-link);
}
.file-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 12px;
  direction: ltr;
}
.file-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.file-list button {
  text-align: left;
  justify-content: flex-start;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-list button.active {
  border-color: var(--accent-link);
  color: var(--accent-link);
  background: var(--accent-soft);
}
.callout {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-right: 3px solid var(--accent-link);
  background: var(--accent-soft);
  color: var(--secondary);
  margin: 14px 0;
  border-radius: 4px;
}
.warning {
  border-right-color: #d9941c;
  background: color-mix(in srgb, #e5a520 7%, var(--surface));
  color: var(--secondary);
}
.key {
  word-break: break-all;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
  direction: ltr;
  user-select: all;
  font: 12px/1.8 var(--mono);
}
.project-card h3 {
  margin-bottom: 5px;
}
.project-card .primary {
  margin-top: 12px;
}
#toast {
  position: fixed;
  bottom: 20px;
  left: 20px;
  max-width: min(440px, calc(100vw - 32px));
  background: var(--raised);
  color: var(--fg);
  padding: 12px 18px;
  border: 1px solid var(--strong-line);
  border-radius: 6px;
  box-shadow: 0 6px 25px #0002;
  z-index: 600;
  display: none;
  white-space: pre-wrap;
}
#toast.error {
  border-color: var(--danger);
  color: var(--danger);
}
dialog {
  background: hsl(var(--background-dialog-default));
  color: var(--fg);
  border: 1px solid var(--strong-line);
  border-radius: 8px;
  padding: 24px;
  width: min(740px, 95vw);
  max-height: 90vh;
  box-shadow: 0 20px 80px #0003;
}
dialog::backdrop {
  background: #0006;
  backdrop-filter: blur(2px);
}
dialog.confirmation {
  width: min(540px, 95vw);
}
.close {
  float: left;
  min-height: 24px;
  padding: 0 7px;
  font-size: 20px;
  line-height: 1.1;
  background: transparent;
  border: 0;
  color: var(--muted);
  box-shadow: none;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.dialog-feedback {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--secondary);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.9;
  outline-offset: 2px;
}
.dialog-feedback.error {
  border-color: var(--danger);
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 7%, var(--surface));
}
.dialog-feedback[hidden] {
  display: none;
}
hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 20px 0;
}
.filter-chip {
  background: var(--muted-bg);
  border: 1px solid var(--line);
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11px;
}
.wide {
  width: 100%;
}
.loading {
  opacity: 0.55;
  pointer-events: none;
}
.logs pre {
  white-space: pre-wrap;
  direction: ltr;
  text-align: left;
}
.check {
  display: flex;
  align-items: center;
  gap: 7px;
}
.inline {
  display: inline-flex;
  margin: 0;
}
.nowrap {
  white-space: nowrap;
}
/* Flat workspaces mirror Studio's explorer / tabs / toolbar / canvas structure. */
.resource-layout {
  display: grid;
  grid-template-columns: 215px minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  min-height: 100%;
  min-width: 0;
}
.resource-explorer {
  position: sticky;
  top: 0;
  align-self: start;
  height: calc(100vh - 49px);
  background: hsl(var(--background-dash-sidebar));
  border-left: 1px solid var(--line);
  padding: 0 12px 12px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.resource-explorer h3 {
  font-size: 13px;
  margin: 0 -12px 2px;
  padding: 13px 16px;
  height: 44px;
  border-bottom: 1px solid var(--line);
}
.resource-explorer input {
  width: 100%;
  min-width: 0;
  font-size: 11px;
}
.resource-explorer > .primary {
  background: var(--surface);
  color: var(--fg);
  border-color: var(--line);
  justify-content: flex-start;
}
.resource-explorer > .primary:hover {
  background: var(--muted-bg);
}
.explorer-list {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-height: 50px;
  margin: 0 -5px;
}
.explorer-list button {
  text-align: left;
  justify-content: flex-start;
  direction: ltr;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  border-radius: 3px;
  min-height: 31px;
  padding: 4px 10px;
  font-size: 12px;
}
.explorer-list button:before {
  content: "";
  width: 12px;
  height: 12px;
  border: 1px solid currentColor;
  border-radius: 2px;
  flex-shrink: 0;
  background:
    linear-gradient(
      to bottom,
      transparent 30%,
      currentColor 30%,
      currentColor 38%,
      transparent 38%
    ),
    linear-gradient(
      to right,
      transparent 32%,
      currentColor 32%,
      currentColor 40%,
      transparent 40%
    );
  color: var(--muted);
  margin-right: 6px;
}
.explorer-list button.active,
.storage-entry.active {
  background: hsl(var(--background-selection));
  border-color: transparent;
  color: var(--fg);
}
.explorer-list button.active:before {
  color: var(--accent-link);
}
.resource-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 49px);
}
.resource-content > .card {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0;
  min-height: 0;
  background: var(--bg);
}
.resource-content > .card > .toolbar {
  margin: 0;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  gap: 6px;
}
.resource-content > .card > .toolbar:empty {
  display: none;
}
.resource-content .toolbar button,
.resource-content .toolbar input,
.resource-content .toolbar select {
  min-height: 28px;
  font-size: 11px;
  padding: 3px 8px;
}
.resource-content .toolbar > strong {
  font-size: 11px;
  font-weight: 500;
}
.resource-content .toolbar .check {
  margin: 0;
}
.workspace-tabs {
  display: flex;
  gap: 0;
  overflow: auto;
  direction: ltr;
  margin: 0;
  min-width: 0;
  padding: 0;
  min-height: 42px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.workspace-tab {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  position: relative;
}
.workspace-tab.active {
  background: var(--bg);
}
.workspace-tab.active:before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--accent-link);
}
.workspace-tab button {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  white-space: nowrap;
  min-height: 41px;
  padding: 8px 13px;
  font-size: 11px;
  color: var(--secondary);
}
.workspace-tab .tab-close {
  color: var(--muted);
  padding: 5px 9px;
}
.workspace-tab.active .table-tab,
.workspace-tab.active .query-tab {
  color: var(--fg);
}
.workspace-tabs > button {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: 11px;
  background: transparent;
  color: var(--secondary);
}
.data-grid {
  max-height: calc(100vh - 270px);
  min-height: 220px;
  border: 0;
  border-radius: 0;
  background: var(--bg);
  flex: 1;
}
.data-grid table {
  min-width: 100%;
  width: max-content;
}
.data-grid th {
  min-width: 155px;
  height: 43px;
  background: var(--muted-bg);
  padding: 5px 12px;
}
.data-grid th small {
  display: inline;
  font-size: 10px;
  font-weight: 400;
  margin-left: 6px;
}
.data-grid th > div {
  display: inline;
}
.data-grid td {
  height: 35px;
  padding: 4px 12px;
  max-width: 360px;
}
.data-grid .row-actions {
  white-space: nowrap;
  min-width: 180px;
  color: var(--muted);
}
.editable-cell {
  cursor: pointer;
  min-width: 155px;
  max-width: 360px;
}
.editable-cell:hover,
.editable-cell:focus {
  background: var(--accent-soft);
  outline: 1px solid var(--accent-link);
  outline-offset: -1px;
}
.generated-cell {
  color: var(--secondary);
}
.null-value {
  font-style: italic;
  color: var(--muted);
  font-size: 10px;
}
.table-definition {
  margin: 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.table-definition summary {
  cursor: pointer;
  color: var(--secondary);
  padding: 8px 14px;
  font-size: 11px;
}
.table-definition .table-wrap {
  margin: 0 12px 12px;
}
.cell-menu {
  position: fixed;
  z-index: 500;
  background: var(--raised);
  border: 1px solid var(--strong-line);
  border-radius: 6px;
  box-shadow: 0 6px 30px #0002;
  display: flex;
  flex-direction: column;
  padding: 4px;
  min-width: 215px;
  max-width: 95vw;
}
.cell-menu button {
  border: 0;
  box-shadow: none;
  background: transparent;
  text-align: right;
  justify-content: flex-start;
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 3px;
}
.cell-menu button:hover {
  background: var(--muted-bg);
}
.pagination {
  border-top: 1px solid var(--line);
  background: var(--surface);
  margin-top: auto !important;
}
.resource-content > .card > .empty {
  flex: 1;
  min-height: 130px;
}
.resource-content > .card > label {
  margin: 0;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}
.resource-content > .card > .breadcrumbs {
  margin: 0;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  min-height: 43px;
}
.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  direction: ltr;
  gap: 2px;
}
.breadcrumbs button {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 3px 7px;
  min-height: 26px;
  font-size: 11px;
}
.breadcrumbs button + button:before {
  content: "/";
  margin-right: 9px;
  color: var(--muted);
}
.storage-browser {
  display: grid;
  grid-template-columns: minmax(180px, 0.85fr) minmax(280px, 1.15fr);
  gap: 0;
  min-height: 490px;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  direction: ltr;
  flex: 1;
}
.storage-browser > section {
  min-width: 0;
  padding: 10px;
  direction: rtl;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.storage-browser > section > input {
  width: 100%;
  min-height: 29px;
  font-size: 11px;
}
.storage-files {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 280px);
  overflow: auto;
  gap: 0;
  margin-top: 8px;
}
.storage-entry {
  flex-shrink: 0;
  text-align: left;
  justify-content: flex-start;
  direction: ltr;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  box-shadow: none;
  min-height: 35px;
  font-size: 12px;
}
.folder-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.folder-entry button:first-child {
  flex: 1;
  justify-content: flex-start;
  text-align: left;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.folder-entry > .danger {
  opacity: 0.4;
  min-height: 24px;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.folder-entry:hover > .danger {
  opacity: 1;
}
.file-details {
  direction: rtl;
  padding: 20px;
  min-width: 0;
  background: var(--bg);
  overflow-wrap: anywhere;
}
.file-preview {
  display: block;
  width: 100%;
  height: 260px;
  object-fit: contain;
  background: repeating-conic-gradient(
      var(--surface) 0% 25%,
      var(--muted-bg) 0% 50%
    )
    50%/20px 20px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 0;
}
.file-details audio {
  width: 100%;
}
.file-icon {
  font-size: 60px;
  text-align: center;
  padding: 45px;
}
.file-details h3 {
  word-break: break-word;
  font-size: 14px;
}
.file-details .toolbar {
  margin-top: 16px;
}
.file-url {
  font: 11px/1.8 var(--mono);
  user-select: all;
  min-width: 0;
  background: var(--surface);
}
.result-tabs {
  min-height: 34px;
  margin: -20px -20px 12px;
}
.result-tabs button {
  min-height: 33px;
  font-size: 11px;
  border-right: 1px solid var(--line);
}
.result-tabs .active {
  color: var(--accent-link);
  box-shadow: inset 0 -2px var(--accent-link);
}
.sql-error {
  white-space: pre-wrap;
}
.shell[data-section="sql"] #view > .workspace-tabs {
  margin: 0 -16px 0;
}
.shell[data-section="sql"] #view > .card {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  margin: 0 -16px;
  padding: 12px 16px;
}
.shell[data-section="sql"] .code {
  border: 0;
  min-height: 360px;
  max-height: 60vh;
  background: var(--bg);
  padding: 12px 16px;
}
.shell[data-section="sql"] .result-tabs {
  margin: -12px -16px 12px;
}
.shell[data-section="sql"] #view > .card > .toolbar {
  margin: 0;
  padding: 0 0 10px;
}
.shell[data-section="sql"] #view > .card > .small {
  margin: 0;
  font-size: 10px;
}
.loading {
  pointer-events: none;
}
.drop-overlay {
  display: none;
}
.storage-browser.drop-active {
  outline: 2px dashed var(--accent-link);
  outline-offset: -4px;
  background: var(--accent-soft);
}
.storage-browser.drop-active .drop-overlay {
  display: flex;
}
.storage-entry.drop-target {
  background: var(--accent-soft);
  outline: 2px dashed var(--accent-link);
  outline-offset: -2px;
}
.breadcrumbs .drop-target {
  background: var(--accent-soft);
  outline: 2px dashed var(--accent-link);
  outline-offset: -2px;
}
.storage-entry.is-dragging {
  opacity: 0.45;
}
.upload-status {
  padding: 10px 14px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--line);
  color: var(--secondary);
  font-size: 11px;
}
.upload-status progress {
  width: 100%;
  height: 5px;
  accent-color: var(--accent-link);
}
.drop-hint {
  font-size: 10px;
  color: var(--muted);
  padding: 5px 12px;
  border-bottom: 1px solid var(--line);
  margin: 0;
}
.upload-drop-zone {
  position: relative;
}
.drop-overlay {
  position: absolute;
  inset: 4px;
  z-index: 4;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  background: color-mix(in srgb, var(--accent-soft) 90%, transparent);
  color: var(--accent-link);
  border: 1px dashed var(--accent-link);
  pointer-events: none;
  font-size: 14px;
}
.drop-overlay strong {
  max-width: 95%;
  overflow-wrap: anywhere;
  font: 12px var(--mono);
}
@media (min-width: 1600px) {
  .shell {
    grid-template-columns: 205px minmax(0, 1fr);
  }
  .resource-layout {
    grid-template-columns: 245px minmax(0, 1fr);
  }
}
@media (max-width: 1050px) {
  .shell {
    grid-template-columns: 170px minmax(0, 1fr);
  }
  .resource-layout {
    grid-template-columns: 180px minmax(0, 1fr);
  }
  .topbar {
    padding: 0 12px;
  }
  .topbar p {
    display: none;
  }
  .header-actions {
    gap: 6px;
  }
  .storage-browser {
    grid-template-columns: minmax(0, 1fr);
  }
  .storage-browser > section {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .storage-files {
    max-height: 300px;
  }
  .file-preview {
    height: 230px;
  }
  .file-details {
    padding: 16px;
  }
  .file-layout {
    grid-template-columns: 150px minmax(0, 1fr);
  }
}
@media (max-width: 760px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    height: auto;
    position: static;
    border-left: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 12px 8px;
    gap: 8px;
    overflow: visible;
  }
  .brand {
    height: 40px;
    font-size: 16px;
  }
  .sidebar-caption,
  .sidebar footer {
    display: none;
  }
  .sidebar > label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 10px;
  }
  .sidebar select {
    width: 65%;
    max-width: 300px;
  }
  .sidebar > .primary {
    align-self: flex-start;
    width: auto;
    position: absolute;
    top: 7px;
    left: 12px;
    min-height: 25px;
    font-size: 10px;
    margin: 0;
  }
  .nav {
    flex-direction: row;
    overflow: auto;
    gap: 3px;
  }
  .nav button {
    flex-shrink: 0;
    padding: 5px 8px;
    font-size: 11px;
  }
  .nav button svg {
    width: 14px;
    height: 14px;
  }
  .main {
    height: auto;
    min-height: calc(100vh - 150px);
    overflow: visible;
    grid-template-rows: 44px minmax(0, 1fr);
  }
  .topbar {
    padding: 0 12px;
    gap: 5px;
  }
  .topbar h1 {
    font-size: 12px;
  }
  .project-name {
    max-width: 100px;
    font-size: 9px;
  }
  .theme-toggle {
    font-size: 9px;
    min-height: 26px;
    padding: 3px 6px;
  }
  .theme-toggle svg {
    width: 13px;
  }
  #view {
    padding: 14px;
    overflow: visible;
  }
  .resource-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .resource-explorer {
    position: static;
    height: auto;
    max-height: 210px;
    border-left: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 12px 10px;
    gap: 7px;
  }
  .resource-explorer h3 {
    height: 35px;
    padding: 8px 12px;
    font-size: 12px;
  }
  .resource-explorer > .primary {
    position: absolute;
    left: 12px;
    margin-top: 5px;
    min-height: 24px;
    font-size: 10px;
  }
  .explorer-list {
    max-height: 100px;
    min-height: 0;
  }
  .explorer-list button {
    min-height: 28px;
    padding: 3px 8px;
    font-size: 11px;
  }
  .resource-content {
    min-height: 0;
  }
  .data-grid {
    max-height: 65vh;
    min-height: 180px;
  }
  .workspace-tabs {
    min-height: 37px;
    max-width: 100%;
  }
  .workspace-tab button {
    min-height: 36px;
    padding: 5px 10px;
  }
  .resource-content .toolbar {
    flex-wrap: wrap;
  }
  .resource-content .toolbar input {
    max-width: 150px;
  }
  .resource-content .toolbar .spacer {
    display: none;
  }
  .file-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .file-list {
    flex-direction: row;
    overflow: auto;
  }
  .file-list button {
    flex-shrink: 0;
  }
  .file-preview {
    height: 220px;
  }
  .storage-browser {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }
  .storage-files {
    max-height: 280px;
  }
  .file-details {
    padding: 16px;
  }
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .grid .card {
    padding: 12px;
  }
  .grid .muted {
    font-size: 10px;
  }
  .metric {
    font-size: 23px;
  }
  .card {
    padding: 14px;
  }
  .login {
    margin: 8vh 16px;
    max-width: none;
    padding: 24px;
  }
  .login .brand {
    height: 40px;
  }
  .code {
    font-size: 11px;
    min-height: 230px;
  }
  .result-tabs {
    margin: -14px -14px 12px;
  }
  .shell[data-section="sql"] .code {
    min-height: 280px;
  }
  .cell-menu {
    min-width: 200px;
  }
  .sidebar:has(+ .main) {
  }
  .file-details .toolbar {
    gap: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
