/* ============================================================
   Leap Tracker — Business Leap Coaching · Floyd Tavares
   Faithful static rebuild of the Lovable (TanStack) app.
   White-dominant, teal primary. Montserrat / Source Sans 3.
   ============================================================ */

:root {
  --radius: 1rem;

  /* Brand — white-dominant, teal primary (verbatim from source) */
  --background: oklch(0.985 0.004 220);
  --foreground: oklch(0.18 0.04 258);
  --card: oklch(1 0 0);
  --popover: oklch(1 0 0);

  /* Primary Teal #16DBD6 / dark teal #11BAB5 */
  --primary: oklch(0.82 0.14 190);
  --primary-foreground: oklch(0.15 0.02 240);
  --primary-dark: oklch(0.72 0.13 190);

  --secondary: oklch(0.968 0.007 247);
  --muted: oklch(0.968 0.007 247);
  --muted-foreground: oklch(0.55 0.03 258);
  --accent: oklch(0.968 0.007 247);

  /* Accent gradient stops */
  --accent-blue: oklch(0.52 0.13 245);
  --accent-pink: oklch(0.62 0.28 350);
  --accent-purple: oklch(0.32 0.19 305);

  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.92 0.01 247);
  --input: oklch(0.92 0.01 247);
  --ring: oklch(0.82 0.14 190);

  --font-display: "Montserrat", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Source Sans 3", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
}

* { box-sizing: border-box; border-color: var(--border); margin: 0; padding: 0; }

html, body {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { min-height: 100vh; padding-bottom: 6rem; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; }
::-webkit-scrollbar { display: none; }
.scrollbar-none { -ms-overflow-style: none; scrollbar-width: none; }

/* ---- Type helpers ---- */
.display { font-family: var(--font-display); }
.black { font-weight: 900; }
.mono {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.tracking-tight { letter-spacing: -0.02em; }
.uppercase { text-transform: uppercase; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: color-mix(in oklab, var(--foreground) 50%, transparent);
}
.teal { color: var(--primary-dark); }
.muted { color: var(--muted-foreground); }
.error { color: var(--destructive); font-size: 0.8rem; }

/* ---- Layout ---- */
.main { margin: 0 auto; width: 100%; max-width: 42rem; padding: 1rem 1rem 0; }
@media (min-width: 1024px) { .main { padding-left: 2rem; padding-right: 2rem; } }
.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;
}
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; } .gap-3 { gap: 0.75rem; } .gap-4 { gap: 1rem; }
.hidden { display: none !important; }

/* ---- Cards ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.card-lg { border-radius: calc(var(--radius) + 4px); }

/* ---- Pills & badges ---- */
.pill {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-family: var(--font-mono); font-size: 9px; text-transform: uppercase;
  letter-spacing: 0.1em; padding: 0.25rem 0.55rem; border-radius: 999px;
  border: 1px solid var(--border);
}
.pill-teal {
  background: color-mix(in oklab, var(--primary) 14%, transparent);
  color: var(--primary-dark);
  border-color: color-mix(in oklab, var(--primary) 30%, transparent);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font-family: var(--font-display); font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.02em; font-size: 0.85rem;
  padding: 0.7rem 1.1rem; border-radius: 0.85rem;
  transition: transform 0.12s var(--ease-out-expo), background 0.15s, box-shadow 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-dark { background: var(--foreground); color: var(--background); }
.btn-ghost { background: transparent; color: color-mix(in oklab, var(--foreground) 70%, transparent); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--foreground); }
.btn-dashed { background: transparent; border: 1.5px dashed var(--border); color: var(--muted-foreground); width: 100%; }
.btn-block { width: 100%; }

/* ---- Inputs ---- */
.input {
  width: 100%; border-radius: 0.75rem; border: 1px solid var(--input);
  background: var(--background); padding: 0.65rem 0.85rem;
  font: inherit; font-size: 0.9rem; color: var(--foreground);
}
.input:focus { outline: none; border-color: var(--primary); }
.input-currency { padding-left: 1.9rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field-label {
  font-family: var(--font-mono); font-size: 9px; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--muted-foreground);
}
.currency-wrap { position: relative; }
.currency-sym { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); font-size: 0.9rem; }

/* ---- Toggle group ---- */
.toggle-group { display: flex; gap: 0.4rem; }
.toggle {
  flex: 1; padding: 0.55rem; border-radius: 0.7rem; border: 1px solid var(--border);
  background: var(--background); font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-foreground);
}
.toggle.on { background: var(--foreground); color: var(--background); border-color: var(--foreground); }

