/* ============================================================================
   MarketPulse — design system
   ----------------------------------------------------------------------------
   1. Tokens
   2. Reset / base
   3. Typography
   4. Layout primitives  (container, grid, flex, spacing)
   5. Sizing & display utilities
   6. Color & border utilities
   7. Components         (.btn, .card, .surface, .nav, .input, .badge, …)
   8. Page-specific composites
   ============================================================================ */

/* ─── 1. Tokens ──────────────────────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg:              #f7f6f2;
  --surface:         #ffffff;
  --surface-2:       #f0ede6;
  --surface-3:       #ebe8e1;
  --surface-inverse: #1c1b19;

  /* Borders */
  --border:          rgba(40, 37, 29, 0.10);
  --border-strong:   rgba(40, 37, 29, 0.20);

  /* Text */
  --text:            #28251d;
  --text-secondary:  #3d3a32;
  --text-muted:      #7a7974;
  --text-subtle:     #8a8880;
  --text-inverse:    #cdccca;

  /* Accent (deep teal) */
  --accent:          #01696f;
  --accent-hover:    #0c4e54;
  --accent-soft:     rgba(1, 105, 111, 0.10);
  --accent-softer:   rgba(1, 105, 111, 0.06);
  --accent-border:   rgba(1, 105, 111, 0.22);

  /* Semantic */
  --danger:          #b91c1c;
  --danger-soft:     rgba(185, 28, 28, 0.10);
  --warning:         #b45309;
  --warning-soft:    #fef3c7;
  --warning-border:  #fcd34d;
  --success:         #047857;
  --success-soft:    rgba(4, 120, 87, 0.10);

  /* Code */
  --code-bg:         #1c1b19;
  --code-text:       #cdccca;
  --code-accent:     #93e2d6;

  /* Elevation */
  --shadow-sm:       0 1px 2px rgba(40, 37, 29, 0.05);
  --shadow:          0 4px 16px -2px rgba(40, 37, 29, 0.07),
                     0 2px 6px -2px rgba(40, 37, 29, 0.05);
  --shadow-lg:       0 10px 30px -4px rgba(40, 37, 29, 0.10),
                     0 4px 12px -2px rgba(40, 37, 29, 0.06);
  --shadow-modal:    0 24px 60px rgba(15,23,42,0.18),
                     0 4px 16px rgba(15,23,42,0.10);

  /* Radii */
  --r-sm:   4px;
  --r-md:   8px;
  --r-lg:   12px;
  --r-xl:   16px;
  --r-2xl:  20px;
  --r-full: 999px;

  /* Type */
  --font-display: 'Cabinet Grotesk', 'Helvetica Neue', sans-serif;
  --font-body:    'General Sans', 'Inter', system-ui, sans-serif;
  --font-mono:    ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Layout */
  --nav-h:      4rem;
  --container:  72rem;   /* max-w-6xl */
}

/* ─── 2. Reset / base ────────────────────────────────────────────────────── */
*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

img, svg { display: block; max-width: 100%; }

ul, ol { padding: 0; margin: 0; list-style: none; }

hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

/* Selection */
::selection { background: var(--accent-soft); color: var(--accent); }

/* Focus ring */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0.5rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--r-md);
  font-size: 0.875rem;
}
.skip-link:focus { top: 0.5rem; color: #fff; }

/* Visually hidden (sr-only) */
.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;
}

/* ─── 3. Typography ──────────────────────────────────────────────────────── */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  margin: 0;
}
h1 { letter-spacing: -0.02em; font-weight: 800; }
h2 { letter-spacing: -0.01em; }
h4, h5, h6 { font-family: var(--font-body); font-weight: 600; margin: 0; line-height: 1.3; }

p { margin: 0; }

code, pre, .font-mono {
  font-family: var(--font-mono);
}

.text-xs   { font-size: 0.75rem;  line-height: 1.4; }
.text-sm   { font-size: 0.875rem; line-height: 1.5; }
.text-base { font-size: 1rem;     line-height: 1.55; }
.text-lg   { font-size: 1.125rem; line-height: 1.55; }
.text-xl   { font-size: 1.25rem;  line-height: 1.45; }
.text-2xl  { font-size: 1.5rem;   line-height: 1.35; }
.text-3xl  { font-size: 1.875rem; line-height: 1.25; }
.text-4xl  { font-size: 2.25rem;  line-height: 1.15; }
.text-5xl  { font-size: 3rem;     line-height: 1.1; }
.text-6xl  { font-size: 3.75rem;  line-height: 1.05; }

.font-medium    { font-weight: 500; }
.font-semibold  { font-weight: 600; }
.font-bold      { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.uppercase   { text-transform: uppercase; }
.italic      { font-style: italic; }
.tracking-tight { letter-spacing: -0.01em; }
.tracking-wide  { letter-spacing: 0.05em; }
.tracking-wider { letter-spacing: 0.08em; }
.leading-tight  { line-height: 1.2; }
.leading-snug   { line-height: 1.35; }
.leading-relaxed{ line-height: 1.7; }
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }
.break-all   { word-break: break-all; }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whitespace-pre { white-space: pre; }

