/* =========================================================
   DevKit — Premium Developer Tools Platform
   Shared Design System
   ========================================================= */

/* -------- Design Tokens -------- */
:root {
  /* Brand */
  --brand-50:  #eef2ff;
  --brand-100: #e0e7ff;
  --brand-200: #c7d2fe;
  --brand-300: #a5b4fc;
  --brand-400: #818cf8;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;

  --accent-1: #8b5cf6;
  --accent-2: #06b6d4;
  --accent-3: #ec4899;
  --accent-4: #10b981;

  /* Light theme */
  --bg:           #fafafa;
  --bg-elev:      #ffffff;
  --bg-soft:      #f4f4f5;
  --bg-overlay:   rgba(255,255,255,0.7);
  --border:       #e4e4e7;
  --border-strong:#d4d4d8;
  --text:         #18181b;
  --text-soft:    #52525b;
  --text-muted:   #71717a;
  --text-faint:   #a1a1aa;

  --code-bg:      #f4f4f5;
  --code-text:    #18181b;
  --success:      #16a34a;
  --danger:       #dc2626;
  --warning:      #d97706;
  --info:         #0284c7;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, 0.12), 0 8px 20px -8px rgba(15, 23, 42, 0.06);
  --shadow-glow: 0 0 0 1px rgba(99, 102, 241, 0.2), 0 8px 30px -10px rgba(99,102,241, 0.35);

  --grad-hero: radial-gradient(1200px 600px at 80% -10%, rgba(99,102,241,0.15), transparent 50%),
               radial-gradient(900px 600px at 10% 10%, rgba(139,92,246,0.10), transparent 55%),
               radial-gradient(900px 600px at 50% 80%, rgba(6,182,212,0.08), transparent 50%);

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-2xl: 28px;

  /* Type */
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Layout */
  --sidebar-w: 264px;
  --topbar-h: 64px;
  --container: 1200px;

  /* Motion */
  --ease: cubic-bezier(.2,.7,.2,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
  --t-fast: 140ms;
  --t-med: 240ms;
  --t-slow: 420ms;
}

[data-theme="dark"] {
  --bg:           #09090b;
  --bg-elev:      #111114;
  --bg-soft:      #18181b;
  --bg-overlay:   rgba(17,17,20,0.7);
  --border:       #27272a;
  --border-strong:#3f3f46;
  --text:         #fafafa;
  --text-soft:    #d4d4d8;
  --text-muted:   #a1a1aa;
  --text-faint:   #71717a;

  --code-bg:      #0b0b0e;
  --code-text:    #e4e4e7;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.6);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.45);
  --shadow-lg: 0 24px 60px -16px rgba(0,0,0,0.7);
  --shadow-glow: 0 0 0 1px rgba(129,140,248,0.25), 0 12px 40px -10px rgba(99,102,241, 0.45);

  --grad-hero: radial-gradient(1200px 600px at 80% -10%, rgba(99,102,241,0.18), transparent 50%),
               radial-gradient(900px 600px at 10% 10%, rgba(139,92,246,0.16), transparent 55%),
               radial-gradient(900px 600px at 50% 80%, rgba(6,182,212,0.12), transparent 50%);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--t-med) var(--ease), color var(--t-med) var(--ease);
}
img, svg { display: block; max-width: 100%; }
a { color: var(--brand-600); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--brand-700); }
[data-theme="dark"] a { color: var(--brand-300); }
[data-theme="dark"] a:hover { color: var(--brand-200); }