/* ---- Gradient icon tiles ---- */
.tile {
  display: flex; align-items: center; justify-content: center;
  border-radius: 1rem; color: #fff; flex-shrink: 0;
}
.tile svg { width: 55%; height: 55%; }
.tile-12 { width: 3rem; height: 3rem; }
.tile-11 { width: 2.75rem; height: 2.75rem; border-radius: 999px; }
.tile-8 { width: 2rem; height: 2rem; border-radius: 999px; }

/* ---- Top nav (branding strip) ---- */
.topnav {
  position: sticky; top: 0; z-index: 40;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklab, var(--background) 90%, transparent);
  backdrop-filter: blur(12px);
}
.topnav-inner { max-width: 42rem; margin: 0 auto; padding: 0.6rem 1rem; display: flex; align-items: center; justify-content: space-between; }
.brand-1 { font-family: var(--font-display); font-weight: 900; letter-spacing: -0.02em; font-size: 1rem; line-height: 1; }
.brand-2 { font-family: var(--font-mono); font-size: 8px; text-transform: uppercase; letter-spacing: 0.18em; color: color-mix(in oklab, var(--foreground) 50%, transparent); margin-top: 2px; }

/* ---- Bottom tab bar ---- */
.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 40;
  border-top: 1px solid var(--border);
  background: color-mix(in oklab, var(--background) 95%, transparent);
  backdrop-filter: blur(18px);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-inner { max-width: 28rem; margin: 0 auto; display: flex; justify-content: space-around; padding: 0.4rem 0.5rem; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; padding: 0.35rem 0.5rem; }
.tab-ico {
  width: 2rem; height: 2rem; border-radius: 999px; display: flex; align-items: center; justify-content: center;
  color: color-mix(in oklab, var(--foreground) 45%, transparent);
  transition: background 0.15s, color 0.15s;
}
.tab-ico svg { width: 1.05rem; height: 1.05rem; }
.tab.active .tab-ico { background: var(--foreground); color: var(--background); }
.tab-label { font-family: var(--font-mono); font-size: 8.5px; text-transform: uppercase; letter-spacing: 0.08em; color: color-mix(in oklab, var(--foreground) 45%, transparent); }
.tab.active .tab-label { color: var(--foreground); }

/* ---- Modals ---- */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: flex;
  align-items: flex-end; justify-content: center;
  background: color-mix(in oklab, var(--foreground) 40%, transparent);
  backdrop-filter: blur(4px); padding: 0;
}
@media (min-width: 640px) { .overlay { align-items: center; padding: 1rem; } }
.sheet {
  background: var(--card); width: 100%; max-width: 32rem;
  border-radius: 1.25rem 1.25rem 0 0; padding: 1.5rem;
  max-height: 92vh; overflow-y: auto;
}
@media (min-width: 640px) { .sheet { border-radius: 1.25rem; } }
.sheet-lg { max-width: 34rem; }