/* Color helpers */
.text-default   { color: var(--text); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-subtle    { color: var(--text-subtle); }
.text-accent    { color: var(--accent); }
.text-danger    { color: var(--danger); }
.text-warning   { color: var(--warning); }
.text-success   { color: var(--success); }
.text-inverse   { color: #fff; }

/* ─── 4. Layout primitives ───────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 1.5rem;
}
.container-sm { max-width: 24rem; }
.container-md { max-width: 28rem; }
.container-lg { max-width: 48rem; }
.container-xl { max-width: 56rem; }
.container-2xl{ max-width: 64rem; }

.flex      { display: flex; }
.inline-flex { display: inline-flex; }
.grid      { display: grid; }
.block     { display: block; }
.inline    { display: inline; }
.inline-block { display: inline-block; }
.hidden    { display: none !important; }

.flex-row    { flex-direction: row; }
.flex-col    { flex-direction: column; }
.flex-wrap   { flex-wrap: wrap; }
.flex-1      { flex: 1 1 0%; }
.flex-auto   { flex: 1 1 auto; }
.flex-none   { flex: none; }
.shrink-0    { flex-shrink: 0; }
.grow        { flex-grow: 1; }

.items-start    { align-items: flex-start; }
.items-center   { align-items: center; }
.items-end      { align-items: flex-end; }
.items-stretch  { align-items: stretch; }

.justify-start   { justify-content: flex-start; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.justify-between { justify-content: space-between; }

.self-start   { align-self: flex-start; }
.self-center  { align-self: center; }

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

/* gap */
.gap-1  { gap: 0.25rem; }
.gap-2  { gap: 0.5rem; }
.gap-3  { gap: 0.75rem; }
.gap-4  { gap: 1rem; }
.gap-5  { gap: 1.25rem; }
.gap-6  { gap: 1.5rem; }
.gap-8  { gap: 2rem; }
.gap-10 { gap: 2.5rem; }
.gap-12 { gap: 3rem; }

/* spacing — scale: 0,1,2,3,4,5,6,8,10,12,16,20,24,32 */
.m-0  { margin: 0; }
.m-auto { margin: auto; }
.mx-auto { margin-inline: auto; }
.my-auto { margin-block: auto; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 0.25rem; } .mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; } .mt-4 { margin-top: 1rem; } .mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; } .mt-8 { margin-top: 2rem; } .mt-10 { margin-top: 2.5rem; }
.mt-12 { margin-top: 3rem; } .mt-16 { margin-top: 4rem; }

.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 0.25rem; } .mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; } .mb-4 { margin-bottom: 1rem; } .mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; } .mb-8 { margin-bottom: 2rem; } .mb-10 { margin-bottom: 2.5rem; }
.mb-12 { margin-bottom: 3rem; } .mb-14 { margin-bottom: 3.5rem; } .mb-16 { margin-bottom: 4rem; }

.p-0 { padding: 0; } .p-1 { padding: 0.25rem; } .p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; } .p-4 { padding: 1rem; } .p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; } .p-8 { padding: 2rem; }

.px-2 { padding-inline: 0.5rem; } .px-3 { padding-inline: 0.75rem; }
.px-4 { padding-inline: 1rem; } .px-5 { padding-inline: 1.25rem; }
.px-6 { padding-inline: 1.5rem; } .px-8 { padding-inline: 2rem; }

.py-1 { padding-block: 0.25rem; } .py-2 { padding-block: 0.5rem; }
.py-3 { padding-block: 0.75rem; } .py-4 { padding-block: 1rem; }
.py-5 { padding-block: 1.25rem; } .py-6 { padding-block: 1.5rem; }
.py-8 { padding-block: 2rem; } .py-10 { padding-block: 2.5rem; }
.py-12 { padding-block: 3rem; } .py-16 { padding-block: 4rem; }
.py-20 { padding-block: 5rem; } .py-24 { padding-block: 6rem; } .py-36 { padding-block: 9rem; }

.pt-3 { padding-top: 0.75rem; } .pt-4 { padding-top: 1rem; } .pt-8 { padding-top: 2rem; }
.pb-8 { padding-bottom: 2rem; }
.pl-3 { padding-left: 0.75rem; }

/* space-y / space-x */
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-y-8 > * + * { margin-top: 2rem; }
.space-y-10 > * + * { margin-top: 2.5rem; }
.space-y-12 > * + * { margin-top: 3rem; }
.divide-y > * + * { border-top: 1px solid var(--border); }

