/* TimeQL — Authentic Minimal Design System
 * Stripe / Linear inspired. Single source of truth for marketing + dashboard + admin.
 */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Surfaces ── */
  --bg: #FCFCFA;
  --bg-elev: #FFFFFF;
  --bg-subtle: #F6F5F2;
  --bg-secondary: #EFEDE8;
  --bg-inverse: #0E0E10;
  --bg-inverse-2: #17171B;

  /* ── Lines ── */
  --hairline: #ECEAE5;
  --border: #E2DFD8;
  --border-strong: #C9C4BA;
  --border-inverse: #2A2A30;

  /* ── Text ── */
  --text: #111113;
  --text-secondary: #56565C;
  --text-tertiary: #8C8B86;
  --text-quaternary: #B4B2AB;
  --text-inverse: #F5F4F1;
  --text-inverse-dim: #8E8D8A;

  /* ── Accents (muted) ── */
  --indigo: #3A3DBE;
  --indigo-soft: #EEEEF8;
  --indigo-line: #D8D8EC;
  --amber: #8C5A11;
  --amber-soft: #F4EFE5;
  --amber-line: #E5DBC4;
  --green: #1F6B3A;
  --green-soft: #ECF1EB;
  --green-line: #D4DECF;
  --red: #B33E3E;
  --red-soft: #F6EBEB;

  /* ── Type ── */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;

  /* ── Layout ── */
  --max-w: 1180px;
  --max-w-narrow: 980px;
  --sidebar-w: 240px;
  --topbar-h: 56px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  /* ── Shadows (paper-like) ── */
  --shadow-xs: 0 1px 0 rgba(17,17,19,0.04);
  --shadow-sm: 0 1px 2px rgba(17,17,19,0.04), 0 0 0 1px rgba(17,17,19,0.04);
  --shadow-md: 0 6px 18px -8px rgba(17,17,19,0.12), 0 0 0 1px rgba(17,17,19,0.05);
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  font-family: var(--font-sans);
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--indigo-soft); color: var(--text); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ═══ Marketing topbar ═══ */
.tq-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--topbar-h);
  background: rgba(252,252,250,0.82);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--hairline);
}
.tq-nav-inner {
  max-width: var(--max-w); margin: 0 auto; height: 100%;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
}
.tq-brand {
  display: flex; align-items: center; gap: 8px;
  color: var(--text);
}
.tq-brand-mark { width: 22px; height: 22px; display: block; }
.tq-brand-name {
  font-family: var(--font-mono);
  font-weight: 600; font-size: 14px;
  letter-spacing: 0.04em;
}
.tq-nav-links {
  display: flex; align-items: center; gap: 28px;
}
.tq-nav-link {
  font-size: 13.5px; color: var(--text-secondary);
  transition: color .12s;
}
.tq-nav-link:hover { color: var(--text); }
.tq-nav-actions { display: flex; align-items: center; gap: 14px; }

/* ═══ Buttons ═══ */
.tq-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 13.5px; font-weight: 500;
  height: 34px; padding: 0 16px;
  border-radius: 8px; cursor: pointer;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
  white-space: nowrap;
}
.tq-btn-primary {
  background: var(--text); color: var(--bg);
  border-color: var(--text);
}
.tq-btn-primary:hover { background: #2A2A2E; border-color: #2A2A2E; }
.tq-btn-ghost {
  background: transparent; color: var(--text);
  border-color: var(--border);
}
.tq-btn-ghost:hover { background: var(--bg-subtle); border-color: var(--border-strong); }
.tq-btn-quiet {
  background: transparent; color: var(--text-secondary);
}
.tq-btn-quiet:hover { color: var(--text); background: var(--bg-subtle); }
.tq-btn-lg { height: 42px; padding: 0 22px; font-size: 14px; border-radius: 9px; }
.tq-btn-sm { height: 28px; padding: 0 12px; font-size: 12.5px; border-radius: 7px; }
.tq-btn .tq-arrow { transition: transform .15s; }
.tq-btn:hover .tq-arrow { transform: translateX(2px); }

/* ═══ Section primitives ═══ */
.tq-section {
  padding: 96px 24px;
  border-top: 1px solid var(--hairline);
}
.tq-section-tight { padding: 64px 24px; }
.tq-container { max-width: var(--max-w); margin: 0 auto; }
.tq-container-narrow { max-width: var(--max-w-narrow); margin: 0 auto; }

.tq-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-tertiary);
}
.tq-eyebrow::before {
  content: ''; width: 18px; height: 1px; background: var(--border-strong);
}
.tq-eyebrow.tq-eyebrow-bare::before { display: none; }

