/*
 * MaluDB — one stylesheet for the public pages, the console and the docs.
 *
 * Layout conventions follow an admin-dashboard template (plans/active/console-redesign.md):
 * fixed sidebar, a top bar, a page header strip, white cards on a grey page. Nothing is
 * taken from the template itself; everything below is drawn from these tokens.
 *
 * Theme: light by default, dark when the system asks for it, and either one when the
 * toggle has set `data-theme` on <html>.
 */

:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef0f4;
  --line: #e5e7eb;
  --line-strong: #d3d8e0;
  --text: #283c50;
  --text-strong: #1a2b3c;
  --muted: #6b7885;
  --primary: #3454d1;
  --primary-hover: #2a45b3;
  --primary-soft: #eaeefb;
  --primary-text: #ffffff;
  --ok: #138a4d;
  --ok-soft: #e2f6eb;
  --warn: #a86400;
  --warn-soft: #fff3dc;
  --danger: #cf3434;
  --danger-soft: #fdeaea;
  --code-bg: #f4f6fa;
  --code-text: #283c50;
  --hero-code-bg: #16213a;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);
  --radius: 8px;
  --radius-sm: 6px;
  --sidebar-width: 256px;
  --header-height: 64px;
  --mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1522;
    --surface: #171f2f;
    --surface-2: #1c2538;
    --surface-3: #232d42;
    --line: #273248;
    --line-strong: #34405a;
    --text: #d7deea;
    --text-strong: #f1f4f9;
    --muted: #93a0b5;
    --primary: #6a86f5;
    --primary-hover: #8198f7;
    --primary-soft: rgba(106, 134, 245, 0.16);
    --primary-text: #0b1020;
    --ok: #4cd08a;
    --ok-soft: rgba(76, 208, 138, 0.14);
    --warn: #f2b54a;
    --warn-soft: rgba(242, 181, 74, 0.14);
    --danger: #f27b7b;
    --danger-soft: rgba(242, 123, 123, 0.14);
    --code-bg: #121a29;
    --code-text: #d7deea;
    --hero-code-bg: #0c1220;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1522;
  --surface: #171f2f;
  --surface-2: #1c2538;
  --surface-3: #232d42;
  --line: #273248;
  --line-strong: #34405a;
  --text: #d7deea;
  --text-strong: #f1f4f9;
  --muted: #93a0b5;
  --primary: #6a86f5;
  --primary-hover: #8198f7;
  --primary-soft: rgba(106, 134, 245, 0.16);
  --primary-text: #0b1020;
  --ok: #4cd08a;
  --ok-soft: rgba(76, 208, 138, 0.14);
  --warn: #f2b54a;
  --warn-soft: rgba(242, 181, 74, 0.14);
  --danger: #f27b7b;
  --danger-soft: rgba(242, 123, 123, 0.14);
  --code-bg: #121a29;
  --code-text: #d7deea;
  --hero-code-bg: #0c1220;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);
}

/*
 * `hidden` must hide. The browser's own rule for it has the lowest specificity
 * there is, so any class here that sets `display` -- `.usage-panel`, `.nav-links`,
 * `.stack` -- silently overrode it: every project card showed its Memory panel
 * stuck on "Loading…" before it was ever opened, because the panel was drawn
 * and the request that fills it is only made on click.
 */
[hidden] {
  display: none !important;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
h4,
h5 {
  color: var(--text-strong);
  line-height: 1.25;
  margin: 0 0 0.5rem;
  font-weight: 650;
}

p {
  margin: 0 0 0.75rem;
}

code,
pre,
kbd {
  font-family: var(--mono);
  font-size: 0.86em;
}

:not(pre) > code {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.05rem 0.3rem;
  overflow-wrap: anywhere;
}

pre {
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  overflow-x: auto;
  max-width: 100%;
  line-height: 1.5;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

/* ------------------------------------------------------------------ *
 * Buttons, badges, forms
 * ------------------------------------------------------------------ */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0.5rem 1.1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.button:hover {
  text-decoration: none;
}

.button.primary {
  background: var(--primary);
  color: var(--primary-text);
  box-shadow: var(--shadow-sm);
}

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

.button.secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--text-strong);
}

