/* Social SDK Cloud dashboard and demo app.
   Direction: a developer console in the shape of a clean social API dashboard (52px top bar, flat
   sidebar, one toolbar row over a full-width table) rendered in charcoal. Grounds step by ~5
   (#0e0e0e / #111 / #161616), four ink tiers, 1px #222 hairlines, Figtree with tabular numerals and
   JetBrains Mono for keys and IDs. Colour lives only in data. Ordered (Bayer)
   dither is reserved for data: KPI sparklines, the edge map and the credit bar. No decorative
   strips, gradients or shadows on surfaces; only the modal lifts off the page. */

:root {
  color-scheme: dark;

  --ground-side: #0e0e0e;
  --ground: #111111;
  --surface: #141416;
  --surface-2: #141414;
  --raised: #1f1f1f;
  --chip: #2a2a2a;
  --line: #222226;
  --line-soft: #1c1c20;
  --line-bar: #1a1a1a;
  --field: #1a1a1a;

  /* One control system: toolbar fields, segmented controls and buttons share these. */
  --control-bg: #141416;
  --control-line: #242428;
  --control-line-hover: #303036;
  --seg-active: #232327;
  --row-hover: #1c1c20;
  --th-ink: #71717a;
  --well: #18181b;
  --well-line: #27272a;
  --title-ink: #f4f4f5;
  --sub-ink: #8b8b92;

  --ink: #f3f3f3;
  --ink-2: #adadad;
  --ink-3: #828282;
  --ink-4: #646464;

  --up: #62dda5;
  --violet: #8a7cfe;
  --green: #5de5a7;
  --yellow: #ffea02;
  --lavender: #c8a2fe;
  --amber: #fec46f;
  --grape: #7a57fa;
  --red: #f2797b;
  --ok: #6bd5a8;

  --sans: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --radius: 12px;
  --radius-sm: 8px;
  /* One height for every toolbar control (buttons, search, selects, segmented controls) and one for form fields. */
  --control-h: 34px;
  --field-h: 36px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --sb-w: 224px;
  --bar-h: 52px;
  --gap: 16px;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--ink);
  font: 400 14px/20px var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin: 0;
}

:focus-visible {
  outline: 2px solid #5a5a5a;
  outline-offset: 2px;
}

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

.icon {
  width: 15px;
  height: 15px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.num {
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: var(--mono);
  font-size: 0.92em;
}

.muted {
  color: var(--ink-3);
}

.faint {
  color: var(--ink-4);
}

.grow {
  flex: 1;
  min-width: 0;
}

.link {
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- dots, marks, badges ---------- */

.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--ink-4);
}

.dot.ok {
  background: var(--ok);
}

.dot.warn {
  background: var(--amber);
}

.dot.err {
  background: var(--red);
}

.dot.violet {
  background: var(--lavender);
}

.status,
.mode,
.cell {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}

.mode {
  gap: 8px;
  color: var(--ink-2);
  font-size: 13px;
}

.mode i {
  width: 6px;
  height: 6px;
  flex: none;
  background: var(--ink-4);
}

.mode.live i {
  background: var(--lavender);
}

.mode.byo i {
  background: var(--amber);
}

.mode.sandbox i {
  background: var(--grape);
}

.sq {
  display: inline-block;
  width: 6px;
  height: 6px;
  flex: none;
}

.pf-logo {
  display: block;
  width: 15px;
  height: 15px;
  flex: none;
  fill: currentColor;
  stroke: none;
}

.pf-mark {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: none;
  color: #e4e4e7;
}

.pf-mark.md {
  width: 22px;
  height: 22px;
}

.pf-mark.md .pf-logo {
  width: 17px;
  height: 17px;
}

.pf-mark.lg {
  width: 24px;
  height: 24px;
}

.pf-mark.lg .pf-logo {
  width: 19px;
  height: 19px;
}

.pf-mark.sm {
  width: 15px;
  height: 15px;
}

.pf-mark.sm .pf-logo {
  width: 13px;
  height: 13px;
}

.pf-mark .icon {
  width: 13px;
  height: 13px;
}

.marks {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
}

.acct-avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  border: 1px solid #2b2b2e;
  background: radial-gradient(circle at 30% 25%, #2a2a2f, #18181b);
  color: #d4d4d8;
  font: 600 11.5px/1 var(--sans);
  letter-spacing: 0.02em;
}

.acct-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.acct-pf-badge {
  position: absolute;
  right: -3px;
  bottom: -2px;
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  color: #e4e4e7;
  box-shadow: 0 0 0 1.5px var(--surface);
}

.acct-pf-badge .pf-logo {
  width: 10px;
  height: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 8px;
  border-radius: 10px;
  background: var(--raised);
  color: var(--ink-2);
  font: 500 12px/1 var(--sans);
  white-space: nowrap;
}

.badge .icon {
  width: 11px;
  height: 11px;
  stroke-width: 2.2;
}

.badge.ok {
  color: var(--up);
}

.badge.violet {
  color: var(--lavender);
}

.badge.mono {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
}

.overline {
  font: 500 11px/14px var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
}

.endpoint {
  flex: none;
  font: 400 11px/20px var(--mono);
  color: var(--ink-4);
  white-space: nowrap;
}

