/* rootcaptcha.ai — brand system (root / ink / lime)
   Distinct from CapMonster orange clones and purple/cream AI defaults. */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@500;600;700;800&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --ink: #0c0f0d;
  --ink-soft: #161b18;
  --paper: #f3f1ea;
  --paper-2: #e8e5db;
  --lime: #c6ff3d;
  --lime-dim: #9fd420;
  --soil: #2a332c;
  --mist: #8a938b;
  --line: rgba(12, 15, 13, 0.1);
  --ok: #1f9d55;
  --warn: #c47a12;
  --err: #d64545;

  --bg-primary: var(--paper);
  --bg-secondary: #fffef9;
  --bg-tertiary: var(--paper-2);
  --bg-card: #fffef9;
  --bg-elevated: #ffffff;
  --bg-sidebar: var(--ink);
  --border: var(--line);
  --border-hover: rgba(12, 15, 13, 0.22);
  --text-primary: var(--ink);
  --text-secondary: #3d463f;
  --text-muted: var(--mist);
  --accent-primary: var(--ink);
  --accent-secondary: var(--lime-dim);
  --accent-emerald: var(--lime-dim);
  --accent-cyan: #2f6f5e;
  --accent-gradient: linear-gradient(120deg, var(--lime) 0%, #e8ff9a 100%);
  --success: var(--ok);
  --warning: var(--warn);
  --error: var(--err);
  --info: #2f6f5e;
  --danger: var(--err);
  --shadow-sm: 0 1px 0 rgba(12, 15, 13, 0.06);
  --shadow-md: 0 18px 50px rgba(12, 15, 13, 0.1);
  --shadow-glow: 0 0 0 transparent;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --sidebar-width: 260px;
  --header-height: 64px;
  --transition: 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --display: "Syne", "IBM Plex Sans", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --surface-blur: rgba(243, 241, 234, 0.86);
  --grid-line: rgba(12, 15, 13, 0.05);
  --scrollbar-size: 6px;
  --scrollbar-track: transparent;
  --scrollbar-thumb: rgba(12, 15, 13, 0.18);
  --scrollbar-thumb-hover: rgba(12, 15, 13, 0.3);
  --scrollbar-thumb-active: var(--lime-dim);
  --cf-orange: var(--lime-dim);
  --cf-orange-dim: #7eae10;
  --cap-amber: var(--lime);
  --evomi-cyan: #2f6f5e;
  --evomi-blue: #2f6f5e;
}

[data-theme="dark"] {
  --bg-primary: var(--ink);
  --bg-secondary: var(--ink-soft);
  --bg-tertiary: #1d2420;
  --bg-card: #141916;
  --bg-elevated: #1a211d;
  --bg-sidebar: #070908;
  --border: rgba(243, 241, 234, 0.08);
  --border-hover: rgba(198, 255, 61, 0.35);
  --text-primary: #f3f1ea;
  --text-secondary: #b7bfb8;
  --text-muted: #7a857c;
  --accent-primary: var(--lime);
  --surface-blur: rgba(12, 15, 13, 0.82);
  --shadow-md: 0 18px 50px rgba(0, 0, 0, 0.45);
  --scrollbar-thumb: rgba(243, 241, 234, 0.15);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  color-scheme: light;
}

[data-theme="dark"] html, html:has([data-theme="dark"]) { color-scheme: dark; }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-secondary); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
.mono, code, pre { font-family: var(--mono); }

.container {
  width: min(1120px, calc(100% - 2.5rem));
  margin-inline: auto;
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition), border-color var(--transition);
  text-decoration: none !important;
}
.btn:hover { transform: translateY(-1px); }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.875rem; }
.btn-primary {
  background: var(--ink);
  color: var(--lime);
  border-color: var(--ink);
}
[data-theme="dark"] .btn-primary {
  background: var(--lime);
  color: var(--ink);
  border-color: var(--lime);
}
.btn-secondary {
  background: transparent;
  border-color: var(--border-hover);
  color: var(--text-primary);
}
.btn-secondary:hover { border-color: var(--text-primary); }