/* ─── 5. Sizing & display ────────────────────────────────────────────────── */
.w-full   { width: 100%; }
.w-auto   { width: auto; }
.h-full   { height: 100%; }
.h-screen { height: 100vh; }
.min-h-screen { min-height: 100vh; }
.h-4  { height: 1rem; }
.h-9  { height: 2.25rem; }
.h-16 { height: 4rem; }
.w-3  { width: 0.75rem; } .h-3  { height: 0.75rem; }
.w-3\.5 { width: 0.875rem; } .h-3\.5 { height: 0.875rem; }
.w-4  { width: 1rem; }    /* h-4 above */
.w-5  { width: 1.25rem; } .h-5  { height: 1.25rem; }
.w-6  { width: 1.5rem; }  .h-6  { height: 1.5rem; }
.w-7  { width: 1.75rem; } .h-7  { height: 1.75rem; }
.w-8  { width: 2rem; }    .h-8  { height: 2rem; }
.w-9  { width: 2.25rem; } /* h-9 above */
.w-10 { width: 2.5rem; }  .h-10 { height: 2.5rem; }
.w-12 { width: 3rem; }    .h-12 { height: 3rem; }
.w-14 { width: 3.5rem; }  .h-14 { height: 3.5rem; }
.w-16 { width: 4rem; }
.w-52 { width: 13rem; }
.min-w-0 { min-width: 0; }