/* ---------- buttons and fields ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: var(--control-h);
  padding: 0 13px;
  border: 1px solid var(--control-line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: #a3a3a3;
  font: 500 13px/1 var(--sans);
  white-space: nowrap;
  transition:
    color 120ms,
    background-color 120ms,
    border-color 120ms;
}

.btn .icon {
  width: 13px;
  height: 13px;
}

.btn:hover {
  color: var(--ink);
  background: var(--row-hover);
}

.btn:active {
  background: var(--seg-active);
}

.btn[disabled] {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

/* Small buttons live in table rows and cards, never in a toolbar. */
.btn.sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12.5px;
  border-radius: 6px;
}

.btn.primary {
  border-color: #ededed;
  background: #ededed;
  color: #111;
  font-weight: 500;
}

.btn.primary:hover {
  background: #fff;
  color: #111;
}

.btn.primary:active {
  background: #d6d6d6;
}

.btn.danger:hover,
.btn.armed {
  color: var(--red);
  border-color: #3a2526;
  background: #1c1616;
}

.btn.ghost {
  border-color: transparent;
  color: var(--ink-3);
}

.btn.ghost:hover {
  color: var(--ink);
  background: var(--raised);
}

.btn.ghost.danger:hover {
  color: var(--red);
  background: #1c1616;
}

.btn.danger-solid {
  border-color: #4a2a2b;
  background: #2a1718;
  color: #ffb4b5;
  font-weight: 500;
}

.btn.danger-solid:hover {
  background: #351c1d;
  color: #ffd0d1;
}

.btn[aria-pressed="true"] {
  color: var(--ink);
  background: var(--raised);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #6b6b6b;
  transition:
    color 120ms,
    background-color 120ms;
}

.icon-btn:hover {
  color: var(--ink);
  background: var(--raised);
}

.icon-btn.sm .icon {
  width: 13px;
  height: 13px;
}

.icon-btn[aria-pressed="true"] {
  color: var(--ink-2);
}

.field {
  display: block;
  margin-top: 14px;
}

.field:first-child {
  margin-top: 0;
}

.field > label,
.field > .label,
.label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  line-height: 16px;
  color: var(--ink-3);
}

.input,
textarea {
  width: 100%;
  height: var(--field-h);
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--ground);
  color: var(--ink);
  font-size: 13px;
  outline: none;
  transition: border-color 120ms;
}

.input::placeholder,
textarea::placeholder {
  color: var(--ink-4);
}

.input:focus,
textarea:focus {
  border-color: #3a3a3a;
}

select.input {
  appearance: none;
  padding-right: 28px;
  background-image:
    linear-gradient(45deg, transparent 50%, #6b6b6b 50%),
    linear-gradient(135deg, #6b6b6b 50%, transparent 50%);
  background-position:
    calc(100% - 14px) 15px,
    calc(100% - 10px) 15px;
  background-size: 4px 4px;
  background-repeat: no-repeat;
}

select.input.sm {
  width: auto;
  height: var(--control-h);
  min-width: 0;
  padding-left: 10px;
  font-size: 12.5px;
  color: var(--ink-2);
  background-position:
    calc(100% - 14px) 13px,
    calc(100% - 10px) 13px;
}

.input.mono {
  font-family: var(--mono);
  font-size: 12.5px;
}

.hint {
  display: block;
  font-size: 12px;
  line-height: 17px;
  color: var(--ink-4);
}

.field-hint {
  margin-top: 6px;
}

.copy-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 3px 3px 3px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--ground);
}

.copy-row code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 400 12.5px/1.4 var(--mono);
  color: var(--ink-2);
}

.notice {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
  color: var(--ink-3);
  font-size: 13px;
  line-height: 18px;
}

.notice .icon {
  width: 14px;
  height: 14px;
  margin-top: 2px;
  color: var(--ink-4);
}

.notice.warn .icon {
  color: var(--amber);
}

/* Loading and inline notes: one quiet line, no card chrome of its own. */
.empty-note {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-4);
  font-size: 13px;
  line-height: 19px;
}

.empty-note.compact {
  padding: 20px 8px;
}

.empty-note strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink-2);
  font-weight: 500;
}

/* The one empty state. It always sits inside a .surface-card and keeps one geometry on every tab. */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  padding: 56px 24px;
  text-align: center;
}

.empty-state-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border: 1px solid var(--well-line);
  border-radius: 10px;
  background: var(--well);
  color: #a1a1aa;
}

.empty-state-icon .icon {
  width: 18px;
  height: 18px;
  stroke-width: 1.6;
}

.empty-state-title {
  margin-top: 14px;
  color: var(--title-ink);
  font: 600 15px/20px var(--sans);
  letter-spacing: -0.01em;
}

/* Two lines reserved, so one-line and two-line copy give the same card height. */
.empty-state-text {
  max-width: 360px;
  min-height: 38px;
  margin-top: 6px;
  color: var(--sub-ink);
  font-size: 13px;
  line-height: 19px;
  text-wrap: pretty;
}

.empty-state-text code {
  color: var(--ink-2);
  font: 400 12px/1 var(--mono);
}

.empty-state-text a {
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.empty-state-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

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

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  flex: none;
  width: var(--sb-w);
  height: 100vh;
  min-width: 0;
  overflow: hidden;
  background: var(--ground-side);
  border-right: 1px solid var(--line-bar);
  transition: width 240ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: width;
}

.sb-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--bar-h);
  padding: 0 18px;
  flex: none;
  border-bottom: 1px solid var(--line-bar);
  overflow: hidden;
  transition: padding 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--ink);
  white-space: nowrap;
}

.brand-mark {
  display: block;
  width: 21px;
  height: 21px;
  flex: none;
}

