/* =============================================================
   qubith.ai — Design System
   Premium, iOS-grade craft. Hand-written, no framework.
   ============================================================= */

/* --- Tokens --- */
:root {
  /* Color: surfaces */
  --bg:               #0A0A0C;
  --bg-elev-1:        #101013;
  --bg-elev-2:        #15151A;
  --bg-elev-3:        #1B1B22;
  --bg-glass:         rgba(20, 20, 24, 0.72);

  /* Color: borders */
  --border-faint:     rgba(255, 255, 255, 0.04);
  --border:           rgba(255, 255, 255, 0.07);
  --border-strong:    rgba(255, 255, 255, 0.12);
  --border-focus:     rgba(245, 165, 106, 0.6);

  /* Color: text */
  --text-primary:     #FAFAF9;
  --text-secondary:   #A8A8B3;
  --text-tertiary:    #6E6E78;
  --text-disabled:    #4A4A52;

  /* Color: brand accent (warm coral → amber) */
  --accent:           #F5A56A;
  --accent-2:         #E8744A;
  --accent-soft:      rgba(245, 165, 106, 0.12);
  --accent-glow:      rgba(245, 165, 106, 0.32);
  --accent-text:      #FFD9B8;

  /* Color: semantic */
  --success:          #4ADE80;
  --success-soft:     rgba(74, 222, 128, 0.12);
  --warning:          #FBBF24;
  --warning-soft:     rgba(251, 191, 36, 0.12);
  --error:            #F87171;
  --error-soft:       rgba(248, 113, 113, 0.12);
  --info:             #93C5FD;
  --info-soft:        rgba(147, 197, 253, 0.12);

  /* Type */
  --font-sans:        'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  --font-mono:        'JetBrains Mono', 'SF Mono', 'Menlo', 'Consolas', monospace;

  /* Type scale (perfect-fourth, 1.25) */
  --t-xs:             0.75rem;     /* 12 */
  --t-sm:             0.875rem;    /* 14 */
  --t-base:           0.9375rem;   /* 15 */
  --t-md:             1rem;        /* 16 */
  --t-lg:             1.125rem;    /* 18 */
  --t-xl:             1.375rem;    /* 22 */
  --t-2xl:            1.75rem;     /* 28 */
  --t-3xl:            2.25rem;     /* 36 */
  --t-4xl:            3rem;        /* 48 */
  --t-5xl:            3.75rem;     /* 60 */
  --t-6xl:            4.5rem;      /* 72 */

  /* Spacing (4px base, dense at small, airy at large) */
  --s-1:              0.25rem;
  --s-2:              0.5rem;
  --s-3:              0.75rem;
  --s-4:              1rem;
  --s-5:              1.25rem;
  --s-6:              1.5rem;
  --s-7:              1.75rem;
  --s-8:              2rem;
  --s-10:             2.5rem;
  --s-12:             3rem;
  --s-16:             4rem;
  --s-20:             5rem;
  --s-24:             6rem;
  --s-32:             8rem;

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

  /* Shadows (iOS-style layered: ambient + key) */
  --shadow-xs:        0 1px 2px rgba(0,0,0,0.4);
  --shadow-sm:        0 2px 4px rgba(0,0,0,0.32), 0 1px 2px rgba(0,0,0,0.24);
  --shadow-md:        0 6px 16px rgba(0,0,0,0.36), 0 2px 4px rgba(0,0,0,0.24);
  --shadow-lg:        0 16px 32px rgba(0,0,0,0.4), 0 4px 8px rgba(0,0,0,0.24);
  --shadow-xl:        0 24px 64px rgba(0,0,0,0.48), 0 8px 16px rgba(0,0,0,0.32);
  --shadow-glow:      0 0 0 1px var(--border-focus), 0 0 24px var(--accent-glow);

  /* Motion */
  --ease-out:         cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart:   cubic-bezier(0.25, 1, 0.5, 1);
  --ease-in-out:      cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring:      cubic-bezier(0.34, 1.56, 0.64, 1);
  --d-fast:           140ms;
  --d-base:           220ms;
  --d-slow:           380ms;
  --d-slower:         560ms;

  /* Layout */
  --max-w-content:    1180px;
  --max-w-prose:      720px;
  --max-w-form:       420px;

  /* Z-index */
  --z-nav:            50;
  --z-modal:          100;
  --z-toast:          200;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font-sans);
  font-size: var(--t-md);
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  font-variant-numeric: oldstyle-nums proportional-nums;
  min-height: 100vh;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; background: none; border: none; outline: none; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
