:root {
  --bg: #f7f7f8;
  --bg-soft: #ffffff;
  --panel: #ffffff;
  --panel-2: #f2f3f5;
  --border: #16181d;
  --border-soft: #d8dae0;
  --text: #111318;
  --text-dim: #4b4f58;
  --text-faint: #767b87;
  --blue: #2563eb;
  --purple: #7c3aed;
  --grad: linear-gradient(90deg, #16181d, #3a3f4b);
  --green: #15803d;
  --red: #b91c1c;
  --amber: #b45309;
  --ink: #111318;
  --radius: 14px;
  --radius-sm: 10px;
  --nav-h: 62px;
  --topbar-h: 58px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

body { font-size: 14.5px; line-height: 1.5; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img, svg { max-width: 100%; }

::selection { background: rgba(139, 92, 246, 0.35); }

.hidden { display: none !important; }

/* ============ App Shell (dashboard / task / profile) ============ */

.app-shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 20px;
}

.sidebar__logo {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: -0.2px;
  color: #fff;
  flex-shrink: 0;
}

.sidebar__brandname {
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: -0.2px;
  white-space: nowrap;
}
.sidebar__brandname em {
  font-style: normal;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  margin-bottom: 16px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}

.sidebar__user-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}
.sidebar__user-email {
  font-size: 11.5px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.navitem {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.navitem:hover { background: var(--panel-2); color: var(--text); }
.navitem.is-active {
  background: var(--ink);
  color: #fff;
  box-shadow: none;
}
.navitem__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
}
.navitem__icon svg { width: 100%; height: 100%; }
.navitem__label { min-width: 0; }

/* Only shown as a tab in the mobile bottom bar */
.navitem--logout-mobile { display: none; }

.sidebar__footer {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 10px;
}

.main {
  padding: 26px 32px 56px;
  max-width: 1280px;
  width: 100%;
  min-width: 0;
}

.crumb {
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 6px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 22px;
}

.page-head h1 {
  font-size: 26px;
  margin: 0 0 6px;
  letter-spacing: -0.4px;
}
.page-head p {
  margin: 0;
  color: var(--text-dim);
  font-size: 13.5px;
}

/* ============ Buttons ============ */

.btn {
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s ease, filter 0.12s ease, opacity 0.12s ease, border-color 0.15s ease;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn--primary {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 6px 14px -8px rgba(17, 19, 24, 0.55);
}
.btn--primary:hover { filter: brightness(1.08); }

.btn--ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn--ghost:hover { color: var(--text); border-color: var(--text-faint); }

.btn--sm { padding: 7px 12px; font-size: 12.5px; }
.btn--block { width: 100%; justify-content: center; }
.btn--danger { background: rgba(239, 68, 68, 0.12); color: #b91c1c; }
.btn--icon { padding: 8px; border-radius: 9px; }

.btn.is-loading .btn__label { opacity: 0; }
.btn__spinner { display: none; }
.btn.is-loading .btn__spinner {
  display: block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  position: absolute;
  animation: spin 0.7s linear infinite;
}
.btn.is-loading { position: relative; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Cards / stats ============ */

.card {
  background: var(--panel);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  min-width: 0;
  box-shadow: 0 1px 0 rgba(17,19,24,0.03);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat-grid--3 { grid-template-columns: repeat(3, 1fr); }
.stat-grid--4 { grid-template-columns: repeat(4, 1fr); }

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}
.stat-card__icon {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.stat-card__icon svg { width: 16px; height: 16px; }
.stat-card__icon--blue { background: rgba(59,130,246,0.15); color: #1d4ed8; }
.stat-card__icon--purple { background: rgba(139,92,246,0.15); color: #6d28d9; }
.stat-card__icon--red { background: rgba(239,68,68,0.15); color: #b91c1c; }
.stat-card__icon--green { background: rgba(34,197,94,0.15); color: #15803d; }

.stat-card__label { font-size: 12px; color: var(--text-faint); margin-bottom: 4px; }
.stat-card__value { font-size: 23px; font-weight: 700; letter-spacing: -0.5px; }
.stat-card__delta { font-size: 11.5px; color: #15803d; margin-top: 4px; }

.grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
  align-items: start;
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}
.card__head h3 { margin: 0 0 4px; font-size: 15px; }
.card__head p { margin: 0; font-size: 12px; color: var(--text-faint); }
.card__link { font-size: 12px; color: #1d4ed8; font-weight: 600; white-space: nowrap; }

.chart-wrap { width: 100%; }
.chart-wrap svg { width: 100%; height: auto; display: block; }
.chart-labels {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-faint); margin-top: 8px;
}

.steps-list { display: flex; flex-direction: column; gap: 14px; }
.step-row { display: flex; align-items: center; gap: 12px; }
.step-row__num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--panel-2); display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text-dim); flex-shrink: 0;
}
.step-row__name { font-size: 13.5px; font-weight: 600; }
.step-row__sub { font-size: 11.5px; color: var(--text-faint); }
.step-row__status { margin-left: auto; font-size: 11.5px; display: flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot--green { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot--red { background: var(--red); box-shadow: 0 0 8px var(--red); }

/* ============ Table ============ */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; color: var(--text-faint); font-weight: 600;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em;
  padding: 8px 10px; border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}
table.tbl td { padding: 12px 10px; border-bottom: 1px solid var(--border-soft); color: var(--text-dim); }
table.tbl tr:last-child td { border-bottom: none; }
.method-tag { font-weight: 700; color: #6d28d9; }
.status-code { font-weight: 600; }
.status-code--2 { color: #15803d; }
.status-code--4, .status-code--5 { color: #b91c1c; }

/* ============ Task list ============ */

.task-list { display: flex; flex-direction: column; }
.task-row {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 4px; border-bottom: 1px solid var(--border-soft);
}
.task-row:last-child { border-bottom: none; }
.task-row__icon {
  width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.task-row__icon svg { width: 17px; height: 17px; }
.task-row__icon--waiting { background: rgba(139,92,246,0.15); color: #6d28d9; }
.task-row__icon--completed { background: rgba(34,197,94,0.15); color: #15803d; }
.task-row__icon--failed { background: rgba(239,68,68,0.15); color: #b91c1c; }

.task-row__body { min-width: 0; flex: 1; }
.task-row__email { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.task-row__meta { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }
.task-row__msg {
  font-size: 12.5px; color: var(--text-dim); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 620px;
}
.task-row__msg.is-error { color: #b91c1c; font-family: 'IBM Plex Mono', monospace; font-size: 11px; }

.task-row__actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.03em;
  padding: 5px 11px; border-radius: 999px; text-transform: uppercase;
  white-space: nowrap;
}
.badge--waiting { background: rgba(139,92,246,0.15); color: #6d28d9; }
.badge--completed { background: rgba(34,197,94,0.15); color: #15803d; }
.badge--failed { background: rgba(239,68,68,0.15); color: #b91c1c; }

.icon-btn {
  width: 30px; height: 30px; border-radius: 8px;
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  flex-shrink: 0;
}
.icon-btn:hover { color: var(--text); border-color: var(--text-faint); }

.empty-state {
  text-align: center; padding: 56px 20px; color: var(--text-faint);
}
.empty-state svg { width: 44px; height: 44px; margin-bottom: 12px; opacity: 0.5; }

/* ============ Modal ============ */

.modal-overlay {
  position: fixed; inset: 0; background: rgba(4,6,14,0.7);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 16px;
}
.modal {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%; max-width: 440px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.6);
}
.modal__eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--text-faint); text-transform: uppercase; margin-bottom: 6px;
}
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.modal__title { font-size: 19px; font-weight: 700; margin: 0; }
.modal__sub { font-size: 12.5px; color: var(--text-faint); margin: 4px 0 18px; word-break: break-word; }
.modal__close {
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.modal__note {
  display: flex; gap: 8px; align-items: flex-start;
  background: rgba(59,130,246,0.08); border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12px; color: #1d4ed8;
  margin: 14px 0 18px; line-height: 1.5;
}
.modal__detail { font-size: 13px; line-height: 1.9; color: var(--text-dim); word-break: break-word; }
.modal__detail b { color: var(--text); }

/* ============ Forms ============ */

.field { display: block; margin-bottom: 16px; }
.field__label { display: block; font-size: 12px; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; }
.field__input, .field__textarea, textarea.field__input {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.field__input::placeholder { color: var(--text-faint); }
.field__input:focus, textarea.field__input:focus { border-color: var(--blue); }
textarea.field__input { resize: vertical; min-height: 80px; }
.field__hint { font-size: 11.5px; color: var(--text-faint); margin-top: 5px; }
.field__input-wrap { position: relative; }
.field__toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-faint); cursor: pointer; padding: 4px;
}

.form__row { display: flex; gap: 10px; }
.form__row .field { flex: 1; min-width: 0; }

.alert {
  border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13px; margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert--error { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); color: #b91c1c; }
.alert--ok { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.3); color: #15803d; }

/* ============ Auth pages ============ */

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}
.auth-shell__left {
  padding: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(59,130,246,0.18), transparent 55%),
    radial-gradient(ellipse at 80% 80%, rgba(139,92,246,0.18), transparent 55%),
    var(--bg);
}
.auth-shell__eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: 0.1em; color: #1d4ed8;
  text-transform: uppercase; margin-bottom: 18px;
}
.auth-shell__left h1 { font-size: clamp(28px, 3.6vw, 44px); line-height: 1.15; margin: 0 0 18px; letter-spacing: -1px; }
.auth-shell__left p { color: var(--text-dim); font-size: 15px; max-width: 460px; line-height: 1.6; }

.auth-shell__right {
  display: flex; align-items: center; justify-content: center;
  padding: 32px 20px; background: var(--bg-soft);
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 30px;
}
.auth-card__logo {
  width: 42px; height: 42px; border-radius: 12px; background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff; margin: 0 auto 16px;
}
.auth-card h2 { text-align: center; margin: 0 0 6px; font-size: 21px; }
.auth-card__sub { text-align: center; color: var(--text-faint); font-size: 13px; margin-bottom: 24px; }
.auth-card__footer { text-align: center; font-size: 13px; color: var(--text-faint); margin-top: 18px; }
.auth-card__footer a { color: #1d4ed8; font-weight: 600; }
.checkbox-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; font-size: 12.5px; flex-wrap: wrap; }
.checkbox-row label { display: flex; align-items: center; gap: 7px; color: var(--text-dim); }

/* ============ Home / landing ============ */

.landing {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 15% 0%, rgba(59,130,246,0.16), transparent 50%),
    radial-gradient(ellipse at 85% 30%, rgba(139,92,246,0.16), transparent 50%),
    var(--bg);
}
.landing__nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 20px 5vw; max-width: 1200px; margin: 0 auto;
}
.landing__nav-actions { display: flex; gap: 10px; }
.landing__hero {
  max-width: 800px; margin: 7vh auto 0; text-align: center; padding: 0 20px;
}
.landing__hero h1 { font-size: clamp(28px, 5.5vw, 52px); line-height: 1.15; letter-spacing: -1px; margin: 18px 0; }
.landing__hero h1 em {
  font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.landing__hero p { color: var(--text-dim); font-size: 15.5px; line-height: 1.6; max-width: 560px; margin: 0 auto 28px; }
.landing__hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.landing__badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; color: #1d4ed8; background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.25); padding: 6px 14px; border-radius: 999px;
  text-align: left;
}
.landing__features {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  max-width: 1000px; margin: 9vh auto 8vh; padding: 0 20px;
}
.feature-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px;
  min-width: 0;
}
.feature-card__icon {
  width: 36px; height: 36px; border-radius: 10px; background: var(--grad);
  display: flex; align-items: center; justify-content: center; margin-bottom: 14px; color: #fff;
}
.feature-card__icon svg { width: 17px; height: 17px; }
.feature-card h3 { font-size: 15px; margin: 0 0 8px; }
.feature-card p { font-size: 12.5px; color: var(--text-faint); margin: 0; line-height: 1.6; }

/* ============ API keys table ============ */

.apikey-row { display: flex; align-items: center; gap: 14px; }
.apikey-row code {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; background: var(--bg-soft);
  padding: 3px 8px; border-radius: 6px; color: var(--text-dim);
}
.new-key-form { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.new-key-form .field__input { flex: 1; min-width: 160px; }

/* ============ Docs ============ */

.docs-key-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: rgba(139,92,246,0.08); border: 1px solid rgba(139,92,246,0.25);
  border-radius: var(--radius); padding: 14px 18px; margin-bottom: 22px;
}
.docs-key-banner__label { font-size: 12px; color: var(--text-faint); margin-bottom: 4px; }
.docs-key-banner__row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.docs-key-banner code {
  font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; color: #6d28d9;
  word-break: break-all;
}
.docs-key-banner__actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Two-column docs layout: sticky in-page nav + content */
.docs-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 30px;
  align-items: start;
}

.docs-nav {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  padding-bottom: 8px;
}
.docs-nav__group { margin-bottom: 18px; }
.docs-nav__group-title {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-faint); margin: 0 0 6px 10px;
}
.docs-nav__link {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; margin-bottom: 1px;
  border-radius: 8px; font-size: 12.5px; font-weight: 500; color: var(--text-dim);
  border-left: 2px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.docs-nav__link:hover { color: var(--text); background: var(--panel-2); }
.docs-nav__link.is-active {
  color: #fff; background: var(--ink); border-left-color: var(--ink);
}
.docs-nav__method {
  font-family: 'IBM Plex Mono', monospace; font-size: 9px; font-weight: 700;
  padding: 1.5px 5px; border-radius: 4px; flex-shrink: 0; letter-spacing: 0.02em;
}
.docs-nav__method--post { background: rgba(59,130,246,0.2); color: #1d4ed8; }
.docs-nav__method--get { background: rgba(34,197,94,0.2); color: #15803d; }
.docs-nav__label { overflow: hidden; text-overflow: ellipsis; }

.docs-content { min-width: 0; display: flex; flex-direction: column; gap: 16px; }

.docs-section { scroll-margin-top: 18px; }
.docs-content code, .table-wrap code {
  font-family: 'IBM Plex Mono', monospace; font-size: 0.92em;
  background: var(--panel-2); border: 1px solid var(--border-soft);
  padding: 1px 6px; border-radius: 5px; color: var(--text);
}
.docs-section h2 { font-size: 18px; margin: 0 0 6px; letter-spacing: -0.2px; }
.docs-section > p.docs-sub { color: var(--text-dim); font-size: 13px; margin: 0 0 16px; line-height: 1.6; }

/* Endpoint URL bar */
.endpoint-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: nowrap;
  background: var(--ink); border: 1px solid var(--ink); border-radius: var(--radius-sm);
  padding: 9px 9px 9px 12px; margin-bottom: 16px; min-width: 0;
}
.endpoint-bar__method {
  font-weight: 700; padding: 3px 9px; border-radius: 6px; font-size: 11px;
  flex-shrink: 0; font-family: 'IBM Plex Mono', monospace;
}
.endpoint-bar__method--post { background: rgba(96,165,250,0.22); color: #93c5fd; }
.endpoint-bar__method--get { background: rgba(74,222,128,0.2); color: #86efac; }
.endpoint-bar__path {
  font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; color: #fff;
  flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; scrollbar-width: none;
}
.endpoint-bar__path::-webkit-scrollbar { display: none; }
.endpoint-bar__path span { color: #8b91a1; }

/* Copy buttons (shared) */
.copy-btn {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  font-size: 11.5px; font-weight: 600; padding: 6px 10px; border-radius: 7px;
  cursor: pointer; font-family: inherit; -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.copy-btn:hover { color: var(--text); border-color: var(--text-faint); }
.copy-btn svg { width: 13px; height: 13px; flex-shrink: 0; }
.copy-btn .copy-btn__ok { display: none; color: #15803d; }
.copy-btn.is-copied .copy-btn__default { display: none; }
.copy-btn.is-copied .copy-btn__ok { display: inline-flex; align-items: center; gap: 6px; }
.copy-btn.is-copied { color: #15803d; border-color: rgba(34,197,94,0.4); }
.copy-btn--icon { padding: 6px; }
.endpoint-bar .copy-btn { border-color: rgba(255,255,255,0.22); color: #cbd0dc; }
.endpoint-bar .copy-btn:hover { color: #fff; border-color: rgba(255,255,255,0.4); }

/* Tabbed code examples */
.code-card {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; margin: 4px 0 16px;
}
.code-card__head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px 6px 6px 4px; border-bottom: 1px solid var(--border); background: var(--panel);
  flex-wrap: wrap;
}
.code-tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.code-tab {
  font-size: 11.5px; font-weight: 600; color: var(--text-faint);
  padding: 6px 12px; border-radius: 7px; cursor: pointer; background: transparent; border: none;
  font-family: inherit; -webkit-tap-highlight-color: transparent;
}
.code-tab:hover { color: var(--text-dim); }
.code-tab.is-active { color: #fff; background: var(--ink); }
.code-card__copy { margin-right: 4px; }
.code-panel { display: none; }
.code-panel.is-active { display: block; }
.code-card pre {
  margin: 0; padding: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; line-height: 1.7;
  color: #cbd5f5; white-space: pre;
}
.code-card--plain pre { padding-top: 14px; }
.code-card code { background: none; border: none; padding: 0; color: inherit; font-size: inherit; }
/* Response blocks (no tabs, just a labelled header) */
.code-card__label {
  font-size: 11px; font-weight: 600; color: var(--text-faint); padding: 8px 12px 0;
}
.code-card--plain .code-card__head { justify-content: flex-end; }

/* syntax token colors */
.tok-key { color: #a78bfa; }
.tok-str { color: #86efac; }
.tok-num { color: #f0abfc; }
.tok-bool { color: #f59e0b; }
.tok-null { color: var(--text-faint); font-style: italic; }
.tok-com { color: var(--text-faint); }
.tok-flag { color: #60a5fa; }
.tok-punc { color: var(--text-faint); }

/* Params table required/optional pills */
.req-pill {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em;
  padding: 2px 8px; border-radius: 999px; white-space: nowrap; display: inline-block;
}
.req-pill--yes { background: rgba(239,68,68,0.12); color: #b91c1c; }
.req-pill--opt { background: rgba(140,150,190,0.12); color: var(--text-faint); }

.docs-callout {
  display: flex; gap: 9px; align-items: flex-start;
  background: rgba(37,99,235,0.07); border: 1px solid rgba(37,99,235,0.28);
  border-radius: var(--radius-sm); padding: 11px 13px; font-size: 12.5px; color: #1d4ed8;
  line-height: 1.55; margin: 2px 0 18px;
}
.docs-callout svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.docs-callout strong { color: inherit; }
.docs-callout--warn {
  background: rgba(180,83,9,0.08); border-color: rgba(180,83,9,0.3); color: var(--amber);
}
.docs-callout--danger {
  background: rgba(185,28,28,0.07); border-color: rgba(185,28,28,0.3); color: var(--red);
}
.docs-callout ul { margin: 4px 0 0; padding-left: 18px; }
.docs-callout li { margin-bottom: 3px; }
.docs-callout li:last-child { margin-bottom: 0; }

.docs-list { margin: 0 0 16px; padding-left: 20px; color: var(--text-dim); font-size: 13px; line-height: 1.85; }
.docs-list li b { color: var(--text); }
.docs-list code { font-size: 12px; }

.docs-end-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 18px; margin-top: 4px; border-top: 1px solid var(--border);
}
.docs-end-nav a {
  font-size: 13px; font-weight: 600; color: var(--text-dim);
  display: flex; align-items: center; gap: 6px;
}
.docs-end-nav a:hover { color: var(--text); }
.docs-end-nav__next { margin-left: auto; text-align: right; }

/* ============ Responsive: tablet ============ */

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .stat-grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .landing__features { grid-template-columns: 1fr; }

  /* Docs: nav collapses into a sticky horizontal pill bar */
  .docs-shell { grid-template-columns: 1fr; gap: 0; }
  .docs-nav {
    position: sticky; top: 0; z-index: 40;
    display: flex; flex-direction: row; align-items: center; flex-wrap: nowrap;
    gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch;
    max-height: none; padding: 4px 2px 12px;
    margin-bottom: 14px; border-bottom: 1px solid var(--border);
    background: var(--bg);
  }
  .docs-nav__group { display: contents; }
  .docs-nav__group-title { display: none; }
  .docs-nav__link {
    flex-shrink: 0; border-left: none; border: 1px solid var(--border);
    background: var(--panel); border-radius: 999px;
  }
  .docs-nav__link.is-active { border-color: var(--purple); }
  .docs-section { scroll-margin-top: 62px; }
}

/* ============ Responsive: mobile (bottom tab bar) ============ */

@media (max-width: 768px) {
  .main { padding: 18px 16px calc(var(--nav-h) + 34px); max-width: 100%; }

  /* Slim top header: brand only, user card + desktop footer hidden */
  .sidebar {
    padding: 12px 16px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar__brand { padding: 0; }
  .sidebar__user, .sidebar__footer { display: none; }

  /* Nav becomes a fixed bottom tab bar */
  .sidebar__nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    flex-direction: row;
    justify-content: space-around;
    gap: 0;
    background: var(--bg-soft);
    border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    z-index: 150;
  }
  .navitem {
    flex: 1;
    flex-direction: column;
    gap: 3px;
    padding: 6px 2px;
    font-size: 10.5px;
    text-align: center;
    border-radius: 10px;
  }
  .navitem.is-active { box-shadow: none; }
  .navitem__icon { width: 20px; height: 20px; }
  .navitem__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 64px; }
  .navitem--logout-mobile { display: flex; }

  .stat-grid, .stat-grid--3, .stat-grid--4 { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .btn { width: 100%; }

  .form__row { flex-direction: column; gap: 0; }

  .docs-key-banner { flex-direction: column; align-items: stretch; }
  .docs-key-banner .btn { width: 100%; }
  .docs-key-banner__actions { flex-direction: column; width: 100%; }
  .docs-key-banner__actions .copy-btn { width: 100%; justify-content: center; }

  .endpoint-bar { flex-wrap: wrap; }
  .endpoint-bar__path { flex-basis: 100%; order: 3; }

  .code-card__head { padding: 8px; }
  .code-tabs { width: 100%; }
  .code-tab { flex: 1; text-align: center; padding: 7px 6px; }

  .docs-end-nav { flex-wrap: wrap; }
  .docs-end-nav__next { margin-left: 0; text-align: left; }

  .auth-shell { grid-template-columns: 1fr; }
  .auth-shell__left { display: none; }
  .auth-shell__right { padding: 20px 14px; }
  .auth-card { padding: 24px; }

  .task-row { flex-wrap: wrap; }
  .task-row__msg { max-width: 100%; white-space: normal; }
  .task-row__actions { width: 100%; justify-content: flex-end; }

  .modal { padding: 20px; }

  /* Prevent iOS Safari from auto-zooming when a field is focused */
  .field__input, textarea.field__input, select.field__input {
    font-size: 16px;
  }
}

@media (max-width: 460px) {
  .stat-grid, .stat-grid--3, .stat-grid--4 { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 22px; }
  .card { padding: 15px; }
  .navitem__label { font-size: 10px; }

  .docs-section h2 { font-size: 16.5px; }
  .code-card pre { font-size: 11px; padding: 12px; }
  .code-tab { font-size: 10.5px; padding: 7px 4px; }
  .endpoint-bar__method { font-size: 10px; padding: 3px 7px; }
}