h1, h2, h3, h4 { color: var(--text); letter-spacing: -0.015em; line-height: 1.2; margin: 0; }
h1 { font-size: clamp(2.2rem, 4.5vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.6rem, 2.5vw, 2.1rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 650; }
p { margin: 0 0 .6em; color: var(--text-soft); }

::selection { background: var(--brand-200); color: var(--brand-700); }
[data-theme="dark"] ::selection { background: rgba(129,140,248,0.4); color: #fff; }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-track { background: transparent; }

/* -------- Layout -------- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* -------- Top Bar -------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  background: var(--bg-overlay);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-500), var(--accent-1));
  box-shadow: 0 6px 16px -6px rgba(99,102,241,.7);
  display: grid; place-items: center;
  color: white;
  font-weight: 800;
  font-size: 14px;
}
.brand-name { font-size: 16px; }
.brand-name span { color: var(--brand-500); }

.nav { display: flex; gap: 6px; margin-left: auto; align-items: center; }
.nav a.nav-link {
  padding: 8px 12px;
  color: var(--text-soft);
  font-weight: 500;
  font-size: 14px;
  border-radius: var(--r-md);
  transition: background var(--t-fast), color var(--t-fast);
}
.nav a.nav-link:hover { background: var(--bg-soft); color: var(--text); }

.theme-toggle, .icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px; height: 38px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-soft);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--t-fast);
}
.theme-toggle:hover, .icon-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
  transform: translateY(-1px);
}
.theme-toggle svg { width: 18px; height: 18px; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

/* Hamburger */
.hamburger {
  display: none;
  width: 38px; height: 38px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: var(--r-md);
  cursor: pointer;
  align-items: center; justify-content: center;
}
.hamburger svg { width: 20px; height: 20px; }

/* -------- Buttons -------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--t-fast), background var(--t-fast), border var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand-600), var(--accent-1));
  color: #fff;
  box-shadow: 0 8px 20px -8px rgba(99,102,241, .55);
}
.btn-primary:hover { box-shadow: 0 12px 30px -10px rgba(99,102,241, .7); transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg-soft); border-color: var(--border-strong); }
.btn-soft {
  background: var(--bg-soft);
  color: var(--text);
  border-color: var(--border);
}
.btn-soft:hover { background: var(--bg-elev); border-color: var(--border-strong); }
.btn-danger {
  background: transparent; color: var(--danger); border-color: var(--border);
}
.btn-danger:hover { background: rgba(220,38,38,0.08); border-color: var(--danger); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }

/* -------- Hero -------- */
.hero {
  position: relative;
  padding: 80px 0 60px;
  background: var(--grad-hero);
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(transparent 0%, var(--bg) 100%);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; text-align: center; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  font-size: 12px; font-weight: 600;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-soft);
  box-shadow: var(--shadow-sm);
}
.hero-eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-4);
  box-shadow: 0 0 0 4px rgba(16,185,129,.15);
}
.hero h1 {
  margin: 22px 0 14px;
  background: linear-gradient(180deg, var(--text), color-mix(in oklab, var(--text), transparent 35%));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero h1 .grad {
  background: linear-gradient(120deg, var(--brand-500), var(--accent-1) 50%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  max-width: 640px;
  margin: 0 auto 28px;
  color: var(--text-muted);
  font-size: 1.05rem;
}
.hero-cta { display: inline-flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* Hero search */
.hero-search {
  max-width: 620px;
  margin: 28px auto 0;
  position: relative;
}
.hero-search input {
  width: 100%;
  padding: 16px 18px 16px 48px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  box-shadow: var(--shadow-md);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
}
.hero-search input:focus {
  border-color: var(--brand-400);
  box-shadow: var(--shadow-glow);
}
.hero-search .icon-search {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-muted);
}
.hero-search .kbd {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-muted);
}

/* Quick results */
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  max-height: 360px; overflow: auto;
  display: none;
  z-index: 20;
  text-align: left;
}
.search-results.open { display: block; }
.search-results a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 14px;
}
.search-results a:hover, .search-results a.active { background: var(--bg-soft); }
.search-results .res-cat { margin-left: auto; font-size: 11px; color: var(--text-muted); }
.search-results .empty { padding: 18px; color: var(--text-muted); text-align: center; font-size: 14px; }

