/* =========================================================================
   Apicraft — shared design system
   Editorial logbook aesthetic. Warm cream paper / darkroom-warm-dark.
   Fraunces wordmark, Instrument Sans UI, IBM Plex Mono for HTTP data.
   Cinnabar accent. Paper grain. Manifesto-aligned: calm, crafted, no slop.
   ========================================================================= */

:root {
  --paper:        #F4EFE4;
  --paper-2:      #FBF7EC;
  --paper-edge:   #E2DBC9;
  --paper-hair:   #D6CDB7;
  --ink:          #1B1813;
  --ink-2:        #5A554B;
  --ink-3:        #8E8779;
  --ink-faint:    #BCB4A0;

  --accent:       #A0392A;
  --accent-soft:  #C76A52;

  --ok:    #4E7A3A;
  --warn:  #AE832A;
  --err:   #A0392A;
  --info:  #41617B;

  --m-get:    #41617B;
  --m-post:   #4E7A3A;
  --m-put:    #AE832A;
  --m-delete: #A0392A;
  --m-patch:  #6E5483;
  --m-head:   #8E8779;

  --json-key:    #5A554B;
  --json-string: #41617B;
  --json-number: #AE832A;
  --json-bool:   #A0392A;
  --json-punct:  #BCB4A0;

  --radius-card:  14px;
  --radius-input: 10px;
  --radius-pill:  999px;
  --radius-sm:    6px;

  --shadow-card: 0 1px 0 rgba(27, 24, 19, 0.04),
                 0 8px 32px -10px rgba(27, 24, 19, 0.10);
  --shadow-card-hover: 0 2px 0 rgba(27, 24, 19, 0.05),
                       0 18px 44px -12px rgba(27, 24, 19, 0.16);
  --shadow-sticky: 0 8px 16px -12px rgba(27, 24, 19, 0.12);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 88px;

  --sidebar-w:   268px;
  --topbar-h:    46px;
  --tabbar-h:    38px;
  --statusbar-h: 32px;
  --canvas-max:  820px;
  --content-width: 760px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:        #14120D;
    --paper-2:      #1C1914;
    --paper-edge:   #2A261D;
    --paper-hair:   #322E24;
    --ink:          #ECE6D5;
    --ink-2:        #B5AE9D;
    --ink-3:        #7C7669;
    --ink-faint:    #4A453D;

    --accent:       #E89580;
    --accent-soft:  #C5705A;

    --ok:    #93B074;
    --warn:  #D9B062;
    --err:   #E89580;
    --info:  #8AA0BA;

    --m-get:    #8AA0BA;
    --m-post:   #93B074;
    --m-put:    #D9B062;
    --m-delete: #E89580;
    --m-patch:  #B49AC2;
    --m-head:   #7C7669;

    --json-key:    #B5AE9D;
    --json-string: #8AA0BA;
    --json-number: #D9B062;
    --json-bool:   #E89580;
    --json-punct:  #4A453D;

    --shadow-card: 0 0 0 1px rgba(255, 248, 230, 0.05),
                   0 12px 28px rgba(0, 0, 0, 0.45);
    --shadow-card-hover: 0 0 0 1px rgba(255, 248, 230, 0.10),
                         0 20px 36px rgba(0, 0, 0, 0.55);
    --shadow-sticky: 0 12px 22px rgba(0, 0, 0, 0.45);
  }
}

/* ========== RESET ========== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
input, textarea { font: inherit; color: inherit; background: none; border: none; padding: 0; }
input:focus, textarea:focus { outline: none; }
ol, ul { list-style: none; padding: 0; margin: 0; }
a { color: inherit; text-decoration: none; }

body {
  font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2' seed='4'/><feColorMatrix values='0 0 0 0 0.1 0 0 0 0 0.09 0 0 0 0 0.075 0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.045'/></svg>");
}

@media (prefers-color-scheme: dark) {
  body {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2' seed='4'/><feColorMatrix values='0 0 0 0 0.95 0 0 0 0 0.9 0 0 0 0 0.82 0 0 0 0.07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  }
}

.mono {
  font-family: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

code.mono, .marketing code {
  font-size: 0.92em;
  padding: 1px 5px;
  background: color-mix(in oklab, var(--ink) 6%, transparent);
  border-radius: 4px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

/* ============================================================================
   MARKETING PAGE
   ============================================================================ */

