/* ============================================================
   pinnapi — shared design system
   Dark, premium developer-tool aesthetic. Single emerald accent.
   Variable NAMES preserved for backward-compat with inline page
   styles + JS; values + treatment fully reworked.
   ============================================================ */
@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  --bg: #06090c;
  --bg-2: #0a0e13;
  --panel: #0e141b;
  --panel2: #0a0e13;
  --border: rgba(255,255,255,.08);
  --border-2: rgba(255,255,255,.14);
  --muted: #8a97a6;
  --faint: #5a6675;
  --text: #e9eef3;
  --accent: #34d399;
  --accent2: #10b981;
  --accent-ink: #04140d;
  --accent-glow: rgba(52,211,153,.16);
  --warn: #fbbf24;
  --danger: #fb7185;
  --first: #34d399;
  --gold: #d4af37;
  --r-card: 16px;
  --r-sm: 10px;
  --ease-out: cubic-bezier(.23,1,.32,1);
  --ease-io: cubic-bezier(.77,0,.175,1);
  --display: "Space Grotesk", system-ui, sans-serif;
  --body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: var(--body); -webkit-font-smoothing: antialiased; line-height: 1.55;
}
/* ambient mesh shared across app pages */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(55vw 45vh at 88% -10%, rgba(52,211,153,.08), transparent 60%),
    radial-gradient(45vw 40vh at -5% 0%, rgba(16,185,129,.05), transparent 55%);
}
body > * { position: relative; z-index: 1; }
a { color: var(--first); text-decoration: none; transition: color .2s var(--ease-out); }
a:hover { color: #5be3b1; text-decoration: none; }
code, .mono { font-family: var(--mono); }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.02em; }