.wordmark {
  font: 600 17px/1 var(--sans);
  letter-spacing: -0.03em;
  color: var(--ink);
  white-space: nowrap;
  transition: opacity 140ms ease;
}

.sb-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 0 16px;
  scrollbar-width: none;
}

.sb-scroll::-webkit-scrollbar {
  display: none;
}

.sb-group {
  display: grid;
  gap: 2px;
  padding: 0 10px 4px;
}

.sb-label {
  padding: 18px 20px 6px;
  font: 500 11.5px/16px var(--sans);
  color: var(--ink-4);
  white-space: nowrap;
  overflow: hidden;
  transition:
    opacity 150ms ease,
    padding 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.sb-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 34px;
  padding: 6px 10px 6px 11px;
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  font-size: 13.5px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  transition:
    color 120ms,
    background-color 120ms;
}

.sb-link .icon {
  width: 16px;
  height: 16px;
  color: #6b6b6b;
  transition: color 120ms;
}

.sb-link:hover {
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.03);
}

.sb-link:hover .icon {
  color: var(--ink-3);
}

.sb-link[aria-current="page"] {
  background: var(--raised);
  color: var(--ink);
  font-weight: 500;
}

.sb-link[aria-current="page"] .icon {
  color: var(--ink);
}

.sb-link:focus-visible {
  outline-offset: -2px;
}

.sb-text {
  min-width: 0;
  padding-block: 1px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 150ms ease;
}

.sb-count {
  margin-left: auto;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--chip);
  color: #b1b1b1;
  font: 500 11px/18px var(--sans);
  text-align: center;
  transition: opacity 140ms ease;
}

.sb-foot {
  flex: none;
  padding: 10px;
  border-top: 1px solid var(--line-soft);
}

.sb-foot[hidden] {
  display: none;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 4px 5px 8px;
  white-space: nowrap;
  overflow: hidden;
}

.user-copy {
  flex: 1;
}

.user-signout {
  flex: none;
  margin-left: auto;
}

.ws-avatar {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 6px;
  background: #232327;
  border: 1px solid #303036;
  color: var(--ink);
  font: 600 11px/1 var(--sans);
}

.ws-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
  transition: opacity 150ms ease;
}

.ws-title {
  font: 500 12.5px/15px var(--sans);
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-sub {
  font: 400 11px/14px var(--mono);
  color: var(--ink-4);
  overflow: hidden;
  text-overflow: ellipsis;
}

body.sb-collapsed {
  --sb-w: 58px;
}

body.sb-collapsed .sb-head {
  padding: 0 18px;
}

body.sb-collapsed .sb-head .wordmark,
body.sb-collapsed .sb-text,
body.sb-collapsed .sb-count,
body.sb-collapsed .ws-copy,
body.sb-collapsed .user-signout {
  opacity: 0;
  pointer-events: none;
}

body.sb-collapsed .sb-label {
  opacity: 0;
  height: 14px;
  padding: 0;
  margin: 10px 14px 4px;
  border-top: 1px solid var(--line-soft);
}

.main {
  flex: 1;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--bar-h);
  padding: 0 20px 0 14px;
  background: var(--ground);
  border-bottom: 1px solid var(--line-bar);
}

.tb-brand {
  display: none;
  align-items: center;
  color: var(--ink);
  flex: none;
}

.tb-brand .brand-mark {
  width: 20px;
  height: 20px;
}

.tb-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.tb-title h1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 500 14.5px/20px var(--sans);
  letter-spacing: -0.005em;
}

.tb-count {
  flex: none;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid #262626;
  border-radius: 6px;
  color: var(--ink-3);
  font: 400 11.5px/18px var(--mono);
  text-align: center;
}

.tb-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.tb-demo .icon {
  width: 12px;
  height: 12px;
}

.env-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid #1f1f1f;
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
}

.env-pill:empty {
  display: none;
}

.env-pill .dot {
  width: 5px;
  height: 5px;
}

.content {
  max-width: 1320px;
  padding: 20px 24px 64px;
}

.content > * + * {
  margin-top: var(--gap);
}

.page-note {
  font-size: 12px;
  line-height: 17px;
  color: var(--ink-4);
}

.banner {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-3);
}

.banner .icon {
  width: 14px;
  height: 14px;
  color: var(--ink-4);
}

.banner code {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  font: 400 11.5px/1.4 var(--mono);
  color: var(--ink-2);
}

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

/* Every card on every tab: one surface, one hairline, one radius, one header. */
.surface-card {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.surface-card.flush {
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
}

.card-title {
  min-width: 0;
}

.card-head h1,
.card-head h2 {
  font: 600 15px/20px var(--sans);
  letter-spacing: -0.01em;
}

.card-head p {
  margin-top: 3px;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-3);
  max-width: 64ch;
}

.card-body {
  padding: 20px;
}

.card-head + .card-body {
  padding-top: 4px;
}

.rows {
  margin-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--line-soft);
  flex-wrap: wrap;
}

.row:first-child {
  border-top: 0;
}

.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ---------- overview: KPI strip ---------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
}

.kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 16px 0 0;
  overflow: hidden;
}

.kpi > :not(.kpi-spark) {
  padding: 0 20px;
}

.kpi-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  line-height: 16px;
  color: #8a8a8a;
  white-space: nowrap;
}