/* -------- Sections -------- */
.section { padding: 64px 0; }
.section-head { text-align: center; margin-bottom: 36px; }
.section-eyebrow {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-500);
  text-transform: uppercase;
  letter-spacing: .12em;
}
.section-head h2 { margin-top: 8px; }
.section-head p { color: var(--text-muted); max-width: 620px; margin: 10px auto 0; }

/* -------- Category Grid -------- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.cat-card {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px;
  overflow: hidden;
  transition: border-color var(--t-med), transform var(--t-med), box-shadow var(--t-med);
}
.cat-card::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(400px 200px at 0% 0%, var(--accent-glow, rgba(99,102,241,0.10)), transparent 60%);
  opacity: 0; transition: opacity var(--t-med);
  pointer-events: none;
}
.cat-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.cat-card:hover::before { opacity: 1; }
.cat-icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--cat-from, var(--brand-500)), var(--cat-to, var(--accent-1)));
  color: white;
  box-shadow: 0 8px 16px -8px var(--cat-shadow, rgba(99,102,241,.55));
  margin-bottom: 14px;
}
.cat-icon svg { width: 22px; height: 22px; }
.cat-card h3 { margin-bottom: 4px; }
.cat-card p { font-size: 14px; color: var(--text-muted); margin: 0 0 14px; }
.cat-list { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-list a {
  font-size: 12px; padding: 4px 10px;
  background: var(--bg-soft);
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: all var(--t-fast);
}
.cat-list a:hover { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-200); }
[data-theme="dark"] .cat-list a:hover { background: rgba(99,102,241,.15); color: var(--brand-200); border-color: var(--brand-500); }

/* -------- Featured Tools -------- */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.tool-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  display: flex; flex-direction: column; gap: 8px;
  transition: all var(--t-med);
  color: var(--text);
}
.tool-card:hover { transform: translateY(-2px); border-color: var(--brand-300); box-shadow: var(--shadow-md); }
[data-theme="dark"] .tool-card:hover { border-color: var(--brand-500); }
.tool-card .tc-head { display: flex; align-items: center; gap: 10px; }
.tool-card .tc-ic {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: var(--bg-soft);
  color: var(--brand-500);
}
.tool-card .tc-ic svg { width: 18px; height: 18px; }
.tool-card h3 { font-size: 1rem; }
.tool-card p { font-size: 13px; color: var(--text-muted); margin: 0; }
.tool-card .tc-tag {
  margin-left: auto; font-size: 10px; font-weight: 700;
  color: var(--brand-600); background: var(--brand-50);
  padding: 2px 8px; border-radius: 999px; letter-spacing: .03em;
}
[data-theme="dark"] .tool-card .tc-tag { background: rgba(129,140,248,.15); color: var(--brand-200); }

/* -------- Stats -------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.stat { text-align: center; padding: 12px; }
.stat .num {
  font-size: 2rem; font-weight: 800; letter-spacing: -.02em;
  background: linear-gradient(135deg, var(--brand-500), var(--accent-1));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat .lbl { font-size: 13px; color: var(--text-muted); }

/* -------- Features -------- */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}
.feature {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
  transition: all var(--t-med);
}
.feature:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.feature .ft-ic {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--bg-soft);
  color: var(--brand-500);
  margin-bottom: 12px;
}
.feature .ft-ic svg { width: 20px; height: 20px; }
.feature h3 { margin-bottom: 4px; }
.feature p { font-size: 14px; color: var(--text-muted); margin: 0; }

/* -------- Privacy banner -------- */
.privacy-banner {
  display: flex; align-items: center; gap: 16px;
  background: var(--bg-elev);
  border: 1px dashed var(--border-strong);
  padding: 18px 22px;
  border-radius: var(--r-lg);
  color: var(--text-soft);
  font-size: 14px;
}
.privacy-banner svg { width: 22px; height: 22px; color: var(--accent-4); flex-shrink: 0; }
.privacy-banner strong { color: var(--text); }