.max-w-md  { max-width: 28rem; }
.max-w-lg  { max-width: 32rem; }
.max-w-xl  { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-5xl { max-width: 64rem; }
.max-w-6xl { max-width: 72rem; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }
.sticky   { position: sticky; top: 0; }
.inset-0  { inset: 0; }
.top-0    { top: 0; } .top-2    { top: 0.5rem; }
.left-0   { left: 0; } .left-2   { left: 0.5rem; } .left-3   { left: 0.75rem; }
.right-2  { right: 0.5rem; }
.bottom-0 { bottom: 0; }
.z-10     { z-index: 10; }
.z-50     { z-index: 50; }
.z-100    { z-index: 100; }
.z-200    { z-index: 200; }
.translate-y--half { transform: translateY(-50%); }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

/* Borders */
.border        { border: 1px solid var(--border); }
.border-strong { border: 1px solid var(--border-strong); }
.border-t      { border-top: 1px solid var(--border); }
.border-b      { border-bottom: 1px solid var(--border); }
.border-l      { border-left: 1px solid var(--border); }
.border-l-2-accent { border-left: 2px solid var(--accent); }
.border-accent { border-color: var(--accent) !important; }
.border-none   { border: 0; }

.rounded     { border-radius: var(--r-md); }
.rounded-sm  { border-radius: var(--r-sm); }
.rounded-md  { border-radius: var(--r-md); }
.rounded-lg  { border-radius: var(--r-lg); }
.rounded-xl  { border-radius: var(--r-xl); }
.rounded-2xl { border-radius: var(--r-2xl); }
.rounded-full{ border-radius: var(--r-full); }

/* Shadow */
.shadow    { box-shadow: var(--shadow); }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* Cursors / interactivity */
.cursor-pointer       { cursor: pointer; }
.cursor-not-allowed   { cursor: not-allowed; }
.transition           { transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, opacity 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease; }

.opacity-0    { opacity: 0; }
.opacity-50   { opacity: 0.5; }
.opacity-70   { opacity: 0.7; }
.opacity-100  { opacity: 1; }

/* ─── 6. Surfaces ────────────────────────────────────────────────────────── */
.bg-bg         { background: var(--bg); }
.bg-surface    { background: var(--surface); }
.bg-surface-2  { background: var(--surface-2); }
.bg-surface-3  { background: var(--surface-3); }
.bg-accent     { background: var(--accent); color: #fff; }
.bg-accent-soft{ background: var(--accent-soft); }
.bg-warning-soft { background: var(--warning-soft); }
.bg-danger-soft  { background: var(--danger-soft); }
.bg-success-soft { background: var(--success-soft); }

/* ─── 7. Components ──────────────────────────────────────────────────────── */

/* Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1;
  padding: 0.625rem 1rem;
  border-radius: var(--r-lg);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.05s ease;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:active   { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); color: #fff; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }

.btn-outline {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-outline:hover:not(:disabled) { border-color: var(--text); }

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(185, 28, 28, 0.25);
}
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; border-color: var(--danger); }

.btn-sm  { font-size: 0.8125rem; padding: 0.4375rem 0.75rem; border-radius: var(--r-md); }
.btn-lg  { font-size: 1rem; padding: 0.875rem 2rem; border-radius: var(--r-xl); font-weight: 600; }
.btn-block { width: 100%; }

/* Input ---------------------------------------------------------------- */
.input,
input[type="email"].input,
input[type="password"].input,
input[type="text"].input {
  display: block;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 0.625rem 0.875rem;
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.input::placeholder { color: var(--text-subtle); }
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input.with-icon { padding-left: 2.5rem; }

.input-code {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.5rem;
  letter-spacing: 0.5em;
  padding-block: 0.875rem;
}

.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
}

/* Card / surface ------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.card-flat { box-shadow: none; }

.surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
}
.surface-muted {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

/* hoverable card */
.card-link {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 1.25rem;
  color: inherit;
  transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.card-link:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  color: inherit;
}
.card-link:hover .card-link__hint { opacity: 1; }
.card-link__hint { color: var(--accent); font-size: 0.75rem; margin-top: 0.5rem; opacity: 1; transition: opacity 0.18s ease; }
@media (min-width: 640px) {
  .card-link__hint { opacity: 0; }
}

/* Nav ------------------------------------------------------------------ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 246, 242, 0.92);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav__inner {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 1.5rem;
}
.nav__links {
  display: none;
  align-items: center;
  gap: 2rem;
}
@media (min-width: 768px) {
  .nav__links { display: flex; }
  .nav__menu-btn { display: none; }
}
.nav__menu-btn {
  color: var(--text-muted);
  padding: 0.25rem;
}
.nav__menu-btn:hover { color: var(--text); }

.nav-link {
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: color 0.18s ease;
}
.nav-link:hover  { color: var(--text); }
.nav-link.active {
  color: var(--text);
  font-weight: 500;
  position: relative;
}
.nav-link.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

/* Mobile menu */
.nav__mobile {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 1rem 1.5rem;
}
.nav__mobile.is-open { display: block; }
@media (min-width: 768px) {
  .nav__mobile, .nav__mobile.is-open { display: none; }
}
.nav__mobile a,
.nav__mobile button {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding: 0.5rem 0;
  text-align: left;
  width: 100%;
}

/* Badge ---------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  padding: 0.25rem 0.625rem;
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge-accent  { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }
.badge-info    { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.badge-purple  { background: #ede9fe; color: #5b21b6; border-color: #c4b5fd; }
.badge-amber   { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.badge-cyan    { background: #cffafe; color: #155e75; border-color: #67e8f9; }
.badge-yellow  { background: #fef9c3; color: #713f12; border-color: #fde047; }
.badge-orange  { background: #ffedd5; color: #7c2d12; border-color: #fdba74; }
.badge-mono    { font-family: var(--font-mono); font-size: 0.6875rem; padding: 0.25rem 0.5rem; }

/* Alert ---------------------------------------------------------------- */
.alert {
  display: block;
  font-size: 0.875rem;
  padding: 0.75rem 1rem;
  border-radius: var(--r-md);
  border: 1px solid;
}
.alert-success { background: var(--success-soft); color: #065f46; border-color: rgba(4, 120, 87, 0.30); }
.alert-error,
.alert-danger  { background: var(--danger-soft); color: #7f1d1d; border-color: rgba(185, 28, 28, 0.30); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-border); }
.alert-info    { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }

/* Code blocks ---------------------------------------------------------- */
code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--accent);
}
pre {
  font-family: var(--font-mono);
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: var(--r-md);
  padding: 1rem;
  overflow-x: auto;
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.6;
}
pre code { color: inherit; font-size: inherit; }

/* Modal ---------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}
.modal-overlay[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: backdrop-in 0.2s ease;
}
.modal-panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  width: 100%;
  max-width: 680px;
  padding: 1.5rem;
  box-shadow: var(--shadow-modal);
  animation: modal-in 0.25s cubic-bezier(0.34, 1.2, 0.64, 1);
  overflow: hidden;
}
.modal-overlay.is-closing .modal-panel    { animation: modal-out 0.18s ease forwards; }
.modal-overlay.is-closing .modal-backdrop { animation: backdrop-out 0.18s ease forwards; }

@keyframes backdrop-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes backdrop-out { to { opacity: 0; } }
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.88) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes modal-out { to { opacity: 0; transform: scale(0.92) translateY(8px); } }

/* Tabs ----------------------------------------------------------------- */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}
.tab {
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: color 0.18s ease, border-color 0.18s ease;
  cursor: pointer;
}
.tab:hover    { color: var(--text); }
.tab.is-active {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--accent);
}
.tab-panel { padding-top: 1.5rem; }
.tab-panel[hidden] { display: none; }

/* Step indicator (numbered circles) ------------------------------------ */
.step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.step-number {
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--r-full);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step-number-sm { width: 1.5rem; height: 1.5rem; }

/* ─── 8. Page composites ─────────────────────────────────────────────────── */

/* Hero ----------------------------------------------------------------- */
.hero {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  text-align: center;
  padding: 6rem 1.5rem;
}
@media (min-width: 768px) { .hero { padding: 9rem 1.5rem; } }
.hero h1 { font-size: clamp(2.25rem, 1.8rem + 2.5vw, 3.75rem); margin-bottom: 1.5rem; }
.hero__pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0.375rem 1rem;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 2rem;
}
.promo-strike {
  color: var(--text-subtle);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}