.button.secondary:hover {
  background: var(--surface-2);
  border-color: var(--muted);
}

.button.small {
  min-height: 32px;
  padding: 0.3rem 0.75rem;
  font-size: 0.82rem;
}

.button.small .icon {
  width: 15px;
  height: 15px;
}

.button.danger {
  color: var(--danger);
}

.button.danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-button:hover {
  background: var(--surface-3);
  color: var(--text-strong);
  text-decoration: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
}

.badge[data-tone]::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge[data-tone="ready"] {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge[data-tone="working"] {
  background: var(--primary-soft);
  color: var(--primary);
}

.badge[data-tone="failed"] {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge[data-tone="working"]::before {
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

/* Block, not grid: "Name <span class=optional>" must stay on one line. */
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-strong);
  min-width: 0;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 400;
  transition: border-color 0.15s, box-shadow 0.15s;
}

label > input:not([type="checkbox"]),
label > select,
label > textarea,
label > .hint,
label > .field-error {
  display: block;
  margin-top: 0.35rem;
}

textarea {
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--danger);
}

input[type="checkbox"] {
  width: auto;
  min-height: 0;
  accent-color: var(--primary);
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.optional,
.hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.8rem;
}

.field-error {
  color: var(--danger);
  font-weight: 500;
  font-size: 0.8rem;
}

.form-error {
  margin: 0;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.stack {
  display: grid;
  gap: 1rem;
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
  gap: 0.9rem;
}

.inline-form > .form-error,
.inline-form > p {
  grid-column: 1 / -1;
}

.inline-form > .button {
  justify-self: start;
}

.inline-form.compact {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.7rem;
  margin-top: 1rem;
  padding: 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.fine,
.usage-note {
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

/* A button that reads as a link. It is a button because it acts on this page rather than
   navigating, and keyboards and screen readers should be told which of the two it is. */
.link-button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
}

.link-button:hover,
.link-button:focus-visible {
  color: var(--primary-hover);
}

.usage-note {
  margin: 0 0 0.5rem;
}

.usage-state {
  margin: 0.4rem 0;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.86rem;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 2rem 1rem;
}

.eyebrow {
  margin: 0 0 0.6rem;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.25rem;
  overflow-x: auto;
}

.tab {
  padding: 0.6rem 0.9rem;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text-strong);
  text-decoration: none;
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

details.help {
  margin: 0.75rem 0 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.88rem;
}

details.help > summary {
  padding: 0.65rem 0.9rem;
  font-weight: 600;
  color: var(--text-strong);
  cursor: pointer;
}

details.help > :not(summary) {
  margin: 0 0.9rem 0.9rem;
}

details.help ol,
details.help ul {
  padding-left: 1.2rem;
}

details.help li {
  margin-bottom: 0.6rem;
}

details.help pre {
  margin: 0.5rem 0;
  background: var(--surface);
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 100;
  max-width: min(520px, calc(100vw - 2rem));
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--text-strong);
  color: var(--surface);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 0.5rem);
  transition: opacity 0.2s, transform 0.2s;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

#toast[data-kind="error"] {
  background: var(--danger);
  color: #fff;
}

#toast[data-kind="success"] {
  background: var(--ok);
  color: #fff;
}

/* ------------------------------------------------------------------ *
 * Header
 * ------------------------------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header-height);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-strong);
  font-weight: 750;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary);
  color: var(--primary-text);
  font-weight: 800;
  font-size: 0.95rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-left: auto;
}

.nav-links a:not(.button) {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.92rem;
}

.nav-links a:not(.button):hover {
  color: var(--text-strong);
  text-decoration: none;
}

.nav-account {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  min-width: 0;
}

.nav-identity {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.5rem;
  min-width: 0;
}

.nav-identity-text {
  display: grid;
  line-height: 1.2;
  min-width: 0;
}

#account-name {
  color: var(--text-strong);
  font-weight: 600;
  font-size: 0.88rem;
}

.nav-email {
  color: var(--muted);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
}

.theme-toggle .theme-light {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .theme-dark {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .theme-light {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .theme-dark {
    display: none;
  }

  :root:not([data-theme="light"]) .theme-toggle .theme-light {
    display: block;
  }
}

.menu-toggle {
  display: none;
}

/* ------------------------------------------------------------------ *
 * Public pages
 * ------------------------------------------------------------------ */