.kpi-head > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.delta {
  color: var(--up);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.kpi-value {
  margin-top: 10px;
  font: 500 28px/32px var(--sans);
  letter-spacing: -0.03em;
}

.kpi-caption {
  margin-top: 4px;
  font-size: 12px;
  line-height: 16px;
  color: #676767;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-spark {
  margin-top: 10px;
  height: 56px;
  border-top: 1px solid var(--line-soft);
}

.spark {
  display: block;
  overflow: visible;
}

/* ---------- overview: platform activity + edge map ---------- */

.activity {
  overflow: hidden;
}

.activity .segmented {
  flex: none;
}

.activity-body {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 0;
  margin-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.activity-list {
  padding: 18px 20px 20px;
  border-right: 1px solid var(--line-soft);
}

.share + .share {
  margin-top: 16px;
}

.share-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.share-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
}

.share-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  flex: none;
  color: #e4e4e7;
}

.share-logo .pf-logo {
  width: 14px;
  height: 14px;
}

.share-num {
  color: var(--ink);
}

.share-num small {
  display: inline-block;
  min-width: 34px;
  margin-left: 8px;
  color: var(--ink-4);
  font-size: 12px;
  text-align: right;
}

.share-meter {
  height: 2px;
  margin-top: 8px;
  background: #232323;
}

.share-meter span {
  display: block;
  height: 100%;
  min-width: 2px;
}

.share-meter span {
  background: var(--violet);
}

.share-empty {
  margin: 0;
  font-size: 12.5px;
  line-height: 18px;
  color: var(--ink-4);
}

/* Delivery activity: stacked outcome columns over a dot-matrix ground. */

.chart-frame {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 16px 20px 14px;
}

.chart-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
}

.chart-stats div + div {
  padding-left: 14px;
  border-left: 1px solid var(--line-soft);
}

.chart-stats dt {
  font-size: 11.5px;
  line-height: 15px;
  color: var(--ink-4);
}

.chart-stats dd {
  margin: 4px 0 0;
  font-size: 17px;
  line-height: 22px;
  color: var(--ink);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 18px 0 10px;
  font-size: 12px;
  color: var(--ink-3);
}

.chart-legend .cell {
  gap: 7px;
}

.chart-box {
  position: relative;
  flex: 1;
  min-height: 220px;
  margin-right: 30px;
  background-image: radial-gradient(circle, #262626 1px, transparent 1.2px);
  background-size: 10px 10px;
  background-position: 0 0;
}

.chart-grid {
  position: absolute;
  inset: 8px 0 0;
  pointer-events: none;
}

.gridline {
  position: absolute;
  left: 0;
  right: 0;
  margin-top: -1px;
  border-top: 1px dashed #262626;
}

.gridline:last-child {
  border-top: 1px solid #2c2c2c;
}

.gridline b {
  position: absolute;
  right: -30px;
  top: -7px;
  width: 26px;
  font: 400 10.5px/14px var(--mono);
  color: var(--ink-4);
  text-align: left;
}

.chart-cols {
  position: absolute;
  inset: 8px 0 0;
  display: flex;
  align-items: stretch;
  gap: 3px;
}

.col {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  border-radius: 4px 4px 0 0;
  cursor: default;
}

.col.is-hover {
  background: rgba(255, 255, 255, 0.035);
}

.stack {
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  width: 100%;
  max-width: 22px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 4px 4px 0 0;
}

.stack .seg {
  display: block;
  flex-basis: 0;
  min-height: 2px;
}

.col.is-hover .stack {
  filter: brightness(1.12);
}

.chart-tip {
  position: absolute;
  z-index: 3;
  top: 6px;
  display: grid;
  gap: 5px;
  min-width: 150px;
  padding: 9px 11px;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  background: rgba(17, 17, 17, 0.96);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-size: 12px;
  color: var(--ink-2);
  pointer-events: none;
}

.tip-head,
.tip-row {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.tip-head {
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-3);
}

.tip-head b,
.tip-row b {
  margin-left: auto;
  color: var(--ink);
  font-weight: 500;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 4px;
  padding: 16px;
  text-align: center;
  font-size: 12.5px;
  line-height: 18px;
  color: var(--ink-4);
}

.chart-empty strong {
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
}

.chart-box.is-empty {
  background-image: radial-gradient(circle, #1f1f1f 1px, transparent 1.2px);
}

.chart-axis {
  display: flex;
  justify-content: space-between;
  margin: 8px 30px 0 0;
  font: 400 10.5px/14px var(--mono);
  color: var(--ink-4);
}

/* ---------- toolbar, segmented control, search ---------- */

/* One toolbar on every tab: segmented control or pill on the left, actions on the right. */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 36px;
  flex-wrap: wrap;
}

/* The same toolbar inside a card, under its header. */
.toolbar.inset {
  padding: 0 20px 16px;
}

.toolbar-end {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-wrap: wrap;
}

.toolbar-end #clear-slot:empty {
  display: none;
}

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: none;
  max-width: 100%;
  height: var(--control-h);
  padding: 3px;
  border: 1px solid var(--control-line);
  border-radius: var(--radius-sm);
  background: var(--control-bg);
  overflow-x: auto;
  scrollbar-width: none;
}

.segmented::-webkit-scrollbar {
  display: none;
}

.segmented-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 26px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--sub-ink);
  font: 500 12.5px/1 var(--sans);
  white-space: nowrap;
  transition:
    color 120ms,
    background-color 120ms,
    box-shadow 120ms;
}

.segmented-btn:hover {
  color: #d4d4d8;
}

