/* PageToAPI design system. Shared by the marketing site, docs, status and the dashboard.
   Light and dark themes: follows the OS, overridable with <html data-theme="light|dark">. */

:root {
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --radius-sm: 8px; --radius: 12px; --radius-lg: 18px; --radius-xl: 22px;
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* light is the default everywhere; dark only on an explicit toggle */
  --bg: #ffffff;
  --bg-2: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --border: #e9ebf0;
  --border-strong: #d5d9e2;
  --text: #0b0d12;
  --text-2: #4b5263;
  --text-3: #6b7280;
  --accent: #2550f5;
  --accent-2: #6d3fd6;
  --accent-ink: #ffffff;
  --accent-soft: #eef2ff;
  --ok: #157a3c; --ok-soft: #e9f8ef;
  --warn: #92400e; --warn-2: #b45309; --warn-soft: #fff6e0;
  --bad: #b42318; --bad-soft: #fdecec;
  --info: #2550f5; --info-soft: #eef2ff;
  --violet: #6d3fd6; --violet-soft: #f3eefe;
  --amber: #f59e0b;
  --ink: #0b0d12; --ink-text: #ffffff;
  --shadow-sm: 0 1px 2px rgba(16, 20, 35, .05);
  --shadow: 0 1px 2px rgba(16, 20, 35, .05), 0 8px 24px -10px rgba(16, 20, 35, .12);
  --shadow-lg: 0 2px 6px rgba(16, 20, 35, .05), 0 30px 60px -24px rgba(16, 20, 35, .22);
  --code-bg: #fbfbfd;
  --code-text: #1f2430;
  --code-border: #e9ebf0;
  --glow: radial-gradient(60% 50% at 50% 0%, #eef2ff 0%, rgba(255, 255, 255, 0) 70%);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #08090d; --bg-2: #0d0f15; --surface: #111319; --surface-2: #161923;
  --border: #22263a; --border-strong: #2e3348;
  --text: #eef0f6; --text-2: #a8afc2; --text-3: #7d849c;
  --accent: #6f8bff; --accent-2: #a78bfa; --accent-soft: rgba(111, 139, 255, .14);
  --ok: #34d399; --ok-soft: rgba(52, 211, 153, .12);
  --warn: #fbbf24; --warn-2: #fbbf24; --warn-soft: rgba(251, 191, 36, .12);
  --bad: #f87171; --bad-soft: rgba(248, 113, 113, .12);
  --info: #6f8bff; --info-soft: rgba(111, 139, 255, .14);
  --violet: #c4b5fd; --violet-soft: rgba(167, 139, 250, .14);
  --ink: #eef0f6; --ink-text: #08090d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -10px rgba(0, 0, 0, .6);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .4), 0 40px 80px -24px rgba(0, 0, 0, .75);
  --code-bg: #0b0d13; --code-text: #d7dcf0; --code-border: #22263a;
  --glow: radial-gradient(60% 50% at 50% 0%, rgba(111, 139, 255, .18), transparent 70%);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 var(--font); font-feature-settings: 'cv11', 'ss01', 'ss03'; overflow-x: clip; }
a { color: inherit; text-decoration: none; }
a.link { color: var(--accent); }
a.link:hover { text-decoration: underline; text-underline-offset: 3px; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
code, kbd, pre, .mono { font-family: var(--mono); font-feature-settings: normal; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.025em; line-height: 1.15; font-weight: 650; }
p { margin: 0; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.tabular { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .container { padding: 0 16px; } }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 99px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 550; font-size: 14px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s; white-space: nowrap; box-shadow: var(--shadow-sm); }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: var(--ink-text); border-color: transparent; }
.btn-primary:hover { background: var(--ink); opacity: .86; }
.btn-accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 6px 18px -8px color-mix(in oklab, var(--accent) 70%, transparent); }
.btn-accent:hover { background: var(--accent); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); border-color: color-mix(in oklab, var(--bad) 40%, transparent); }
.btn-lg { height: 48px; padding: 0 24px; font-size: 15px; }
.btn-sm { height: 32px; padding: 0 13px; font-size: 13px; }
.btn-icon { width: 40px; padding: 0; border-radius: 10px; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; }
.label { font-size: 13px; font-weight: 550; color: var(--text); }
.hint { font-size: 12.5px; color: var(--text-3); }
.input, .select, .textarea { width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s; font-size: 14px; }
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input.mono { font-family: var(--mono); font-size: 13px; }
.switch { position: relative; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--border-strong); transition: background .2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: white; box-shadow: var(--shadow-sm); transition: transform .2s var(--ease); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 15px; }
.divider { height: 1px; background: var(--border); border: 0; margin: 0; }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 12px; font-weight: 550;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.dot.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

kbd { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 5px; border: 1px solid var(--border-strong); background: var(--surface-2); font-size: 11px; color: var(--text-2); }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { text-align: left; font-weight: 600; font-size: 12px; color: var(--text-3); padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* ---------- code ---------- */
.code { position: relative; background: var(--code-bg); color: var(--code-text); border-radius: var(--radius); border: 1px solid var(--code-border);
  font: 13px/1.7 var(--mono); overflow: auto; }
.code pre { margin: 0; padding: 18px 20px; }
.code .c { color: var(--text-3); } .code .k { color: var(--violet); } .code .s { color: var(--ok); } .code .n { color: var(--warn-2); } .code .p { color: var(--accent); }
.copy-btn { position: absolute; top: 10px; right: 10px; height: 28px; padding: 0 10px; border-radius: 7px; border: 1px solid rgba(255,255,255,.12);
  background: var(--surface); color: var(--text-2); font: 12px var(--font); cursor: pointer; border-color: var(--border); }
.copy-btn:hover { color: var(--text); background: var(--surface-2); }

/* ---------- toast ---------- */
.toasts { position: fixed; z-index: 100; bottom: 20px; right: 20px; display: grid; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px; padding: 12px 14px; border-radius: 12px; background: var(--text); color: var(--bg);
  box-shadow: var(--shadow-lg); font-size: 14px; animation: toast-in .25s var(--ease); }
.toast.bad { background: var(--bad); color: white; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(6, 8, 14, .5); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px;
  animation: fade .15s; }
.modal { width: 100%; max-width: 480px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  animation: pop .2s var(--ease); }
.modal-head { padding: 20px 22px 0; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 16px 22px; display: grid; gap: 14px; }
.modal-foot { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }

/* ---------- skeleton ---------- */
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.03em; font-size: 16px; }
.logo-mark { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: #2550f5; flex: none; }
/* Portal mark: a browser window holding { } (brand/portal-glyph.svg) */
.logo-mark::after { content: ''; width: 92%; height: 92%; background: #ffffff;
  -webkit-mask: url(/brand/portal-glyph.svg) center / contain no-repeat; mask: url(/brand/portal-glyph.svg) center / contain no-repeat; }
.wordmark { text-transform: none; }
.eyebrow-mono { display: inline-block; font: 13px var(--mono); color: var(--text-2); background: var(--accent-soft); padding: 2px 6px; border-right: 2px solid var(--accent); }

/* ---------- theme toggle ---------- */
.theme-toggle { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.theme-toggle:hover { color: var(--text); background: var(--surface-2); }

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