/* —— Logo —— */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none !important;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.04em;
}
.logo-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 0.4rem;
  background: var(--lime);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  font-weight: 800;
}
.logo-text { font-size: 1.15rem; }
.logo-text .tld { color: var(--mist); font-weight: 500; }

/* —— Landing header —— */
.landing-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: var(--surface-blur);
  border-bottom: 1px solid var(--border);
}
.landing-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  gap: 1rem;
}
.landing-nav {
  display: flex;
  gap: 1.25rem;
  font-size: 0.92rem;
  color: var(--text-secondary);
}
.landing-nav-toggle {
  display: none;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}
.landing-nav a { text-decoration: none; }
.landing-nav a:hover { color: var(--text-primary); }
.landing-actions { display: flex; gap: 0.5rem; align-items: center; }

/* —— Hero (one composition) —— */
.hero {
  position: relative;
  min-height: calc(100vh - var(--header-height));
  display: grid;
  align-items: end;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 80% 10%, rgba(198, 255, 61, 0.35), transparent 55%),
    linear-gradient(160deg, #ebe7db 0%, #d9d3c2 48%, #bdb7a4 100%);
  isolation: isolate;
}
[data-theme="dark"] .hero {
  background:
    radial-gradient(ellipse 70% 50% at 85% 0%, rgba(198, 255, 61, 0.18), transparent 50%),
    linear-gradient(165deg, #0c0f0d 0%, #151a16 55%, #1c241c 100%);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, #000 20%, transparent 90%);
  pointer-events: none;
  z-index: 0;
}
.hero-ink-rail {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: clamp(4.5rem, 12vw, 9rem);
  background: var(--ink);
  z-index: 0;
  pointer-events: none;
}
.hero-ink-rail::after {
  content: "root";
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) rotate(-90deg);
  transform-origin: center;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--lime);
  white-space: nowrap;
}
.hero-slash {
  position: absolute;
  right: -8%;
  top: -20%;
  width: min(52vw, 34rem);
  height: 140%;
  background: linear-gradient(115deg, transparent 42%, rgba(198, 255, 61, 0.55) 42.5%, rgba(198, 255, 61, 0.55) 46%, transparent 46.5%);
  z-index: 0;
  pointer-events: none;
  animation: has-slash 1.1s cubic-bezier(.2,.7,.2,1) both;
}
.hero-content {
  position: relative;
  z-index: 1;
  padding: clamp(3rem, 10vh, 6rem) 0 clamp(4rem, 12vh, 7rem);
  max-width: 40rem;
  margin-left: clamp(0.5rem, 4vw, 2rem);
}
.has-enter {
  animation: has-rise 0.85s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes has-rise {
  from { opacity: 0; transform: translateY(1.25rem); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes has-slash {
  from { opacity: 0; transform: translateX(3rem); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes has-logo-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(198, 255, 61, 0); }
  50% { box-shadow: 0 0 0 6px rgba(198, 255, 61, 0.18); }
}
.landing-header .logo-icon {
  animation: has-logo-pulse 3.2s ease-in-out infinite;
}
.hero-brand {
  font-family: var(--display);
  font-size: clamp(3.2rem, 9vw, 5.6rem);
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 0.92;
  margin-bottom: 1.25rem;
}
.hero-brand span { color: var(--lime-dim); }
[data-theme="dark"] .hero-brand span { color: var(--lime); }
.hero h1, .hero .hero-line {
  font-family: var(--display);
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin-bottom: 0.85rem;
  max-width: 22ch;
}
.hero-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 36ch;
  margin-bottom: 1.75rem;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-bottom: 2rem; }
.hero-badge, .trust-metrics { display: none; } /* declutter first viewport */

.hero-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--mono);
}
.hero-flow b { color: var(--text-primary); font-weight: 500; }