body.marketing { overflow-x: hidden; }

.marketing-page {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-9) var(--space-6) var(--space-9);
}

@media (max-width: 720px) {
  .marketing-page { padding: var(--space-7) var(--space-4); }
}

.marketing-masthead {
  text-align: center;
  margin-bottom: var(--space-7);
}

.marketing-wordmark {
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-weight: 350;
  font-size: clamp(72px, 13vw, 128px);
  line-height: 0.95;
  margin: 0 0 var(--space-4);
  letter-spacing: -0.04em;
  font-variation-settings: 'opsz' 144, 'SOFT' 50, 'WONK' 1;
  color: var(--ink);
}

.marketing-meta {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-3);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

.marketing-meta-divider {
  display: inline-block;
  width: 1px;
  height: 10px;
  background: var(--paper-hair);
}

.marketing-tagline {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: clamp(22px, 3.4vw, 32px);
  line-height: 1.3;
  margin: var(--space-7) auto 0;
  max-width: 32ch;
  text-align: center;
  letter-spacing: -0.015em;
  font-variation-settings: 'opsz' 48, 'SOFT' 40;
  color: var(--ink);
}

.marketing-tagline em {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}

.marketing-lead {
  margin: var(--space-5) auto 0;
  font-size: 16px;
  line-height: 1.6;
  max-width: 56ch;
  text-align: center;
  color: var(--ink-2);
}

/* ── Hero CTA — "try the workspace" link below the lead ──────────── */

.marketing-cta {
  margin: var(--space-6) 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.cta-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  background: var(--ink);
  color: var(--paper);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border-radius: var(--radius-pill);
  transition: background 180ms ease, transform 180ms ease, gap 180ms ease;
  box-shadow: var(--shadow-card);
}

.cta-primary:hover {
  background: color-mix(in oklab, var(--ink) 88%, var(--accent));
  gap: 14px;
  transform: translateY(-1px);
}

.cta-primary:active { transform: translateY(0); }

.cta-arrow {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-weight: 500;
}

.cta-note {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

/* ── Waitlist signup form ──────────────────────────────────────────── */

.signup {
  margin: var(--space-7) auto 0;
  max-width: 520px;
  background: var(--paper-2);
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius-card);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
}

.signup-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.signup-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: 19px;
  margin: 0;
  letter-spacing: -0.01em;
  font-variation-settings: 'opsz' 24, 'SOFT' 50;
}

.signup-meta {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

.signup-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.signup-row {
  display: flex;
  gap: var(--space-3);
}

@media (max-width: 520px) {
  .signup-row { flex-direction: column; }
}

.signup-input {
  flex: 1;
  font-size: 15px;
  padding: 12px 14px;
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius-input);
  background: var(--paper);
  color: var(--ink);
  transition: border-color 160ms ease;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  letter-spacing: -0.01em;
}

.signup-input::placeholder { color: var(--ink-3); }
.signup-input:focus { border-color: var(--accent-soft); }

.signup-button {
  padding: 12px 22px;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius-input);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: background 160ms ease, transform 160ms ease;
  white-space: nowrap;
}

.signup-button:hover {
  background: color-mix(in oklab, var(--ink) 88%, var(--accent));
}

.signup-button:active { transform: translateY(1px); }

.signup-button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.signup-hint {
  font-size: 12px;
  color: var(--ink-3);
  margin: 0;
  text-align: center;
}

.signup-success,
.signup-error {
  padding: 12px 14px;
  border-radius: var(--radius-input);
  font-size: 14px;
  margin: 0;
}

.signup-success {
  background: color-mix(in oklab, var(--ok) 10%, transparent);
  border: 1px solid color-mix(in oklab, var(--ok) 30%, transparent);
  color: var(--ok);
}