/* -------- Footer -------- */
.footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 40px 0;
  background: var(--bg-elev);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 32px;
}
.footer h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); margin-bottom: 12px; }
.footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.footer a { color: var(--text-soft); font-size: 14px; }
.footer a:hover { color: var(--text); }
.footer-bottom {
  margin-top: 32px; padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
  color: var(--text-muted); font-size: 13px;
}

/* =========================================================
   Tool Page Layout (sidebar)
   ========================================================= */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: calc(100vh - var(--topbar-h));
}
.sidebar {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 22px 14px;
  border-right: 1px solid var(--border);
  background: var(--bg-elev);
}
.sidebar-search {
  position: relative; margin-bottom: 18px;
}
.sidebar-search input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  font-size: 13px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--r-md);
  font-family: inherit;
  outline: none;
  transition: border-color var(--t-fast);
}
.sidebar-search input:focus { border-color: var(--brand-400); }
.sidebar-search svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-muted);
}
.side-group { margin-bottom: 14px; }
.side-group .side-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-muted);
  padding: 6px 10px; margin-bottom: 4px;
}
.side-group ul { list-style: none; padding: 0; margin: 0; }
.side-group a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  font-size: 13.5px;
  color: var(--text-soft);
  border-radius: var(--r-md);
  transition: background var(--t-fast), color var(--t-fast);
}
.side-group a:hover { background: var(--bg-soft); color: var(--text); }
.side-group a.active {
  background: linear-gradient(90deg, rgba(99,102,241,.10), transparent);
  color: var(--brand-600); font-weight: 600;
  position: relative;
}
.side-group a.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  background: linear-gradient(180deg, var(--brand-500), var(--accent-1));
  border-radius: 4px;
}
[data-theme="dark"] .side-group a.active { color: var(--brand-200); }
.side-group .side-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}
.side-group a:hover .side-dot { background: var(--brand-400); }

.side-group a.soon { color: var(--text-faint); cursor: not-allowed; }
.side-group a.soon:hover { background: transparent; color: var(--text-faint); }
.side-group a.soon .side-dot { background: var(--text-faint); opacity: .6; }
.side-group a .side-soon {
  margin-left: auto;
  font-size: 9.5px; font-weight: 700;
  letter-spacing: .08em;
  color: var(--text-muted);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 999px;
}

/* Main */
.main {
  padding: 28px clamp(20px, 4vw, 40px) 60px;
  min-width: 0;
}
.breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex; gap: 6px; align-items: center;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text); }
.tool-header { margin-bottom: 22px; }
.tool-header .badge {
  font-size: 11px; font-weight: 700;
  color: var(--brand-600); background: var(--brand-50);
  padding: 3px 10px; border-radius: 999px;
  display: inline-block; margin-bottom: 10px; letter-spacing: .04em;
}
[data-theme="dark"] .tool-header .badge { background: rgba(129,140,248,.15); color: var(--brand-200); }
.tool-header h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin-bottom: 6px; }
.tool-header p { color: var(--text-muted); max-width: 720px; }

/* Ads */
.ad-slot {
  width: 100%;
  min-height: 90px;
  margin: 0 auto;
  overflow: hidden;
}
.ad-slot[hidden] { display: none; }
.ad-slot-home {
  margin-top: 8px;
  margin-bottom: 16px;
}
.ad-slot-tool {
  margin-bottom: 22px;
}

/* Card */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.card-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.card-toolbar h3 { font-size: 14px; color: var(--text-muted); font-weight: 600; margin-right: auto; text-transform: uppercase; letter-spacing: .08em;}

.io-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 900px) {
  .io-grid { grid-template-columns: 1fr; }
}

