/* touchNspace portal. Neutral greys, one dark accent, the system font. */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #fafafa;
  --surface: #ffffff;
  --subtle: #f5f5f5;
  --hover: #f4f4f5;
  --border: #e5e5e5;
  --border-strong: #d4d4d4;
  --text: #0a0a0a;
  --text-2: #404040;
  --muted: #737373;
  --faint: #a3a3a3;

  --accent: #0a0a0a;
  --accent-hover: #262626;
  --focus: #2563eb;
  --ring: 0 0 0 3px rgba(37, 99, 235, .16);

  --ok: #15803d;
  --ok-dot: #22c55e;
  --ok-soft: #f0fdf4;
  --ok-border: #bbf7d0;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;
  --info: #1d4ed8;
  --info-soft: #eff6ff;
  --info-border: #bfdbfe;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
}
a { color: inherit; }
h1, h2 { margin: 0; letter-spacing: -0.015em; font-weight: 600; }
code { font-family: var(--mono); font-size: .92em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- buttons ---------- */

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 500; font-size: 14px; text-decoration: none; white-space: nowrap; cursor: pointer;
  box-shadow: var(--shadow); transition: background .12s, border-color .12s, color .12s;
}
.button:hover { background: var(--hover); border-color: var(--border-strong); }
.button-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.button-small { height: 32px; padding: 0 12px; font-size: 13px; }
.button-danger { color: var(--danger); }
.button-danger:hover { background: var(--danger-soft); border-color: var(--danger-border); }
.button-ghost { width: 100%; }
.button-oauth { width: 100%; height: 40px; }
.button.is-disabled, .button:disabled { opacity: .45; pointer-events: none; box-shadow: none; }
.provider-icon { width: 16px; height: 16px; flex: none; }

/* ---------- forms ---------- */