/* —— Sections —— */
.section { padding: clamp(3.5rem, 8vh, 5.5rem) 0; }
.section-header { margin-bottom: 2rem; max-width: 36rem; }
.section-header h2 {
  font-family: var(--display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.04em;
  margin-bottom: 0.4rem;
}
.section-header p { color: var(--text-secondary); }

.captcha-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}
.captcha-type {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 0.9rem;
  background: var(--bg-secondary);
}
.type-icon {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--lime-dim);
  margin-bottom: 0.35rem;
}
.type-name { font-weight: 600; letter-spacing: -0.02em; }

.code-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--ink);
  color: #e8ebe7;
}
.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 0.8rem;
  color: #9aa39b;
}
.code-block pre {
  padding: 1.1rem 1.15rem 1.35rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.55;
}
.gradient { background: none; color: inherit; }

.landing-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.landing-footer .container {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* —— Auth pages —— */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}
.login-brand {
  background:
    radial-gradient(circle at 20% 20%, rgba(198,255,61,0.28), transparent 45%),
    var(--ink);
  color: #f3f1ea;
  padding: clamp(2rem, 5vw, 3.5rem);
  display: flex;
  align-items: flex-end;
}
.login-brand-inner { max-width: 28rem; }
.login-brand h2 {
  font-family: var(--display);
  font-size: clamp(2rem, 4vw, 2.8rem);
  letter-spacing: -0.045em;
  line-height: 1.05;
  margin: 2rem 0 0.85rem;
}
.login-brand h2 span { color: var(--lime); }
.login-brand p { color: #aeb6af; margin-bottom: 1.5rem; }
.login-features { display: grid; gap: 0.65rem; }
.login-feature {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  font-size: 0.92rem;
  color: #c9d0c9;
}
.login-feature-icon {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  background: rgba(198,255,61,0.15);
  color: var(--lime);
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  flex-shrink: 0;
}
.login-form-side {
  display: grid;
  place-items: center;
  padding: 2rem;
  background: var(--bg-primary);
}
.login-card {
  width: min(400px, 100%);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
}
.login-card h1 {
  font-family: var(--display);
  font-size: 1.65rem;
  letter-spacing: -0.03em;
  margin-bottom: 0.35rem;
}
.login-sub { color: var(--text-secondary); margin-bottom: 1.25rem; font-size: 0.95rem; }
.login-hint { color: var(--text-muted); font-size: 0.88rem; }
.form-group { margin-bottom: 0.9rem; }
.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text-secondary);
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.8rem;
  outline: none;
}
.form-group input:focus {
  border-color: var(--lime-dim);
  box-shadow: 0 0 0 3px rgba(198, 255, 61, 0.25);
}

/* —— Dashboard —— */
.dashboard-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--bg-sidebar);
  color: #e8ebe7;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.06);
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-header { padding: 1.15rem 1.1rem; }
.sidebar .logo-text { color: #f3f1ea; }
.balance-card {
  margin: 0 1rem 1rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: rgba(198, 255, 61, 0.08);
  border: 1px solid rgba(198, 255, 61, 0.18);
}
.balance-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: #9aa39b; }
.balance-value {
  font-family: var(--display);
  font-size: 1.65rem;
  letter-spacing: -0.03em;
  color: var(--lime);
  margin: 0.2rem 0;
}
.balance-sub { font-size: 0.78rem; color: #8b948c; }
.sidebar-nav { flex: 1; overflow: auto; padding: 0 0.65rem 1rem; }
.nav-section { margin-bottom: 1rem; }
.nav-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6f786f;
  padding: 0.4rem 0.55rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: #c5ccc5;
  font-size: 0.92rem;
}
.nav-item:hover, .nav-item.active {
  background: rgba(198, 255, 61, 0.1);
  color: var(--lime);
}
.nav-icon { opacity: 0.7; width: 1.1rem; text-align: center; }
.sidebar-footer { padding: 1rem; border-top: 1px solid rgba(255,255,255,0.06); }
.sidebar-status { display: flex; align-items: center; gap: 0.45rem; font-size: 0.78rem; color: #8b948c; }
.status-dot {
  width: 0.45rem; height: 0.45rem; border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 3px rgba(198,255,61,0.2);
}

.main-content { min-width: 0; background: var(--bg-primary); }
.topbar {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.35rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 {
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}
.content-area { padding: 1.35rem; }
.section-panel { display: none; }
.section-panel.active { display: block; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.stat-card, .card, .panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.05rem;
}
.stat-card .label { font-size: 0.75rem; color: var(--text-muted); }
.stat-card .value {
  font-family: var(--display);
  font-size: 1.5rem;
  letter-spacing: -0.03em;
  margin-top: 0.2rem;
}

.role-banner {
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.role-banner.is-ok {
  background: rgba(31, 157, 85, 0.1);
  border: 1px solid rgba(31, 157, 85, 0.25);
}
.role-banner.is-warn {
  background: rgba(196, 122, 18, 0.1);
  border: 1px solid rgba(196, 122, 18, 0.25);
}

.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-md); }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 0.65rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); background: var(--bg-tertiary); }

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  background: var(--ink);
  color: var(--lime);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.output, .code-out, pre.out {
  background: var(--ink);
  color: #dfe5df;
  border-radius: var(--radius-md);
  padding: 0.9rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  overflow: auto;
}