.promo-highlight {
  color: var(--accent);
  font-weight: 700;
}
.hero__sub {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 36rem;
  margin: 0 auto 2.5rem;
  line-height: 1.6;
}

/* Section bands */
.section { padding: 5rem 0; border-top: 1px solid var(--border); }
.section--muted { background: var(--surface-2); }

/* Tool feature card (homepage grid) ------------------------------------ */
.feature-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 1.25rem;
  color: inherit;
  transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.feature-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  color: inherit;
}
.feature-card h4 { font-size: 0.95rem; font-weight: 600; margin: 0; }
.feature-card p  { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Agent card (homepage prompts) ---------------------------------------- */
.agent-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  overflow: hidden;
}
.agent-card__head { padding: 1.25rem; border-bottom: 1px solid var(--border); }
.agent-card__body { padding: 1.25rem; flex: 1; display: flex; flex-direction: column; gap: 1rem; }
.agent-card__icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.agent-card__prompt {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.8;
  flex: 1;
}
.agent-card__copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--accent);
  opacity: 0.75;
  transition: opacity 0.18s ease;
}
.agent-card__copy-btn:hover { opacity: 1; }
.agent-card__copy-btn.is-copied { opacity: 1; }
.agent-card__response-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: color 0.18s ease;
}
.agent-card__response-btn:hover { color: var(--text); }

/* Tools-page sidebar --------------------------------------------------- */
.toc-link {
  display: block;
  border-left: 2px solid transparent;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color 0.18s ease, border-color 0.18s ease;
}
.toc-link:hover { color: var(--text); }
.toc-link.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}
.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

/* Tool reference card -------------------------------------------------- */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  margin-bottom: 1rem;
  transition: border-color 0.18s ease;
}
.tool-card:hover { border-color: var(--border-strong); }
.tool-card__header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  text-align: left;
}
.tool-card__icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.tool-card__body {
  border-top: 1px solid var(--border);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.tool-card__body[hidden] { display: none; }
.tool-card__chevron { transition: transform 0.18s ease; }
.tool-card.is-open .tool-card__chevron { transform: rotate(180deg); }

/* Param table */
.param-table { width: 100%; font-size: 0.8125rem; text-align: left; border-collapse: collapse; }
.param-table thead { color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.param-table th { padding: 0 0.5rem 0.5rem 0; font-weight: 500; border-bottom: 1px solid var(--border); }
.param-table td { padding: 0.5rem 0.5rem 0.5rem 0; border-bottom: 1px solid var(--border); }
.param-table tr:last-child td { border-bottom: 0; }
.param-table .param-name { font-family: var(--font-mono); color: var(--accent); font-size: 0.75rem; }

/* Token alert (tools.html) */
.alert-tokens {
  background: var(--warning-soft);
  border: 1px solid var(--warning-border);
  color: var(--warning);
  padding: 1rem 1.25rem;
  border-radius: var(--r-lg);
  font-size: 0.875rem;
}
.alert-tokens strong { color: var(--warning); }

/* Prose (legal pages) -------------------------------------------------- */
.prose { color: var(--text-secondary); line-height: 1.7; max-width: 56rem; }
.prose h2 { font-size: 1.125rem; font-weight: 600; color: var(--text); margin-top: 2.5rem; margin-bottom: 0.75rem; }
.prose h3 { font-size: 1rem; font-weight: 600; color: var(--text); margin-top: 1.5rem; margin-bottom: 0.5rem; }
.prose p  { margin-bottom: 1rem; }
.prose a  { color: var(--accent); text-decoration: underline; }
.prose ul { padding-left: 1.5rem; list-style: disc; margin-bottom: 1rem; }
.prose ul li { margin-bottom: 0.375rem; }
.prose code { background: var(--surface-2); padding: 0.125rem 0.375rem; border-radius: 4px; }
.prose section { margin-bottom: 2.5rem; }

/* API key blur (dashboard) --------------------------------------------- */
.api-key-masked {
  filter: blur(6px);
  user-select: none;
  cursor: default;
  transition: filter 0.2s ease;
}

/* Snippet code blocks — prevent accidental keyboard-copy of sentinel value */
pre.snippet-pre {
  user-select: none;
}

/* <details> chevron rotation ------------------------------------------- */
.details-chevron { transition: transform 0.2s ease; }
details[open] .details-chevron { transform: rotate(90deg); }

/* Loader/icon-pulse used on dashboard ---------------------------------- */
@keyframes mp-lens-pulse {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%       { transform: scale(0.55); opacity: 0.6; }
}
.mp-loader-lens { transform-origin: 18px 18px; animation: mp-lens-pulse 1.6s ease-in-out infinite; }

/* Local dev banner (login/signup) -------------------------------------- */
.dev-banner {
  background: #78350f;
  color: #fcd34d;
  font-size: 0.75rem;
  text-align: center;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #92400e;
}
.dev-banner a { color: #fcd34d; font-weight: 700; text-decoration: underline; }

/* No-script fallback --------------------------------------------------- */
.noscript-fallback {
  background: var(--bg);
  color: var(--text-muted);
  text-align: center;
  padding: 3rem 1rem;
  font-family: system-ui, sans-serif;
}
.noscript-fallback h1 { color: var(--text); font-size: 1.5rem; margin-bottom: 1rem; }

/* Dashboard usage bar */
.usage-bar-track {
  width: 100%;
  height: 0.5rem;
  background: var(--surface-3);
  border-radius: var(--r-full);
  overflow: hidden;
}
.usage-bar {
  height: 100%;
  border-radius: var(--r-full);
  transition: width 0.4s ease, background-color 0.18s ease;
}
.usage-bar--healthy  { background: var(--success); }
.usage-bar--warning  { background: var(--warning); }
.usage-bar--critical { background: var(--danger); }

/* Dashboard shell ------------------------------------------------------- */
.dashboard-layout {
  display: grid;
  gap: 1.25rem;
}

.dashboard-sidebar-card,
.dashboard-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.dashboard-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.dashboard-nav {
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.dashboard-nav__button {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.dashboard-nav__button:hover {
  background: var(--surface-2);
  color: var(--text);
}

.dashboard-nav__button.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-softer);
}

.dashboard-sidebar__meta {
  padding: 0.875rem;
  border-radius: var(--r-lg);
  background: var(--surface-2);
}

.dashboard-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.dashboard-overview-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.875rem;
}

.dashboard-overview-card {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.dashboard-overview-card__head {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
}

.dashboard-overview-card__icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--r-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
}

.dashboard-overview-key {
  display: block;
  padding: 0.875rem 1rem;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  word-break: break-all;
}

.dashboard-overview-showcase {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.dashboard-overview-showcase__list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.875rem;
}

.dashboard-overview-showcase__item {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 0.875rem;
  border-radius: var(--r-lg);
  background: var(--surface-2);
}

.dashboard-overview-details-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.875rem;
}

.dashboard-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  border-radius: var(--r-xl);
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
}