/* ---- Habit rows ---- */
.hrow {
  position: relative; display: flex; align-items: center; gap: 0.6rem;
  width: 100%; text-align: left; padding: 0.65rem 0.7rem; border-radius: 1rem;
  border: 1px solid var(--border); background: var(--card);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  overflow: visible;
}
.hrow:not(.readonly):hover { border-color: color-mix(in oklab, var(--primary) 40%, transparent); box-shadow: 0 4px 14px rgba(0,0,0,0.06); }
.hrow:not(.readonly):active { transform: scale(0.99); }
.hrow.done { border-color: color-mix(in oklab, var(--primary) 30%, transparent); background: color-mix(in oklab, var(--primary) 5%, var(--card)); }
.hrow.readonly { opacity: 0.55; }
.hrow-body { flex: 1; min-width: 0; }
.hrow-label { font-family: var(--font-display); font-weight: 900; font-size: 15px; text-transform: uppercase; line-height: 1.15; }
.hrow.done .hrow-label { text-decoration: line-through; text-decoration-color: var(--primary); }
.hrow-micro { font-family: var(--font-mono); font-size: 9px; color: var(--primary-dark); text-transform: uppercase; letter-spacing: 0.06em; }
.hrow-target { font-size: 11px; color: color-mix(in oklab, var(--foreground) 50%, transparent); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.hrow-check {
  width: 1.9rem; height: 1.9rem; border-radius: 999px; flex-shrink: 0; flex-grow: 0;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--border); color: transparent; transition: background 0.15s, border-color 0.15s, color 0.15s;
  align-self: center;
}
.hrow.done .hrow-check { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---- Date scroller ---- */
.datescroll { display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.25rem; }
.daychip {
  min-width: 60px; border-radius: 1rem; border: 1px solid transparent;
  padding: 0.5rem 0; display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  color: color-mix(in oklab, var(--foreground) 60%, transparent); background: transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.daychip .dw { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; }
.daychip .dd { font-family: var(--font-display); font-weight: 900; font-size: 1.125rem; }
.daychip.sel { border-color: var(--foreground); background: var(--foreground); color: var(--background); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }

/* ---- Bar chart ---- */
.bars { display: flex; align-items: flex-end; gap: 0.3rem; height: 6rem; }
.barcol { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.25rem; height: 100%; justify-content: flex-end; }
.bar { width: 100%; border-radius: 0.3rem 0.3rem 0 0; background: var(--muted); transition: height 0.4s var(--ease-out-expo); }
.bar.partial { background: color-mix(in oklab, var(--primary) 40%, transparent); }
.bar.full { background: var(--primary); }
.barlabel { font-family: var(--font-mono); font-size: 8px; color: var(--muted-foreground); }

/* ---- Banner ---- */
.victory {
  display: flex; align-items: center; gap: 0.6rem; margin-top: 0.75rem;
  padding: 0.8rem 1rem; border-radius: 1rem;
  background: color-mix(in oklab, var(--primary) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--primary) 30%, transparent);
  color: var(--primary-dark); font-family: var(--font-display); font-weight: 800; font-size: 0.85rem; text-transform: uppercase;
}

/* ---- Switch ---- */
.switch { width: 2.6rem; height: 1.5rem; border-radius: 999px; background: var(--border); position: relative; transition: background 0.15s; flex-shrink: 0; }
.switch.on { background: var(--primary); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 1.1rem; height: 1.1rem; border-radius: 999px; background: #fff; transition: transform 0.15s var(--ease-out-expo); box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.switch.on::after { transform: translateX(1.1rem); }

/* ---- Popover ---- */
.popover { position: absolute; right: 0; top: calc(100% + 0.4rem); z-index: 60; width: 16rem; background: var(--popover); border: 1px solid var(--border); border-radius: 0.9rem; padding: 0.6rem; box-shadow: 0 12px 32px rgba(0,0,0,0.14); }
.popover-item { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.5rem 0.6rem; border-radius: 0.6rem; width: 100%; text-align: left; }
.popover-item:hover { background: var(--muted); }
.popover-item .pi-title { font-family: var(--font-display); font-weight: 700; font-size: 0.85rem; }
.popover-item .pi-sub { font-size: 0.7rem; color: var(--muted-foreground); }

/* ---- Milestones ---- */
.msrow { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0; }
.msdot { width: 0.625rem; height: 0.625rem; border-radius: 999px; flex-shrink: 0; }
.mslabel { font-family: var(--font-display); font-weight: 700; font-size: 0.85rem; text-transform: uppercase; flex: 1; }
.msstats { display: flex; gap: 0.6rem; font-family: var(--font-mono); font-size: 10px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }

/* ---- Avatar ---- */
.avatar { width: 2.75rem; height: 2.75rem; border-radius: 999px; display: flex; align-items: center; justify-content: center; color: #fff; font-family: var(--font-display); font-weight: 900; background: linear-gradient(135deg, #a3e635, #10b981); flex-shrink: 0; }

/* ---- Entrance animation ---- */
@keyframes leap-slide-up { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.entrance { animation: leap-slide-up 0.8s var(--ease-out-expo) both; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---- Section header ---- */
.sec-title { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.2em; color: var(--muted-foreground); }
.h2 { font-family: var(--font-display); font-weight: 900; font-size: 1.5rem; text-transform: uppercase; letter-spacing: -0.02em; line-height: 1.05; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }

/* ---- Fixed-size inline icon wrapper (account social rows etc.) ---- */
.icon-20 { width: 20px; height: 20px; flex-shrink: 0; display: block; }
.icon-20 svg { width: 100%; height: 100%; display: block; }

/* span-based controls inside .hrow (nested-button parse fix) */
.hrow-slot [role="button"], .popover-item { cursor: pointer; }
.popover-item { display: flex; }

/* Floyd AI typing indicator */
.floyd-typing { display: inline-flex; gap: 4px; }
.floyd-typing span { font-size: 8px; color: var(--muted-foreground); animation: floydBlink 1.2s infinite ease-in-out; }
.floyd-typing span:nth-child(2) { animation-delay: .2s; }
.floyd-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes floydBlink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