.form { display: grid; gap: 16px; }
.form-inline { margin-top: 12px; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.field input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 400; outline: none; box-shadow: var(--shadow);
  transition: border-color .12s, box-shadow .12s;
}
.field select, .field textarea {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 400; outline: none; box-shadow: var(--shadow);
}
.field textarea { font: 12.5px/1.6 var(--mono); resize: vertical; }
.field select:focus, .field textarea:focus { border-color: var(--focus); box-shadow: var(--ring); }
.field small label { display: inline; font-weight: 400; }
.field small input[type=checkbox] { width: auto; height: auto; box-shadow: none; vertical-align: -2px; }
.try-new { padding: 14px 16px; border: 1px solid var(--ok-border); border-radius: var(--radius-sm); margin-bottom: 12px; }
.try-new .muted { margin: 0 0 10px; }
.try-key { margin-top: 4px; }
.try-run { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.try-run[hidden] { display: none; }
.field input::placeholder { color: var(--faint); }
.field input:focus { border-color: var(--focus); box-shadow: var(--ring); }
.field small { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.input-wrap { position: relative; display: block; }
.input-wrap:has(.reveal) input { padding-right: 42px; }
.reveal {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px;
  border: 0; border-radius: 6px; background: transparent; color: var(--faint); cursor: pointer; display: grid; place-items: center;
}
.reveal:hover { color: var(--text); background: var(--hover); }
.reveal[aria-pressed="true"] { color: var(--text); }
.reveal svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.link-small { font-size: 13px; color: var(--muted); text-decoration: none; justify-self: end; margin-top: -8px; }
.link-small:hover { color: var(--text); text-decoration: underline; }

/* ---------- notices and pills ---------- */

.notice { border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13.5px; margin-bottom: 16px; border: 1px solid; }
.notice a { font-weight: 500; }
.notice-info { background: var(--info-soft); border-color: var(--info-border); color: var(--info); }
.notice-success { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok); }
.notice-error { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; font-style: normal; white-space: nowrap;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.pill-ok::before { background: var(--ok-dot); }
.pill-bad { color: var(--danger); border-color: var(--danger-border); }
.pill-bad::before { background: var(--danger); }
.pill-off { color: var(--muted); }
.pill-soon { color: var(--muted); }

/* ---------- sign-in pages ---------- */

.auth-page { background: var(--surface); --focus: #6d4aff; --ring: 0 0 0 3px rgba(109, 74, 255, .2); }
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }

/* left half: the illustration */
.auth-art { position: sticky; top: 0; height: 100vh; z-index: 1; }
.auth-art-clip { position: absolute; inset: 0; overflow: hidden; background: #1a0c4d; }
.auth-art-image {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
  animation: art-in .9s cubic-bezier(.2, .7, .2, 1) both;
}
/* the plug that leaves the picture and points at the form */
.auth-edge {
  position: absolute; z-index: 2; top: 71%; right: -104px; width: 262px; height: auto; display: none; pointer-events: none;
}

/* right half: the form */
.auth-panel { position: relative; overflow: hidden; display: flex; flex-direction: column; padding: 28px 40px; min-width: 0; }
.auth-top { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; }
.auth-brand {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 18px; letter-spacing: -.02em; text-decoration: none; color: var(--text);
}

/* the home menu: three short answers, each in a popup */
.auth-menu { display: flex; flex-wrap: wrap; gap: 4px; }
.auth-menu button {
  height: 34px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2);
  font: inherit; font-size: 14px; font-weight: 550; cursor: pointer; transition: background .12s, color .12s;
}
.auth-menu button:hover { background: #f1eefb; color: var(--text); }
.auth-menu .menu-free { color: #3f7a0a; }
.auth-menu .menu-free::before { content: ""; display: inline-block; width: 7px; height: 7px; margin: 0 7px 1px 0; background: #8fca1c; }

.info-dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 18px;
  background: #fff; color: var(--text); box-shadow: 0 30px 80px -20px rgba(21, 10, 58, .55); overflow: auto;
}
.info-dialog::backdrop { background: rgba(21, 10, 58, .55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.info-dialog[open] { animation: rise .25s cubic-bezier(.2, .7, .2, 1) both; }
.info-body { padding: 30px 30px 26px; }
.info-eyebrow { display: block; margin-bottom: 10px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #6d4aff; }
.info-body h2 { font-size: 24px; line-height: 1.2; font-weight: 750; letter-spacing: -.03em; }
.info-body p { margin: 12px 0 0; font-size: 15px; line-height: 1.6; color: var(--text-2); }
.info-steps { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 14px; }
.info-steps li { display: flex; gap: 14px; }
.info-steps b {
  width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 7px;
  background: #b8f33d; color: #150a3a; font-size: 13px; font-weight: 800;
}
.info-steps strong { display: block; font-size: 15px; font-weight: 650; }
.info-steps span { display: block; margin-top: 2px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.info-big { margin: 18px 0 0; padding: 18px; border-radius: 14px; background: #f3f0ff; border: 1px solid #e2dbff; }
.info-big strong { display: block; font-size: 34px; font-weight: 800; letter-spacing: -.03em; color: #4527d6; font-variant-numeric: tabular-nums; }
.info-big span { font-size: 14px; color: var(--text-2); }
.info-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.info-actions .button { height: 38px; font-size: 14px; }
@media (max-width: 520px) { .auth-menu { width: 100%; justify-content: space-between; } .auth-menu button { padding: 0 8px; font-size: 13.5px; } .info-body { padding: 24px 20px 20px; } }
.auth-brand .logo-mark { color: var(--text); }
.auth-body { position: relative; z-index: 1; width: 100%; max-width: 408px; margin: auto; padding: 48px 0; animation: rise .6s cubic-bezier(.2, .7, .2, 1) both; }
.auth-body h1 { font-size: 36px; font-weight: 750; line-height: 1.12; letter-spacing: -.035em; text-align: center; }
.auth-body .lead { color: var(--muted); text-align: center; margin: 12px 0 0; font-size: 15.5px; }
.auth-body .lead strong { color: var(--text); font-weight: 600; }
.auth-body > h1 + *, .auth-body > .lead + * { margin-top: 34px; }

/* chunky controls: a solid lower edge that gives way when pressed */
.auth-body .button {
  height: 46px; border-radius: 10px; font-size: 15px; font-weight: 600;
  border-color: #d6d3dd; box-shadow: 0 2px 0 #d6d3dd;
  transition: transform .08s, box-shadow .08s, background .12s, border-color .12s;
}
.auth-body .button:hover { background: #faf9fc; border-color: #c4bfd0; box-shadow: 0 2px 0 #c4bfd0; }
.auth-body .button:active { transform: translateY(2px); box-shadow: 0 0 0 transparent; }
.auth-body .button-primary { background: var(--accent); border-color: var(--accent); box-shadow: 0 2px 0 #6d4aff; color: #fff; }
.auth-body .button-primary:hover { background: #1c1433; border-color: #1c1433; box-shadow: 0 2px 0 #6d4aff; }
.auth-body .button-oauth .provider-icon { width: 18px; height: 18px; }
.auth-body .field { font-size: 13.5px; font-weight: 600; color: var(--text); gap: 7px; }
.auth-body .field input {
  height: 46px; padding: 0 14px; border-radius: 10px; font-size: 15px;
  background: #f6f5f9; border-color: #dedbe6; box-shadow: inset 0 1px 2px rgba(21, 10, 58, .06);
}
.auth-body .field input:hover { border-color: #c4bfd0; }
.auth-body .field input:focus { background: #fff; border-color: var(--focus); box-shadow: var(--ring); }
.auth-body .field small { font-weight: 400; }
.auth-body .link-small:hover, .auth-foot a:hover { color: #6d4aff; }
.auth-foot { margin: 28px 0 0; font-size: 14.5px; color: var(--muted); text-align: center; }
.auth-foot a { color: var(--text); font-weight: 600; text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }
/* a small scene in the corner of the form side */
.auth-spot { position: absolute; right: 44px; bottom: 0; width: 178px; height: auto; display: none; pointer-events: none; animation: rise .8s .35s cubic-bezier(.2, .7, .2, 1) both; }

.oauth { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; }
.divider {
  display: flex; align-items: center; gap: 14px; margin: 26px 0; color: var(--faint);
  font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes art-in { from { opacity: 0; transform: scale(1.04); } to { opacity: 1; transform: none; } }
@media (min-width: 1280px) { .auth-edge { display: block; } }
@media (min-width: 1280px) and (min-height: 880px) { .auth-spot { display: block; } }
@media (prefers-reduced-motion: reduce) { .auth-art-image, .auth-body, .auth-spot, .info-dialog[open] { animation: none; } }

/* ---------- app shell ---------- */

.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  padding: 16px 12px; background: var(--surface); border-right: 1px solid var(--border);
}
.sidebar-brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 18px; font-weight: 600; font-size: 15px; letter-spacing: -.01em; text-decoration: none; }
.sidebar-brand .logo-mark { color: var(--text); }
.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 7px;
  color: var(--text-2); text-decoration: none; font-weight: 500; font-size: 14px;
}
.nav-item svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; color: var(--muted); }
a.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.is-active { background: var(--subtle); color: var(--text); }
.nav-item.is-active svg { color: var(--text); }

.sidebar-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 6px 0; border-top: 1px solid var(--border); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--subtle); border: 1px solid var(--border); font-weight: 600; font-size: 12px; color: var(--text-2); }
.sidebar-email { flex: 1; min-width: 0; font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user form { margin: 0; }
.icon-button { width: 30px; height: 30px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.icon-button:hover { background: var(--hover); color: var(--text); }
.icon-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.main { min-width: 0; width: 100%; max-width: 1160px; padding: 36px 40px 64px; }
.page-head { margin-bottom: 28px; }
.page-head h1 { font-size: 24px; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

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

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; min-width: 0; padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.card-wide { grid-column: 1 / -1; }
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.card-head > div:not(.card-icon) { flex: 1; min-width: 0; }
.card-head h2 { font-size: 15px; }
.card-head .pill { margin-left: auto; flex: none; }
.card-icon {
  width: 32px; height: 32px; flex: none; border-radius: 8px; display: grid; place-items: center;
  background: var(--subtle); border: 1px solid var(--border); color: var(--text-2);
}
.card-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.muted { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.card-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.card > .card-actions { margin-top: auto; }
.card > :has(+ .card-actions) { margin-bottom: 16px; }
.empty { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.label { margin: 18px 0 8px; font-size: 12px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.footnote { margin: 20px 2px 0; max-width: 720px; color: var(--muted); font-size: 13px; }

.facts { margin: 0; display: grid; }
.facts div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.facts div:last-child { border-bottom: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; font-variant-numeric: tabular-nums; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; counter-reset: step; }
.steps li { counter-increment: step; display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.steps li:last-child { border-bottom: 0; }
.steps li::before {
  content: counter(step); width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--border-strong); font-size: 11.5px; font-weight: 600; color: var(--muted);
}
.steps li.is-done { color: var(--muted); }
.steps li.is-done::before { content: "✓"; background: var(--text); border-color: var(--text); color: #fff; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.chip { height: 26px; display: inline-flex; align-items: center; padding: 0 10px; border-radius: 999px; background: var(--subtle); border: 1px solid var(--border); font-size: 12.5px; font-weight: 500; }

/* ---------- connection ---------- */

.card-reveal { margin-bottom: 16px; border-color: var(--ok-border); background: linear-gradient(var(--ok-soft), var(--surface) 70%); }
.copy-row { display: flex; align-items: center; gap: 8px; }
.copy-row code {
  flex: 1; min-width: 0; height: 36px; display: flex; align-items: center; padding: 0 12px; overflow-x: auto; white-space: nowrap;
  background: var(--subtle); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px;
}
.copy-row code.secret { background: var(--surface); border-color: var(--ok-border); font-weight: 500; }
.copy-row[hidden], .creds-none[hidden] { display: none; }

/* dashboard credentials */
.creds-card { margin-top: 16px; display: grid; gap: 12px; }
.creds-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.creds-head h2 { margin: 0; font-size: 15px; font-weight: 650; }
.creds-list { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 16px; align-items: center; }
.creds-list dt { font-size: 13px; color: var(--muted); }
.creds-list dd { margin: 0; min-width: 0; }
.creds-none { font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.creds-none code { font-size: 12.5px; }
.creds-note { margin: 0; font-size: 12.5px; }
@media (max-width: 640px) {
  .creds-list { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .creds-list dd + dt { margin-top: 6px; }
}
.snippet {
  margin: 0; padding: 14px 16px; overflow-x: auto; border-radius: var(--radius-sm);
  background: #0a0a0a; color: #e5e5e5; font: 12.5px/1.6 var(--mono);
}
.key-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; }
.key-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.key-list li:last-child { border-bottom: 0; }
.key-list form { margin: 0; }
.key-main { flex: 1; min-width: 0; display: grid; gap: 1px; font-size: 13.5px; }
.key-main strong { font-weight: 500; }
.key-main .muted { font-size: 12.5px; }
.form-row { grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; padding-top: 16px; border-top: 1px solid var(--border); }
.form-row .button { height: 40px; }

.test-result:empty { display: none; }
.test-result { margin: 16px 0 0; }
.tool-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; color: var(--text); }
.tool-list li { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 12px; font-size: 13px; }
.tool-list span { color: var(--muted); }

/* ---------- connectors ---------- */

.toolbar { display: flex; gap: 8px; margin: -12px 0 20px; }
.connector-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.connector { display: flex; flex-direction: column; }
.client-badge {
  width: 36px; height: 36px; flex: none; border-radius: 9px; display: grid; place-items: center;
  background: var(--subtle); border: 1px solid var(--border); color: var(--text); font-weight: 600; font-size: 14px;
}
.connector.is-connected .client-badge { background: var(--text); border-color: var(--text); color: #fff; }
.connector-meta { margin: 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.connector-meta code { color: var(--text-2); }
.setup { margin-top: 14px; }
.setup summary { list-style: none; display: inline-flex; cursor: pointer; }
.setup summary::-webkit-details-marker { display: none; }
.setup summary::after { content: ""; width: 6px; height: 6px; margin: -3px 0 0 2px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform .15s; }
.setup[open] summary::after { transform: rotate(-135deg); margin-top: 3px; }
.setup-body { margin-top: 12px; }
.setup-body .label { margin-top: 0; text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.snippet-wrap { position: relative; }
.snippet-wrap .snippet { padding-right: 72px; white-space: pre; }
.snippet-wrap .copy-snippet { position: absolute; top: 8px; right: 8px; height: 26px; padding: 0 9px; font-size: 12px; background: #262626; border-color: #404040; color: #e5e5e5; box-shadow: none; }
.snippet-wrap .copy-snippet:hover { background: #404040; }
.setup-body .muted { margin-top: 10px; font-size: 12.5px; }

/* ---------- settings ---------- */

.method-list { list-style: none; margin: 0; padding: 0; display: grid; }
.method-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.method-list li:first-child { padding-top: 0; }
.method-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.method-list form { margin: 0; }
.method-icon { width: 32px; height: 32px; flex: none; border-radius: 8px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.method-icon svg { width: 16px; height: 16px; }
.method-icon > svg:not(.provider-icon) { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.method-main { flex: 1; min-width: 0; display: grid; font-size: 13.5px; }
.method-main strong { font-weight: 500; }
.method-main .muted { margin: 0; font-size: 12.5px; }

/* ---------- usage ---------- */

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat { display: grid; gap: 4px; align-content: start; }
.stat-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.stat strong { font-size: 28px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat strong small { font-size: 14px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.meter { height: 6px; margin: 6px 0 2px; border-radius: 999px; background: var(--subtle); border: 1px solid var(--border); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--text); border-radius: inherit; }
.meter.is-full span { background: var(--danger); }
.bars { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 8px; height: 180px; align-items: end; }
.bar { height: 100%; display: grid; grid-template-rows: auto 1fr auto; justify-items: center; gap: 6px; }
.bar-value { min-height: 16px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-fill { align-self: end; width: 100%; max-width: 28px; min-height: 2px; border-radius: 4px 4px 1px 1px; background: var(--text); }
.bar:hover .bar-fill { background: var(--focus); }
.bar-day { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { padding: 0 12px 8px 0; text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); border-bottom: 1px solid var(--border); }
.table td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 0; }
.table td:first-child { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }

/* ---------- error page ---------- */

.plain-page { background: var(--bg); }
.plain { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.plain-card { max-width: 420px; display: grid; gap: 12px; justify-items: center; text-align: center; padding: 32px; }
.plain-card h1 { font-size: 20px; }
.plain-card p { margin: 0; color: var(--muted); }
.brand-inline { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }

/* ---------- small screens ---------- */

@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px;
    padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--border);
  }
  .sidebar-brand { flex: 1; padding: 0; }
  .nav { order: 3; flex: 1 1 100%; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
  .nav-item { white-space: nowrap; height: 32px; }
  .sidebar-user { order: 2; margin: 0; padding: 0; border-top: 0; }
  .sidebar-email { display: none; }
  .main { padding: 24px 16px 48px; }
  .grid, .connector-grid { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .bars { gap: 3px; }
  .bar-value { display: none; }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .tool-list li { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .auth-panel { padding: 20px 16px; }
  .auth-body { padding: 28px 0 32px; }
  .auth-body h1 { font-size: 30px; }
}
/* narrow screens: the picture becomes a band above the form */
@media (max-width: 960px) {
  .auth { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .auth-art { position: relative; height: 210px; }
  .auth-art-image { object-position: 50% 40%; }
}

/* ---------- signed-in pages: the console theme ----------
   Calm and readable first. 8-bit shows up only as accents: the pixel art on the sign-in page,
   square step badges, a segmented meter and the pixel robot in empty states. */

.app-page {
  --violet: #6d4aff; --violet-hover: #5b37f2; --violet-ink: #4527d6; --violet-soft: #f3f0ff; --violet-line: #e2dbff;
  --lime: #b8f33d; --lime-soft: #f0fbdc; --lime-ink: #3f7a0a;
  --accent: var(--violet); --accent-hover: var(--violet-hover); --focus: var(--violet); --ring: 0 0 0 3px rgba(109, 74, 255, .18);
  --bg: #f7f7fb; --surface: #ffffff; --subtle: #f8f7fc; --hover: #f3f2f9;
  --border: #e9e7f2; --border-strong: #d9d6e6;
  --text: #17142b; --text-2: #45415e; --muted: #706d88; --faint: #a3a1b7;
  --radius: 14px; --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(23, 20, 43, .04);
  --shadow-lift: 0 1px 2px rgba(23, 20, 43, .04), 0 8px 24px -12px rgba(23, 20, 43, .12);
  background: var(--bg);
}

/* sidebar */
.app-page .sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 18px 12px; }
.app-page .sidebar-brand { padding: 4px 10px 22px; font-weight: 700; letter-spacing: -.02em; }
.app-page .sidebar-brand .logo-mark { color: var(--violet); }
.app-page .nav { gap: 2px; }
.app-page .nav-item { height: 36px; padding: 0 10px; border-radius: 9px; color: var(--text-2); font-weight: 500; }
.app-page .nav-item svg { color: var(--faint); stroke-width: 1.7; }
.app-page a.nav-item:hover { background: var(--hover); color: var(--text); }
.app-page a.nav-item:hover svg { color: var(--muted); }
.app-page .nav-item.is-active { background: var(--violet-soft); color: var(--violet-ink); font-weight: 600; }
.app-page .nav-item.is-active svg { color: var(--violet); }
.app-page .sidebar-user { padding-top: 14px; }
.app-page .avatar { border-radius: 8px; background: var(--violet-soft); border: 1px solid var(--violet-line); color: var(--violet-ink); }

/* page */
.app-page .main { padding: 40px 44px 72px; }
.app-page .page-head { margin-bottom: 24px; }
.app-page .page-head h1 { font-size: 28px; font-weight: 700; letter-spacing: -.03em; }
.app-page .page-head p { margin-top: 6px; font-size: 15px; color: var(--muted); }

/* cards */
.app-page .grid { gap: 16px; }
.app-page .card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.app-page .card-head { gap: 12px; margin-bottom: 18px; }
.app-page .card-head h2 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.app-page .card-icon { width: 34px; height: 34px; border-radius: 9px; border: 0; background: var(--violet-soft); color: var(--violet); }
.app-page .card-icon-teal { background: var(--lime-soft); color: var(--lime-ink); }
.app-page .card-icon svg { width: 17px; height: 17px; stroke-width: 1.8; }
.app-page .card-actions { border-top-color: var(--border); }

/* buttons */
.app-page .button {
  height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  font-weight: 600; transition: background .12s, border-color .12s, transform .06s;
}
.app-page .button-small { height: 32px; padding: 0 12px; }
.app-page .button:hover { background: var(--hover); border-color: #cbc7dc; }
.app-page .button:active { transform: translateY(1px); }
.app-page .button-primary { background: var(--violet); border-color: var(--violet); color: #fff; box-shadow: 0 1px 2px rgba(69, 39, 214, .3), inset 0 1px 0 rgba(255, 255, 255, .14); }
.app-page .button-primary:hover { background: var(--violet-hover); border-color: var(--violet-hover); }

/* fields */
.app-page .field input, .app-page .field select, .app-page .field textarea, .app-page .tool-filter {
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow);
}
.app-page .field input:focus, .app-page .field select:focus, .app-page .field textarea:focus, .app-page .tool-filter:focus {
  border-color: var(--violet); box-shadow: var(--ring);
}

/* small parts */
.app-page .pill { border-radius: 999px; font-weight: 600; background: var(--surface); }
.app-page .pill-ok::before { background: #4fbf26; }
.app-page .chip { border-radius: 8px; background: var(--violet-soft); border-color: var(--violet-line); color: var(--violet-ink); }
.app-page .notice { border-radius: var(--radius-sm); }
.app-page .snippet { background: #15122b; color: #e6e3f5; border-radius: var(--radius-sm); }
.app-page .snippet-wrap .copy-snippet { background: #2a2548; border-color: #3a3460; color: #e6e3f5; box-shadow: none; }
.app-page .copy-row code { border-radius: var(--radius-sm); }
.app-page .client-badge { border-radius: 9px; background: var(--violet-soft); border-color: var(--violet-line); color: var(--violet-ink); }
.app-page .connector.is-connected .client-badge { background: var(--violet); border-color: var(--violet); color: #fff; }
.badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 7px; border-radius: 6px; color: #4527d6; background: #f3f0ff; }
.pixel-sprite { display: block; height: auto; }

/* the monthly meter: rounded track, segmented fill */
.app-page .meter { height: 10px; margin: 10px 0 2px; border: 0; border-radius: 999px; background: #efedf7; overflow: hidden; }
.app-page .meter span { border-radius: 0; background: repeating-linear-gradient(90deg, var(--violet) 0 6px, #8b6fff 6px 8px); }
.app-page .meter.is-full span { background: var(--danger); }
.app-page .bar-fill { border-radius: 3px 3px 0 0; background: var(--violet); }
.app-page .bar:hover .bar-fill { background: var(--violet-hover); }

/* checklist: square pixel badges */
.app-page .steps li { align-items: flex-start; gap: 12px; padding: 12px 0; }
.app-page .steps li::before { width: 22px; height: 22px; margin-top: 1px; border-radius: 6px; border: 1.5px solid var(--border-strong); font-weight: 700; color: var(--muted); }
.app-page .steps li.is-done::before { background: var(--violet); border-color: var(--violet); color: #fff; }
.app-page .steps li > div { display: grid; gap: 2px; min-width: 0; }
.app-page .steps li strong { font-weight: 600; font-size: 13.5px; color: var(--text); }
.app-page .steps li.is-done strong { color: var(--muted); font-weight: 500; text-decoration: line-through; text-decoration-color: var(--faint); }
.app-page .steps li .muted { margin: 0; font-size: 12.5px; line-height: 1.45; }

/* ---------- dashboard ----------
   Three blocks only: the balance and usage figures, the business problems with the tool
   that solves each, and the setup checklist. */

.card-note { margin: 0; font-size: 13px; color: var(--muted); }
.app-page .page-head p:empty { display: none; }
.key-reveal { display: grid; gap: 12px; margin-bottom: 16px; }
.key-reveal h2 { font-size: 15px; font-weight: 650; }
.key-reveal .muted { margin-top: 2px; }

.stats-row { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); gap: 12px; }
.app-page .stat-card { display: grid; gap: 6px; align-content: start; padding: 18px 20px; color: inherit; text-decoration: none; min-width: 0; }
.app-page a.stat-card { transition: border-color .12s, box-shadow .12s; }
.app-page a.stat-card:hover { border-color: var(--violet-line); box-shadow: var(--shadow-lift); }
.stat-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.stat-value { font-size: 30px; line-height: 1.1; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.stat-foot, .stat-link { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-link { color: var(--violet); font-weight: 600; }
.app-page .stat-balance { background: linear-gradient(135deg, #ffffff 0%, var(--violet-soft) 100%); border-color: var(--violet-line); }
.stat-balance .stat-value { color: var(--violet-ink); }
.app-page .stat-balance .meter { margin: 4px 0 0; }
.connect-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.app-page .connect-card { display: grid; grid-template-rows: auto 1fr auto; gap: 6px; padding: 18px 20px; }
.connect-card strong { font-size: 15px; font-weight: 650; }
.connect-card span { font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.connect-card .button { justify-self: start; margin-top: 8px; }
.app-page .connect-main { border-color: var(--violet-line); background: linear-gradient(135deg, #ffffff 0%, var(--violet-soft) 100%); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; }
.section-head .section-title { margin: 0; }
.guarantees { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.guarantees span { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: 999px; background: var(--lime-soft); color: var(--lime-ink); font-size: 12.5px; font-weight: 650; }
.guarantees span::before { content: ""; width: 6px; height: 6px; background: currentColor; }

.dash-section { margin-top: 32px; }
.section-title { margin: 0 0 12px; font-size: 16px; font-weight: 700; letter-spacing: -.015em; }
.case-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.case-card {
  display: grid; grid-template-rows: auto 1fr auto; gap: 8px; height: 100%; padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); color: inherit; text-decoration: none;
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.case-card:hover { border-color: var(--violet-line); box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.case-pain { font-size: 15px; font-weight: 650; letter-spacing: -.01em; line-height: 1.35; }
.case-pain::before { content: ""; display: inline-block; width: 8px; height: 8px; margin: 0 9px 2px 0; background: #ff4fa3; }
.case-fix { font-size: 13.5px; line-height: 1.5; color: var(--text-2); }
.case-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.case-foot code { padding: 2px 7px; border-radius: 6px; background: var(--violet-soft); color: var(--violet-ink); font-size: 12px; font-weight: 600; }
.case-foot em { font-style: normal; font-size: 13px; font-weight: 650; color: var(--violet); }

.app-page .steps-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.app-page .steps-row li { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.app-page .steps-row li:last-child { border-bottom: 1px solid var(--border); }
.app-page .steps-row a.muted { font-size: 12.5px; color: var(--violet); text-decoration: none; font-weight: 600; margin: 0; }
.app-page .steps-row li.is-done a.muted { color: var(--muted); font-weight: 500; }

/* ---------- sandbox ---------- */

.how { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.how li { display: flex; gap: 12px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 13.5px; }
.how strong { display: block; font-size: 14px; font-weight: 650; }
.how .muted { display: block; margin: 2px 0 0; }
.how-num {
  width: 24px; height: 24px; flex: none; border-radius: 6px; display: grid; place-items: center;
  background: var(--violet-soft, #f3f0ff); color: var(--violet-ink, #4527d6); font-weight: 800; font-size: 12px;
}

/* the key box folds away once the key works */
.key-card, .app-page .key-card { margin-bottom: 16px; padding: 0; }
.key-card > summary {
  list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; border-radius: var(--radius);
}
.key-card > summary::-webkit-details-marker { display: none; }
.key-card > summary:hover { background: var(--subtle); }
.key-card[open] > summary { border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.key-title { display: grid; gap: 1px; min-width: 0; flex: 1; }
.key-title strong { font-size: 14px; font-weight: 650; }
.key-title span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key-title code { font-size: 12.5px; color: var(--text-2); }
.key-toggle { flex: none; font-size: 13px; font-weight: 600; color: var(--violet); }
.key-toggle::after { content: "Change"; }
.key-card[open] .key-toggle::after { content: "Hide"; }
.key-body { padding: 16px 18px 18px; }
.key-form { margin: 0; }
.key-form .field { max-width: 560px; }
.key-card .test-result { margin: 12px 0 0; }
.key-card .test-result:empty { display: none; }
.key-card .test-result .notice, .key-card .test-result.notice { margin-bottom: 0; }

.sandbox-body { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
.sandbox-body[hidden], .fields[hidden] { display: none; }
.tools-card { position: sticky; top: 20px; padding: 16px !important; }
.tools-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.tools-head h2 { font-size: 14px; }
.tool-filter {
  width: 100%; height: 36px; margin: 0 0 8px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; outline: none;
}
.tool-picker { list-style: none; margin: 0; padding: 0 4px 0 0; display: grid; gap: 2px; max-height: min(520px, 60vh); overflow-y: auto; overscroll-behavior: contain; }
.tool-item {
  width: 100%; display: grid; gap: 2px; padding: 9px 10px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.tool-item:hover { background: var(--hover); }
.tool-item.is-active { background: var(--violet-soft, #f3f0ff); border-color: var(--violet-line, #e2dbff); }
.tool-name { font-family: var(--mono); font-size: 12.5px; font-weight: 600; overflow-wrap: anywhere; }
.tool-item.is-active .tool-name { color: var(--violet-ink, #4527d6); }
.tool-summary { font-size: 12.5px; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tool-empty { padding: 10px; font-size: 13px; color: var(--muted); }

.run-card { min-width: 0; }
.run-head h2 { font-family: var(--mono); font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.run-head .muted { max-height: 7.5em; overflow-y: auto; margin-top: 6px; font-size: 14px; color: var(--text-2); white-space: pre-line; }
.fields { margin: 14px 0 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--subtle); }
.fields summary { list-style: none; cursor: pointer; padding: 9px 12px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.fields summary::-webkit-details-marker { display: none; }
.fields summary::after { content: "▾"; float: right; color: var(--muted); }
.fields[open] summary::after { content: "▴"; }
.fields dl { margin: 0; padding: 0 12px 4px; max-height: 240px; overflow-y: auto; }
.fields dl > div { padding: 9px 0; border-top: 1px solid var(--border); font-size: 13px; }
.fields dt { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-weight: 500; }
.fields dt code { font-size: 12.5px; }
.fields dd { margin: 4px 0 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.field-type { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; margin-right: 4px; }
.run-form { margin-top: 16px; }
.run-form textarea { min-height: 200px; max-height: 50vh; }
.run-actions { display: flex; align-items: center; gap: 12px; }
.run-actions .muted { margin: 0; font-size: 13px; }
.result-body { max-height: 420px; overflow: auto; margin: 10px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 1100px) {
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .connect-grid { grid-template-columns: minmax(0, 1fr); }
  .app-page .steps-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .sandbox-body { grid-template-columns: minmax(0, 1fr); }
  .tools-card { position: static; }
  .tool-picker { max-height: 260px; }
}
@media (max-width: 760px) {
  .app-page .main { padding: 24px 16px 48px; }
  .how, .stats-row, .app-page .steps-row { grid-template-columns: minmax(0, 1fr); }
  .run-actions { flex-wrap: wrap; }
  .app-page .sidebar { border-right: 0; border-bottom: 1px solid var(--border); padding: 10px 12px; }
  .app-page .sidebar-brand { padding: 0; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* agent skill card and the per-tool copy button */
.skill-card { margin-bottom: 16px; }
.skill-card .card-head { margin-bottom: 12px; align-items: center; }
.skill-card .card-head .button { flex: none; margin-left: auto; }
.skill-card .card-note code, .skill-card .muted code { font-size: 12.5px; padding: 1px 5px; border-radius: 5px; background: var(--subtle, #f8f7fc); border: 1px solid var(--border, #e9e7f2); }
.run-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.copy-agent { flex: none; }
.skill-card + .toolbar { margin-top: 0; }