.badge, .pill {
  display: inline-flex;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(198,255,61,0.2);
  color: var(--ink);
}
[data-theme="dark"] .badge { color: var(--lime); }

.status-ready, .ready { color: var(--ok); }
.status-failed, .failed { color: var(--err); }
.status-processing, .processing { color: var(--warn); }

/* pricing / guide leftovers */
.pricing-grid, .guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.price-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  background: var(--bg-secondary);
}
.price-card h3 { font-family: var(--display); letter-spacing: -0.03em; margin-bottom: 0.4rem; }

@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; }
  .login-brand { min-height: 38vh; }
  .landing-nav { display: none; }
  .landing-nav-toggle { display: inline-grid; }
  .landing-nav.is-open {
    display: flex;
    position: absolute;
    top: calc(var(--header-height) - 0.25rem);
    left: 0.75rem;
    right: 0.75rem;
    flex-direction: column;
    gap: 0;
    padding: 0.5rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md, 0 12px 40px rgba(0,0,0,.12));
    z-index: 60;
  }
  .landing-nav.is-open a {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--border);
  }
  .landing-nav.is-open a:last-child { border-bottom: 0; }
  .dashboard-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(84vw, var(--sidebar-width));
    transform: translateX(-105%);
    transition: transform var(--transition);
    z-index: 50;
  }
  .sidebar.open { transform: translateX(0); }
}

/* ──────────────────────────────────────────────────────────────────────────
   Product UI compatibility layer
   Every dynamic class emitted by app.js and every dashboard.html component
   lives here. The visual language is "control room/editorial": dense data,
   strong typography, one fluorescent signal color, no generic gradient cards.
   ────────────────────────────────────────────────────────────────────────── */

::selection { background: var(--lime); color: var(--ink); }
::-webkit-scrollbar { width: var(--scrollbar-size); height: var(--scrollbar-size); }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

input, select, textarea {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: .68rem .78rem;
  outline: none;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--lime-dim);
  box-shadow: 0 0 0 3px rgba(198, 255, 61, .16);
}
input[readonly] { color: var(--text-secondary); cursor: text; }
button:disabled { opacity: .55; cursor: wait; transform: none !important; }
code {
  font-size: .86em;
  padding: .08em .3em;
  border-radius: 3px;
  background: rgba(127, 127, 127, .11);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.btn-copy {
  border: 0;
  background: var(--ink);
  color: var(--lime);
  font-family: var(--mono);
  font-size: .7rem;
  padding: 0 .7rem;
  cursor: pointer;
  flex: 0 0 auto;
}

.page-content { padding: 1.25rem; max-width: 1520px; margin: 0 auto; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: .75rem; }
.topbar-right { color: var(--text-muted); font-size: .8rem; }
.mobile-menu-btn {
  display: none;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--mono);
  color: var(--text-secondary);
}
.live-dot {
  width: .45rem;
  height: .45rem;
  border-radius: 50%;
  background: var(--lime-dim);
  box-shadow: 0 0 0 4px rgba(159, 212, 32, .12);
}
.sidebar-overlay { display: none; }
.sidebar-status.offline .status-dot { background: var(--err); box-shadow: none; }
.sidebar-status.offline { color: #f5a4a4; }

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: .9rem;
  overflow: hidden;
}
.panel-header {
  min-height: 3.25rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
}
.panel-header h2 {
  font-family: var(--display);
  font-size: .98rem;
  letter-spacing: -.025em;
}
.panel-meta { color: var(--text-muted); font-size: .75rem; font-family: var(--mono); }
.panel-body { min-width: 0; overflow: auto; }
.panel-body.padded { padding: 1rem; }