.signup-error {
  background: color-mix(in oklab, var(--err) 10%, transparent);
  border: 1px solid color-mix(in oklab, var(--err) 30%, transparent);
  color: var(--err);
}

.cf-turnstile { margin: var(--space-2) auto 0; min-height: 65px; display: flex; justify-content: center; }

/* ── What it does · feature blocks ───────────────────────────────── */

.marketing-section {
  margin: var(--space-9) 0;
}

.marketing-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--paper-edge);
}

.marketing-section-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: 28px;
  margin: 0;
  letter-spacing: -0.015em;
  font-variation-settings: 'opsz' 36, 'SOFT' 50;
}

.marketing-section-meta {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

.feature-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

@media (max-width: 720px) {
  .feature-list { grid-template-columns: 1fr; }
}

.feature {
  background: var(--paper-2);
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius-card);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  position: relative;
  transition: border-color 180ms ease, transform 180ms ease;
}

.feature::before {
  content: '';
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 2px;
  background: transparent;
  border-radius: 2px;
  transition: background 180ms ease;
}

.feature:hover {
  border-color: var(--ink-3);
  transform: translateY(-1px);
}

.feature:hover::before {
  background: var(--accent);
}

.feature-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: 19px;
  margin: 0;
  letter-spacing: -0.01em;
  font-variation-settings: 'opsz' 24, 'SOFT' 50;
}

.feature-body {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0;
}

.feature-tag {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  text-transform: uppercase;
}

/* ── Pricing teaser ──────────────────────────────────────────────── */

.pricing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

@media (max-width: 720px) {
  .pricing-grid { grid-template-columns: 1fr; }
}

.tier {
  background: var(--paper-2);
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius-card);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.tier-name {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: 22px;
  margin: 0;
  letter-spacing: -0.01em;
  font-variation-settings: 'opsz' 28, 'SOFT' 50;
}

.tier-price {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 13px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

.tier-body {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0;
}

.tier-bullets {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-2);
  margin-top: var(--space-2);
}

.tier-bullets li {
  position: relative;
  padding-left: 18px;
}

.tier-bullets li::before {
  content: '·';
  position: absolute;
  left: 4px;
  color: var(--accent);
  font-weight: 700;
}

.tier-foot {
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: 1px dashed var(--paper-hair);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

.tier-cta {
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px dashed var(--paper-hair);
  font-size: 13px;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: gap 160ms ease;
}

.tier-cta:hover { gap: 10px; }

/* ── Manifesto block ──────────────────────────────────────────────── */

.manifesto {
  margin: var(--space-9) 0;
  padding: var(--space-6);
  background: var(--paper-2);
  border: 1px solid var(--paper-edge);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-card);
}

.manifesto-quote {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: 20px;
  line-height: 1.45;
  margin: 0 0 var(--space-3);
  font-variation-settings: 'opsz' 28, 'SOFT' 50;
  letter-spacing: -0.005em;
}

.manifesto-attr {
  margin: 0;
  font-size: 12px;
  color: var(--ink-3);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  letter-spacing: 0.04em;
}

/* ── Footer ──────────────────────────────────────────────────────── */

.marketing-footer {
  margin-top: var(--space-9);
  padding-top: var(--space-5);
  border-top: 1px solid var(--paper-edge);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--ink-3);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  letter-spacing: 0.02em;
}

@media (max-width: 520px) {
  .marketing-footer { flex-direction: column; gap: var(--space-3); }
}

.marketing-footer a:hover { color: var(--ink); }

.footer-mark {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 15px;
  color: var(--ink-2);
  font-variation-settings: 'opsz' 18, 'SOFT' 50;
  letter-spacing: -0.005em;
  text-transform: none;
}

/* ── Page entrance ───────────────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  .marketing-page > * { animation: enter 700ms cubic-bezier(0.16, 1, 0.3, 1) both; }
  .marketing-masthead { animation-delay:   0ms; }
  .signup            { animation-delay: 120ms; }
  .marketing-section { animation-delay: 220ms; }
  .manifesto         { animation-delay: 320ms; }
  .marketing-footer  { animation-delay: 420ms; }
}

@keyframes enter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   WORKSPACE SHELL — three-pane (lifted from design POC)
   ============================================================================ */