code, pre, kbd { font-family: var(--font-mono); font-feature-settings: 'calt', 'liga'; }
img, svg, video { display: block; max-width: 100%; }
ul, ol { list-style: none; }

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

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

/* --- Focus ring (custom, not the ugly default) --- */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- Background (subtle radial gradient + grain) --- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(245, 165, 106, 0.08), transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 50%, rgba(232, 116, 74, 0.04), transparent 50%),
    var(--bg);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.4;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.04 0'/></filter><rect width='200' height='200' filter='url(%23n)'/></svg>");
  background-size: 200px 200px;
  mix-blend-mode: overlay;
}

/* --- Layout --- */
.container { max-width: var(--max-w-content); margin-inline: auto; padding-inline: var(--s-6); }
@media (min-width: 768px) { .container { padding-inline: var(--s-10); } }
@media (min-width: 1024px) { .container { padding-inline: var(--s-12); } }

/* --- Typography --- */
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.eyebrow::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--accent-glow);
}
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.025em; line-height: 1.1; color: var(--text-primary); }
h1 { font-size: clamp(2.5rem, 5vw + 1rem, var(--t-6xl)); letter-spacing: -0.035em; line-height: 1.05; }
h2 { font-size: clamp(1.75rem, 3vw + 0.5rem, var(--t-4xl)); letter-spacing: -0.03em; }
h3 { font-size: var(--t-xl); }
.text-display { font-size: clamp(3rem, 6vw + 1rem, 5rem); font-weight: 700; letter-spacing: -0.04em; line-height: 1; }
.text-gradient {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 50%, #F5A56A 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.text-muted { color: var(--text-secondary); }
.text-faint { color: var(--text-tertiary); }
.mono { font-family: var(--font-mono); font-feature-settings: 'calt', 'liga'; }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  padding: 0 var(--s-5);
  height: 40px;
  border-radius: var(--r-md);
  font-size: var(--t-sm);
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: transform var(--d-fast) var(--ease-out),
              background-color var(--d-base) var(--ease-out),
              box-shadow var(--d-base) var(--ease-out),
              color var(--d-base) var(--ease-out),
              border-color var(--d-base) var(--ease-out);
  user-select: none;
  white-space: nowrap;
  position: relative;
  isolation: isolate;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #1A0E08;
  box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, 0 1px 2px rgba(0,0,0,0.4), 0 0 0 1px rgba(245,165,106,0.4);
}
.btn-primary:hover {
  box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 2px 8px rgba(245,165,106,0.3), 0 0 0 1px rgba(245,165,106,0.5);
  filter: brightness(1.05);
}

.btn-secondary {
  background: var(--bg-elev-2);
  color: var(--text-primary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background: var(--bg-elev-3);
  border-color: var(--border-strong);
}

.btn-ghost {
  color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-elev-1); }

.btn-lg { height: 48px; padding: 0 var(--s-7); font-size: var(--t-md); border-radius: var(--r-lg); }
.btn-sm { height: 32px; padding: 0 var(--s-3); font-size: var(--t-xs); }