.segmented-btn[aria-pressed="true"] {
  background: var(--seg-active);
  color: var(--title-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.seg-count {
  color: var(--th-ink);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.seg-count:empty {
  display: none;
}

.segmented-btn[aria-pressed="true"] .seg-count {
  color: #a1a1aa;
}

.search-input {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 220px;
  min-width: 180px;
  height: var(--control-h);
  padding: 0 11px;
  border: 1px solid var(--control-line);
  border-radius: var(--radius-sm);
  background: var(--control-bg);
  color: var(--th-ink);
  transition: border-color 120ms;
}

.search-input .icon {
  width: 14px;
  height: 14px;
}

.search-input input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  outline: none;
}

.search-input input::placeholder {
  color: var(--th-ink);
}

.search-input input::-webkit-search-cancel-button {
  filter: grayscale(1) brightness(0.6);
}

.search-input:hover,
.toolbar select.input:hover {
  border-color: var(--control-line-hover);
}

.search-input:focus-within {
  border-color: #3f3f46;
}

.toolbar select.input {
  width: auto;
  height: var(--control-h);
  min-width: 0;
  padding-left: 11px;
  border-color: var(--control-line);
  background-color: var(--control-bg);
  color: var(--ink-2);
  font-size: 13px;
  background-position:
    calc(100% - 14px) 14px,
    calc(100% - 10px) 14px;
}

/* Read-only context at control height: an auth header, an MCP URL, a billing provider. */
.toolbar-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  height: var(--control-h);
  padding: 0 12px;
  border: 1px solid var(--control-line);
  border-radius: var(--radius-sm);
  background: var(--control-bg);
  color: var(--ink-3);
  font-size: 12.5px;
  white-space: nowrap;
}

.toolbar-pill > span,
.toolbar-pill code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolbar-pill code {
  color: var(--ink-2);
  font: 400 12px/1 var(--mono);
}

.toolbar-pill .icon {
  width: 13px;
  height: 13px;
  color: var(--ink-4);
}

/* ---------- data table ---------- */

.log {
  overflow: hidden;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  font-size: 12px;
  line-height: 20px;
  color: var(--ink-4);
  white-space: nowrap;
}

.table-scroll {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  height: 38px;
  padding: 0 16px;
  border-top: 1px solid var(--line-soft);
  color: var(--th-ink);
  font: 500 11px/1 var(--sans);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}

.surface-card.flush > .table-scroll:first-child th {
  border-top: 0;
}

.data-table td {
  height: 52px;
  padding: 0 16px;
  border-top: 1px solid var(--line-soft);
  color: #e4e4e7;
  white-space: nowrap;
}

/* Edge cells line up with the 20px card header inset. */
.data-table th:first-child,
.data-table td:first-child {
  padding-left: 20px;
}

.data-table th:last-child,
.data-table td:last-child {
  padding-right: 20px;
}

.data-table .num {
  text-align: right;
}

.data-table td.muted {
  color: var(--ink-4);
}

.data-table .dest {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink-2);
}

.data-table tbody tr {
  transition: background-color 120ms;
}

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

.data-table .row-actions {
  width: 1%;
  text-align: right;
}

.data-table td.row-actions .btn + .btn {
  margin-left: 4px;
}

tr.clickable {
  cursor: pointer;
}

tr.clickable:focus-visible {
  background: var(--row-hover);
  outline: none;
}

tr.fresh {
  animation: fresh 1.8s var(--ease);
}

@keyframes fresh {
  from {
    background: rgba(138, 124, 254, 0.12);
  }
}

.table-more {
  display: flex;
  justify-content: center;
  padding: 12px;
  border-top: 1px solid var(--line-soft);
}

.log .empty-state {
  border-top: 1px solid var(--line-soft);
}

.pf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1px;
  background: var(--line-soft);
  border-top: 1px solid var(--line-soft);
}

.pf-tile {
  display: block;
  padding: 16px 20px;
  border: 0;
  background: var(--surface);
  text-align: start;
  transition: background-color 120ms;
}

.pf-tile:hover {
  background: var(--field);
}

.pf-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
}

.pf-tile strong {
  display: block;
  margin-top: 12px;
  font: 400 22px/26px var(--sans);
  letter-spacing: -0.02em;
}

.pf-tile-meta {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}

/* ---------- drawer ---------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms var(--ease);
}

body.drawer-open .scrim {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  width: min(520px, 100vw);
  background: #131313;
  border-left: 1px solid var(--line);
  translate: 100% 0;
  visibility: hidden;
  transition:
    translate 240ms var(--ease),
    visibility 0s linear 240ms;
}

body.drawer-open .drawer {
  translate: 0 0;
  visibility: visible;
  transition:
    translate 240ms var(--ease),
    visibility 0s linear 0s;
}

.drawer-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 16px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.drawer-head h2 {
  font: 600 15px/20px var(--sans);
  letter-spacing: -0.01em;
}

.drawer-id {
  margin-top: 2px;
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.drawer-error {
  margin-bottom: 22px;
}

.drawer-section + .drawer-section {
  margin-top: 24px;
}

.drawer-section h3 {
  margin-bottom: 10px;
  font: 500 11px/14px var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
}

.kv {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px 16px;
  margin: 0;
  font-size: 13px;
  line-height: 18px;
}

.kv dt {
  color: var(--ink-4);
}

.kv dd {
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.ledger-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-3);
}

.ledger-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.ledger-row span:last-child {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ledger-row.total {
  color: var(--ink);
  font-weight: 500;
}

.code-wrap {
  position: relative;
}

.code {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--ground);
  color: var(--ink-2);
  font: 400 12px/1.65 var(--mono);
  white-space: pre;
  overflow-x: auto;
}

.code .s {
  color: #9fdcbf;
}

.code .k {
  color: var(--lavender);
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #161616;
}

/* ---------- accounts, OAuth apps, API keys ---------- */