.quickstart-panel {
  position: relative;
  border-top: 3px solid var(--lime-dim);
}
.quickstart-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.quickstart-step {
  min-width: 0;
  padding: 1rem;
  border-right: 1px solid var(--border);
}
.quickstart-step:last-child { border-right: 0; }
.quickstart-step-num {
  font-family: var(--mono);
  font-size: .65rem;
  color: var(--lime-dim);
  margin-bottom: .65rem;
}
.quickstart-step h3 { font-size: .9rem; margin-bottom: .3rem; }
.quickstart-step p { color: var(--text-muted); font-size: .76rem; min-height: 2.3em; margin-bottom: .7rem; }
.copy-field, .api-key-display { display: flex; min-width: 0; }
.copy-field input, .api-key-display input { min-width: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.copy-field .btn-copy, .api-key-display .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.quickstart-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.quick-task-panel .form-row {
  display: grid;
  grid-template-columns: 1fr 2fr 1.2fr auto;
  align-items: end;
  gap: .75rem;
}
.settings-form { max-width: 100%; }
.form-row, .form-grid { display: grid; gap: .75rem; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-group { min-width: 0; }
.form-group.flex-2 { grid-column: span 1; }
.form-actions { display: flex; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }
.ui-input, .ui-select, .input-mono { width: 100%; }
.input-mono { font-family: var(--mono); font-size: .8rem; }
.select-wrap { position: relative; }
.select-wrap::after {
  content: "⌄";
  position: absolute;
  right: .75rem;
  top: 50%;
  transform: translateY(-55%);
  pointer-events: none;
  color: var(--text-muted);
}
.ui-select { appearance: none; padding-right: 2rem; }

.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 7.2rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
}
.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 2.4rem;
  height: 2px;
  background: var(--text-muted);
}
.stat-card.emerald::before { background: var(--lime-dim); }
.stat-card.cyan::before { background: var(--accent-cyan); }
.stat-label { color: var(--text-muted); font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; }
.stat-value {
  font-family: var(--display);
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1;
  letter-spacing: -.05em;
  margin: .65rem 0 .3rem;
}
.stat-change { color: var(--text-muted); font-size: .72rem; }
.stat-change.positive { color: var(--ok); }
.stat-change.negative { color: var(--err); }

.dashboard-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: .9rem; }
.chart-bars {
  height: 240px;
  display: flex;
  align-items: stretch;
  gap: clamp(.4rem, 2vw, 1.1rem);
  padding: 1.1rem 1rem .75rem;
}
.chart-bar-group { flex: 1; min-width: 0; display: grid; grid-template-rows: 1.4rem 1fr 1.2rem; text-align: center; }
.chart-bar-value, .chart-bar-label { font-family: var(--mono); font-size: .64rem; color: var(--text-muted); }
.chart-bar-wrapper { display: flex; align-items: end; justify-content: center; border-bottom: 1px solid var(--border); }
.chart-bar { width: min(28px, 70%); min-height: 4px; background: var(--lime-dim); border-radius: 3px 3px 0 0; }