.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4.5rem 1.25rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 3.5rem;
  align-items: center;
  padding-top: 5rem;
}

.hero h1 {
  font-size: clamp(2.1rem, 4.2vw, 3.3rem);
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 1.25rem;
}

.lede {
  font-size: 1.12rem;
  color: var(--muted);
  max-width: 38rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.75rem 0 1rem;
}

.hero-note {
  color: var(--muted);
  font-size: 0.88rem;
}

.hero-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.window-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.65rem 0.9rem;
  background: var(--hero-code-bg);
}

.window-bar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3a4560;
}

.window-bar em {
  margin-left: 0.5rem;
  color: #8b97b0;
  font-style: normal;
  font-family: var(--mono);
  font-size: 0.75rem;
}

.hero-code {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--hero-code-bg);
  color: #d7deea;
  padding: 0.5rem 1.1rem 1.25rem;
  font-size: 0.8rem;
}

.tok-k {
  color: #9fb3ff;
}

.tok-s {
  color: #7fd9a8;
}

.hero-card dl {
  margin: 0;
  padding: 0.5rem 1.25rem;
}

.hero-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
}

.hero-card dl div:last-child {
  border-bottom: 0;
}

.hero-card dt {
  color: var(--muted);
  font-size: 0.85rem;
}

.hero-card dd {
  margin: 0;
  color: var(--text-strong);
  font-weight: 600;
  font-size: 0.88rem;
  text-align: right;
}

.section-heading {
  max-width: 44rem;
  margin-bottom: 2.25rem;
}

.section-heading h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.02em;
}

.section-heading p:not(.eyebrow) {
  color: var(--muted);
}

#why {
  border-top: 1px solid var(--line);
}

.product-grid,
.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

.product-card,
.plan-card,
.panel,
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.product-card {
  padding: 1.5rem;
}

.product-card h3 {
  font-size: 1.05rem;
}

.product-card p {
  color: var(--muted);
  margin: 0;
}

.product-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 1rem;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
}

.product-icon .icon {
  width: 22px;
  height: 22px;
}

.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.75rem 1.5rem;
}

.plan-card.featured {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), var(--shadow-lg);
}

.plan-badge {
  position: absolute;
  top: -0.7rem;
  left: 1.5rem;
  margin: 0;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-text);
  font-size: 0.72rem;
  font-weight: 700;
}

.plan-card h3 {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 600;
}

.plan-price {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin: 0.25rem 0;
  color: var(--text-strong);
  font-size: 2.2rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.plan-price span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0;
}

.plan-lede {
  color: var(--muted);
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.plan-limits {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  font-size: 0.9rem;
}

.plan-limits li {
  position: relative;
  padding: 0.3rem 0 0.3rem 1.5rem;
}

.plan-limits li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.62rem;
  width: 9px;
  height: 5px;
  border-left: 2px solid var(--ok);
  border-bottom: 2px solid var(--ok);
  transform: rotate(-45deg);
}

.plan-limits li.excluded {
  color: var(--muted);
}

.plan-limits li.excluded::before {
  top: 0.8rem;
  width: 9px;
  height: 0;
  border-left: 0;
  border-bottom: 2px solid var(--muted);
  transform: none;
}

.plan-limits em {
  color: var(--warn);
  font-style: normal;
  font-size: 0.8rem;
}

.plan-excludes {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--line);
}

#start {
  padding-top: 2rem;
}

.auth-layout {
  display: grid;
  place-items: center;
}

.auth-card {
  position: relative;
  width: min(440px, 100%);
  padding: 2.75rem 2rem 2rem;
  box-shadow: var(--shadow-lg);
}