.acct {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  max-width: 100%;
}

.acct-text {
  display: grid;
  min-width: 0;
  overflow: hidden;
}

.acct-name {
  font-size: 13.5px;
  line-height: 18px;
  color: var(--ink);
}

.acct-handle {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 16px;
  color: var(--ink-4);
}

.clip {
  max-width: 150px;
}

.clip {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.oauth-col .clip {
  max-width: 200px;
  color: var(--ink-2);
}

.key-name {
  font-weight: 500;
}

.key-cell {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}

.key-cell code {
  margin-right: 4px;
  font: 400 12.5px/1.4 var(--mono);
  color: var(--ink-2);
}

.key-cell .clip {
  max-width: 280px;
}

.quickstart {
  overflow: hidden;
}

.qs-note {
  margin-top: 12px;
}

.qs-code {
  border: 0;
  border-radius: 0;
  padding: 16px 96px 18px 18px;
  background: var(--surface);
}

.quickstart .copy-btn {
  top: 10px;
  right: 12px;
}

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.62);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 160ms var(--ease),
    visibility 0s linear 160ms;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
  transition:
    opacity 160ms var(--ease),
    visibility 0s linear 0s;
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(480px, 100%);
  max-height: min(680px, calc(100dvh - 32px));
  background: #141414;
  border: 1px solid #262626;
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  scale: 0.97;
  translate: 0 6px;
  transition:
    scale 180ms var(--ease),
    translate 180ms var(--ease);
}

.modal-backdrop.open .modal {
  scale: 1;
  translate: 0 0;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 14px 0 20px;
}

.modal-head h2 {
  font: 600 15.5px/22px var(--sans);
  letter-spacing: -0.01em;
}

.modal-head p {
  margin-top: 3px;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-3);
}

.modal-head .icon-btn {
  margin-top: -2px;
}

.modal-body {
  overflow-y: auto;
  padding: 18px 20px 20px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 20px -20px -20px;
  padding: 14px 20px;
  border-top: 1px solid var(--line-soft);
}

.modal-foot .btn.primary,
.modal-note {
  margin-top: 14px;
}

body.modal-open {
  overflow: hidden;
}

.pf-pick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.pf-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  height: 52px;
  padding: 0 10px 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  text-align: start;
  transition:
    background-color 120ms,
    border-color 120ms;
}

.pf-option:hover {
  background: var(--raised);
  border-color: #2e2e2e;
}

.pf-option[disabled] {
  opacity: 0.5;
  cursor: progress;
}

.pf-option .grow {
  display: grid;
}

.pf-option-name {
  font-size: 13.5px;
  line-height: 18px;
}

.pf-option-meta {
  font-size: 11.5px;
  line-height: 15px;
  color: var(--ink-4);
}

.pf-option .chev {
  width: 13px;
  height: 13px;
  color: var(--ink-4);
  transition: translate 160ms var(--ease);
}

.pf-option:hover .chev {
  translate: 2px 0;
  color: var(--ink-3);
}

.link-result {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 12px;
}

.link-result-name {
  font-size: 14px;
  line-height: 18px;
}

.modal-form .field + .field {
  margin-top: 14px;
}

.secret-field {
  position: relative;
}

.secret-field .input {
  padding-right: 38px;
}

.secret-field .icon-btn {
  position: absolute;
  top: 4px;
  right: 4px;
}

.secret-mask {
  -webkit-text-security: disc;
}

.secret-mask.revealed {
  -webkit-text-security: none;
}

.secret-mask:placeholder-shown {
  -webkit-text-security: none;
}

/* ---------- billing ---------- */

.tier {
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.tiers {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap);
}

.tier-foot {
  margin-top: auto;
  padding-top: 18px;
}

.tier-action {
  width: 100%;
}

.tier.current {
  border-color: rgba(138, 124, 254, 0.42);
  box-shadow: inset 0 0 0 1px rgba(138, 124, 254, 0.08);
}

.tier-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 20px;
}

.tier-head strong {
  font-weight: 600;
  font-size: 15px;
}

.tier-price {
  margin-top: 14px;
  font: 500 32px/36px var(--sans);
  letter-spacing: -0.03em;
}

.tier-price small {
  margin-left: 2px;
  font-size: 13px;
  letter-spacing: 0;
  color: var(--ink-4);
  font-weight: 400;
}

.tier-credit {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink-3);
}

.tier ul {
  display: grid;
  gap: 9px;
  margin: 18px 0 0;
  padding: 16px 0 0;
  list-style: none;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-2);
}

.tier li {
  display: flex;
  gap: 9px;
}

.tier li .icon {
  width: 13px;
  height: 13px;
  margin-top: 3px;
  color: var(--ink-4);
}

.tier.current li .icon {
  color: var(--lavender);
}

.rates {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 14px;
  border-block: 1px solid var(--line-soft);
}

.rate {
  display: grid;
  gap: 2px;
  padding: 12px 18px;
  border-left: 1px solid var(--line-soft);
}

.rate:first-child {
  border-left: 0;
}