.tq-h1 {
  font-size: clamp(40px, 5.4vw, 64px);
  font-weight: 600; line-height: 1.04;
  letter-spacing: -0.035em;
  color: var(--text);
}
.tq-h2 {
  font-size: clamp(26px, 3vw, 36px);
  font-weight: 600; line-height: 1.15;
  letter-spacing: -0.028em;
}
.tq-h3 {
  font-size: 18px; font-weight: 600;
  letter-spacing: -0.012em;
}
.tq-lede {
  font-size: 17px; line-height: 1.6;
  color: var(--text-secondary);
  max-width: 640px;
}

/* ═══ Hairline lists ═══ */
.tq-rows { border-top: 1px solid var(--hairline); }
.tq-row {
  display: grid; grid-template-columns: 160px 1fr auto;
  align-items: baseline; gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--hairline);
}
.tq-row-key {
  font-family: var(--font-mono);
  font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-tertiary);
}
.tq-row-body { font-size: 15px; color: var(--text); line-height: 1.6; }
.tq-row-body em { font-style: normal; color: var(--text-secondary); }
.tq-row-aside {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text-tertiary);
}

/* ═══ Code ═══ */
code, .tq-code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  font-feature-settings: 'liga' 0;
}
.tq-inline-code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 1px 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--hairline);
  border-radius: 5px;
  color: var(--text);
}