.workspace-app {
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr var(--statusbar-h);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.workspace-row {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 0;
  border-top: 1px solid var(--paper-edge);
}

/* topbar */
.ws-topbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-4) 0 var(--space-5);
  background: var(--paper-2);
  position: relative;
}

.ws-brand {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: 19px;
  letter-spacing: -0.015em;
  font-variation-settings: 'opsz' 24, 'SOFT' 50, 'WONK' 1;
  color: var(--ink);
}

.ws-divider {
  width: 1px;
  height: 18px;
  background: var(--paper-edge);
}

.ws-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 5px 10px 5px 9px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.ws-pill:hover { background: var(--paper); }

.ws-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
}

.ws-topbar-spacer { flex: 1; }

.ws-palette {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 5px 6px 5px 10px;
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink-3);
  font-size: 12px;
  min-width: 220px;
}

.ws-palette:hover { border-color: var(--ink-3); color: var(--ink-2); }

.ws-palette-label { flex: 1; text-align: left; }

.ws-palette-key {
  font-size: 11px;
  color: var(--ink-3);
  padding: 1px 6px;
  background: var(--paper-2);
  border: 1px solid var(--paper-edge);
  border-radius: 4px;
  letter-spacing: 0.04em;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

/* sidebar */
.ws-sidebar {
  background: var(--paper);
  border-right: 1px solid var(--paper-edge);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.ws-sidebar-head {
  padding: var(--space-4) var(--space-4) var(--space-3);
  border-bottom: 1px solid var(--paper-edge);
}

.ws-workspace-name {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: 17px;
  margin: 0;
  letter-spacing: -0.01em;
  font-variation-settings: 'opsz' 24, 'SOFT' 50;
}

.ws-workspace-meta {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

.ws-tree {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2) 0;
}

.ws-section { padding: 2px var(--space-3); }

.ws-section-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px var(--space-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--ink-2);
  transition: background 140ms ease, color 140ms ease;
}

.ws-section-head:hover { background: var(--paper-2); color: var(--ink); }

.ws-section-name {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex: 1;
}

.ws-section-count {
  font-size: 10.5px;
  color: var(--ink-3);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

.ws-items {
  margin: 2px 0 6px 4px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ws-item {
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 8px 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--ink-2);
  font-size: 13px;
  position: relative;
}

.ws-item:hover { background: var(--paper-2); color: var(--ink); }

.ws-item.is-active {
  background: color-mix(in oklab, var(--accent) 8%, var(--paper-2));
  color: var(--ink);
}

.ws-item.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 5px;
  bottom: 5px;
  width: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.ws-method {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

.ws-item-name {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12.5px;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* method colors */
.method--get    { color: var(--m-get); }
.method--post   { color: var(--m-post); }
.method--put    { color: var(--m-put); }
.method--delete { color: var(--m-delete); }
.method--patch  { color: var(--m-patch); }
.method--head   { color: var(--m-head); }

/* canvas pane */
.ws-canvas-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--paper);
}

.ws-canvas-scroll {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.ws-canvas-content {
  max-width: var(--canvas-max);
  margin: 0 auto;
  padding: var(--space-5) var(--space-6) var(--space-7);
}

.ws-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: var(--space-4);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

.ws-breadcrumb .sep { color: var(--ink-faint); }
.ws-breadcrumb .current { color: var(--ink-2); }

/* composer */
.ws-composer {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--paper);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  background-image: linear-gradient(to bottom, var(--paper) 92%, transparent 100%);
}

.ws-url-bar {
  display: flex;
  align-items: stretch;
  background: var(--paper-2);
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius-input);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.ws-url-bar:focus-within { border-color: var(--accent-soft); }

.ws-method-select {
  padding: 0 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  border-right: 1px solid var(--paper-edge);
  background: var(--paper);
  min-width: 88px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  appearance: none;
  cursor: pointer;
}

.ws-url-input {
  flex: 1;
  padding: 0 var(--space-4);
  font-size: 14px;
  height: 46px;
  color: var(--ink);
  letter-spacing: -0.01em;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

.ws-send {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-5);
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  font-weight: 500;
  border-left: 1px solid var(--paper-edge);
}

.ws-send:hover { background: color-mix(in oklab, var(--ink) 90%, var(--accent)); }
.ws-send[disabled] { opacity: 0.6; cursor: wait; }

.ws-send-key {
  font-size: 11px;
  opacity: 0.7;
  padding: 1px 5px;
  background: color-mix(in oklab, var(--paper) 18%, transparent);
  border-radius: 4px;
  letter-spacing: 0.04em;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

/* ── Composer sections (Headers, Body, etc.) ──────────────────── */

.ws-section-block {
  margin-top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ws-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 4px;
}

.ws-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.ws-section-count {
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}

/* ── Headers KV editor ─────────────────────────────────────────── */

.ws-headers-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ws-header-row {
  display: grid;
  grid-template-columns: 220px 1fr 28px;
  gap: 6px;
  align-items: stretch;
}

@media (max-width: 720px) {
  .ws-header-row { grid-template-columns: 1fr 1fr 28px; }
}

.ws-header-key,
.ws-header-value {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius-input);
  background: var(--paper-2);
  color: var(--ink);
  font-size: 13px;
  letter-spacing: -0.01em;
  transition: border-color 140ms ease;
}

.ws-header-key { font-weight: 500; }
.ws-header-key::placeholder,
.ws-header-value::placeholder { color: var(--ink-3); }

.ws-header-key:focus,
.ws-header-value:focus { border-color: var(--accent-soft); }

.ws-header-remove {
  width: 28px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 140ms ease, color 140ms ease;
}

.ws-header-remove:hover {
  background: color-mix(in oklab, var(--err) 10%, transparent);
  color: var(--err);
}

.ws-headers-add {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12.5px;
  color: var(--accent);
  border: 1px dashed var(--paper-edge);
  border-radius: var(--radius-pill);
  transition: border-color 140ms ease, background 140ms ease;
}

.ws-headers-add:hover {
  border-color: var(--accent);
  background: color-mix(in oklab, var(--accent) 6%, transparent);
}

/* ── Auth helper ───────────────────────────────────────────────── */

.ws-auth-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ws-auth-type,
.ws-auth-location {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 13px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius-input);
  background: var(--paper-2);
  color: var(--ink);
  appearance: none;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
                    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 14px) 16px, calc(100% - 9px) 16px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

.ws-auth-type:focus,
.ws-auth-location:focus { border-color: var(--accent-soft); outline: none; }

.ws-auth-type { align-self: flex-start; min-width: 180px; }
.ws-auth-location { min-width: 140px; }

.ws-auth-fields .ws-auth-group { display: none; gap: 6px; }

.ws-auth-fields[data-active="bearer"] .ws-auth-group[data-for="bearer"],
.ws-auth-fields[data-active="apikey"] .ws-auth-group[data-for="apikey"],
.ws-auth-fields[data-active="basic"]  .ws-auth-group[data-for="basic"] {
  display: flex;
}

.ws-auth-fields[data-active="apikey"] .ws-auth-group[data-for="apikey"] {
  display: grid;
  grid-template-columns: 220px 1fr 140px;
  gap: 6px;
}

@media (max-width: 720px) {
  .ws-auth-fields[data-active="apikey"] .ws-auth-group[data-for="apikey"] {
    grid-template-columns: 1fr;
  }
}

.ws-auth-fields[data-active="basic"] .ws-auth-group[data-for="basic"] {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

@media (max-width: 720px) {
  .ws-auth-fields[data-active="basic"] .ws-auth-group[data-for="basic"] {
    grid-template-columns: 1fr;
  }
}

.ws-auth-input {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius-input);
  background: var(--paper-2);
  color: var(--ink);
  font-size: 13px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  letter-spacing: -0.01em;
  transition: border-color 140ms ease;
}

.ws-auth-input::placeholder { color: var(--ink-3); }
.ws-auth-input:focus { border-color: var(--accent-soft); }

/* ── Body editor ───────────────────────────────────────────────── */

.ws-body-input {
  width: 100%;
  min-height: 90px;
  padding: 12px 14px;
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius-input);
  background: var(--paper-2);
  color: var(--ink);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}