.rate-value {
  font: 500 15px/20px var(--sans);
  color: var(--ink);
}

.rate-label {
  font-size: 12px;
  line-height: 16px;
  color: var(--ink-4);
}

.econ {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 40px;
  row-gap: 24px;
}

.econ-value {
  margin-top: 6px;
  font: 500 48px/52px var(--sans);
  letter-spacing: -0.03em;
}

.dbar {
  display: flex;
  gap: 3px;
  height: 18px;
  margin-top: 18px;
  image-rendering: pixelated;
}

.dbar.thin {
  height: 9px;
  margin-top: 8px;
}

.dbar span {
  min-width: 3px;
  image-rendering: pixelated;
}

.econ-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.econ-legend .cell {
  gap: 7px;
}

.econ-legend b {
  color: var(--ink);
  font-weight: 500;
}

.pool {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.pool-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--ink-3);
}

.pool-top span:last-child {
  color: var(--ink);
}

.ledger-note {
  margin-top: 14px;
}

/* ---------- workflows ---------- */

.events {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.event {
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: 400 11.5px/22px var(--mono);
  color: var(--ink-2);
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 100;
  max-width: calc(100vw - 32px);
  padding: 9px 14px;
  border: 1px solid var(--chip);
  border-radius: 8px;
  background: var(--raised);
  color: var(--ink);
  font-size: 13px;
  translate: -50% 8px;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 160ms,
    translate 160ms var(--ease);
}

.toast.show {
  opacity: 1;
  translate: -50% 0;
}

/* ---------- demo app ---------- */

.demo-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 28px;
  background: var(--ground-side);
  border-bottom: 1px solid #171717;
}

.demo-label {
  padding-left: 12px;
  border-left: 1px solid #262626;
  font-size: 14px;
  line-height: 18px;
  color: var(--ink-3);
  white-space: nowrap;
}

.demo-header .spacer {
  flex: 1;
}

.demo-main {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 28px 64px;
}

.stack {
  display: grid;
  gap: var(--gap);
  min-width: 0;
}

.composer .card-head h1 {
  font-size: 18px;
  line-height: 24px;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px 0 10px;
  border: 1px solid #262626;
  border-radius: 16px;
  background: transparent;
  color: var(--ink-3);
  font-size: 13px;
  white-space: nowrap;
  transition:
    color 120ms,
    background-color 120ms,
    border-color 120ms;
}

.pill:hover {
  color: var(--ink-2);
  background: var(--field);
}

.pill[aria-pressed="true"] {
  color: var(--ink);
  background: var(--raised);
  border-color: #383838;
}

.pill-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  color: #e4e4e7;
  transition:
    color 120ms,
    opacity 120ms;
}

.pill-logo .pf-logo {
  width: 14px;
  height: 14px;
}

.pill[aria-pressed="false"] .pill-logo {
  color: var(--ink-4);
  opacity: 0.78;
}

.textarea-wrap {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--ground);
  transition: border-color 120ms;
}

.textarea-wrap:focus-within {
  border-color: #3a3a3a;
}

.textarea-wrap textarea {
  display: block;
  height: 148px;
  padding: 12px 13px;
  border: 0;
  background: transparent;
  resize: vertical;
  font-size: 14.5px;
  line-height: 22px;
}

.textarea-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 0 13px 10px;
  font-size: 12px;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}

.textarea-foot .over {
  color: var(--red);
}

.toggles {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px dashed #2e2e2e;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-3);
  font-size: 12.5px;
  white-space: nowrap;
  transition:
    color 120ms,
    background-color 120ms,
    border-color 120ms;
}

.toggle .icon {
  width: 12px;
  height: 12px;
  stroke-width: 2;
}

.toggle:hover {
  color: var(--ink-2);
}

.toggle[aria-pressed="true"] {
  border-style: solid;
  border-color: #3a3a3a;
  background: var(--raised);
  color: var(--ink);
}

.link-field {
  margin-top: 10px;
}

.fee-hint {
  margin-top: 8px;
  font-size: 12px;
  line-height: 17px;
  color: var(--ink-4);
}

.fee-hint b {
  color: var(--yellow);
  font-weight: 500;
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.composer-actions .hint {
  margin-right: auto;
}

.receipt .card-head {
  padding-top: 22px;
}

.deliveries {
  display: grid;
}

.delivery {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line-soft);
}

.delivery:first-child {
  border-top: 0;
  padding-top: 2px;
}

.delivery-name {
  font-size: 14px;
}

.delivery .meta {
  margin-top: 2px;
  font-size: 12px;
  line-height: 17px;
  color: var(--ink-4);
  overflow-wrap: anywhere;
}

.delivery .meta a {
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.delivery-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  font-size: 13px;
  color: var(--ink-2);
}

.credit-foot {
  margin-top: 10px;
  font-size: 12px;
  line-height: 17px;
  color: var(--ink-4);
}

.receipt-cost {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.receipt-cost-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.history {
  padding-top: 14px;
}

.history-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
}

.history-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.history-row .grow {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
}

.history-when {
  min-width: 56px;
  text-align: end;
}

.api-call summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  cursor: pointer;
  list-style: none;
  font-size: 13.5px;
  color: var(--ink-2);
}

.api-call summary::-webkit-details-marker {
  display: none;
}

.api-call summary span:first-child::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 10px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  rotate: -45deg;
  translate: 0 -1px;
  transition: rotate 160ms var(--ease);
}