textarea.io, input.io, select.io {
  width: 100%;
  min-height: 280px;
  padding: 14px 16px;
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
input.io { min-height: 0; padding: 10px 14px; font-family: inherit; font-size: 14px; }
select.io { min-height: 0; padding: 10px 14px; font-family: inherit; font-size: 14px; }
textarea.io:focus, input.io:focus, select.io:focus {
  border-color: var(--brand-400);
  box-shadow: var(--shadow-glow);
}
.io-readout {
  min-height: 280px;
  padding: 14px 16px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: 13.5px;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  color: var(--code-text);
}
.io-readout.empty { color: var(--text-faint); font-style: italic; display: grid; place-items: center; }

/* Status */
.status-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; flex-wrap: wrap; }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.status.ok { color: var(--success); }
.status.err { color: var(--danger); }
.status.info { color: var(--info); }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.muted { color: var(--text-muted); }

/* Field row */
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-muted); font-weight: 600; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .06em;}
@media (max-width: 720px) { .fields { grid-template-columns: 1fr; } }

/* Toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 44px; height: 24px;
}
.switch input { display: none; }
.switch span {
  position: absolute; inset: 0;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--t-fast);
}
.switch span::before {
  content: ""; position: absolute; left: 2px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px;
  background: var(--text-soft);
  border-radius: 50%;
  transition: all var(--t-fast);
}
.switch input:checked + span {
  background: linear-gradient(135deg, var(--brand-500), var(--accent-1));
  border-color: transparent;
}
.switch input:checked + span::before {
  left: 22px; background: #fff;
}

/* Drop zone */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: 30px;
  text-align: center;
  color: var(--text-muted);
  background: var(--bg-soft);
  transition: all var(--t-fast);
  cursor: pointer;
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--brand-400);
  background: color-mix(in oklab, var(--brand-50), var(--bg-soft));
  color: var(--text);
}
[data-theme="dark"] .dropzone:hover, [data-theme="dark"] .dropzone.drag {
  background: rgba(99,102,241,0.08);
}
.dropzone svg { width: 28px; height: 28px; color: var(--brand-500); margin-bottom: 8px; }
.dropzone strong { display: block; color: var(--text); margin-bottom: 4px; }

/* Toast */
.toast-host {
  position: fixed; right: 18px; bottom: 18px;
  display: grid; gap: 10px; z-index: 200;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 14px;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  min-width: 220px;
  font-size: 14px;
  animation: toastIn .25s var(--ease-out);
}
.toast .dot { width: 8px; height: 8px; border-radius: 50%; }
.toast.ok .dot { background: var(--success); }
.toast.err .dot { background: var(--danger); }
.toast.info .dot { background: var(--info); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* Tooltip */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--text);
  color: var(--bg);
  font-size: 11px; font-weight: 600;
  padding: 5px 8px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-fast), transform var(--t-fast);
}
[data-tip]:hover::after { opacity: .96; transform: translateX(-50%) translateY(0); }

/* Animations */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease-out), transform .6s var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }

/* Mobile */
.backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 49; opacity: 0; pointer-events: none;
  transition: opacity var(--t-med);
}
.backdrop.open { opacity: 1; pointer-events: auto; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    width: 280px;
    height: calc(100vh - var(--topbar-h));
    z-index: 60;
    transform: translateX(-105%);
    transition: transform var(--t-med) var(--ease-out);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: inline-flex; }
  .nav .nav-link { display: none; }
}

@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .hero { padding: 56px 0 40px; }
  .section { padding: 44px 0; }
}
@media (max-width: 460px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* Utility */
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.right { justify-content: flex-end; }
.kbd-inline {
  font-family: var(--font-mono); font-size: 11px;
  padding: 2px 6px; border-radius: 4px;
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--text-muted);
}
.swatch { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); }
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tag {
  display: inline-flex; gap: 6px; align-items: center;
  font-size: 12px; padding: 4px 10px;
  border: 1px solid var(--border); background: var(--bg-soft);
  color: var(--text-soft); border-radius: 999px;
}

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

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--brand-400);
  outline-offset: 2px;
  border-radius: 6px;
}