.dashboard-notice--success {
  border-color: rgba(4, 120, 87, 0.24);
  background: var(--success-soft);
}

.dashboard-inline-error {
  padding: 0.875rem 1rem;
  border-radius: var(--r-lg);
  border: 1px solid rgba(185, 28, 28, 0.18);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.875rem;
}

.dashboard-warning-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.875rem;
  border-radius: var(--r-lg);
  border: 1px solid var(--warning-border);
  background: var(--warning-soft);
  color: var(--warning);
}

.dashboard-billing-hero {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-top: 1.125rem;
}

.dashboard-billing-hero__content {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.dashboard-stat-stack,
.dashboard-account-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.875rem;
}

.dashboard-stat {
  padding: 0.875rem;
  border-radius: var(--r-lg);
  background: var(--surface-2);
}

.dashboard-billing-hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem;
}

.dashboard-billing-hero__actions .btn {
  flex: 0 0 auto;
}

.dashboard-transactions-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.dashboard-transactions-table-shell {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
}

.dashboard-transactions-actions {
  display: flex;
  justify-content: flex-end;
}

.dashboard-transactions-table {
  width: 100%;
  min-width: 42rem;
  border-collapse: collapse;
}

.dashboard-transactions-table th {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.dashboard-transactions-cell {
  padding: 0.875rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.dashboard-transactions-cell--action,
th.dashboard-transactions-table__action {
  text-align: right;
}

.dashboard-transaction-status {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: var(--r-full);
  border: 1px solid transparent;
  font-size: 0.75rem;
  font-weight: 600;
}

.dashboard-transaction-status--success {
  color: var(--success);
  background: var(--success-soft);
  border-color: rgba(4, 120, 87, 0.2);
}

.dashboard-transaction-status--pending {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: rgba(180, 83, 9, 0.18);
}

.dashboard-transaction-status--neutral {
  color: var(--text-secondary);
  background: var(--surface-2);
  border-color: var(--border);
}

#billing-action-note {
  flex-basis: 100%;
}

.dashboard-billing-modal {
  width: min(100%, 32rem);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.dashboard-billing-modal-summary {
  padding: 0.875rem 1rem;
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, rgba(1, 105, 111, 0.05), transparent 100%), var(--surface-2);
  border: 1px solid var(--border);
}

.dashboard-billing-modal-summary__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.dashboard-billing-modal-summary__row + .dashboard-billing-modal-summary__row {
  margin-top: 0.5rem;
}

.dashboard-payment-shell {
  padding: 0.875rem;
  border-radius: var(--r-xl);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.dashboard-payment-method-hero {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 0.875rem;
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, rgba(1, 105, 111, 0.05), transparent 100%), var(--surface-2);
  border: 1px solid var(--border);
}

.dashboard-payment-method-logo {
  width: 3.75rem;
  min-width: 3.75rem;
  height: 2.375rem;
  border-radius: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  overflow: hidden;
  padding: 0.45rem;
}

.dashboard-payment-method-logo[data-brand="visa"] {
  background: #ffffff;
}

.dashboard-payment-method-logo[data-brand="mastercard"] {
  background: #ffffff;
}

.dashboard-payment-method-logo[data-brand="amex"] {
  background: #ffffff;
}

.dashboard-payment-method-logo[data-brand="discover"] {
  background: #ffffff;
}

.dashboard-payment-method-logo__image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.dashboard-payment-method-logo__text {
  color: var(--text);
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.dashboard-payment-method-copy {
  min-width: 0;
  flex: 1;
}

#billing-payment-element {
  min-height: 12rem;
}

@media (max-width: 639px) {
  .modal-panel {
    padding: 1.25rem;
  }
}

.dashboard-plan-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.dashboard-plan-card {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.dashboard-plan-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.dashboard-plan-card--featured {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 2px var(--accent-softer), var(--shadow-sm);
}

.dashboard-plan-card--current {
  border-color: var(--accent-border);
  background: linear-gradient(180deg, rgba(1, 105, 111, 0.04), transparent 60%), var(--surface);
}

.dashboard-plan-card--selected {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 2px var(--accent-softer);
}

.dashboard-plan-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.dashboard-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.dashboard-badge--accent {
  background: var(--accent-soft);
  color: var(--accent);
}

@media (min-width: 768px) {
  .dashboard-nav {
    flex-direction: column;
  }

  .dashboard-nav__button {
    width: 100%;
    justify-content: flex-start;
  }

  .dashboard-account-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    display: grid;
  }

  .dashboard-stat-stack {
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  }

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

  .dashboard-payment-method-hero {
    padding: 1.125rem 1.25rem;
  }

  .dashboard-overview-showcase__list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-overview-details-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .dashboard-layout {
    grid-template-columns: 18rem minmax(0, 1fr);
    align-items: start;
  }

  .dashboard-sidebar {
    position: sticky;
    top: calc(var(--nav-h) + 1rem);
  }

  .dashboard-stat-stack {
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  }
}

@media (min-width: 1280px) {
  .dashboard-stat-stack {
    grid-template-columns: repeat(3, minmax(15rem, 1fr));
  }
}

/* Responsive helpers --------------------------------------------------- */
@media (min-width: 640px) {
  .sm\:grid-cols-2  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:grid-cols-3  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sm\:flex-row     { flex-direction: row; }
  .sm\:inline       { display: inline; }
  .sm\:block        { display: block; }
  .sm\:hidden       { display: none !important; }
}

@media (min-width: 768px) {
  .md\:flex         { display: flex; }
  .md\:flex-row     { flex-direction: row; }
  .md\:hidden       { display: none !important; }
  .md\:block        { display: block; }
  .md\:grid-cols-2  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-4  { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .md\:text-2xl     { font-size: 1.5rem; line-height: 1.35; }
  .md\:text-3xl     { font-size: 1.875rem; line-height: 1.25; }
  .md\:text-4xl     { font-size: 2.25rem; line-height: 1.15; }
  .md\:text-5xl     { font-size: 3rem; line-height: 1.1; }
  .md\:text-6xl     { font-size: 3.75rem; line-height: 1.05; }
  .md\:py-16        { padding-block: 4rem; }
  .md\:py-24        { padding-block: 6rem; }
  .md\:py-36        { padding-block: 9rem; }
  .md\:gap-4        { gap: 1rem; }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-3  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4  { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\:block        { display: block; }
  .lg\:hidden       { display: none !important; }
}

/* ─── Pricing page ───────────────────────────────────────────────────────── */
.pricing-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: stretch;
}
@media (min-width: 640px)  { .pricing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .pricing-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}
.pricing-card:hover { box-shadow: var(--shadow); }
.pricing-card--featured {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-softer), var(--shadow);
}
.pricing-card--featured:hover {
  box-shadow: 0 0 0 3px var(--accent-softer), var(--shadow-lg);
}

.pricing-badge {
  position: absolute;
  top: -0.8rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.875rem;
  border-radius: var(--r-full);
  white-space: nowrap;
}

.pricing-plan-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.pricing-plan-name--featured { color: var(--accent); }

.pricing-price {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin: 0.5rem 0 0.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.125rem;
}
.pricing-price sup {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
}
.pricing-price-custom {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin: 0.5rem 0 0.25rem;
}

.pricing-period {
  font-size: 0.8125rem;
  color: var(--text-muted);
  min-height: 1.25rem;
}

.pricing-tagline {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.75rem;
  min-height: 2.5rem;
}

.pricing-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

.pricing-features {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-bottom: 1.5rem;
}
.pricing-feature {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.45;
}
.pricing-feature svg {
  flex: none;
  width: 1rem;
  height: 1rem;
  color: var(--accent);
  margin-top: 0.125rem;
}
.pricing-feature--muted { color: var(--text-muted); }
.pricing-feature--muted svg { color: var(--text-muted); }

.pricing-compare-intro {
  max-width: 42rem;
  margin: 0 auto 2rem;
  text-align: center;
}

.pricing-compare-intro p {
  margin-top: 0.75rem;
  font-size: 0.95rem;
}

.pricing-compare-scroller {
  overflow-x: auto;
  overflow-y: visible;
  padding-top: 1rem;
  padding-bottom: 0.75rem;
}

.pricing-compare-table {
  width: 100%;
  min-width: 56rem;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  overflow: visible;
  box-shadow: var(--shadow-sm);
}

.pricing-compare-table th,
.pricing-compare-table td {
  padding: 0.8rem 1rem;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.pricing-compare-table thead th {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.pricing-compare-table tbody tr:last-child th,
.pricing-compare-table tbody tr:last-child td {
  border-bottom: 0;
}

.pricing-compare-table thead tr:first-child th:first-child {
  border-top-left-radius: calc(var(--r-2xl) - 1px);
}

.pricing-compare-table thead tr:first-child th:last-child {
  border-top-right-radius: calc(var(--r-2xl) - 1px);
}

.pricing-compare-table tbody tr:last-child th:first-child {
  border-bottom-left-radius: calc(var(--r-2xl) - 1px);
}

.pricing-compare-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: calc(var(--r-2xl) - 1px);
}

.pricing-compare-table__corner {
  width: 25%;
  min-width: 15rem;
  text-align: left;
  vertical-align: middle !important;
}

.pricing-compare-table__corner-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.pricing-compare-table__corner-copy {
  margin-top: 0.5rem;
  margin-bottom: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.pricing-compare-plan {
  width: 25%;
  min-width: 13rem;
  text-align: center;
  position: relative;
}

.pricing-compare-plan__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  min-height: 100%;
}

.pricing-compare-plan__cta {
  margin-top: 0.5rem;
}

.pricing-compare-plan--featured {
  background: linear-gradient(180deg, rgba(1, 105, 111, 0.12) 0%, rgba(1, 105, 111, 0.05) 100%);
  box-shadow: inset 0 0 0 1px var(--accent-border);
}

.pricing-compare-plan--featured .pricing-compare-plan__header {
  padding-top: 0;
}

.pricing-compare-plan--featured .pricing-badge {
  top: -1rem;
  left: 50%;
  transform: translateX(-50%);
}

.pricing-compare-table thead th:nth-child(4),
.pricing-compare-table tbody td:nth-child(4) {
  background-color: rgba(1, 105, 111, 0.04);
}

.pricing-compare-table thead th:nth-child(4) {
  background-image: linear-gradient(180deg, rgba(1, 105, 111, 0.12) 0%, rgba(1, 105, 111, 0.05) 100%);
}

.pricing-compare-label {
  width: 25%;
  min-width: 15rem;
  text-align: left;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
}

.pricing-compare-note {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.35;
  color: var(--text-muted);
}

.pricing-compare-value {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.35;
  text-align: center;
  vertical-align: middle;
}

.pricing-compare-row--with-note td.pricing-compare-value {
  position: relative;
}

.pricing-compare-row--with-note td.pricing-compare-value .pricing-compare-mark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.pricing-compare-mark {
  display: inline-block;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
}

.pricing-compare-mark--yes {
  color: var(--accent);
}

.pricing-compare-mark--no {
  color: var(--text-muted);
}

.pricing-compare-section-row th,
.pricing-compare-section-row td {
  padding-top: 1.35rem;
  padding-bottom: 0.5rem;
  border-bottom: 0;
  background: transparent;
}

.pricing-compare-section-row td {
  padding-left: 0;
  padding-right: 0;
}

.pricing-compare-section-row td:last-child {
  background-color: rgba(1, 105, 111, 0.04);
}

.pricing-compare-section-label {
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  text-align: left;
  padding-bottom: 0.35rem !important;
  border-bottom: 2px solid var(--accent-border) !important;
}

.pricing-compare-footnote {
  max-width: 46rem;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 767px) {
  .pricing-compare-intro {
    margin-bottom: 1.5rem;
  }

  .pricing-compare-table th,
  .pricing-compare-table td {
    padding: 0.875rem 0.875rem;
  }

  .pricing-compare-table {
    min-width: 49rem;
  }

  .pricing-compare-table__corner-title {
    font-size: 1.125rem;
  }
}