/* The reset page stands alone -- no hero beside it -- so it needs the padding the sales page's
   layout would otherwise have given it. */
.reset-page {
  padding: 3rem 1.25rem 4rem;
}

.form-ok {
  color: var(--ok);
  font-size: 0.92rem;
}

.auth-mark {
  position: absolute;
  top: -22px;
  left: 50%;
  width: 44px;
  height: 44px;
  transform: translateX(-50%);
  border: 4px solid var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-size: 1.1rem;
}

.auth-card .tabs {
  justify-content: center;
}

.auth-card .stack .button {
  width: 100%;
}

.coming-soon-mark {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-weight: 700;
  font-size: 0.8rem;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer p {
  margin: 0;
  flex: 1;
}

.site-footer .brand {
  font-size: 0.95rem;
}

.site-footer .brand-mark {
  width: 26px;
  height: 26px;
  font-size: 0.8rem;
}

/* ------------------------------------------------------------------ *
 * Console shell: sidebar, top bar, page header
 * ------------------------------------------------------------------ */

body.is-console .site-header {
  margin-left: var(--sidebar-width);
}

body.is-console .nav {
  max-width: none;
  padding: 0 1.5rem;
}

body.is-console .site-header .brand,
body.is-console .theme-toggle {
  order: 0;
}

body.is-console .site-header > .nav > .brand {
  display: none;
}

.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow-y: auto;
}

.sidebar-brand {
  flex: none;
  height: var(--header-height);
  padding: 0 1.4rem;
  border-bottom: 1px solid var(--line);
}

.console-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 1rem 0.85rem 2rem;
}

.nav-heading {
  margin: 1rem 0.6rem 0.4rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.nav-heading:first-child {
  margin-top: 0;
}

.console-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 550;
  font-size: 0.9rem;
  text-decoration: none;
}

.console-nav a .icon {
  color: var(--muted);
}

.console-nav a:hover {
  background: var(--surface-2);
  color: var(--text-strong);
}

.console-nav a.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.console-nav a.active .icon {
  color: var(--primary);
}

.project-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0.25rem 0 0.25rem 1.2rem;
  padding-left: 0.6rem;
  border-left: 1px solid var(--line);
}

.project-nav-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0.7rem 0.25rem;
  color: var(--text-strong);
  font-weight: 650;
  font-size: 0.85rem;
  min-width: 0;
}

.project-nav-name span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-nav a {
  padding: 0.45rem 0.7rem;
  font-size: 0.86rem;
}

.dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--muted);
}

.dot[data-tone="ready"] {
  background: var(--ok);
}

.dot[data-tone="working"] {
  background: var(--primary);
}

.dot[data-tone="failed"] {
  background: var(--danger);
}

.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(10, 15, 25, 0.45);
}

.console-main {
  margin-left: var(--sidebar-width);
  min-width: 0;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  min-height: 68px;
  padding: 0.85rem 1.75rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.page-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
  min-width: 0;
}