/* ═══ Console ═══ */
.tq-console {
  background: var(--bg-inverse);
  border: 1px solid var(--border-inverse);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-family: var(--font-mono);
  color: var(--text-inverse-dim);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04) inset,
    0 30px 60px -30px rgba(17,17,19,0.35),
    0 0 0 1px rgba(17,17,19,0.04);
}
.tq-console-bar {
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border-bottom: 1px solid var(--border-inverse);
  background: linear-gradient(180deg, #1B1B20, #15151A);
}
.tq-console-bar .tq-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #2D2D34;
}
.tq-console-bar .tq-bar-title {
  margin-left: auto; margin-right: auto;
  font-size: 11px; color: #5C5C66; letter-spacing: 0.06em;
}
.tq-console-body {
  padding: 22px 24px;
  font-size: 12.5px;
  line-height: 1.95;
  white-space: pre;
  overflow-x: auto;
}
.tq-console-body .c-prompt { color: #F1F0EC; }
.tq-console-body .c-hint   { color: #5C5C66; }
.tq-console-body .c-key    { color: #9DA0FF; }
.tq-console-body .c-str    { color: #C8B58A; }
.tq-console-body .c-num    { color: #C8B58A; }
.tq-console-body .c-ok     { color: #7FB28F; }
.tq-console-body .c-meta   { color: #5C5C66; }
.tq-console-body .c-arrow  { color: #5C5C66; }
.tq-cursor {
  display: inline-block; width: 7px; height: 14px;
  background: #C8B58A; vertical-align: -2px; margin-left: 4px;
  animation: tq-blink 1.05s steps(2) infinite;
}
@keyframes tq-blink { 50% { opacity: 0; } }

/* ═══ Footer ═══ */
.tq-footer {
  padding: 80px 24px 64px;
  border-top: 1px solid var(--hairline);
  background: var(--bg);
}
.tq-footer-inner { max-width: var(--max-w); margin: 0 auto; }
.tq-footer-top {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 48px; padding-bottom: 48px;
  border-bottom: 1px solid var(--hairline);
}
.tq-footer-col-title {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 14px;
}
.tq-footer-col a {
  display: block; font-size: 14px;
  color: var(--text); padding: 5px 0;
}
.tq-footer-col a:hover { color: var(--indigo); }
.tq-footer-bottom {
  padding-top: 32px;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 16px;
}
.tq-footer-meta {
  font-size: 12.5px; color: var(--text-tertiary);
  line-height: 1.7;
}

/* ═══ Animations ═══ */
@keyframes tq-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.tq-reveal {
  opacity: 0; transform: translateY(16px);
  transition: opacity .6s ease, transform .6s ease;
}
.tq-reveal.is-visible { opacity: 1; transform: translateY(0); }
.tq-stagger > * {
  opacity: 0; transform: translateY(12px);
  transition: opacity .5s ease, transform .5s ease;
}
.tq-stagger.is-visible > * { opacity: 1; transform: translateY(0); }
.tq-stagger.is-visible > *:nth-child(1) { transition-delay: 0ms; }
.tq-stagger.is-visible > *:nth-child(2) { transition-delay: 40ms; }
.tq-stagger.is-visible > *:nth-child(3) { transition-delay: 80ms; }
.tq-stagger.is-visible > *:nth-child(4) { transition-delay: 120ms; }
.tq-stagger.is-visible > *:nth-child(5) { transition-delay: 160ms; }
.tq-stagger.is-visible > *:nth-child(6) { transition-delay: 200ms; }
.tq-stagger.is-visible > *:nth-child(7) { transition-delay: 240ms; }
.tq-stagger.is-visible > *:nth-child(8) { transition-delay: 280ms; }

/* ═══ Dashboard topbar (shared chrome) ═══ */
.dash-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--topbar-h);
  background: var(--bg-elev);
  border-bottom: 1px solid var(--hairline);
  display: flex; align-items: center;
}
.dash-topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; height: 100%;
  padding-right: 24px;
}
.dash-topbar-brand {
  display: flex; align-items: center; gap: 8px;
  width: var(--sidebar-w); padding: 0 20px; height: 100%;
  border-right: 1px solid var(--hairline);
  color: var(--text);
}
.dash-topbar-brand img { width: 22px; height: 22px; }
.dash-topbar-brand-name {
  font-family: var(--font-mono); font-weight: 600; font-size: 13.5px;
  letter-spacing: 0.04em;
}
.dash-topbar-ctx {
  font-size: 13px; color: var(--text-secondary);
  padding: 0 16px;
  display: flex; align-items: center; gap: 10px;
}
.dash-topbar-ctx .sep { color: var(--text-quaternary); }
.dash-topbar-right { display: flex; align-items: center; gap: 6px; }
.dash-topbar-link {
  font-size: 13px; color: var(--text-secondary);
  padding: 6px 10px; border-radius: 6px;
}
.dash-topbar-link:hover { color: var(--text); background: var(--bg-subtle); }
.dash-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-subtle); border: 1px solid var(--border);
  margin-left: 6px;
}

/* ═══ Sidebar ═══ */
.dash-sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0;
  width: var(--sidebar-w);
  border-right: 1px solid var(--hairline);
  background: var(--bg);
  padding: 16px 12px;
  overflow-y: auto;
}
.dash-side-section { margin-bottom: 18px; }
.dash-side-label {
  font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-tertiary);
  padding: 6px 12px 8px;
}
.dash-side-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; border-radius: 7px;
  font-size: 13.5px; color: var(--text-secondary);
  transition: background .12s, color .12s;
  cursor: pointer;
}
.dash-side-item:hover { background: var(--bg-subtle); color: var(--text); }
.dash-side-item.is-active {
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: var(--shadow-xs), inset 0 0 0 1px var(--hairline);
}
.dash-side-item svg {
  width: 16px; height: 16px; opacity: 0.7; flex-shrink: 0;
}
.dash-side-item.is-active svg { opacity: 1; color: var(--indigo); }

/* ═══ Dashboard main ═══ */
.dash-main {
  margin-left: var(--sidebar-w);
  padding: calc(var(--topbar-h) + 32px) 40px 64px;
  max-width: calc(1140px + var(--sidebar-w));
  min-height: 100vh;
}
.dash-page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--hairline);
}
.dash-page-title {
  font-size: 24px; font-weight: 600; letter-spacing: -0.022em;
}
.dash-page-sub {
  font-size: 13.5px; color: var(--text-secondary); margin-top: 4px;
}
.dash-page-actions { display: flex; gap: 10px; align-items: center; }

/* ═══ Stat grid ═══ */
.dash-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background: var(--bg-elev);
  overflow: hidden;
  margin-bottom: 24px;
}
.dash-stat {
  padding: 22px 24px;
  border-right: 1px solid var(--hairline);
}
.dash-stat:last-child { border-right: none; }
.dash-stat-label {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 6px;
}
.dash-stat-value {
  font-size: 26px; font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.dash-stat-sub {
  font-size: 12.5px; color: var(--text-tertiary);
  margin-top: 4px;
}
.dash-stat-trend-up { color: var(--green); }
.dash-stat-trend-down { color: var(--red); }

/* ═══ Cards ═══ */
.dash-card {
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.dash-card-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--hairline);
  display: flex; align-items: center; justify-content: space-between;
}
.dash-card-title {
  font-size: 14px; font-weight: 600;
  letter-spacing: -0.01em;
}
.dash-card-body { padding: 0; }
.dash-card-body-pad { padding: 20px; }

