/* Your account: the SQL panel. Extends ../styles.css (tokens, nav, .btn, .field, .err); nothing here
   is loaded from anywhere but this origin. No inline styles in index.html: the site's CSP can drop
   'unsafe-inline' for styles without touching this page. */

body.app { font-size: 15px; }
.app .wrap { max-width: 1536px; padding-bottom: 40px; }
.app nav.top { margin-bottom: 28px; }
.app nav.top ul { gap: 28px; }
.app .brand { font-size: 28px; }
.app .brand svg { width: 38px; height: 30px; }

.app h1 { font-size: 40px; margin: 0 0 6px; }
.app h2 { font-size: 22px; margin: 0 0 14px; max-width: none; }
.app h3 { font-size: 17px; margin: 0 0 10px; }
.app .lede { font-size: 17px; margin: 0 0 22px; max-width: 70ch; }

.hidden { display: none !important; }

/* sign-in */
.signin { max-width: 560px; }
.signin .field input { font-family: var(--mono); font-size: 14px; }
.signin details { margin: 0 0 18px; font-size: 14px; color: var(--muted); }
.signin summary { cursor: pointer; }

/* account bar */
.acct { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; border: 1px solid var(--rule); border-radius: 10px; background: #fff; padding: 10px 16px; margin: 0 0 20px; font-size: 14px; }
.acct .who { font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft); }
.acct .spacer { flex: 1; }
.acct .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--rule); display: inline-block; margin-right: 6px; vertical-align: -1px; }
.acct .dot.ok { background: var(--ok); }
.acct .dot.warn { background: var(--accent); }

/* layout */
.panel-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }
.side { border: 1px solid var(--rule); border-radius: 10px; background: #fff; padding: 16px 18px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.side h3 { font-family: var(--mono); font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin: 14px 0 8px; }
.side h3:first-child { margin-top: 0; }
.tree { list-style: none; margin: 0; padding: 0; }
.tree li { margin: 0; }
.tree .ns { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); margin: 8px 0 3px; }
.tree button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 5px 8px; border-radius: 6px; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; }
.tree button:hover { background: var(--bg-soft); }
.tree button.on { background: var(--tint); color: var(--accent-deep); }
.tree button small { color: var(--muted); font-family: var(--mono); font-size: 11px; margin-left: 6px; }
.side .empty { color: var(--muted); font-size: 13.5px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--rule); margin: 0 0 18px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 8px 14px; font: inherit; font-size: 15px; color: var(--ink-soft); cursor: pointer; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.tab { display: none; }
.tab.on { display: block; }