.api-call[open] summary span:first-child::before {
  rotate: 45deg;
}

.api-call summary:hover {
  color: var(--ink);
}

.api-call .card-body {
  padding-top: 0;
}

/* ---------- responsive ---------- */

@media (max-width: 1180px) {
  .activity-body {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .tiers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .rates {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rate:nth-child(2n + 1) {
    border-left: 0;
  }

  .rate:nth-child(n + 3) {
    border-top: 1px solid var(--line-soft);
  }
}

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

@media (max-width: 900px) {
  .app {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 50;
    width: 264px;
    height: 100%;
    translate: -100% 0;
    visibility: hidden;
    transition:
      translate 240ms var(--ease),
      visibility 0s linear 240ms;
  }

  body.nav-open .sidebar {
    translate: 0 0;
    visibility: visible;
    transition:
      translate 240ms var(--ease),
      visibility 0s linear 0s;
  }

  body.nav-open .scrim {
    z-index: 45;
    opacity: 1;
    pointer-events: auto;
  }

  body.sb-collapsed .sb-head {
    justify-content: flex-start;
    padding: 0 18px;
  }

  body.sb-collapsed .sb-head .wordmark,
  body.sb-collapsed .sb-text,
  body.sb-collapsed .sb-count,
  body.sb-collapsed .ws-copy,
  body.sb-collapsed .sb-label {
    opacity: 1;
    pointer-events: auto;
  }

  .tb-brand {
    display: inline-flex;
  }

  body.sb-collapsed .sb-label {
    height: auto;
    margin: 0;
    padding: 20px 20px 6px;
    border-top: 0;
  }

  .topbar {
    padding: 0 16px 0 8px;
  }

  .content {
    padding: 16px 16px 48px;
  }

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

  .activity-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .activity-list {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
    padding: 16px;
  }

  .chart-frame {
    padding: 14px 16px 12px;
  }

  .chart-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 12px;
  }

  .chart-stats div:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }

  .chart-box {
    min-height: 170px;
  }

  .chart-cols {
    gap: 2px;
  }

  .toolbar.inset {
    padding: 0 16px 16px;
  }

  .toolbar .search-input,
  .toolbar .toolbar-pill {
    flex: 1 1 100%;
    width: auto;
  }

  .toolbar select.input {
    flex: 1 1 0;
    min-width: 0;
  }

  .toolbar > .segmented:first-child {
    width: 100%;
  }

  .toolbar > .segmented:first-child .segmented-btn {
    flex: 1;
  }

  .toolbar-end {
    width: 100%;
    margin-left: 0;
  }

  .toolbar-end > .btn {
    flex: 1;
  }

  .log .toolbar-end {
    width: auto;
  }

  .data-table .col-wide {
    display: none;
  }

  .data-table th:first-child,
  .data-table td:first-child {
    padding-left: 16px;
  }

  .data-table th:last-child,
  .data-table td:last-child {
    padding-right: 16px;
  }

  .card-head {
    flex-wrap: wrap;
    padding: 16px;
  }

  .card-body {
    padding: 16px;
  }

  .card-head + .card-body {
    padding-top: 4px;
  }

  .card-head .endpoint {
    display: none;
  }

  .row {
    padding: 12px 16px;
  }

  .kv {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .econ-value {
    font-size: 40px;
    line-height: 44px;
  }

  .rate {
    padding: 12px 16px;
  }

  .demo-header {
    gap: 10px;
    height: 52px;
    padding: 0 16px;
  }

  .demo-main {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px 16px 48px;
  }

  .api-call summary {
    padding: 14px 16px;
  }
}

@media (max-width: 560px) {
  .data-table .col-mid {
    display: none;
  }

  .data-table th,
  .data-table td {
    padding: 0 12px;
  }

  .acct-handle {
    max-width: 140px;
  }

  /* Row buttons with an icon collapse to it; text-only states (Confirm cancel) keep their label. */
  td.row-actions .btn:has(.icon) span {
    display: none;
  }

  td.row-actions .btn:has(.icon) {
    width: 28px;
    padding: 0;
  }

  .tb-right .env-pill {
    display: none;
  }

  .tb-demo {
    padding: 0 8px;
  }

  .toolbar .segmented {
    flex: 1 1 auto;
  }

  .toolbar .segmented-btn {
    flex: 1;
  }

  .toolbar > .btn {
    flex: 1;
  }

  .pf-pick {
    grid-template-columns: minmax(0, 1fr);
  }

  .modal-backdrop {
    align-items: end;
    padding: 8px;
  }

  .modal {
    max-height: calc(100dvh - 16px);
  }

  .modal-foot {
    flex-wrap: wrap-reverse;
  }

  .modal-foot .btn {
    flex: 1;
  }

  .qs-code {
    padding-right: 18px;
    padding-top: 52px;
  }

  .key-cell .clip {
    max-width: 130px;
  }

  .demo-header .env-pill {
    display: none;
  }

  .composer-actions {
    flex-wrap: wrap;
  }

  .composer-actions .btn {
    width: 100%;
  }
}

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

/* MCP view: tool group headings and the resources row. */
.wf-mcp-group-head {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 20px;
  background: var(--ground);
  color: var(--ink-4);
  font: 500 11.5px/1.3 var(--sans);
  letter-spacing: 0.02em;
}

.wf-mcp-resources {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--line-soft);
}

@media (max-width: 640px) {
  .wf-mcp-tool.wf-mcp-tool-filler {
    display: none;
  }
}