/* ---------------- nav ---------------- */
header.nav {
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(10,14,19,.72);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  display: flex; align-items: center; gap: 18px;
  position: sticky; top: 0; z-index: 10;
}
header.nav .brand { font-family: var(--display); font-weight: 700; letter-spacing: -.02em; font-size: 19px; }
header.nav .brand b { color: var(--accent); }
header.nav nav { margin-left: auto; display: flex; gap: 8px; }
header.nav nav a { color: var(--muted); font-size: 14px; font-weight: 500; padding: 7px 13px; border-radius: 999px; transition: color .2s var(--ease-out), background .2s var(--ease-out); }
header.nav nav a:hover { color: var(--text); background: rgba(255,255,255,.05); text-decoration: none; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  background: var(--accent); color: var(--accent-ink);
  border: none; border-radius: var(--r-sm); font-weight: 600;
  cursor: pointer; font-family: var(--body); font-size: 14px;
  box-shadow: 0 0 0 1px rgba(52,211,153,.35), 0 10px 30px -14px var(--accent-glow);
  transition: transform .16s var(--ease-out), background .2s var(--ease-out), box-shadow .2s var(--ease-out), border-color .2s var(--ease-out), opacity .2s;
}
.btn:hover { background: #42e0a7; box-shadow: 0 0 0 1px rgba(52,211,153,.55), 0 14px 36px -12px var(--accent-glow); }
.btn:active { transform: scale(.97); }
.btn.ghost { background: rgba(255,255,255,.04); border: 1px solid var(--border); color: var(--text); box-shadow: none; }
.btn.ghost:hover { background: rgba(255,255,255,.08); border-color: var(--border-2); }
.btn.gold { background: var(--gold); color: #1a1407; box-shadow: 0 0 0 1px rgba(212,175,55,.4), 0 10px 30px -14px rgba(212,175,55,.3); }
.btn.gold:hover { background: #e2c354; }
.btn.big { padding: 14px 26px; font-size: 16px; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* ---------------- landing legacy classes (kept for any other consumer) ---------------- */
section.hero { padding: 80px 24px 60px; text-align: center; }
section.hero h1 { font-size: 44px; margin: 0 0 16px; letter-spacing: -.02em; line-height: 1.1; }
section.hero h1 span.hl { color: var(--accent); }
section.hero p.lead { color: var(--muted); font-size: 18px; max-width: 680px; margin: 0 auto 28px; line-height: 1.55; }
section.hero .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
section.hero .stats { margin-top: 40px; display: flex; gap: 32px; justify-content: center; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
section.hero .stats b { color: var(--text); font-size: 15px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 20px 0 60px; }
.feature { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-card); padding: 22px; transition: border-color .3s var(--ease-out), transform .3s var(--ease-out); }
.feature:hover { border-color: var(--border-2); transform: translateY(-3px); }
.feature h3 { margin: 0 0 8px; font-size: 16px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }

/* ---------------- pricing ---------------- */
section.pricing { padding: 60px 0; border-top: 1px solid var(--border); }
section.pricing h2 { font-size: 28px; text-align: center; margin: 0 0 8px; }
section.pricing p.sub { text-align: center; color: var(--muted); margin: 0 0 36px; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.plan {
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.012));
  border: 1px solid var(--border); border-radius: var(--r-card);
  padding: 24px; display: flex; flex-direction: column; gap: 12px; position: relative;
}
.plan.free { border-color: rgba(52,211,153,.45); }
.plan.gold { border-color: rgba(212,175,55,.5); }
.plan.pricing-card { padding: 30px 26px; transition: transform .3s var(--ease-out), border-color .3s var(--ease-out); }
.plan.pricing-card:hover { transform: translateY(-4px); border-color: var(--border-2); }
.plan.pricing-card .tagline { color: var(--muted); font-size: 13px; margin: -4px 0 4px; }
.plan.pricing-card .per-month { color: var(--muted); font-size: 13px; margin: -4px 0 8px; display: flex; align-items: center; gap: 8px; }
.plan.pricing-card .save { display: inline-block; background: var(--accent-glow); color: var(--accent); padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.plan.pricing-card ul { list-style: none; padding: 0; margin: 0; }
.plan.pricing-card ul li { padding: 4px 0 4px 24px; position: relative; line-height: 1.45; }
.plan.pricing-card ul li::before { content: "✓"; color: var(--accent); font-weight: 700; position: absolute; left: 0; top: 4px; }
.plan .ribbon { position: absolute; top: -10px; right: 14px; background: var(--gold); color: #111; padding: 3px 9px; font-size: 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.plan h3 { margin: 0; font-size: 16px; }
.plan .price { font-family: var(--display); font-size: 32px; font-weight: 600; color: var(--text); letter-spacing: -.02em; }
.plan .price small { color: var(--muted); font-weight: 400; font-size: 13px; font-family: var(--body); }
.plan ul { margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 13px; line-height: 1.8; }
.plan ul li::before { content: "→ "; color: var(--accent); }

/* billing toggle */
.bill-toggle { display: inline-flex; padding: 4px; background: var(--panel2); border: 1px solid var(--border); border-radius: 999px; gap: 2px; justify-content: center; margin: 0 auto 24px; flex-wrap: wrap; }
.bill-toggle button { background: transparent; color: var(--muted); border: none; padding: 10px 16px; cursor: pointer; border-radius: 999px; font-family: var(--body); font-size: 12px; font-weight: 600; transition: color .2s var(--ease-out), background .2s var(--ease-out); white-space: nowrap; }
.bill-toggle button.active { background: var(--accent); color: var(--accent-ink); }
.bill-toggle button:hover:not(.active) { color: var(--text); }

/* ---------------- panel / dashboard ---------------- */
.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 24px 0; }
.card { background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.01)); border: 1px solid var(--border); border-radius: var(--r-card); padding: 22px; transition: border-color .3s var(--ease-out); }
.card:hover { border-color: var(--border-2); }
.card h3 { margin: 0 0 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; font-family: var(--body); }
.card .big-num { font-family: var(--display); font-size: 32px; font-weight: 600; line-height: 1; letter-spacing: -.02em; }
.card .big-num small { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 6px; font-family: var(--body); }
.card .kv { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; }
.card .kv span { color: var(--muted); }

.keybar { display: flex; align-items: center; gap: 10px; background: var(--panel2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 11px 15px; margin-bottom: 20px; }
.keybar .key { font-family: var(--mono); font-size: 13px; flex: 1; word-break: break-all; }
.keybar .key.masked { color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
table th { text-align: left; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-size: 11px; padding: 9px 12px; border-bottom: 1px solid var(--border); }
table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
table tr { transition: background .15s var(--ease-out); }
table tr:hover td { background: rgba(255,255,255,.025); }

footer { padding: 30px 24px; border-top: 1px solid var(--border); text-align: center; color: var(--muted); font-size: 13px; margin-top: 60px; }

.flash { padding: 12px 16px; border-radius: var(--r-sm); margin: 16px 0; font-size: 14px; }
.flash.ok { background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.4); color: var(--accent); }
.flash.warn { background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.4); color: var(--warn); }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; z-index: 100; animation: modalFade .2s var(--ease-out); }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--panel); border: 1px solid var(--border-2); border-radius: 20px; padding: 32px; max-width: 560px; width: 90%; box-shadow: 0 40px 100px -40px rgba(0,0,0,.9); animation: modalPop .28s var(--ease-out); }
@keyframes modalPop { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
.modal h3 { margin: 0 0 12px; font-size: 20px; }
.modal p { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.key-reveal { background: var(--bg); border: 1px solid rgba(52,211,153,.4); border-radius: var(--r-sm); padding: 14px; font-family: var(--mono); word-break: break-all; font-size: 14px; color: var(--accent); margin-bottom: 16px; }

@media (prefers-reduced-motion: reduce) {
  /* Resolve animations to their final state almost instantly rather than
     disabling them — `animation:none` left `.fade-in` elements stuck at
     opacity:0 (invisible dashboard). Keeps the UI calm without hiding it;
     JS-driven liveliness (charts, counters, live feed) is unaffected. */
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ──────────────── Mobile ──────────────── */
@media (max-width: 700px) {
  header.nav { padding: 12px 16px; gap: 12px; flex-wrap: wrap; }
  header.nav .brand { font-size: 17px; }
  header.nav nav { gap: 6px; font-size: 13px; width: 100%; margin-left: 0; justify-content: flex-end; margin-top: 2px; }
  section.hero { padding: 50px 16px 40px; }
  section.hero h1 { font-size: 30px; }
  section.hero p.lead { font-size: 15px; padding: 0 6px; }
  section.hero .cta { gap: 10px; flex-direction: column; align-items: stretch; max-width: 300px; margin: 0 auto; }
  section.hero .cta .btn { width: 100%; }
  section.hero .stats { gap: 18px; font-size: 12px; padding: 0 12px; }
  .btn.big { padding: 12px 20px; font-size: 14px; }
  .container { padding: 0 16px; }
  .features { gap: 12px; margin-bottom: 40px; }
  .feature { padding: 18px; }
  section.pricing { padding: 40px 0; }
  section.pricing h2 { font-size: 24px; }
  section.pricing p.sub { font-size: 13px; }
  .pro-grid, .pricing-grid { grid-template-columns: 1fr !important; gap: 12px; }
  .plan.pricing-card { padding: 24px 20px; }
  .plan.pricing-card .price { font-size: 34px; }
  .bill-toggle { flex-direction: column; width: 100%; max-width: 320px; }
  .bill-toggle button { width: 100%; padding: 12px 14px; }
  .compare { margin-top: 40px; padding-top: 28px; }
  .compare h3 { font-size: 17px; }
  .compare table { display: block; overflow-x: auto; white-space: nowrap; font-size: 12px; }
  .compare table th, .compare table td { padding: 10px 10px; }
  .trial-card { flex-direction: column; align-items: flex-start; gap: 12px; padding: 18px; }
  .trial-card .btn { width: 100%; }
  h1 { font-size: 22px !important; }
  .panel-grid { gap: 12px; }
  .keybar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .keybar .key { font-size: 11px; flex: 1 1 100%; order: 1; }
  .keybar #emailDisplay { flex: 1 1 100%; order: 2; margin-left: 0; }
  .keybar .btn { order: 3; flex: 1; }
  .card { padding: 16px; }
  .card .big-num { font-size: 26px; }
  .chart-card { padding: 16px; }
  .chart-head { gap: 10px; }
  .chart-tabs button { padding: 5px 10px; font-size: 11px; }
  #usageChart { height: 180px !important; }
  table { font-size: 12px; }
  table th, table td { padding: 8px 8px; }
  table { display: block; overflow-x: auto; }
  footer { padding: 20px 16px; font-size: 12px; }
  .modal { padding: 24px 20px; width: 92%; }
  .modal h3 { font-size: 18px; }
  .modal p { font-size: 13px; }
  .key-reveal { font-size: 12px; padding: 12px; }
}
@media (max-width: 420px) {
  section.hero h1 { font-size: 26px; }
  section.hero h1 br { display: none; }
  section.pricing h2 { font-size: 20px; }
  .plan.pricing-card .price { font-size: 30px; }
  .card .big-num { font-size: 22px; }
}