.type-breakdown { padding: 1rem; display: grid; gap: .72rem; }
.type-row { display: grid; grid-template-columns: minmax(7rem, 1.5fr) minmax(4rem, 2fr) 2.5rem; gap: .6rem; align-items: center; }
.type-label { font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type-bar-track { height: .34rem; background: var(--bg-tertiary); border-radius: 99px; overflow: hidden; }
.type-bar-fill { height: 100%; background: var(--accent-cyan); border-radius: inherit; }
.type-count { text-align: right; font-family: var(--mono); font-size: .7rem; color: var(--text-muted); }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { white-space: nowrap; }
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: rgba(127, 127, 127, .05); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.task-type-tag {
  display: inline-block;
  max-width: 15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  padding: .18rem .42rem;
  background: var(--bg-tertiary);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: .68rem;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  border-radius: 99px;
  padding: .18rem .45rem;
  font-size: .67rem;
  font-weight: 600;
  text-transform: uppercase;
}
.status-badge.ready { color: var(--ok); background: rgba(31, 157, 85, .1); }
.status-badge.processing, .status-badge.pending { color: var(--warn); background: rgba(196, 122, 18, .1); }
.status-badge.failed { color: var(--err); background: rgba(214, 69, 69, .1); }

.benchmark-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1px;
  background: var(--border);
}
.benchmark-card { background: var(--bg-card); padding: 1rem; }
.bench-type { color: var(--text-muted); font-family: var(--mono); font-size: .67rem; min-height: 2rem; }
.bench-rate { font-family: var(--display); font-size: 1.5rem; letter-spacing: -.04em; }

.empty-state {
  min-height: 7rem;
  display: grid;
  place-items: center;
  align-content: center;
  gap: .5rem;
  color: var(--text-muted);
  text-align: center;
  font-size: .8rem;
  padding: 1rem;
}
.empty-icon { font-size: 1.4rem; filter: grayscale(1); }
.loading-shimmer {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--bg-tertiary), var(--bg-elevated), var(--bg-tertiary));
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.farm-result, .code-inline-block, .key-once {
  display: block;
  width: 100%;
  min-height: 2.5rem;
  background: var(--ink);
  color: #dce4dc;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius-sm);
  padding: .8rem;
  font-family: var(--mono);
  font-size: .72rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
}
.farm-result:empty, .farm-result.is-hidden { display: none; }
.farm-result.is-error { color: #ff9b9b; border-color: rgba(214,69,69,.35); }
.farm-result.is-success { color: var(--lime); border-color: rgba(198,255,61,.3); }
.vault-stats-bar { display: flex; gap: .55rem; flex-wrap: wrap; padding: .75rem 1rem; border-bottom: 1px solid var(--border); }
.vault-stat { font-size: .7rem; padding: .3rem .55rem; border: 1px solid var(--border); border-radius: 99px; }
.vault-stat .dot { display: inline-block; width: .4rem; height: .4rem; border-radius: 50%; background: var(--ok); margin-right: .35rem; }
.vault-panel-inner { padding: .85rem 1rem 1.1rem; }
.quick-task-form { margin: 0; }
.status-label { font-size: .78rem; color: var(--text-secondary); }
.adm-use, .cust-usage-btn { white-space: nowrap; }
.table-scroll { overflow: auto; }

/* Standalone editorial pages */
.public-shell { min-height: calc(100vh - var(--header-height)); }
.public-hero {
  padding: clamp(3rem, 8vw, 6rem) 0 2.5rem;
  border-bottom: 1px solid var(--border);
}
.public-kicker {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--lime-dim);
  font-size: .7rem;
  margin-bottom: .8rem;
}
.public-title {
  font-family: var(--display);
  font-size: clamp(2.3rem, 7vw, 5rem);
  line-height: .96;
  letter-spacing: -.065em;
  max-width: 14ch;
}
.public-lead { color: var(--text-secondary); max-width: 42rem; font-size: 1.02rem; margin-top: 1rem; }
.public-content { padding: 2rem 0 5rem; }
.editorial-grid { display: grid; grid-template-columns: 16rem minmax(0, 1fr); gap: 2rem; }
.editorial-index { position: sticky; top: calc(var(--header-height) + 1rem); align-self: start; }
.editorial-index a { display: block; padding: .5rem 0; border-bottom: 1px solid var(--border); text-decoration: none; font-size: .8rem; color: var(--text-secondary); }
.editorial-index a:hover { color: var(--lime-dim); }
.editorial-main { min-width: 0; }
.editorial-section { padding: 0 0 2.5rem; margin-bottom: 2.5rem; border-bottom: 1px solid var(--border); scroll-margin-top: 6rem; }
.editorial-section h2 { font-family: var(--display); font-size: 1.45rem; letter-spacing: -.04em; margin-bottom: .7rem; }
.editorial-section h3 { font-size: .95rem; margin: 1.2rem 0 .5rem; }
.editorial-section p { color: var(--text-secondary); margin-bottom: .8rem; }
.callout { border-left: 3px solid var(--lime-dim); padding: .75rem 1rem; background: rgba(159,212,32,.07); color: var(--text-secondary); }
.price-summary { display: flex; justify-content: space-between; gap: 1rem; align-items: end; flex-wrap: wrap; padding-bottom: 1.25rem; }
.price-summary strong { font-family: var(--display); font-size: 2rem; letter-spacing: -.04em; }
.footer-links { display: flex; gap: 1rem; }