.box { border: 1px solid var(--rule); border-radius: 10px; background: #fff; padding: 18px 20px; margin: 0 0 18px; }
.box.tight { padding: 12px 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row .grow { flex: 1; }
.right { margin-left: auto; }

/* SQL */
.status { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); }
.status b { color: var(--ink); font-weight: 500; }
textarea.sql { width: 100%; min-height: 150px; resize: vertical; font-family: var(--mono); font-size: 13.5px; line-height: 1.5; color: var(--code); background: var(--dark); border: 1px solid var(--dark-2); border-radius: 8px; padding: 14px 16px; }
textarea.sql:focus { outline: 2px solid var(--accent); }
.btn.sm { font-size: 17px; padding: 8px 18px; }
.btn.xs { font-family: var(--sans); font-size: 13.5px; padding: 6px 12px; border-radius: 6px; }
.btn.ghost.xs { border-color: var(--rule); color: var(--ink-soft); }
.btn.ghost.xs:hover { background: var(--bg-soft); }
.btn.danger { background: transparent; color: var(--accent-deep); border: 1px solid var(--accent); }
.btn.danger:hover { background: var(--tint); }
input.num { width: 90px; padding: 7px 10px; font: inherit; font-size: 14px; border: 1px solid var(--rule); border-radius: 6px; }
label.inl { font-size: 13.5px; color: var(--ink-soft); display: inline-flex; gap: 8px; align-items: center; }

.results { overflow: auto; max-height: 60vh; border: 1px solid var(--rule); border-radius: 8px; }
.results table { border-collapse: separate; border-spacing: 0; font-size: 13px; font-family: var(--mono); min-width: 100%; }
.results th, .results td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.results th { position: sticky; top: 0; background: var(--bg-soft); font-weight: 500; color: var(--ink-soft); }
.results th small { display: block; color: var(--muted); font-weight: 400; font-size: 10.5px; }
.results td.num { text-align: right; }
.results td.null { color: var(--muted); font-style: italic; }
.results tr:last-child td { border-bottom: 0; }

.err { display: none; }
.err.on { display: block; }
.err pre { margin: 8px 0 0; font-size: 12px; white-space: pre-wrap; word-break: break-word; color: var(--ink-soft); }
.note { border-left: 3px solid var(--ok); background: #eef8f1; color: var(--ok-text); padding: 10px 14px; border-radius: 4px; font-size: 14px; margin: 0 0 14px; }
.note.warn { border-left-color: var(--accent); background: var(--tint); color: var(--accent-deep); }

pre.code { font-size: 12.5px; }
pre.code.wrap { white-space: pre-wrap; word-break: break-all; }
.once { border: 1px dashed var(--accent); background: var(--tint); border-radius: 8px; padding: 12px 14px; margin: 12px 0 0; }
.once b { display: block; margin-bottom: 6px; color: var(--accent-deep); }

/* forms */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; margin: 0 0 12px; }
.field { margin: 0; }
.field input, .field select { width: 100%; padding: 9px 12px; font: inherit; font-size: 14px; color: var(--ink); background: #fff; border: 1px solid var(--rule); border-radius: 7px; }
.field select[multiple] { min-height: 74px; }
.cols { width: 100%; border-collapse: collapse; margin: 0 0 12px; font-size: 14px; }
.cols td { padding: 4px 6px 4px 0; }
.cols input, .cols select { width: 100%; padding: 7px 10px; font: inherit; font-size: 13.5px; border: 1px solid var(--rule); border-radius: 6px; }
.cols td.req { text-align: center; width: 80px; }
.cols td.rm { width: 36px; }
.cols button.rm { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; }

table.plain.small { font-size: 14px; }
table.plain.small th, table.plain.small td { padding: 8px 12px 8px 0; }
table.plain.small td:first-child { font-family: var(--mono); font-size: 13px; }
table.plain .mono { font-family: var(--mono); font-size: 12.5px; }
table.plain td .btn.xs { margin-left: 8px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 14px; margin: 0 0 14px; }
.kv dt { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: .04em; align-self: center; }
.kv dd { margin: 0; font-family: var(--mono); font-size: 13px; word-break: break-all; }

footer.app-foot { margin-top: 40px; border-top: 1px solid var(--rule); padding-top: 18px; font-size: 13px; color: var(--muted); }

/* small screens (tester 2026-09-21, item 4: horizontal overflow at 390 px, the onboarding card and the sidebar
   clipped). A grid child may shrink below its content (min-width: 0; `1fr` alone means minmax(auto, 1fr), whose
   minimum is the content), a table wider than its box scrolls inside the box, long identifiers wrap. */
.panel-grid > * { min-width: 0; }
.box, .side { min-width: 0; overflow-x: auto; }
.acct .who { overflow-wrap: anywhere; }
.handle input { min-width: 0; }
.kv { grid-template-columns: minmax(0, max-content) minmax(0, 1fr); }
.once-row { align-items: flex-start; gap: 8px; }
.once-row pre.code { margin: 0; flex: 1; min-width: 0; }
@media (max-width: 1000px) {
  .panel-grid { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; max-height: none; }
  .app .wrap { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 640px) {
  .app .wrap { padding-left: 14px; padding-right: 14px; }
  .app h1 { font-size: 32px; }
  .app nav.top ul { gap: 8px 16px; }
  .tabs button { padding: 8px 10px; font-size: 14px; }
  .newcat input { width: 100%; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dt { margin-top: 8px; }
  .results th, .results td { max-width: 240px; }
  .cathead h2 { font-size: 22px; }
}

/* the shortcut hint inside the orange Run button */
.btn .muted { color: rgba(255, 255, 255, .78); }

/* sign-in and first-login screens (2026-09-20: OpenID Connect first, the API key a fold-out) */
.signin .row { margin: 0 0 14px; }
.signin .btn.ghost { color: var(--ink); border-color: var(--ink); }
.signin-note { margin: 0 0 22px; }
.signin details form { margin-top: 12px; }
.handle { display: flex; align-items: center; border: 1px solid var(--rule); border-radius: 7px; background: #fff; overflow: hidden; }
.handle .pre { font-family: var(--mono); font-size: 13px; color: var(--muted); padding: 0 0 0 12px; white-space: nowrap; }
.handle input { border: 0 !important; border-radius: 0 !important; font-family: var(--mono); font-size: 14px; padding-left: 4px !important; }
.handle input:focus { outline: none !important; }
.handle.taken { border-color: var(--accent); }
.handle.free { border-color: var(--ok); }

/* sidebar organisation picker */
.orgpick { font-size: 14px; margin: 0 0 6px; }
.orgpick select { width: 100%; padding: 6px 8px; font: inherit; font-size: 14px; border: 1px solid var(--rule); border-radius: 6px; background: #fff; }
.orgpick .h { font-family: var(--mono); font-size: 12px; color: var(--muted); word-break: break-all; }

/* levels, roles, bars */
.lvl { display: inline-block; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; border: 1px solid var(--rule); color: var(--ink-soft); }
.lvl.write { border-color: var(--ok); color: var(--ok-text); }
.lvl.read { border-color: var(--rule); }
.lvl.none, .lvl.unknown { color: var(--muted); border-style: dashed; }
.lvl.admin { border-color: var(--accent); color: var(--accent-deep); }
.bar { height: 10px; background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; margin: 6px 0 4px; }
.bar i { display: block; height: 100%; background: var(--ok); }
.bar.warn i { background: var(--accent); }
.bar.over i { background: var(--accent-deep); }
/* a share of a total, not a level against a limit: thinner and neutral (the Usage tab's per-catalog rows) */
.bar.thin { height: 5px; margin: 5px 0 2px; }
.bar.thin i { background: var(--ink-soft); opacity: .55; }
.meter { margin: 0 0 16px; }
.meter .row { font-size: 14px; }
.meter .row b { font-weight: 500; }
table.plain.small select { padding: 4px 8px; font: inherit; font-size: 13.5px; border: 1px solid var(--rule); border-radius: 6px; background: #fff; }
table.grants td, table.grants th { text-align: center; }
table.grants td:first-child, table.grants th:first-child { text-align: left; }

/* danger zone */
.danger-zone { border-color: var(--accent); }
.danger-zone h2 { color: var(--accent-deep); }
.danger-zone p { font-size: 14.5px; }
.btn.danger.sm { font-family: var(--sans); font-size: 15px; padding: 9px 16px; }
.btn.danger[disabled] { opacity: .45; }

/* "this deployment does not serve that route yet" */
.notyet { border-left: 3px solid var(--rule); background: var(--bg-soft); color: var(--ink-soft); padding: 10px 14px; border-radius: 4px; font-size: 14px; margin: 0 0 14px; }
.notyet code { font-size: 12.5px; }

/* the login flow pages served by this file (docs/login.md): /app/welcome, /app/reset, /app/forgot, /app/device */
.signin form .field input[type=email], .signin form .field input[type=password], .signin form .field input[type=text] { font-family: var(--sans); font-size: 15px; }
.signin .field .hint a { color: var(--ink-soft); }
.signin .check { margin: 0 0 16px; font-size: 14px; }
.signin .terms { margin: 0 0 16px; }
.signin #idp-row { margin: 0 0 18px; }
.signin .sub { font-size: 17px; color: var(--ink-soft); max-width: 60ch; }
.signin .notyet { max-width: 60ch; }
input.usercode { font-family: var(--mono) !important; font-size: 22px !important; letter-spacing: .18em; text-transform: uppercase; max-width: 260px; }

/* the device consent screen (docs/agent-setup.md): what approving connects, and the level the person may lower */
.consent { margin: 0 0 16px; }
.consent .kv dd { font-family: var(--sans); font-size: 15px; }
.consent .kv dd b { font-weight: 600; }
.levels, .choices { border: 1px solid var(--rule); border-radius: 8px; padding: 10px 14px 4px; margin: 0 0 14px; }
.levels legend, .choices legend { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: .04em; padding: 0 6px; }
.levels .check, .choices .check { margin: 0 0 10px; font-size: 14.5px; }
.levels .hint { margin: 0 0 8px; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-deep); text-decoration: underline; cursor: pointer; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#signup-inline .sub { margin: 0 0 14px; font-size: 15px; }
/* "Continue in your agent": the prompt a person pastes; no credential in it */
.continue { border-color: var(--accent); background: var(--tint); }
.continue h2 { color: var(--accent-deep); }
.continue .prompt { background: #fff; color: var(--ink); border: 1px solid var(--rule); border-radius: 8px; padding: 12px 14px; font-size: 13.5px; line-height: 1.5; margin: 0 0 12px; white-space: pre-wrap; word-break: normal; }
.continue .form-row { max-width: 320px; }

/* the Catalogs tab, 2026-09-20 night: a list view and a catalog view (Connect · Tables · Access · Settings) */
.newcat { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--rule); }
.newcat label { font-size: 14px; color: var(--ink-soft); white-space: nowrap; }
.newcat input { width: 220px; padding: 7px 10px; font: inherit; font-family: var(--mono); font-size: 13.5px; border: 1px solid var(--rule); border-radius: 6px; }
.newcat .hint { flex-basis: 100%; font-size: 13px; color: var(--muted); margin: 0; }
.newcat .hint code { font-size: 12px; }
table.catalogs a.catname { color: var(--ink); font-weight: 500; text-decoration: none; border-bottom: 1px solid var(--rule); }
table.catalogs a.catname:hover { color: var(--accent-deep); border-bottom-color: var(--accent); }
.crumbs { margin: 0 0 8px; font-size: 14px; }
.crumbs a { color: var(--ink-soft); text-decoration: none; }
.crumbs a:hover { color: var(--accent-deep); }
.cathead { margin: 0 0 12px; }
.cathead h2 { margin: 0; font-size: 26px; }
.cathead .lvl { vertical-align: middle; }
.tabs.sub { margin: 0 0 16px; }
.tabs.sub button { font-size: 14px; padding: 6px 12px; }
.cvsec[role=tabpanel] { display: none; }
.cvsec[role=tabpanel].on { display: block; }
.recipe { margin: 0 0 12px; }
.recipe .row { margin: 0 0 4px; }
.recipe pre.code { margin: 0; }
details.fold { margin: 12px 0 0; border-top: 1px solid var(--rule); padding-top: 10px; font-size: 14px; }
details.fold summary { cursor: pointer; color: var(--ink-soft); font-weight: 500; }
details.fold[open] summary { margin-bottom: 10px; }
details.fold .kv dd { font-family: var(--mono); font-size: 12.5px; }

/* The login card (2026-09-22, the LakehouseBox mockup): slim header, one centred white card, slim footer.
   Every view carrying .signin (welcome, reset, forgot, device, authorize, onboard) inherits the card; only the
   login view has the centred head (.lg-head). The ids app.js looks up are unchanged; #key-details is now the
   "Advanced connection options" fold (the API address and the API key), which the script opens when the login
   route is missing. .lg-* classes are the login redesign's own. */
.lg-top { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; min-height: 72px; margin-bottom: 56px; flex-wrap: wrap; }
.lg-new { margin: 0; font-size: 16px; color: var(--ink-soft); }
.lg-new a { display: inline-block; padding: 10px 0; color: var(--accent); font-weight: 500; border-bottom: 0; }
.lg-new a:hover { color: var(--accent-deep); }
/* signed in (the panel, or the first-login step): the invitation to create an account goes, the header tightens */
body:has(#panel:not(.hidden)) .lg-new, body:has(#onboard:not(.hidden)) .lg-new { display: none; }
body:has(#panel:not(.hidden)) .lg-top { margin-bottom: 28px; }

.signin { max-width: 560px; margin: 0 auto; background: #fff; border: 1px solid var(--rule); border-radius: 14px; padding: 36px 40px 30px; box-shadow: 0 18px 50px rgba(26, 25, 23, .06), 0 1px 3px rgba(26, 25, 23, .05); }
.lg-head { text-align: center; margin: 0 0 28px; }
.lg-head .lg-mark { display: block; width: 40px; height: 40px; margin: 0 auto 18px; }
.app .lg-head h1 { font-size: 44px; font-weight: 500; letter-spacing: -.03em; line-height: 1.05; margin: 0 0 10px; }
.lg-head .sub { font-family: var(--sans); font-size: 17.5px; line-height: 1.45; color: var(--ink-soft); margin: 0; max-width: none; }

.signin .field { margin: 0 0 20px; }
.signin .field label { font-size: 15.5px; font-weight: 500; color: var(--ink); margin-bottom: 8px; }
.signin .field input { min-height: 48px; border-radius: 8px; border-color: #d9d2c8; }
.signin .field input::placeholder { color: #a39b93; }
.lg-labelrow { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 8px; }
.lg-labelrow label { margin: 0; }
.lg-labelrow a { font-size: 14.5px; font-weight: 500; color: var(--accent); padding: 10px 0; margin: -10px 0; }
.lg-labelrow a:hover { color: var(--accent-deep); }
/* the eye: a 44px button inside the field that flips the input between password and text (app.js, eyeToggle) */
.lg-pw { position: relative; }
.lg-pw input { padding-right: 54px; }
.lg-eye { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; border-radius: 7px; color: var(--ink-soft); cursor: pointer; padding: 0; }
.lg-eye:hover { color: var(--ink); background: var(--bg-soft); }
.lg-eye .eye-off { display: none; }
.lg-eye[aria-pressed="true"] .eye-on { display: none; }
.lg-eye[aria-pressed="true"] .eye-off { display: inline; }
.signin .btn.lg-submit { width: 100%; justify-content: center; background: var(--accent); font-family: var(--sans); font-size: 17.5px; font-weight: 600; min-height: 56px; border-radius: 9px; margin: 4px 0 0; }
.signin .btn.lg-submit:hover { background: var(--accent-deep); }
.lg-stay { text-align: center; font-size: 13.5px; color: var(--muted); margin: 14px 0 0; }
.signin #idp-row { margin: 18px 0 0; flex-direction: column; align-items: stretch; }
.signin #idp-row .btn { justify-content: center; }
.signin #idp-row .small { text-align: center; }
/* the fold: the API address (self-hosted deployments) and the API key */
.signin details.lg-adv { margin: 24px 0 0; padding-top: 6px; border-top: 1px solid var(--rule); font-size: 14.5px; color: var(--ink-soft); }
.lg-adv summary { display: flex; align-items: center; gap: 12px; min-height: 44px; list-style: none; cursor: pointer; font-size: 15.5px; font-weight: 500; color: var(--ink); }
.lg-adv summary::-webkit-details-marker { display: none; }
.lg-adv summary::before { content: ""; flex: none; width: 8px; height: 8px; margin: -4px 4px 0; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg); transition: transform .15s; }
.lg-adv[open] summary::before { transform: rotate(-135deg); margin-top: 4px; }
.lg-adv-body { padding: 8px 0 0; }
.lg-adv-body .field label { font-size: 14.5px; }
.lg-adv-body .field label .muted { font-weight: 400; }
.lg-adv-body form { margin: 0; }
.lg-adv-body .btn.sm.ghost { font-family: var(--sans); font-size: 15px; min-height: 44px; }
.lg-help { text-align: center; margin: 24px 0 0; font-size: 16px; color: var(--ink-soft); }
.lg-help a { display: inline-block; padding: 10px 0; color: var(--accent); font-weight: 500; border-bottom: 0; }
.lg-help a:hover { color: var(--accent-deep); }
/* the other views keep their own head: an eyebrow, a heading, a lede, inside the same card */
.signin .eyebrow { margin-bottom: 14px; }
.signin > h1 { font-size: 34px; margin: 0 0 10px; }
.signin .lede { font-size: 16px; margin: 0 0 20px; }

footer.lg-foot { margin-top: 72px; border-top: 1px solid var(--rule); padding: 24px 0 36px; display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
footer.lg-foot p { margin: 0; max-width: none; }
.lg-foot-brand { font-family: var(--serif); font-weight: 600; font-size: 22px; letter-spacing: -.02em; color: var(--ink); border-bottom: 0; }
.lg-op { display: block; font-size: 12.5px; margin-top: 2px; }
footer.lg-foot ul { gap: 6px 24px; }
footer.lg-foot ul a { padding: 12px 0; }
footer.lg-foot ul a:hover { color: var(--ink); }

@media (max-width: 640px) {
  .lg-top { min-height: 60px; margin-bottom: 24px; }
  .lg-new { font-size: 15px; }
  .signin { padding: 26px 18px 20px; border-radius: 12px; }
  .app .lg-head h1 { font-size: 34px; }
  .lg-head .sub { font-size: 16.5px; }
  .signin > h1 { font-size: 30px; }
  footer.lg-foot { margin-top: 48px; justify-content: center; text-align: center; }
  footer.lg-foot ul { justify-content: center; }
}


/* ============================================================================================================
   The workspace (2026-09-22, the founder's mockup). One sidebar: organisation navigation above, the catalog and
   table tree below. No oversized header, no sign-in banner: the brand lives in the sidebar, the identity in its
   foot, DuckDB's readiness in the top-right corner, the connection in a one-line footer. Settings are cards with a
   short explanation beside each control; the long compatibility text folds. Serif stays for the brand and the
   page title; every other heading in the workspace is sans-serif. app.js's ids and tab roles are untouched.
   ============================================================================================================ */
body:has(#panel:not(.hidden)) { background: var(--bg); }
body:has(#panel:not(.hidden)) .wrap { max-width: none; padding: 0; }
body:has(#panel:not(.hidden)) .lg-top, body:has(#panel:not(.hidden)) footer.lg-foot { display: none; }
body:has(#panel:not(.hidden)) #main { margin: 0; }

.ws { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.ws-side { display: flex; flex-direction: column; gap: 14px; padding: 18px 16px 16px; background: #fff; border-right: 1px solid var(--rule); position: sticky; top: 0; height: 100vh; overflow: auto; }
.ws-brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: 600; font-size: 24px; letter-spacing: -.02em; color: var(--ink); border-bottom: 0; padding: 2px 8px 6px; }
.ws-brand .mark { width: 30px; height: 30px; }
.ws-side .orgpick { margin: 0; padding: 0 2px; }
.ws-side .orgpick select { padding: 8px 10px; font-size: 14.5px; font-weight: 500; border-radius: 8px; }
.ws-side .orgpick .h { font-size: 11.5px; margin-top: 4px; }

/* navigation: the same tablist, vertical */
.tabs.ws-nav { display: flex; flex-direction: column; gap: 2px; border: 0; margin: 4px 0 0; }
.tabs.ws-nav button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; border-left: 3px solid transparent; margin: 0; padding: 9px 10px 9px 13px; border-radius: 0 8px 8px 0; font-family: var(--sans); font-size: 15px; color: var(--ink-soft); }
.tabs.ws-nav button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tabs.ws-nav button:hover { background: var(--bg-soft); color: var(--ink); }
.tabs.ws-nav button.on { background: var(--tint); color: var(--accent-deep); border-left-color: var(--accent); font-weight: 500; }

/* the explorer: catalogs, then the selected catalog's tables */
.ws-explorer { border-top: 1px solid var(--rule); padding-top: 12px; }
.ws-explorer h3 { display: flex; align-items: center; justify-content: space-between; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin: 0 0 8px; padding: 0 2px; }
.ws-iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; padding: 0; }
.ws-iconbtn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ws-iconbtn:hover { background: var(--bg-soft); color: var(--ink); }
.ws-explorer .tree button { font-size: 14px; padding: 6px 8px 6px 28px; position: relative; }
.ws-explorer #tree-wh .catname::before { content: ""; position: absolute; left: 8px; top: 9px; width: 12px; height: 12px; border: 1.5px solid currentColor; border-radius: 6px / 3px; opacity: .7; }
.ws-explorer .tree-tables { margin-left: 14px; border-left: 1px solid var(--rule); padding-left: 4px; }
.ws-explorer .tree-tables .ns { padding-left: 8px; }
.ws-explorer .tree-tables button { padding-left: 26px; }
.ws-explorer .tree-tables button::before { content: ""; position: absolute; left: 8px; top: 10px; width: 11px; height: 9px; border: 1.5px solid currentColor; border-radius: 2px; opacity: .7; background: linear-gradient(currentColor, currentColor) 0 3px / 100% 1px no-repeat; }
.ws-tables-of { padding: 8px 2px 2px 16px; font-size: 12.5px; }
.ws-tables-of:empty { display: none; }

.ws-bottom { margin-top: auto; border-top: 1px solid var(--rule); padding-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.ws-bottom > a { display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 13px; font-size: 14.5px; color: var(--ink-soft); border-bottom: 0; border-radius: 8px; }
.ws-bottom > a:hover { background: var(--bg-soft); color: var(--ink); }
.ws-bottom svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ws-user { display: flex; align-items: center; gap: 10px; padding: 10px 6px 4px 8px; }
.ws-avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--bg-soft); border: 1px solid var(--rule); display: inline-flex; align-items: center; justify-content: center; font-family: var(--sans); font-size: 12.5px; font-weight: 600; color: var(--ink); }
.ws-user .who { flex: 1; min-width: 0; font-family: var(--sans); font-size: 13px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* the main column */
.ws-main { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }
.ws-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 32px; border-bottom: 1px solid var(--rule); background: rgba(251, 248, 244, .92); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(4px); }
.ws-crumbs { display: flex; align-items: center; gap: 10px; font-family: var(--sans); font-size: 15px; color: var(--ink-soft); }
.ws-crumbs .sep { color: var(--muted); }
.ws-crumbs [aria-current] { color: var(--ink); font-weight: 600; }
.ws-crumbs .linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-soft); cursor: pointer; }
.ws-crumbs .linkish:hover { color: var(--accent-deep); }
.ws-engine { display: inline-flex; align-items: center; gap: 8px; font-family: var(--sans); font-size: 14px; color: var(--ink-soft); }
.ws-engine .dot, .ws-foot .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--rule); display: inline-block; }
.ws-engine .dot.ok, .ws-foot .dot.ok { background: var(--ok); }
.ws-engine .dot.warn { background: var(--accent); }
.ws-content { flex: 1; padding: 22px 32px 40px; }
.ws-foot { display: flex; align-items: center; gap: 22px; padding: 10px 32px; border-top: 1px solid var(--rule); font-family: var(--sans); font-size: 13px; color: var(--muted); background: #fff; }
.ws-foot > span:first-child { display: inline-flex; align-items: center; gap: 8px; color: var(--ok-text); }
.ws-host { font-family: var(--mono); font-size: 12.5px; }

/* titles: serif for the page title, sans for everything below */
.ws-titlerow { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; margin: 0 0 18px; }
.app .ws-title { font-family: var(--serif); font-weight: 500; font-size: 40px; letter-spacing: -.025em; line-height: 1.05; margin: 0; }
.ws-sub { font-family: var(--sans); font-size: 15px; color: var(--ink-soft); margin: 0; }
.ws-h { font-family: var(--sans); font-weight: 600; font-size: 20px; letter-spacing: 0; margin: 6px 0 2px; }
.ws-h + .ws-sub { margin: 0 0 16px; }
.ws .box h2 { font-family: var(--sans); font-weight: 600; font-size: 17px; letter-spacing: 0; margin: 0 0 10px; }
.ws .box h3 { font-family: var(--sans); font-weight: 600; font-size: 15px; }
.ws .box { border-radius: 12px; padding: 20px 22px; }
.ws .tabs.sub { margin: 18px 0 20px; }
.ws .tabs.sub button { font-size: 15px; padding: 8px 4px; margin-right: 22px; }

/* the catalog head */
.ws .crumbs { display: none; }               /* the top bar carries the breadcrumb now */
.ws .cathead { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin: 0; }
.app .ws .cathead h1 { font-family: var(--serif); font-weight: 500; font-size: 40px; letter-spacing: -.025em; line-height: 1.05; margin: 0 0 8px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ws .cathead h1 .lvl { font-size: 12px; padding: 5px 10px; border-radius: 6px; letter-spacing: .04em; }
.ws .cathead h1 .lvl.write { background: #eaf6ee; }
.ws .cathead #cv-meta { display: block; font-size: 14.5px; }
.ws-connect { display: inline-flex; align-items: center; gap: 10px; font-family: var(--sans); font-size: 15px; font-weight: 500; padding: 10px 18px; border-radius: 8px; border-color: var(--rule); color: var(--ink); background: #fff; flex: none; }
.ws-connect svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ws-connect:hover { background: var(--bg-soft); color: var(--ink); }

/* settings cards */
.card-head { display: flex; align-items: flex-start; gap: 16px; padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid var(--rule); }
.card-head h2 { font-family: var(--serif) !important; font-weight: 500 !important; font-size: 22px !important; letter-spacing: -.01em; margin: 0 0 2px !important; }
.ws .card-head h2 { font-family: var(--sans) !important; font-weight: 600 !important; font-size: 18px !important; }
.card-head p { margin: 0; font-size: 14.5px; color: var(--ink-soft); }
.card-ic { flex: none; width: 46px; height: 46px; border-radius: 10px; background: var(--lake); display: inline-flex; align-items: center; justify-content: center; color: #2974a2; }
.card-ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ws-warn { display: block; position: relative; border: 1px solid #f1d9a8; background: #fdf6e6; color: #5b4a12; border-radius: 8px; padding: 10px 14px 10px 40px; font-size: 14px; line-height: 1.5; margin: 0 0 16px; }
.ws-warn::before { content: "!"; position: absolute; left: 13px; top: 11px; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid #b98a1f; color: #b98a1f; font-weight: 700; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.ws .danger-zone h2 { color: var(--accent-deep); }
.ws details.fold { border-top: 1px solid var(--rule); margin-top: 14px; padding-top: 12px; }
.ws details.fold summary { display: flex; align-items: center; gap: 10px; }
.ws details.fold summary::before { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.ws details.fold[open] summary::before { transform: rotate(45deg); }

/* SQL explorer: editor and results take the screen, the table panel sits beside them */
.sql-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.sql-main { min-width: 0; }
.sql-box { padding: 16px 18px; }
.sql-conn { margin: 0 0 12px; }
.ws textarea.sql { min-height: 220px; }
.ws .results { max-height: none; margin-top: 16px; background: #fff; }
.ws .results table { font-family: var(--sans); font-size: 14px; }
.ws .results th { font-family: var(--sans); text-transform: none; }
.ws .results th small { font-family: var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.ws .results td.num { font-family: var(--mono); }
.sql-side .box { position: sticky; top: 64px; }
.sql-side .box h2 { font-family: var(--serif) !important; font-weight: 500 !important; font-size: 20px !important; }
.sql-about { margin: 14px 0 0; font-size: 13.5px; }

@media (max-width: 1100px) {
  .sql-grid { grid-template-columns: minmax(0, 1fr); }
  .sql-side .box { position: static; }
}
@media (max-width: 900px) {
  .ws { grid-template-columns: minmax(0, 1fr); }
  .ws-side { position: static; height: auto; }
  .ws-top, .ws-content, .ws-foot { padding-left: 18px; padding-right: 18px; }
  .app .ws-title, .app .ws .cathead h1 { font-size: 32px; }
  .ws .cathead { flex-direction: column; }
}


/* ---- workspace, second pass (closer to the mockups) ---- */
/* sidebar: the organisation as a bordered selector row, chips, tighter brand */
.ws-brand { font-size: 22px; padding: 0 6px 4px; }
.ws-brand .mark { width: 28px; height: 28px; }
.ws-side .orgpick { border: 1px solid var(--rule); border-radius: 8px; padding: 8px 10px; background: #fff; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14.5px; font-weight: 500; }
.ws-side .orgpick .lvl { margin-left: auto; font-size: 10.5px; padding: 3px 7px; background: var(--lake); border-color: transparent; color: #2974a2; }
.ws-side .orgpick .h { flex-basis: 100%; font-weight: 400; }
.ws-side .orgpick select { border: 0; padding: 0; font-weight: 500; background: transparent; flex: 1; }
.tabs.ws-nav button { padding: 8px 10px 8px 12px; font-size: 14.5px; border-radius: 8px; border-left: 0; }
.tabs.ws-nav button.on { border-left: 0; box-shadow: inset 3px 0 0 var(--accent); }
.ws-explorer h3 { font-size: 10.5px; }
.ws-explorer .tree button { padding: 5px 8px 5px 30px; }
.ws-explorer #tree-wh .catname::before { left: 10px; top: 8px; width: 11px; height: 12px; border-radius: 5px / 2.5px; }
.ws-explorer .tree-tables .ns { position: relative; padding-left: 30px; font-family: var(--sans); font-size: 13.5px; color: var(--ink-soft); }
.ws-explorer .tree-tables .ns::before { content: ""; position: absolute; left: 10px; top: 4px; width: 12px; height: 9px; border: 1.5px solid currentColor; border-radius: 2px; border-top-width: 3px; opacity: .7; }
.ws-explorer .tree-tables { margin-left: 8px; border-left: 0; padding-left: 0; }
.ws-explorer .tree-tables button { padding-left: 46px; }
.ws-explorer .tree-tables button::before { left: 26px; }
.ws-explorer .empty { padding: 4px 8px 0 30px; font-size: 13px; }
.ws-user .who { font-size: 13.5px; color: var(--ink); }

/* top bar and status */
.ws-top { padding: 10px 28px; }
.ws-crumbs { font-size: 14.5px; }
.ws-engine { font-size: 14px; max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-engine .dot { flex: none; }
.ws-content { padding: 20px 28px 36px; }

/* the catalog head: name, then the two chips, the meta line under, Connect at the right */
.app .ws .cathead h1 { font-size: 44px; gap: 12px; margin-bottom: 6px; }
.ws .cathead h1 .lvl { font-family: var(--sans); text-transform: none; letter-spacing: 0; font-size: 13.5px; font-weight: 500; padding: 5px 12px 5px 28px; border-radius: 7px; position: relative; }
.ws .cathead h1 .lvl.write { background: #eaf6ee; border-color: #cfe9d8; color: #1f6b3d; }
.ws .cathead h1 .lvl.write::before { content: ""; position: absolute; left: 10px; top: 50%; width: 12px; height: 12px; transform: translateY(-50%); border-radius: 50%; background: #1f6b3d; }
.ws .cathead h1 .lvl.write::after { content: "access"; margin-left: .3em; }
.ws .cathead h1 .lvl.read { padding-left: 12px; }
.ws .cathead h1 .lvl.read::after { content: "access"; margin-left: .3em; }
.ws .cathead h1 .lvl { display: inline-block; text-transform: lowercase; }
.ws .cathead h1 .lvl::first-letter { text-transform: uppercase; }
.ws-vis { display: inline-flex; align-items: center; gap: 7px; font-family: var(--sans); font-size: 13.5px; font-weight: 500; padding: 5px 12px; border-radius: 7px; background: var(--bg-soft); border: 1px solid var(--rule); color: var(--ink-soft); }
.ws-vis svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.ws .cathead #cv-meta { font-family: var(--sans); font-size: 14.5px; color: var(--ink-soft); }

/* cards */
.ws .box.card { padding: 22px 24px; }
.card-head { align-items: center; }
.card-head .chip, .chip { display: inline-block; font-family: var(--sans); font-size: 13px; font-weight: 500; padding: 4px 10px; border-radius: 6px; background: var(--lake); color: #2974a2; }
.card-head .chip { margin-left: auto; }
.ws #vis-state p { font-size: 15px; color: var(--ink); margin: 0 0 12px; }
.ws #vis-state p b, .ws #fmt-state p b { font-weight: 600; }
.ws #vis-form .form-row { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
.ws #vis-form label, .ws #del-form label { font-family: var(--sans); font-size: 14.5px; font-weight: 600; color: var(--ink); display: block; margin-bottom: 8px; }
.ws #vis-form label code, .ws #del-form label code { font-weight: 600; }
.ws #fmt-options .check { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--rule); border-radius: 8px; padding: 12px 14px; margin: 0 0 10px; font-size: 14.5px; }
.ws #fmt-options .check:has(input:checked) { border-color: #2974a2; background: #f3f9fc; }
.ws #fmt-options .check input { margin-top: 3px; }
.ws #fmt-state p { font-size: 14.5px; margin: 0 0 14px; }
.ws .btn.sm { font-family: var(--sans); font-size: 15px; font-weight: 500; padding: 9px 16px; border-radius: 8px; }
.ws .btn.danger.xs { font-family: var(--sans); font-size: 14px; padding: 8px 14px; border-radius: 8px; }
.ws .btn.ghost.xs { font-size: 14px; padding: 7px 12px; border-radius: 7px; color: var(--ink); }

/* SQL explorer */
.sql-titlerow { align-items: center; margin-bottom: 6px; }
.sql-actions .btn { font-size: 14px; }
.ws .sql-conn { font-family: var(--sans); font-size: 14px; color: var(--ink-soft); margin: 0 0 16px; max-width: none; }
.sql-head { display: flex; align-items: baseline; gap: 12px; margin: 0 0 12px; }
.sql-head h2 { margin: 0 !important; font-size: 17px !important; }
.sql-head .muted { font-size: 13.5px; }
.ws textarea.sql { background: #fcfaf7; color: var(--ink); border: 1px solid #d9d2c8; border-radius: 8px; font-size: 14px; line-height: 1.6; padding: 14px 16px 14px 18px; min-height: 200px; box-shadow: inset 34px 0 0 #f3efe8, inset 35px 0 0 #e9e2d8; text-indent: 0; padding-left: 50px; }
.ws textarea.sql:focus { outline: 2px solid #2974a2; outline-offset: -1px; }
.sql-run { margin-top: 12px; }
.ws #run { background: var(--accent); font-family: var(--sans); font-weight: 600; font-size: 15px; padding: 10px 18px; border-radius: 8px; display: inline-flex; align-items: center; gap: 10px; }
.ws #run:hover { background: var(--accent-deep); }
.ws #run .muted { font-family: var(--mono); font-size: 12px; opacity: .85; }
.ws #run[disabled] { opacity: .5; }
.sql-ro { display: inline-flex; align-items: center; gap: 6px; }
.sql-ro svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; opacity: .8; }
.results-box { padding: 16px 18px; }
.results-head { display: flex; align-items: baseline; gap: 14px; margin: 0 0 12px; }
.results-head h2 { margin: 0 !important; font-size: 17px !important; }
.results-head .status { font-family: var(--sans); font-size: 14px; }
.results-head .status:not(:empty)::before { content: "\2713  "; color: var(--ok-text); font-weight: 700; }
.ws .results { margin-top: 0; border-radius: 8px; }
.ws .results th { padding: 8px 12px; color: var(--ink); font-weight: 600; }
.ws .results th small { display: block; font-size: 10px; font-weight: 500; color: var(--muted); letter-spacing: .08em; }
.ws .results td { padding: 7px 12px; }
.ws .results .idx { color: var(--muted); font-family: var(--mono); font-size: 12.5px; width: 34px; text-align: right; }
.ws .results th.idx { text-align: right; }
.ws .results tr:nth-child(even) td { background: #fcfaf7; }

/* the table panel beside the editor */
.sql-side .box { padding: 18px 20px; }
.tp-head { display: flex; align-items: center; justify-content: space-between; }
.tp-head h2 { font-family: var(--serif) !important; font-weight: 500 !important; font-size: 22px !important; margin: 0 !important; }
.tp-close { font-size: 20px; color: var(--muted); }
.tp-meta { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-soft); margin: 6px 0 14px; }
.tp-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border: 1px solid var(--rule); border-radius: 8px; margin: 0 0 12px; }
.tp-stats > div { padding: 10px 12px; border-right: 1px solid var(--rule); }
.tp-stats > div:last-child { border-right: 0; }
.tp-stats b { display: block; font-size: 17px; font-weight: 600; color: var(--ink); }
.tp-stats span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.tp-actions { gap: 8px; margin: 0 0 16px; }
.tp-actions .btn { padding: 5px 9px; font-size: 12.5px; }
.tp-actions { flex-wrap: nowrap; }
.tp-h { font-family: var(--sans); font-weight: 600; font-size: 14.5px; margin: 0 0 8px; padding-top: 12px; border-top: 1px solid var(--rule); }
.tp-cols { list-style: none; margin: 0; padding: 0; }
.tp-cols li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
.tp-cols li:last-child { border-bottom: 0; }
.tp-ic { flex: none; width: 28px; font-family: var(--mono); font-size: 10.5px; color: var(--muted); text-align: center; }
.tp-name { flex: 1; color: var(--ink); font-weight: 500; }
.tp-name small { color: var(--accent-deep); }
.tp-type { font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft); }
.tp-more { font-size: 14px; }
.tp-more .kv { margin-top: 10px; }
.sql-about { margin-top: 14px; }
.sql-side > .box > p.muted { font-size: 14px; }

/* the login card's help line and the "new here" header belong to the logged-out views only */
body:has(#panel:not(.hidden)) .lg-help { display: none; }

.ws-hint { margin: 10px 0 0; font-size: 13.5px; }
.ws #fmt-options { margin: 0 0 6px; }
.ws #fmt-form details.fold { margin-top: 8px; }
.ws #vis-state p { font-weight: 600; }
.ws #vis-state p b { font-weight: 600; }

.ws #vis-state .vis-sub { display: block; font-weight: 400; font-size: 14.5px; color: var(--ink-soft); margin-top: 2px; }

/* styles.css animates a homepage element also called .sql (opacity 0 until revealed); the editor is not that */
.ws textarea.sql { opacity: 1 !important; transform: none !important; animation: none !important; }


/* ---- third pass: the reviewers' punch list ---- */
.vsep { display: inline-block; width: 1px; height: 14px; background: var(--rule); margin: 0 12px; vertical-align: -2px; }
/* sidebar */
.ws-side .orgpick { position: relative; padding-left: 36px; min-height: 40px; }
.ws-side .orgpick::before { content: ""; position: absolute; left: 11px; top: 50%; width: 14px; height: 15px; transform: translateY(-50%); border: 1.6px solid var(--ink-soft); border-radius: 7px / 3px; }
.ws-side .orgpick .h { display: none; }
.ws-side .orgpick .lvl { font-family: var(--sans); text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 500; padding: 3px 8px; background: var(--bg-soft); color: var(--ink-soft); border: 1px solid var(--rule); }
.tabs.ws-nav button svg { width: 20px; height: 20px; stroke-width: 1.75; }
.tabs.ws-nav button { gap: 14px; }
.ws-explorer .tree button.on { background: transparent; color: var(--ink); font-weight: 500; }
.ws-explorer .tree-tables button.on { background: var(--lake); color: #1f5f85; }
.ws-explorer .tree button small { display: none; }
.ws-tables-of { display: none; }
.ws-explorer #tree-wh .catname { padding-left: 30px; }
.ws-explorer #tree-wh .catname::before { left: 10px; top: 8px; width: 12px; height: 13px; border-radius: 6px / 2.5px; opacity: .8; }
.ws-explorer .tree-tables { margin-left: 14px; }
.ws-user { padding: 12px 6px 6px 6px; }
.ws-avatar { width: 40px; height: 40px; font-size: 13px; }
.ws-bottom { padding-bottom: 8px; }
/* top-right engine status keeps a hint that it opens on demand */
.ws-engine::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); margin-left: 4px; opacity: .7; }
/* catalog head */
.ws .cathead h1 .lvl, .ws-vis { height: 30px; box-sizing: border-box; display: inline-flex; align-items: center; font-size: 14px; border-radius: 6px; }
.ws .cathead h1 .lvl.write { padding-left: 30px; }
.ws .cathead h1 .lvl.write::before { width: 14px; height: 14px; left: 10px; background: #1f6b3d url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12l4 4 8-8'/%3E%3C/svg%3E") center / 10px no-repeat; }
.ws-vis { color: var(--ink); }
.ws .cathead #cv-meta { font-size: 15px; }
/* the catalog's own tabs */
.ws .tabs.sub { width: 100%; margin: 14px 0 22px; gap: 0; }
.ws .tabs.sub button { font-family: var(--sans); font-size: 15.5px; padding: 10px 2px; margin-right: 40px; border-bottom-width: 3px; }
.ws .tabs.sub button.on { color: var(--accent-deep); border-bottom-color: var(--accent); font-weight: 500; }
.ws-h { margin: 4px 0 2px; }
.ws-h + .ws-sub { margin-bottom: 14px; }
/* cards */
.card-ic { width: 52px; height: 52px; }
.card-ic svg { width: 24px; height: 24px; stroke-width: 1.75; }
.card-ic.danger { background: var(--tint); color: var(--accent-deep); }
.card-head { padding-bottom: 18px; margin-bottom: 18px; }
.card-head .chip { font-size: 14px; height: 30px; display: inline-flex; align-items: center; padding: 0 12px; color: var(--ink); }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--rule); padding-top: 16px; margin-top: 16px; }
.card-foot details.fold { border-top: 0; margin: 0; padding: 0; flex: 1; }
.card-foot details.fold[open] { flex-basis: 100%; }
.ws .btn.sm[disabled], .ws .btn.danger.sm[disabled] { background: var(--bg-soft); color: var(--muted); border: 1px solid var(--rule); opacity: 1; cursor: default; }
.setting-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 0 0 8px; }
.setting-label { font-family: var(--sans); font-weight: 600; font-size: 15px; color: var(--ink); }
.setting-row select { padding: 9px 36px 9px 12px; font: inherit; font-size: 14.5px; border: 1px solid var(--rule); border-radius: 8px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234f4a44' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 10px center / 14px no-repeat; appearance: none; min-width: 240px; }
.chip.chip-ok { background: #eaf6ee; color: #1f6b3d; }
.setting-hint { margin: 0; }
#fmt-compat p { margin: 0 0 6px; font-size: 14px; }
#fmt-compat b { color: var(--ink); font-weight: 600; }
.ws .danger-zone { border-color: var(--rule); }
.ws .danger-zone h2 { color: var(--ink); }
.ws .danger-zone .card-head h2 { color: var(--ink) !important; }
.ws .danger-zone > p { display: none; }
.ws-warn { background: #fff8ec; border-color: #f3d9a4; color: var(--ink); border-radius: 10px; padding: 12px 16px 12px 44px; }
.ws-warn::before { content: ""; left: 14px; top: 12px; width: 18px; height: 18px; border: 0; border-radius: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c23c14' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l10 18H2z'/%3E%3Cpath d='M12 9v5M12 17.5v.5'/%3E%3C/svg%3E") center / contain no-repeat; }
.ws #vis-form label b, .ws #del-form label b { font-family: var(--sans); }
.ws #vis-form .form-row .field:last-child .btn, .ws #del-form .form-row .field:last-child .btn { min-width: 145px; }
/* footer */
.ws-host { font-family: var(--sans); font-size: 14px; color: var(--ink-soft); }
.ws-foot { font-size: 14px; }


/* ---- fourth pass: the SQL explorer punch list ---- */
.ws-crumbs [aria-current] { font-weight: 500; }
.ws-engine { border: 1px solid var(--rule); border-radius: 8px; padding: 6px 10px 6px 12px; background: #fff; font-size: 13.5px; }
.results-box { padding: 14px 0 0; overflow: hidden; }
.results-head { padding: 0 18px 12px; }
.results-head .status:not(:empty)::before { content: ""; display: inline-block; width: 15px; height: 15px; margin-right: 6px; vertical-align: -3px; border-radius: 50%; background: #2e9e5b url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12l4 4 8-8'/%3E%3C/svg%3E") center / 10px no-repeat; }
.ws .results { border: 0; border-top: 1px solid var(--rule); border-radius: 0; max-height: 62vh; }
.ws .results table { font-size: 13.5px; }
.ws .results th { background: #f5f4f2; padding: 8px 12px; border-right: 1px solid var(--rule); font-size: 13.5px; }
.ws .results th:last-child, .ws .results td:last-child { border-right: 0; }
.ws .results th small { font-size: 10px; margin-top: 1px; }
.ws .results td { padding: 5px 12px; height: 29px; border-right: 1px solid var(--rule); }
.ws .results td.num { font-family: var(--sans); font-variant-numeric: tabular-nums; }
.ws .results .idx { background: #efeeec; width: 40px; text-align: center; font-family: var(--sans); font-size: 12.5px; }
.ws .results tr:nth-child(even) td { background: #fff; }
.ws .results tr:nth-child(even) td.idx { background: #efeeec; }
.ws .btn.ghost.xs svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; margin-right: 6px; vertical-align: -2px; }
#csv { display: inline-flex; align-items: center; }
.sql-head { border-bottom: 1px solid var(--rule); margin: -16px -18px 14px; padding: 12px 18px; }
.ws #run .muted { font-family: var(--sans); font-size: 12px; opacity: .75; margin-left: 4px; }
.ws #run::before { content: ""; width: 0; height: 0; border-left: 9px solid #fff; border-top: 6px solid transparent; border-bottom: 6px solid transparent; margin-right: 2px; }
.ws select.num { width: auto; padding: 7px 30px 7px 10px; appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234f4a44' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 8px center / 12px no-repeat; }
.sql-actions .btn { font-size: 13.5px; padding: 8px 12px; border-radius: 8px; }
.ws .sql-conn { margin: 0 0 14px; }
/* the table panel */
.tp-stats { display: flex; border: 0; border-radius: 0; margin: 0 0 14px; }
.tp-stats > div { padding: 0 14px 0 0; border-right: 1px solid var(--rule); margin-right: 14px; }
.tp-stats > div:last-child { border-right: 0; margin-right: 0; }
.tp-stats b { font-size: 15px; white-space: nowrap; }
.tp-stats span { margin-top: 1px; }
.tp-actions .btn { white-space: nowrap; display: inline-flex; align-items: center; padding: 6px 10px; font-size: 12.5px; }
.tp-h { display: flex; align-items: center; justify-content: space-between; }
.tp-h::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); margin-right: 4px; }
.tp-ic svg { width: 15px; height: 15px; fill: none; stroke: var(--ink-soft); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tp-type { font-family: var(--sans); font-size: 13px; color: var(--muted); }
.tp-more summary { display: flex; align-items: center; justify-content: space-between; }
.tp-more summary::before { display: none; }
.tp-more summary::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); margin-right: 4px; }
.tp-more[open] summary::after { transform: rotate(45deg); }
.sql-about { background: var(--lake); border: 0 !important; border-radius: 10px; padding: 14px 16px !important; margin-top: 16px !important; font-size: 13.5px; color: var(--ink-soft); }
.sql-about summary { display: block; cursor: pointer; }
.sql-about summary::before { display: none; }
.sql-about-lead { display: block; color: var(--ink); margin-bottom: 4px; padding-left: 24px; position: relative; }
.sql-about-lead::before { content: "i"; position: absolute; left: 0; top: 1px; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid #2974a2; color: #2974a2; font: 600 10px/14px var(--sans); text-align: center; }
.sql-about-link { color: #2974a2; text-decoration: underline; padding-left: 24px; }
.sql-about[open] summary { margin-bottom: 8px; }
.sql-about p { margin: 0; padding-left: 24px; }
.ws-foot { font-size: 13.5px; padding: 8px 28px; }

/* ---- fifth pass: real icons in the sidebar tree and the organisation row; the panel's buttons wrap ---- */
.ws-side .orgpick::before { border: 0; border-radius: 0; width: 16px; height: 16px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234f4a44' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cellipse cx='12' cy='6' rx='8' ry='3'/%3E%3Cpath d='M4 6v12c0 1.7 3.6 3 8 3s8-1.3 8-3V6M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3'/%3E%3C/svg%3E") center / contain no-repeat; }
.ws-explorer #tree-wh .catname::before { border: 0; border-radius: 0; opacity: 1; width: 15px; height: 15px; top: 7px; left: 9px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234f4a44' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cellipse cx='12' cy='6' rx='8' ry='3'/%3E%3Cpath d='M4 6v12c0 1.7 3.6 3 8 3s8-1.3 8-3V6M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3'/%3E%3C/svg%3E") center / contain no-repeat; }
.ws-explorer .tree-tables .ns::before { border: 0; border-radius: 0; opacity: 1; width: 15px; height: 15px; top: 2px; left: 9px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234f4a44' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3C/svg%3E") center / contain no-repeat; }
.ws-explorer .tree-tables button::before { border: 0; border-radius: 0; opacity: 1; width: 15px; height: 15px; top: 8px; left: 26px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234f4a44' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M3 15h18M9 4v16M15 4v16'/%3E%3C/svg%3E") center / contain no-repeat; }
.ws-explorer .tree-tables button.on::before { filter: none; }
.tp-actions { flex-wrap: wrap; gap: 6px; }
.tp-stats span { white-space: normal; }


/* ---- sixth pass: the founder's review of the live workspace ---- */
/* the engine status lives in the footer now, quietly */
.ws-foot .ws-engine { border: 0; background: none; padding: 0; font-size: 13.5px; color: var(--muted); max-width: none; }
.ws-foot .ws-engine::after { display: none; }
/* the head chips read as the mockup: Private · Read & write */
.ws .cathead h1 .lvl { font-size: 0; text-transform: none; padding-right: 12px; }
.ws .cathead h1 .lvl::first-letter { text-transform: none; }
.ws .cathead h1 .lvl::after { font-size: 14px; margin-left: 0; }
.ws .cathead h1 .lvl.write::after { content: "Read & write"; }
.ws .cathead h1 .lvl.read::after { content: "Read"; }
.ws .cathead h1 .lvl.unknown::after, .ws .cathead h1 .lvl.none::after { content: "No access"; }
/* permissions */
.perm-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 0 0 14px; }
.perm-head h2 { font-size: 20px !important; margin: 0 0 4px !important; }
.perm-head .ws-sub { margin: 0; }
.perm-grant { display: inline-flex; align-items: center; gap: 8px; }
.perm-note { display: flex; align-items: center; gap: 10px; background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 8px; padding: 10px 14px; font-size: 14px; color: var(--ink-soft); margin: 0 0 14px; }
.perm-note::before { content: "i"; flex: none; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--ink-soft); font: 600 10px/14px var(--sans); text-align: center; }
.perm-table { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; font-size: 14.5px; }
.perm-table th { text-align: left; font-family: var(--sans); font-weight: 600; font-size: 14px; color: var(--ink); background: var(--bg-soft); padding: 10px 14px; border-bottom: 1px solid var(--rule); }
.perm-table td { padding: 12px 14px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.perm-table td + td, .perm-table th + th { border-left: 1px solid var(--rule); }
.perm-table tr:last-child td { border-bottom: 0; }
.perm-table .act { width: 200px; text-align: right; }
.perm-who { display: inline-flex; align-items: center; gap: 12px; }
.perm-who .ws-avatar { width: 38px; height: 38px; font-size: 12.5px; }
.perm-who .ws-avatar.tok { font-size: 0; background: var(--bg-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234f4a44' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='15' r='4'/%3E%3Cpath d='M10.5 12.5L20 3M15 5l3 3M12 8l3 3'/%3E%3C/svg%3E") center / 18px no-repeat; }
.perm-who b { display: block; font-weight: 600; color: var(--ink); }
.perm-who small { display: block; font-size: 13px; color: var(--muted); }
.chip.perm-write, .chip.perm-read { background: var(--lake); color: #1f5f85; font-size: 14px; padding: 6px 12px; }
.perm-via { color: var(--ink); }
.perm-lock { display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231a1917' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / contain no-repeat; }
.perm-foot { margin: 12px 0 0; }
.perm-links { display: flex; gap: 28px; margin: 14px 0 0; font-size: 14.5px; }
.perm-links .linkbtn { color: var(--ink-soft); text-decoration: none; }
.perm-links .linkbtn:hover { color: var(--accent-deep); }
/* the dialog */
.ws-dialog { border: 1px solid var(--rule); border-radius: 12px; padding: 22px 24px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(26, 25, 23, .18); color: var(--ink); font-family: var(--sans); }
.ws-dialog::backdrop { background: rgba(26, 25, 23, .35); }
.dlg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 0 0 16px; }
.dlg-head h2 { font-family: var(--sans); font-weight: 600; font-size: 20px; margin: 0 0 4px; }
.dlg-head p { margin: 0; font-size: 14.5px; color: var(--ink-soft); }
.dlg-label { display: block; font-weight: 600; font-size: 14.5px; margin: 0 0 8px; }
.ws-dialog select { width: 100%; padding: 10px 36px 10px 12px; font: inherit; font-size: 14.5px; border: 1px solid var(--rule); border-radius: 8px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234f4a44' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 10px center / 14px no-repeat; appearance: none; margin: 0 0 18px; }
.perm-opts { display: grid; gap: 10px; margin: 0 0 12px; }
.perm-opt { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--rule); border-radius: 10px; padding: 12px 14px; cursor: pointer; }
.perm-opt:has(input:checked) { border-color: #2974a2; background: #f3f9fc; }
.perm-opt input { margin-top: 3px; }
.perm-opt b { display: block; font-weight: 600; font-size: 15px; }
.perm-opt small { display: block; font-size: 13.5px; color: var(--ink-soft); }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
/* download menu */
.dl-menu { position: relative; }
.dl-menu summary { list-style: none; display: inline-flex; align-items: center; cursor: pointer; }
.dl-menu summary::-webkit-details-marker { display: none; }
.dl-menu summary::after { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); margin-left: 8px; }
.dl-list { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--rule); border-radius: 8px; box-shadow: 0 10px 30px rgba(26, 25, 23, .12); padding: 6px; min-width: 150px; z-index: 6; display: grid; }
.dl-list button { background: none; border: 0; text-align: left; padding: 8px 12px; font: inherit; font-size: 14px; color: var(--ink); border-radius: 6px; cursor: pointer; }
.dl-list button:hover { background: var(--bg-soft); }
.dl-menu:has(#csv.hidden) { display: none; }


/* ---- seventh pass: the Tables page (mockup #30) ---- */
.tbl-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 16px; }
.tbl-head h2 { display: inline-flex; align-items: center; gap: 12px; font-size: 22px !important; margin: 0 !important; }
.tbl-head .count { font-size: 13px; font-weight: 600; color: var(--ink-soft); background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 6px; padding: 3px 9px; }
.tbl-create { background: var(--accent); display: inline-flex; align-items: center; gap: 8px; }
.tbl-create:hover { background: var(--accent-deep); }
.tbl-tools { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) auto; gap: 14px; margin: 0 0 16px; }
.tbl-search, .tbl-ns { display: flex; align-items: center; gap: 10px; border: 1px solid var(--rule); border-radius: 8px; padding: 0 12px; background: #fff; min-height: 42px; }
.tbl-search svg, .tbl-ns svg { width: 18px; height: 18px; fill: none; stroke: var(--ink-soft); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tbl-search input { flex: 1; border: 0; padding: 0; font: inherit; font-size: 14.5px; min-width: 0; background: transparent; }
.tbl-search input:focus, .tbl-ns select:focus { outline: none; }
.tbl-ns select { flex: 1; border: 0; padding: 0 20px 0 0; font: inherit; font-size: 14.5px; background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234f4a44' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right center / 14px no-repeat; appearance: none; }
.tbl-refresh { display: inline-flex; align-items: center; min-height: 42px; padding: 0 16px; font-size: 14.5px; border-radius: 8px; }
.tbl-refresh svg { margin-right: 8px; }
.tbl-table { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; font-size: 14.5px; }
.tbl-table th { text-align: left; font-family: var(--sans); font-weight: 600; font-size: 14px; color: var(--ink); background: var(--bg-soft); padding: 10px 14px; border-bottom: 1px solid var(--rule); }
.tbl-table td { padding: 12px 14px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.tbl-table td + td, .tbl-table th + th { border-left: 1px solid var(--rule); }
.tbl-table tr:last-child td { border-bottom: 0; }
.tbl-table .act { width: 130px; text-align: right; }
.tbl-name { display: inline-flex; align-items: center; gap: 12px; }
.tbl-ic { flex: none; width: 20px; height: 20px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234f4a44' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M3 15h18M9 4v16M15 4v16'/%3E%3C/svg%3E") center / contain no-repeat; }
.tbl-link { color: #1f5f85; font-weight: 600; text-decoration: none; font-size: 15px; }
.tbl-link:hover { text-decoration: underline; }
.tbl-name small { display: block; font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.chip.chip-grey { background: var(--bg-soft); color: var(--ink); border: 1px solid var(--rule); font-size: 13.5px; padding: 5px 10px; }
.tbl-q { font-family: var(--mono); font-size: 12px; margin-right: 8px; }
.tbl-summary { margin: 12px 0 0; }
.tbl-empty { margin: 0; }
.tbl-cta { display: flex; align-items: center; gap: 18px; padding: 16px 20px; }
.tbl-cta-ic { flex: none; width: 42px; height: 42px; border: 1.5px solid var(--ink); border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; }
.tbl-cta-ic svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tbl-cta b { display: block; font-weight: 600; font-size: 16px; color: var(--ink); }
.tbl-cta p { margin: 2px 0 0; font-size: 14.5px; color: var(--ink-soft); }
.tbl-cta-link { margin-left: auto; color: var(--accent-deep); font-weight: 500; text-decoration: none; white-space: nowrap; }
.tbl-cta-link:hover { text-decoration: underline; }
.ws-dialog-wide { width: min(640px, calc(100vw - 32px)); }
.ws-dialog .form-row { margin-bottom: 14px; }
.ws-dialog .cols { margin-bottom: 8px; }
@media (max-width: 900px) { .tbl-tools { grid-template-columns: 1fr; } .tbl-cta { flex-wrap: wrap; } .tbl-cta-link { margin-left: 0; } }

.ws .tabs.sub { flex-wrap: nowrap; max-width: none; }
.ws .tabs.sub button { margin-right: 32px; white-space: nowrap; }

/* ---- custom select (select.js, /select.css): the widget where the native select had a special shape ---- */
.field .csel-btn { min-height: 38px; padding: 8px 12px; font-size: 14px; border-radius: 7px; }
.cols .csel-btn { min-height: 34px; padding: 6px 10px; font-size: 13.5px; border-radius: 6px; }
.cols .csel-lbl, .cols .csel-desc { white-space: normal; }
table.plain.small .csel-btn { min-height: 30px; padding: 4px 8px; font-size: 13.5px; border-radius: 6px; }
.ws .csel.num .csel-btn { min-height: 34px; padding: 6px 10px; font-size: 13.5px; }
.setting-row .csel { min-width: 240px; }
.ws-dialog .csel { margin: 0 0 18px; }
.ws-dialog .cols .csel, .ws-dialog .field .csel { margin: 0; }
.ws-dialog .csel-btn { min-height: 42px; padding: 10px 12px; }
.orgpick .csel { display: block; width: 100%; }
.ws-side .orgpick .csel { flex: 1; min-width: 0; width: auto; }
.ws-side .orgpick .csel-btn, .tbl-ns .csel-btn { min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
.ws-side .orgpick .csel-btn { font-weight: 500; }
.ws-side .orgpick .csel-btn:focus-visible, .ws-side .orgpick .csel.open .csel-btn, .tbl-ns .csel-btn:focus-visible, .tbl-ns .csel.open .csel-btn { box-shadow: none; outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 3px; }
.tbl-ns .csel { flex: 1; min-width: 0; }
.tbl-ns .csel-pop { left: -12px; }

/* Files (the blob bucket): rows with a thumbnail column, a folder breadcrumb, the preview dialog (2026-09-22) */
.files-sub { margin: -6px 0 14px; }
.files-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-family: var(--mono); font-size: 13px; margin: 0 0 12px; min-height: 20px; }
.files-crumbs .linkbtn { font-family: var(--mono); font-size: 13px; text-decoration: none; }
.files-crumbs .linkbtn:hover { text-decoration: underline; }
.files-crumbs .sep { color: var(--muted); }
.files-crumbs .files-cur { color: var(--ink); font-weight: 600; }
.files-table .files-thumb { width: 56px; padding: 6px 10px; text-align: center; }
.files-table td.files-thumb img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; display: block; cursor: zoom-in; background: var(--bg-soft); }
.files-ic { display: inline-block; width: 22px; height: 22px; vertical-align: middle; background: center / contain no-repeat; }
.files-ic.folder { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232974a2' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3C/svg%3E"); }
.files-ic.file { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234f4a44' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h8l5 5v13H6z'/%3E%3Cpath d='M14 3v5h5'/%3E%3C/svg%3E"); }
.files-table button.tbl-link { background: none; border: 0; padding: 0; font: inherit; font-size: 15px; font-weight: 600; color: #1f5f85; cursor: pointer; text-align: left; word-break: break-all; }
.files-table button.tbl-link:hover { text-decoration: underline; }
.files-hint { display: block; font-family: var(--sans); font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.files-foot { margin-top: 12px; align-items: center; }
.files-empty { border: 1px dashed var(--rule); border-radius: 8px; padding: 16px 18px; font-size: 14.5px; }
.files-empty p { margin: 0 0 10px; }
.files-empty ul { margin: 0 0 10px; padding-left: 20px; }
.files-empty li { margin: 0 0 8px; }
.files-empty code { font-size: 12.5px; word-break: break-all; }
.files-dialog { width: min(900px, calc(100vw - 32px)); }
.files-dialog .dlg-head h2 { word-break: break-all; }
.files-dialog .dlg-head p { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.files-preview { display: flex; align-items: center; justify-content: center; min-height: 160px; max-height: calc(100vh - 260px); background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.files-preview img { max-width: 100%; max-height: calc(100vh - 260px); object-fit: contain; display: block; }
.files-preview p { margin: 0; padding: 24px; }
.files-dlg-foot { align-items: center; }
.files-dlg-foot .btn.disabled { opacity: .5; pointer-events: none; }

/* ---- Import dialog (web/app/import.js; docs/import-dialog.md). Tokens from styles.css; the dialog frame is .ws-dialog ---- */
.tbl-actions { display: inline-flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.tbl-import { display: inline-flex; align-items: center; gap: 8px; border-color: var(--rule); color: var(--ink); }
.tbl-import svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tbl-import:hover { background: var(--bg-soft); color: var(--ink); }
.imp-dialog { width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; }
.imp-src-pick { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; padding: 3px; margin: 0 0 18px; gap: 2px; background: var(--bg-soft); }
.imp-src-opt { position: relative; display: inline-flex; align-items: center; padding: 7px 14px; border-radius: 6px; font-size: 14px; color: var(--ink-soft); cursor: pointer; }
.imp-src-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.imp-src-opt:has(input:checked) { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(26, 25, 23, .08); }
.imp-src-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.imp-steps { list-style: none; margin: 0; padding: 0; }
.imp-step { position: relative; padding: 0 0 22px 34px; }
.imp-step::before { content: ""; position: absolute; left: 6px; top: 3px; width: 12px; height: 12px; border: 2px solid var(--rule); border-radius: 50%; background: #fff; box-sizing: border-box; }
.imp-step::after { content: ""; position: absolute; left: 11px; top: 19px; bottom: 6px; border-left: 2px dotted var(--rule); }
.imp-step:last-child::after { display: none; }
.imp-step:has(.imp-chip, .imp-schema, .imp-handover-ready)::before { border-color: #2974a2; background: #2974a2; box-shadow: inset 0 0 0 2px #fff; }
.imp-step h3 { font-family: var(--sans); font-weight: 600; font-size: 15.5px; margin: 0 0 10px; color: var(--ink); }
.imp-drop { display: flex; align-items: center; gap: 14px; border: 1.5px dashed var(--rule); border-radius: 10px; padding: 16px 18px; background: #fff; cursor: pointer; font-size: 14px; color: var(--ink-soft); margin: 0 0 12px; }
.imp-drop b { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); }
.imp-drop.over, .imp-drop:hover { border-color: var(--accent); background: var(--tint); }
.imp-drop:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.imp-drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.imp-drop-ic { flex: none; width: 36px; height: 36px; border: 1.5px solid var(--ink); border-radius: 6px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231a1917' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12M7 10l5 5 5-5M4 17v3h16v-3'/%3E%3C/svg%3E") center / 18px no-repeat; }
.imp-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; padding: 0; }
.imp-chips:empty { display: none; }
.imp-chip { display: inline-flex; align-items: center; gap: 10px; border: 1px solid var(--rule); border-radius: 8px; padding: 6px 8px 6px 12px; font-size: 14px; background: #fff; max-width: 100%; }
.imp-chip.bad { border-color: var(--accent); background: var(--tint); }
.imp-chip-name { font-family: var(--mono); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.imp-chip-size { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.imp-chip-x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; }
.imp-chip-x:hover { color: var(--accent-deep); }
.imp-keynote { border-left: 3px solid var(--ok); background: #eef8f1; color: var(--ok-text); padding: 10px 14px; border-radius: 4px; margin: 0 0 14px; }
.imp-keynote b { color: var(--ok-text); }
.imp-secret { display: flex; align-items: center; gap: 6px; }
.imp-secret input { flex: 1; min-width: 0; }
.imp-secret .ws-iconbtn svg { width: 18px; height: 18px; fill: none; stroke: var(--ink-soft); stroke-width: 1.8; }
.imp-secret .ws-iconbtn[aria-pressed="true"] svg { stroke: var(--accent-deep); }
.imp-schema { border-collapse: separate; border-spacing: 0; font-size: 13px; width: 100%; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.imp-schema th, .imp-schema td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.imp-schema th { background: var(--bg-soft); font-weight: 500; color: var(--ink-soft); font-family: var(--sans); }
.imp-schema tr:last-child td { border-bottom: 0; }
.imp-schema tr.bad td { color: var(--accent-deep); }
.imp-schema td.mono { font-family: var(--mono); font-size: 12.5px; }
.imp-two { display: grid; grid-template-columns: fit-content(46%) minmax(0, 1fr); gap: 14px; align-items: start; }
.imp-schema-wrap, .imp-rows { overflow: auto; max-height: 300px; min-width: 0; }
.imp-rows.results table { width: max-content; }
.imp-sum { margin: 0 0 10px; }
.imp-empty { margin: 0; }
.imp-switch { display: flex; align-items: center; gap: 12px; margin: 14px 0 0; cursor: pointer; font-size: 14.5px; color: var(--ink); }
.imp-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.imp-switch-ui { flex: none; width: 40px; height: 22px; border-radius: 11px; background: var(--rule); position: relative; transition: background .15s; }
.imp-switch-ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: left .15s; }
.imp-switch:has(input:checked) .imp-switch-ui { background: var(--ok); }
.imp-switch:has(input:checked) .imp-switch-ui::after { left: 20px; }
.imp-switch:has(input:focus-visible) .imp-switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
.imp-switch b { display: block; font-weight: 600; }
.imp-switch small { display: block; color: var(--ink-soft); font-size: 13px; }
.imp-target.form-row { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 8px; }
.imp-dialog .field .csel { margin: 0; }
.imp-handover { border-top: 1px solid var(--rule); padding-top: 16px; margin-top: 4px; }
.imp-why { margin: 0 0 12px; color: var(--ink-soft); }
.imp-why a { color: var(--ink-soft); border-bottom: 1px solid var(--rule); }
.imp-dialog pre.code { margin: 0 0 10px; }
.imp-dialog .row { margin: 0 0 10px; }
.imp-inline { margin: 0; font-size: 13.5px; align-items: center; }
.imp-inline input { margin: 0; }
.imp-dialog .dlg-foot { justify-content: space-between; }
@media (max-width: 640px) {
  .imp-dialog { padding: 18px 14px; }
  .imp-src-pick { display: flex; }
  .imp-src-opt { flex: 1; justify-content: center; padding: 8px 6px; font-size: 13.5px; }
  .imp-step { padding-left: 26px; }
  .imp-step::before { left: 2px; } .imp-step::after { left: 7px; }
  .imp-two { grid-template-columns: 1fr; }
  .imp-drop { flex-direction: column; align-items: flex-start; }
  .imp-chip-name { max-width: 160px; }
  .imp-dialog .dlg-foot { flex-wrap: wrap; }
  .tbl-actions { width: 100%; justify-content: flex-start; }
}
/* the founder's review (2026-09-22): the dialog's close button was a 28 px target; long types (a STRUCT, a CRS) are cut
   with an ellipsis and carry the full text as a tooltip; a binary cell says BINARY and its size instead of its bytes */
.dlg-head .ws-iconbtn { width: 40px; height: 40px; font-size: 24px; line-height: 1; border-radius: 8px; color: var(--ink-soft); flex: none; }
.dlg-head .ws-iconbtn:hover { background: var(--bg-soft); color: var(--ink); }
.imp-schema td.type { max-width: 36ch; overflow: hidden; text-overflow: ellipsis; }
.imp-rows th small { display: block; max-width: 28ch; overflow: hidden; text-overflow: ellipsis; }
.results td.bin, .imp-rows td.bin { color: var(--muted); font-family: var(--mono); font-size: 12px; letter-spacing: .02em; }

/* ---- the Catalog explorer as the place that attaches (2026-09-22, docs/sql-panel.md §10): one node per catalog ---- */
.ws-explorer-lede { margin: -2px 2px 8px; font-size: 12.5px; line-height: 1.4; }
.ws-explorer .catrow { display: flex; align-items: center; gap: 2px; min-width: 0; }
.ws-explorer .catrow .catname { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 26px !important; }
.ws-explorer .catrow .catname::before { left: 6px !important; }
.ws-explorer .catrow .chev { flex: none; width: 22px; height: 28px; padding: 0; margin-left: -4px; color: var(--muted); }
.ws-explorer .catrow .chev svg { width: 14px; height: 14px; transition: transform .12s; }
.ws-explorer li.cat.open .catrow .chev svg { transform: rotate(90deg); }
.ws-explorer .catrow .tag { flex: none; font-family: var(--mono); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--rule); border-radius: 4px; padding: 1px 5px; margin-left: 2px; }
.ws-explorer .catrow .tag.shared { border-color: #b9d7e4; color: #2974a2; }
.ws-explorer .catrow .tag.direct { border-style: dashed; }
.ws-explorer .catrow .tag.write { border-color: #9fcdb0; color: #1f6b3d; }
.ws-explorer .catrow .tag.err { border-color: var(--accent); color: var(--accent-deep); }
/* the attach switch: a small track, the knob slides right when on */
.ws-explorer .att-toggle { flex: none; width: 30px; height: 18px; border-radius: 9px; border: 1px solid var(--rule); background: var(--bg-soft); position: relative; cursor: pointer; padding: 0; margin: 0 4px 0 6px; }
.ws-explorer .att-toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 1px solid var(--rule); box-sizing: border-box; transition: left .12s; }
.ws-explorer .att-toggle[aria-checked="true"] { background: #1f6b3d; border-color: #1f6b3d; }
.ws-explorer .att-toggle[aria-checked="true"]::after { left: 15px; border-color: #1f6b3d; }
.ws-explorer .att-toggle[aria-busy="true"] { opacity: .5; cursor: progress; }
.ws-explorer .att-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ws-explorer li.cat.attached > .catrow .catname { color: var(--ink); }
.ws-explorer li.cat.on > .catrow .catname { background: var(--tint); color: var(--accent-deep); font-weight: 500; }
.ws-explorer li.cat > .tree-tables { display: none; }
.ws-explorer li.cat.open > .tree-tables { display: block; }
.ws-explorer li.cat > .tree-tables .empty { padding-left: 30px; font-size: 12.5px; color: var(--muted); }
.ws-explorer li.cat > .tree-tables .err { padding: 4px 8px 4px 30px; font-size: 12.5px; color: var(--accent-deep); }
.ws-explorer .detach { flex: none; width: 24px; height: 24px; font-size: 16px; color: var(--muted); }
.ws-explorer .detach:hover { color: var(--accent-deep); }
.ws-explorer li.add button { padding-left: 30px !important; color: var(--accent-deep); }
.ws-explorer li.add button::before { content: "+"; position: absolute; left: 11px; top: 4px; font-size: 16px; line-height: 1; color: var(--accent-deep); }
.ws-explorer li.public { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 30px; color: var(--muted); font-size: 14px; position: relative; cursor: not-allowed; }
.ws-explorer li.public::before { content: ""; position: absolute; left: 9px; top: 8px; width: 15px; height: 15px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a948c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cellipse cx='12' cy='12' rx='4' ry='9'/%3E%3Cpath d='M3 12h18'/%3E%3C/svg%3E") center / contain no-repeat; }
.ws-explorer li.public .tag { font-family: var(--mono); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; border: 1px dashed var(--rule); border-radius: 4px; padding: 1px 5px; }
.ws-explorer .tree-tables button[data-shared]::before { opacity: .6; }
.sql-titlerow .ws-sub { flex: 1 1 100%; margin: 0; }
.att-dialog textarea { width: 100%; box-sizing: border-box; font: inherit; font-family: var(--mono); font-size: 12.5px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 8px; resize: vertical; }
.att-secret-wrap { position: relative; display: block; }
.att-secret-wrap input { width: 100%; box-sizing: border-box; padding-right: 48px; }
.att-eye { width: 36px; height: 36px; right: 4px; }
.dlg-actions { margin-top: 12px; align-items: center; gap: 10px; }
.dlg-actions .status { font-size: 13.5px; color: var(--ink-soft); }
/* the table panel for a colleague's table: columns from DESCRIBE, no API facts */
.tp-shared .tp-meta .chip { background: var(--bg-soft); color: var(--ink-soft); }

/* The import runs in the tab (2026-09-22): the button, the step list, the outcome; the hand-over folds under "Other ways" */
.imp-run-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 12px; }
.imp-run-row .btn svg { width: 16px; height: 16px; margin-right: 8px; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.imp-fv { margin: 10px 0 0; }
.imp-fv small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; max-width: 60ch; }
.imp-progress { list-style: none; margin: 0 0 12px; padding: 0; font-size: 14px; color: var(--ink-soft); }
.imp-pstep { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.imp-pmark { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--rule); flex: none; box-sizing: border-box; }
.imp-pstep.running .imp-pmark { border-color: var(--accent); border-top-color: transparent; animation: imp-spin .8s linear infinite; }
.imp-pstep.done .imp-pmark { border-color: var(--ok); background: var(--ok); }
.imp-pstep.done { color: var(--ink); }
.imp-pstep.skip .imp-pmark { border-color: var(--rule); background: var(--rule); }
.imp-pstep.warn .imp-pmark { border-color: #d59a2b; background: #d59a2b; }
.imp-pstep.failed .imp-pmark { border-color: var(--accent-deep); background: var(--accent-deep); }
.imp-pstep.failed { color: var(--accent-deep); }
@keyframes imp-spin { to { transform: rotate(360deg); } }
.imp-done { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.imp-done .btn { margin: 0; }
#imp-alt { margin-top: 8px; }
#imp-alt > summary { font-size: 14px; color: var(--ink-soft); }
/* Save as table (2026-09-23): a button in the results head, the dialog reuses the Import dialog's target and step styles */
.results-head #save-table svg { width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.results-head .dl-menu { margin-left: 8px; }
#st-dialog .imp-progress { margin-top: 10px; }
/* The SQL editor (editor.js, CodeMirror): the textarea stays as the value carrier, hidden; the editor takes its place */
textarea.sql.cm-hidden { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; opacity: 0 !important; pointer-events: none; margin: 0; padding: 0; border: 0; }
.cm-host { width: 100%; margin: 0 0 4px; }
.cm-host .cm-editor { min-height: 220px; }
.cm-host .cm-scroller { overflow: auto; max-height: 60vh; }