/* ═══ Tables ═══ */
.dash-table { width: 100%; border-collapse: collapse; }
.dash-table th {
  font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-tertiary);
  text-align: left;
  padding: 12px 20px;
  border-bottom: 1px solid var(--hairline);
  background: var(--bg-subtle);
}
.dash-table td {
  font-size: 13.5px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--hairline);
  color: var(--text);
  vertical-align: middle;
}
.dash-table tr:last-child td { border-bottom: none; }
.dash-table tr:hover td { background: var(--bg-subtle); }
.dash-table .ep {
  font-family: var(--font-mono); font-size: 12px; color: var(--indigo);
}
.dash-table .num {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ═══ Pills / Badges ═══ */
.tq-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--bg-elev);
  color: var(--text-secondary);
}
.tq-pill-indigo { background: var(--indigo-soft); border-color: var(--indigo-line); color: var(--indigo); }
.tq-pill-amber  { background: var(--amber-soft);  border-color: var(--amber-line);  color: var(--amber); }
.tq-pill-green  { background: var(--green-soft);  border-color: var(--green-line);  color: var(--green); }
.tq-pill-mute   { color: var(--text-tertiary); }

/* ═══ Forms ═══ */
.tq-input {
  width: 100%; height: 38px; padding: 0 12px;
  font-family: inherit; font-size: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  transition: border-color .12s, box-shadow .12s;
}
.tq-input:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(58,61,190,0.12); }
.tq-input::placeholder { color: var(--text-quaternary); }

/* ═══ Modal ═══ */
.tq-modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(17,17,19,0.32);
  backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center;
}
.tq-modal-backdrop.is-open { display: flex; }
.tq-modal {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  border: 1px solid var(--hairline);
  width: 100%; max-width: 420px; margin: 16px;
  padding: 32px;
  box-shadow: 0 25px 50px -12px rgba(17,17,19,0.18);
  position: relative;
  animation: tq-fade-up .2s ease both;
}
.tq-modal-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: none; cursor: pointer;
  color: var(--text-tertiary); padding: 4px;
}
.tq-modal-close:hover { color: var(--text); }
.tq-modal-title { font-size: 20px; font-weight: 600; letter-spacing: -0.018em; margin-bottom: 6px; }
.tq-modal-desc { font-size: 13.5px; color: var(--text-secondary); margin-bottom: 22px; }

.tq-auth-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  height: 42px; border-radius: 9px;
  font-family: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background .12s, border-color .12s;
  margin-bottom: 10px;
}
.tq-auth-google { background: var(--bg-elev); border: 1px solid var(--border); color: var(--text); }
.tq-auth-google:hover { background: var(--bg-subtle); }
.tq-auth-github { background: #1A1A1F; border: 1px solid #1A1A1F; color: #fff; }
.tq-auth-github:hover { background: #2A2A30; }
.tq-auth-demo { background: var(--bg-subtle); border: 1px solid var(--hairline); color: var(--text-secondary); }
.tq-auth-demo:hover { background: var(--bg-secondary); color: var(--text); }

/* ═══ Mobile ═══ */
@media (max-width: 1024px) {
  .tq-footer-top { grid-template-columns: 1fr 1fr; gap: 32px; }
  .dash-stats { grid-template-columns: repeat(2, 1fr); }
  .dash-stat:nth-child(2n) { border-right: none; }
  .dash-stat:nth-child(-n+2) { border-bottom: 1px solid var(--hairline); }
}
@media (max-width: 768px) {
  .tq-section { padding: 64px 20px; }
  .tq-nav-links { display: none; }
  .tq-row { grid-template-columns: 1fr; gap: 6px; padding: 14px 0; }
  .tq-row-aside { display: none; }
  .dash-sidebar { display: none; }
  .dash-main { margin-left: 0; padding: calc(var(--topbar-h) + 24px) 20px 48px; }
  .dash-topbar-brand { width: auto; padding: 0 16px; border-right: none; }
  .dash-topbar-ctx { display: none; }
  .dash-stats { grid-template-columns: 1fr; }
  .dash-stat { border-right: none; border-bottom: 1px solid var(--hairline); }
  .dash-stat:last-child { border-bottom: none; }
}