/* --- Cards (iOS-style, layered surface) --- */
.card {
  position: relative;
  background: linear-gradient(180deg, var(--bg-elev-1) 0%, var(--bg) 100%);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--s-6);
  transition: transform var(--d-base) var(--ease-out),
              border-color var(--d-base) var(--ease-out),
              box-shadow var(--d-base) var(--ease-out);
}
.card-interactive { cursor: pointer; }
.card-interactive:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
}
.card-elevated {
  background: linear-gradient(180deg, var(--bg-elev-2) 0%, var(--bg-elev-1) 100%);
  box-shadow: var(--shadow-md);
}

.card-glow::before {
  content: "";
  position: absolute; inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(245,165,106,0.5), transparent 40%, transparent 60%, rgba(232,116,74,0.3));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* --- Pills / Badges --- */
.pill {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: var(--s-1) var(--s-3);
  height: 24px;
  border-radius: var(--r-full);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.pill-accent { background: var(--accent-soft); border-color: rgba(245,165,106,0.2); color: var(--accent-text); }
.pill-success { background: var(--success-soft); border-color: rgba(74,222,128,0.2); color: var(--success); }
.pill-warning { background: var(--warning-soft); border-color: rgba(251,191,36,0.2); color: var(--warning); }
.pill-error { background: var(--error-soft); border-color: rgba(248,113,113,0.2); color: var(--error); }
.pill-info { background: var(--info-soft); border-color: rgba(147,197,253,0.2); color: var(--info); }

/* --- Form --- */
.input {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 var(--s-4);
  border-radius: var(--r-md);
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: var(--t-md);
  transition: border-color var(--d-base) var(--ease-out),
              background-color var(--d-base) var(--ease-out),
              box-shadow var(--d-base) var(--ease-out);
}
.input::placeholder { color: var(--text-tertiary); }
.input:hover { background: var(--bg-elev-2); }
.input:focus {
  background: var(--bg-elev-2);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.input-error { border-color: var(--error); }
.input-error:focus { box-shadow: 0 0 0 4px var(--error-soft); }
.label {
  display: block;
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--s-2);
}
.field { margin-bottom: var(--s-5); }

/* --- Nav (top bar with glass effect) --- */
.topnav {
  position: sticky; top: 0;
  z-index: var(--z-nav);
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
  padding: 0 var(--s-6);
  background: rgba(10, 10, 12, 0.7);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-faint);
}
.topnav-inner { max-width: var(--max-w-content); margin: 0 auto; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--s-8); }
.brand { display: flex; align-items: center; gap: var(--s-2); font-weight: 600; font-size: var(--t-md); letter-spacing: -0.02em; }
.brand-mark {
  width: 24px; height: 24px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  position: relative;
  box-shadow: 0 0 16px var(--accent-glow);
}
.brand-mark::after {
  content: "";
  position: absolute; inset: 4px;
  border-radius: 3px;
  background: var(--bg);
  background-image: linear-gradient(135deg, transparent 40%, rgba(245,165,106,0.4) 100%);
}
.nav-links { display: flex; align-items: center; gap: var(--s-1); }
.nav-link {
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  font-size: var(--t-sm);
  color: var(--text-secondary);
  transition: color var(--d-base) var(--ease-out), background-color var(--d-base) var(--ease-out);
}
.nav-link:hover { color: var(--text-primary); background: var(--bg-elev-1); }
.nav-link.active { color: var(--text-primary); }
@media (max-width: 640px) { .nav-links .nav-link:not(.always) { display: none; } }