.page-heading h1 {
  margin: 0;
  padding-right: 1rem;
  border-right: 1px solid var(--line-strong);
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.breadcrumb a {
  color: var(--text-strong);
  font-weight: 550;
}

.breadcrumb .sep {
  color: var(--line-strong);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.page-body {
  display: grid;
  gap: 1.5rem;
  max-width: 1400px;
  padding: 1.75rem;
}

.page-body > section {
  display: grid;
  gap: 1.5rem;
  min-width: 0;
}

.card {
  min-width: 0;
  padding: 1.25rem 1.5rem 1.5rem;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin: -1.25rem -1.5rem 1.25rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
}

.card-head h2,
.card-head h3 {
  margin: 0;
  font-size: 1rem;
}

.card-head .usage-note {
  margin: 0.2rem 0 0;
}

.card-note {
  margin: -0.25rem 0 1rem;
}

.card h3 {
  font-size: 0.95rem;
  margin-top: 1.5rem;
}

.card h4,
.card h5 {
  font-size: 0.9rem;
  margin-top: 1.25rem;
}

.card > :first-child:not(.card-head),
.card-head + * {
  margin-top: 0;
}

.project-view-body,
.usage-panel {
  display: grid;
  gap: 1.5rem;
  min-width: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.grid-main-side {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

/* ------------------------------------------------------------------ *
 * Stat cards
 * ------------------------------------------------------------------ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.25rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat-top {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
}

.stat-value {
  display: block;
  color: var(--text-strong);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.stat-label {
  display: block;
  color: var(--text);
  font-weight: 600;
  font-size: 0.86rem;
}

.stat-foot {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.stat-card .usage-bar {
  margin-top: -0.4rem;
}

/* ------------------------------------------------------------------ *
 * Tables
 * ------------------------------------------------------------------ */

.table-scroll {
  margin: 0 -1.5rem -1.5rem;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table th:first-child,
.data-table td:first-child {
  padding-left: 1.5rem;
}

.data-table th:last-child,
.data-table td:last-child {
  padding-right: 1.5rem;
}

.data-table tbody tr:hover {
  background: var(--surface-2);
}

.project-cell {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 12rem;
}

.project-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
}

.project-cell a {
  display: block;
  color: var(--text-strong);
  font-weight: 650;
}

.project-ref {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.project-url code {
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
}

.cell-note {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.empty-projects {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--muted);
}

/* ------------------------------------------------------------------ *
 * Project pages
 * ------------------------------------------------------------------ */

.connect-row {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.connect-row > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.copy-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.3rem 0.35rem 0.3rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.copy-field code {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.shortcut {
  display: flex;
  gap: 0.9rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.shortcut:hover {
  border-color: var(--primary);
  text-decoration: none;
}

.shortcut strong {
  display: block;
  color: var(--text-strong);
}

.shortcut span {
  color: var(--muted);
  font-size: 0.85rem;
}

.shortcut .stat-icon {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
}

.status-card {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.plan-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.plan-summary strong {
  color: var(--text-strong);
  font-size: 1.3rem;
}

/* Usage meters (Plan & usage) */

.usage-meter {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.usage-meter:last-of-type {
  border-bottom: 0;
}

.usage-meter-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  font-size: 0.88rem;
}

.usage-meter-head span:first-child {
  color: var(--text-strong);
  font-weight: 600;
}

.usage-meter-head span:last-child {
  color: var(--muted);
}

.usage-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.usage-bar span {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: var(--primary);
}

[data-state="warning"] .usage-bar span {
  background: var(--warn);
}

[data-state="restricted"] .usage-bar span,
[data-state="exceeded"] .usage-bar span {
  background: var(--danger);
}

.usage-limits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
  margin: 0.75rem 0;
}

.usage-limits div {
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.usage-limits dt {
  color: var(--muted);
  font-size: 0.78rem;
}

.usage-limits dd {
  margin: 0.15rem 0 0;
  color: var(--text-strong);
  font-weight: 600;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.usage-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
}

/* API keys, tokens, memory spaces: list rows */

.api-key,
.memory-space {
  display: grid;
  gap: 0.35rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.api-key:last-child,
.memory-space:last-child {
  border-bottom: 0;
}

.api-key header,
.memory-space header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.api-key header strong,
.memory-space header strong {
  color: var(--text-strong);
}

.api-key .usage-note,
.memory-space .usage-note {
  margin: 0;
}

.api-key > .button,
.memory-space > .button {
  justify-self: start;
}

.api-key[data-type="secret"] header .badge {
  background: var(--warn-soft);
  color: var(--warn);
}

.api-key[data-type="publishable"] header .badge {
  background: var(--ok-soft);
  color: var(--ok);
}

.key-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.key-value {
  display: block;
  flex: 1 1 16rem;
  min-width: 0;
  padding: 0.45rem 0.65rem !important;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.key-issued {
  margin: 0.5rem 0 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--ok);
  border-radius: var(--radius-sm);
  background: var(--ok-soft);
}

.key-issued[data-state="secret"] {
  border-color: var(--warn);
  background: var(--warn-soft);
}

.key-issued p {
  margin-bottom: 0.6rem;
}

.key-issued .key-value {
  background: var(--surface);
}

.memory-space details {
  margin-top: 0.25rem;
}

.memory-space details > summary {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

/* Provider keys: one row per provider (name, what is set, remove), then a form whose key field
   gets the width. */
.provider-key-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.provider-key-list li {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}

.provider-key-list li:last-child {
  border-bottom: 0;
}

.provider-key-list strong {
  color: var(--text-strong);
}

.provider-key-status {
  min-width: 0;
  overflow-wrap: anywhere;
}

.inline-form.provider-key-form {
  grid-template-columns: minmax(140px, 1fr) minmax(220px, 2.2fr) auto;
}

@media (max-width: 640px) {
  .inline-form.provider-key-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .provider-key-list li {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .provider-key-status {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* Deleting a project: a card that looks like what it does, without shouting on every page. */
.danger-zone {
  border-color: var(--danger);
}

.danger-zone .card-head h2 {
  color: var(--danger);
}

/* The models form: one box per job (extraction, embeddings), provider and model side by side
   inside it, so nothing reads as belonging to its neighbour. */
.inline-form.model-form {
  grid-template-columns: minmax(0, 1fr);
}

.model-group {
  display: grid;
  gap: 0.5rem;
  min-width: 0;
  margin: 0;
  padding: 0.75rem 0.9rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.model-group legend {
  padding: 0 0.35rem;
  color: var(--text-strong);
  font-weight: 600;
  font-size: 0.9rem;
}

.model-group > .usage-note {
  margin: 0;
}

.model-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  align-items: end;
  gap: 0.7rem;
}

.model-fields:empty {
  display: none;
}

.model-summary {
  display: grid;
  gap: 0.15rem;
  margin: 0;
  font-size: 0.88rem;
}

.model-summary > div {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 0.5rem;
}

.model-summary dt {
  color: var(--muted);
}

.model-summary dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.memory-space[data-state="pending"] header .badge,
.memory-space[data-state="deleting"] header .badge {
  background: var(--primary-soft);
  color: var(--primary);
}

.memory-space[data-state="active"] header .badge {
  background: var(--ok-soft);
  color: var(--ok);
}

.memory-space[data-state="failed"] header .badge {
  background: var(--danger-soft);
  color: var(--danger);
}

/* SQL editor and table browser */

.sql-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.sql-statement textarea {
  min-height: 14rem;
  background: var(--code-bg);
}

.sql-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  align-items: start;
}

.sql-controls .usage-actions {
  grid-column: 1 / -1;
  margin: 0;
}

.sql-results {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.sql-result {
  min-width: 0;
}

.sql-table-wrap {
  max-width: 100%;
  max-height: 32rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.sql-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.sql-table th {
  position: sticky;
  top: 0;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-strong);
  font-weight: 650;
  text-align: left;
  white-space: nowrap;
}

.sql-table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.8rem;
  max-width: 28rem;
  overflow-wrap: anywhere;
  vertical-align: top;
}

.sql-table tr:last-child td {
  border-bottom: 0;
}

.sql-null {
  color: var(--muted);
  font-style: italic;
}

.sql-error {
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 0.82rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.tables-toolbar {
  margin-bottom: 1rem;
}

.tables-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.tables-list {
  position: sticky;
  top: calc(var(--header-height) + 1rem);
  max-height: calc(100vh - var(--header-height) - 2rem);
  overflow-y: auto;
  padding-right: 0.5rem;
  border-right: 1px solid var(--line);
}

.tables-list ul {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.table-link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  font-family: var(--mono);
  font-size: 0.84rem;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.table-link:hover {
  background: var(--surface-2);
}

.table-link.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.rls-off {
  padding: 0 0.35rem;
  border-radius: 4px;
  background: var(--warn-soft);
  color: var(--warn);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 700;
}

.table-detail {
  min-width: 0;
}

.table-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.table-detail-head h3 {
  margin: 0;
}

.table-detail-head code {
  font-size: 1rem;
  border: 0;
  background: none;
  padding: 0;
}

.table-item {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

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

.table-item .usage-note {
  margin: 0.15rem 0 0;
}

/* Organization and tokens */

.org-picker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.org-picker select {
  width: auto;
}

.member-list {
  display: grid;
}

.member-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.member-row:last-child {
  border-bottom: 0;
}

.member-email {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  color: var(--text-strong);
  font-weight: 550;
  overflow-wrap: anywhere;
}

.member-role select {
  min-height: 34px;
  padding: 0.25rem 0.5rem;
  width: auto;
}

.account-item[data-expired="true"] {
  opacity: 0.65;
}

/* ------------------------------------------------------------------ *
 * Docs
 * ------------------------------------------------------------------ */

.docs {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 3rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.docs-toc {
  position: sticky;
  top: calc(var(--header-height) + 1.5rem);
  align-self: start;
}

.docs-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.15rem;
}

.docs-toc a {
  display: block;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
}

.docs-toc a:hover {
  background: var(--surface);
  text-decoration: none;
}

.docs-body {
  min-width: 0;
  padding: 2rem 2.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.docs-body h1 {
  font-size: 2rem;
  letter-spacing: -0.02em;
}

.docs-body section {
  padding-top: 1.5rem;
  margin-top: 1.5rem;
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--header-height) + 1rem);
}

.docs-body h2 {
  font-size: 1.35rem;
}

.docs-body h3 {
  font-size: 1.05rem;
  margin-top: 1.25rem;
}

.docs-body .steps li {
  margin-bottom: 0.5rem;
}

.docs-body .table-wrap {
  overflow-x: auto;
}

.docs-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.docs-body th,
.docs-body td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.docs-body th {
  background: var(--surface-2);
  color: var(--text-strong);
}

/* ------------------------------------------------------------------ *
 * Narrow screens
 * ------------------------------------------------------------------ */

@media (max-width: 1100px) {
  .grid-main-side {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 960px) {
  .hero,
  .product-grid,
  .plan-grid,
  .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero {
    gap: 2.5rem;
    padding-top: 3rem;
  }

  body.is-console .site-header {
    margin-left: 0;
  }

  body.is-console .site-header > .nav > .brand {
    display: inline-flex;
  }

  body.is-console .menu-toggle {
    display: inline-grid;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: none;
  }

  body.nav-open .sidebar {
    transform: none;
    box-shadow: var(--shadow-lg);
  }

  .console-main {
    margin-left: 0;
  }

  .tables-layout,
  .docs {
    grid-template-columns: minmax(0, 1fr);
  }

  .tables-list {
    position: static;
    max-height: 16rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: 0.5rem;
  }

  .docs-toc {
    position: static;
  }
}

@media (max-width: 640px) {
  :root {
    font-size: 14.5px;
  }

  .nav,
  body.is-console .nav {
    padding: 0 1rem;
    gap: 0.35rem;
  }

  .nav-links {
    gap: 0.9rem;
  }

  .nav-links a[href="#why"],
  .nav-links a[href="./docs.html"] {
    display: none;
  }

  .nav-identity-text,
  .nav-docs {
    display: none;
  }

  .section {
    padding: 3rem 1rem;
  }

  .page-header {
    padding: 0.85rem 1rem;
  }

  .page-heading h1 {
    border-right: 0;
    padding-right: 0;
  }

  .page-body {
    padding: 1rem;
    gap: 1rem;
  }

  .card {
    padding: 1rem;
  }

  .card-head {
    margin: -1rem -1rem 1rem;
    padding: 0.85rem 1rem;
  }

  .table-scroll {
    margin: 0 -1rem -1rem;
  }

  .data-table th:first-child,
  .data-table td:first-child {
    padding-left: 1rem;
  }

  .data-table .hide-narrow {
    display: none;
  }

  .member-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .member-row > :last-child {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .docs-body {
    padding: 1.25rem;
  }

  .auth-card {
    padding: 2.5rem 1.25rem 1.5rem;
  }
}

.sql-results {
  margin-top: 1.25rem;
}

.usage-actions .usage-note {
  margin: 0;
}