/* Admin */
.admin-wrap { max-width: 1240px; margin: 0 auto; padding: 1.5rem 1rem 5rem; }
.admin-hero { padding: 1rem 0 1.5rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.admin-hero h1 { font-family: var(--display); font-size: clamp(2rem, 5vw, 3.5rem); letter-spacing: -.055em; line-height: 1; margin: 1rem 0 .5rem; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.admin-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1rem; }
.admin-card h2 { font-family: var(--display); font-size: 1rem; letter-spacing: -.03em; margin-bottom: .6rem; }
.admin-meta { color: var(--text-muted); font-size: .76rem; margin-bottom: .75rem; }
.admin-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .7rem; }
.admin-row input { flex: 1; min-width: 8rem; }
.fleet-pills { display: flex; gap: .4rem; flex-wrap: wrap; }
.fleet-pill { border: 1px solid var(--border); padding: .25rem .5rem; border-radius: 99px; font-family: var(--mono); font-size: .65rem; }
#adm-err { color: var(--err); padding: .6rem 0; }

@media (max-width: 1100px) {
  .quickstart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quickstart-step:nth-child(2) { border-right: 0; }
  .quickstart-step:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .quick-task-panel .form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .mobile-menu-btn { display: inline-grid; place-items: center; }
  .sidebar-overlay.open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 45;
  }
  .topbar { padding: 0 .8rem; }
  .topbar-right .panel-meta, .topbar-right .live-indicator { display: none; }
  .page-content { padding: .8rem; }
  .editorial-grid { grid-template-columns: 1fr; }
  .editorial-index { position: static; }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  :root { --header-height: 58px; }
  .container { width: min(100% - 1.25rem, 1120px); }
  .landing-actions .btn-secondary { display: none; }
  .hero { min-height: calc(92vh - var(--header-height)); }
  .hero-ink-rail { width: 0.55rem; }
  .hero-ink-rail::after { display: none; }
  .hero-slash { opacity: 0.55; width: 70vw; }
  .hero-content { padding: 3rem 0 4rem; margin-left: 0.75rem; }
  .hero-brand { font-size: clamp(2.9rem, 17vw, 4.3rem); }
  .hero-cta { display: grid; }
  .hero-cta .btn { width: 100%; }
  .login-brand { min-height: auto; padding: 1.5rem; }
  .login-brand h2 { margin-top: 1.4rem; }
  .login-features { display: none; }
  .login-form-side { padding: .8rem; align-items: start; }
  .login-card { padding: 1.2rem; box-shadow: none; }
  .quickstart-grid, .quick-task-panel .form-row, .form-grid-2 { grid-template-columns: 1fr; }
  .quickstart-step { border-right: 0; border-bottom: 1px solid var(--border); }
  .quickstart-step:last-child { border-bottom: 0; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .stat-card { min-height: 6.5rem; }
  .panel-header { align-items: flex-start; flex-direction: column; }
  .chart-bars { gap: .25rem; }
  .type-row { grid-template-columns: minmax(6rem, 1fr) 1fr 2rem; }
  .topbar-right .btn { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