/* --- Code blocks --- */
.code-block {
  position: relative;
  background: #0A0A0E;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.code-block::before {
  /* macOS-style window dots */
  content: "";
  position: absolute; top: 14px; left: 16px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #FF6259, #ED4337);
  box-shadow:
    20px 0 0 -1px #FFBD2E,
    20px 0 0 0 #FFBD2E,
    40px 0 0 -1px #28C940,
    40px 0 0 0 #28C940;
}
.code-block pre {
  margin: 0;
  padding: 44px 20px 20px;
  font-size: var(--t-sm);
  line-height: 1.65;
  color: #D4D4D8;
  overflow-x: auto;
  font-feature-settings: 'calt', 'liga';
}
.code-block pre::-webkit-scrollbar { height: 6px; }
.code-copy {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  background: rgba(255,255,255,0.04);
  color: var(--text-tertiary);
  font-size: var(--t-sm);
  opacity: 0;
  transition: opacity var(--d-base) var(--ease-out), background var(--d-base) var(--ease-out), color var(--d-base) var(--ease-out);
}
.code-block:hover .code-copy { opacity: 1; }
.code-copy:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.code-copy.copied { color: var(--success); }

/* --- Syntax tokens (lightweight) --- */
.tk-key { color: #C4A7E7; }     /* property/key */
.tk-str { color: #A8DDA0; }     /* string */
.tk-num { color: #F5A56A; }     /* number */
.tk-com { color: #6E6E78; font-style: italic; } /* comment */
.tk-pun { color: #A8A8B3; }     /* punctuation */
.tk-fn  { color: #93C5FD; }     /* function */
.tk-var { color: #F5D7A0; }     /* variable */
.tk-cls { color: #FFD9B8; }     /* class */
.tk-tag { color: #F87171; }     /* tag */

/* --- Hero (landing) --- */
.hero {
  position: relative;
  padding: var(--s-24) 0 var(--s-16);
  text-align: center;
  isolation: isolate;
}
.hero::before {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  width: 140%; height: 100%;
  transform: translateX(-50%);
  z-index: -1;
  background: radial-gradient(ellipse 60% 60% at 50% 0%, rgba(245, 165, 106, 0.18) 0%, transparent 60%);
  pointer-events: none;
}
.hero-eyebrow { margin-bottom: var(--s-6); }
.hero-title { margin-bottom: var(--s-6); }
.hero-title .word { display: inline-block; }
.hero-sub {
  max-width: 620px;
  margin: 0 auto var(--s-10);
  font-size: clamp(var(--t-md), 1vw + 0.875rem, var(--t-lg));
  line-height: 1.6;
  color: var(--text-secondary);
}
.hero-ctas { display: flex; gap: var(--s-3); justify-content: center; flex-wrap: wrap; }

/* --- Section spacing --- */
.section { padding: var(--s-24) 0; }
.section-header { text-align: center; margin-bottom: var(--s-16); max-width: 720px; margin-inline: auto; }
.section-header h2 { margin-bottom: var(--s-4); }
.section-header p { color: var(--text-secondary); font-size: var(--t-lg); line-height: 1.6; }

/* --- Grid --- */
.grid-3 { display: grid; gap: var(--s-5); grid-template-columns: 1fr; }
@media (min-width: 768px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.grid-2 { display: grid; gap: var(--s-5); grid-template-columns: 1fr; }
@media (min-width: 768px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
.grid-4 { display: grid; gap: var(--s-4); grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }

/* --- Toast --- */
.toast-root {
  position: fixed; top: 80px; right: var(--s-6);
  z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: var(--s-2);
  pointer-events: none;
  max-width: 380px;
}
.toast {
  background: var(--bg-elev-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: var(--s-3);
  font-size: var(--t-sm);
  pointer-events: auto;
  animation: toast-in var(--d-slow) var(--ease-out) both;
  position: relative;
  overflow: hidden;
}
.toast::after {
  content: "";
  position: absolute; bottom: 0; left: 0;
  height: 2px;
  background: var(--accent);
  animation: toast-progress 3s linear forwards;
}
.toast.toast-success::after { background: var(--success); }
.toast.toast-error::after { background: var(--error); }
.toast.removing { animation: toast-out var(--d-base) var(--ease-out) forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px) scale(0.96); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(20px) scale(0.96); }
}
@keyframes toast-progress {
  from { width: 100%; }
  to { width: 0; }
}

/* --- Modal --- */
.modal-backdrop {
  position: fixed; inset: 0;
  z-index: var(--z-modal);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-4);
  animation: backdrop-in var(--d-base) var(--ease-out);
}
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%;
  max-width: 480px;
  background: var(--bg-elev-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-2xl);
  padding: var(--s-6);
  box-shadow: var(--shadow-xl);
  animation: modal-in var(--d-slow) var(--ease-spring);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-title { font-size: var(--t-lg); font-weight: 600; margin-bottom: var(--s-2); }
.modal-desc { color: var(--text-secondary); font-size: var(--t-sm); margin-bottom: var(--s-5); }
.modal-actions { display: flex; gap: var(--s-2); justify-content: flex-end; margin-top: var(--s-6); }

/* --- Live status indicator --- */
.live-dot {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-size: var(--t-xs);
  color: var(--text-tertiary);
}
.live-dot::before {
  content: "";
  width: 8px; height: 8px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5);
  animation: live-pulse 2s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
}

/* --- Stat --- */
.stat {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
}
.stat-label { font-size: var(--t-sm); color: var(--text-tertiary); margin-bottom: var(--s-2); }
.stat-value { font-size: var(--t-2xl); font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* --- Table --- */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--t-sm);
}
.table th {
  text-align: left;
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border-faint);
  color: var(--text-secondary);
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg-elev-1); }
.table .num { font-variant-numeric: tabular-nums; text-align: right; }

/* --- Quota ring (animated) --- */
.quota-ring {
  position: relative;
  width: 160px; height: 160px;
  display: grid; place-items: center;
}
.quota-ring svg { transform: rotate(-90deg); }
.quota-ring circle { transition: stroke-dashoffset 1s var(--ease-out); }
.quota-ring-text {
  position: absolute;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.quota-ring-text .v { font-size: var(--t-2xl); font-weight: 600; letter-spacing: -0.02em; }
.quota-ring-text .l { font-size: var(--t-xs); color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.06em; }

/* --- Tabs --- */
.tabs { display: flex; gap: 2px; background: var(--bg-elev-1); padding: 4px; border-radius: var(--r-md); border: 1px solid var(--border); width: fit-content; }
.tab {
  padding: var(--s-2) var(--s-4);
  border-radius: 6px;
  font-size: var(--t-sm);
  color: var(--text-tertiary);
  transition: color var(--d-base) var(--ease-out), background var(--d-base) var(--ease-out);
}
.tab:hover { color: var(--text-secondary); }
.tab.active { background: var(--bg-elev-3); color: var(--text-primary); box-shadow: var(--shadow-sm); }

/* --- Section fade-in (scroll reveal) --- */
[data-reveal] { opacity: 0; transform: translateY(16px); transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out); }
[data-reveal].revealed { opacity: 1; transform: translateY(0); }

/* --- Sidebar layout (dashboard/admin) --- */
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 60px); }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }
.sidebar {
  border-right: 1px solid var(--border-faint);
  padding: var(--s-6) var(--s-4);
  background: var(--bg);
  position: sticky; top: 60px; height: calc(100vh - 60px);
  overflow-y: auto;
}
@media (max-width: 900px) { .sidebar { position: static; height: auto; } }
.sidebar-section { margin-bottom: var(--s-6); }
.sidebar-label { font-size: var(--t-xs); color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.06em; padding: 0 var(--s-3); margin-bottom: var(--s-2); }
.sidebar-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  font-size: var(--t-sm);
  color: var(--text-secondary);
  transition: color var(--d-base) var(--ease-out), background var(--d-base) var(--ease-out);
}
.sidebar-item:hover { color: var(--text-primary); background: var(--bg-elev-1); }
.sidebar-item.active { color: var(--text-primary); background: var(--bg-elev-2); }
.sidebar-item svg { width: 16px; height: 16px; opacity: 0.6; }
.sidebar-item.active svg { opacity: 1; color: var(--accent); }

.main { padding: var(--s-8) var(--s-10); max-width: 1080px; }
@media (max-width: 900px) { .main { padding: var(--s-6); } }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s-8); }
.page-title { font-size: var(--t-2xl); font-weight: 600; letter-spacing: -0.02em; }