.ws-body-input::placeholder { color: var(--ink-3); }
.ws-body-input:focus { border-color: var(--accent-soft); }

.ws-send-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.ws-send-divider .line { height: 1px; background: var(--paper-edge); }

.ws-send-divider .label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px;
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

/* run result stack toolbar (clear history etc.) */
.ws-runs-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  margin-bottom: var(--space-2);
}

.ws-runs-meta {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}

.ws-clear-history {
  font-size: 12px;
  color: var(--ink-3);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.ws-clear-history:hover {
  border-color: var(--err);
  color: var(--err);
  background: color-mix(in oklab, var(--err) 8%, transparent);
}

.ws-clear-history[disabled] { opacity: 0.5; cursor: wait; }

/* run result stack */
.ws-runs {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.ws-run {
  background: var(--paper-2);
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius-card);
  overflow: hidden;
  position: relative;
}

.ws-run.is-expanded { box-shadow: var(--shadow-card); }

.ws-run-head {
  display: grid;
  grid-template-columns: 24px 76px auto auto auto 1fr auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
}

.ws-run-time { font-size: 12.5px; color: var(--ink-2); font-family: 'IBM Plex Mono', ui-monospace, monospace; }

.ws-run-status { display: inline-flex; align-items: center; gap: 7px; }

.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status-dot--ok { background: var(--ok); }
.status-dot--warn { background: var(--warn); }
.status-dot--err { background: var(--err); }
.status-dot--info { background: var(--info); }

.ws-run-status-code { font-size: 13px; font-weight: 600; color: var(--ink); font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.ws-run-status-text { font-size: 12px; color: var(--ink-3); }

.ws-run-stat { display: inline-flex; align-items: baseline; gap: 5px; }
.ws-run-stat-label { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.ws-run-stat-val { font-size: 12px; color: var(--ink-2); font-family: 'IBM Plex Mono', ui-monospace, monospace; }

.ws-run-spacer { width: 1px; }
.ws-run-source { font-size: 11px; color: var(--ink-3); font-family: 'IBM Plex Mono', ui-monospace, monospace; }

.ws-run-body { border-top: 1px solid var(--paper-edge); padding: var(--space-4) var(--space-5); background: var(--paper); }

.ws-run-body pre {
  margin: 0;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink);
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-x: auto;
}

.ws-run-body .jk { color: var(--json-key); }
.ws-run-body .js { color: var(--json-string); }
.ws-run-body .jn { color: var(--json-number); }
.ws-run-body .jb { color: var(--json-bool); }
.ws-run-body .jp { color: var(--json-punct); }

.ws-empty {
  text-align: center;
  padding: var(--space-7) var(--space-4);
  color: var(--ink-3);
  font-size: 14px;
}

.ws-empty .lead {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px;
  margin-bottom: var(--space-3);
  font-variation-settings: 'opsz' 28, 'SOFT' 50;
  color: var(--ink-2);
}

/* statusbar */
.ws-statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 var(--space-5);
  background: color-mix(in oklab, var(--paper) 88%, transparent);
  backdrop-filter: saturate(160%) blur(20px);
  -webkit-backdrop-filter: saturate(160%) blur(20px);
  border-top: 1px solid var(--paper-edge);
  font-size: 11px;
  color: var(--ink-3);
}

.ws-statusbar-left,
.ws-statusbar-right {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
}

.ws-statusbar-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

.ws-statusbar-value {
  color: var(--ink-2);
  font-size: 11px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

.ws-statusbar-divider {
  display: inline-block;
  width: 1px;
  height: 10px;
  background: var(--paper-hair);
}

/* HTMX indicators */
.htmx-indicator { opacity: 0; transition: opacity 200ms ease; }
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-request.htmx-indicator { opacity: 1; }