/* --- Auth pages --- */
.auth-shell { min-height: 100vh; display: flex; flex-direction: column; }
.auth-main { flex: 1; display: grid; place-items: center; padding: var(--s-8) var(--s-6); }
.auth-card { width: 100%; max-width: var(--max-w-form); }
.auth-brand { display: flex; align-items: center; gap: var(--s-3); justify-content: center; margin-bottom: var(--s-8); }
.auth-title { font-size: var(--t-2xl); font-weight: 600; text-align: center; margin-bottom: var(--s-2); letter-spacing: -0.02em; }
.auth-sub { color: var(--text-secondary); text-align: center; font-size: var(--t-sm); margin-bottom: var(--s-8); }

/* --- Pricing tier card --- */
.tier {
  position: relative;
  display: flex; flex-direction: column;
  padding: var(--s-8) var(--s-6);
  border-radius: var(--r-xl);
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  transition: transform var(--d-base) var(--ease-out), border-color var(--d-base) var(--ease-out), box-shadow var(--d-base) var(--ease-out);
}
.tier:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow-lg); }
.tier-featured {
  background: linear-gradient(180deg, rgba(245,165,106,0.05) 0%, var(--bg-elev-1) 60%);
  border-color: rgba(245,165,106,0.2);
  box-shadow: 0 0 0 1px rgba(245,165,106,0.1), 0 16px 32px rgba(0,0,0,0.3);
}
.tier-featured:hover { border-color: rgba(245,165,106,0.35); box-shadow: 0 0 0 1px rgba(245,165,106,0.2), 0 24px 48px rgba(0,0,0,0.4); }
.tier-badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1A0E08;
  font-size: var(--t-xs);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-full);
  letter-spacing: 0.02em;
}
.tier-name { font-size: var(--t-sm); color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: var(--s-3); }
.tier-price { font-size: var(--t-5xl); font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.tier-price small { font-size: var(--t-md); font-weight: 400; color: var(--text-tertiary); }
.tier-meta { color: var(--text-tertiary); font-size: var(--t-sm); margin-top: var(--s-2); margin-bottom: var(--s-6); }
.tier-features { list-style: none; padding: 0; margin: 0 0 var(--s-8); display: flex; flex-direction: column; gap: var(--s-3); }
.tier-features li { display: flex; align-items: center; gap: var(--s-2); font-size: var(--t-sm); color: var(--text-secondary); }
.tier-features li::before { content: "✓"; color: var(--accent); font-weight: 600; }
.tier-cta { margin-top: auto; }

/* --- Floating nav (gradient text) --- */
.brand-name {
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: -0.025em;
}
.brand-name b { font-weight: 600; color: var(--text-primary); -webkit-text-fill-color: var(--text-primary); }

/* --- Empty state --- */
.empty {
  text-align: center;
  padding: var(--s-12) var(--s-6);
  color: var(--text-tertiary);
}
.empty-icon { font-size: var(--t-4xl); margin-bottom: var(--s-3); opacity: 0.4; }
.empty-title { font-size: var(--t-md); font-weight: 500; color: var(--text-secondary); margin-bottom: var(--s-2); }

/* --- Skeleton loader (for future use) --- */
@keyframes shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }
.skeleton {
  background: linear-gradient(90deg, var(--bg-elev-1) 25%, var(--bg-elev-2) 50%, var(--bg-elev-1) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: var(--r-sm);
}

/* --- Page transition (fades new content in) --- */
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }
body { animation: page-in var(--d-slower) var(--ease-out); }

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