/* Binectics — Operating system for fitness
   Shared design tokens + base styles
*/

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500;600&family=Instrument+Serif:ital@0;1&display=swap');

:root {
  /* Surface */
  --bg: oklch(0.985 0.005 85);
  --bg-2: oklch(0.965 0.006 85);
  --bg-3: oklch(0.945 0.007 85);
  --fg: oklch(0.18 0.008 80);
  --fg-2: oklch(0.36 0.008 80);
  --fg-3: oklch(0.55 0.008 80);
  --fg-4: oklch(0.72 0.008 80);
  --border: oklch(0.91 0.006 85);
  --border-2: oklch(0.86 0.008 85);
  --ink: oklch(0.14 0.008 80);

  /* Signal (single primary action color — athletic green, restrained) */
  --signal: oklch(0.68 0.16 148);
  --signal-ink: oklch(0.22 0.05 148);
  --signal-soft: oklch(0.94 0.04 148);

  /* Role accents — matched chroma + lightness so dashboards harmonize */
  --consumer: oklch(0.58 0.14 320);
  --consumer-soft: oklch(0.94 0.03 320);
  --gym: oklch(0.58 0.14 248);
  --gym-soft: oklch(0.94 0.03 248);
  --trainer: oklch(0.72 0.13 75);
  --trainer-soft: oklch(0.95 0.04 75);
  --dietitian: oklch(0.58 0.14 300);
  --dietitian-soft: oklch(0.95 0.03 300);
  --admin: oklch(0.45 0.02 80);
  --admin-soft: oklch(0.93 0.005 85);

  /* Semantic */
  --danger: oklch(0.58 0.18 25);
  --danger-soft: oklch(0.95 0.03 25);
  --warn: oklch(0.72 0.14 75);

  /* Type */
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", monospace;
  --font-serif: "Instrument Serif", "Cormorant Garamond", Georgia, serif;

  /* Radii — disciplined, barely rounded */
  --r-1: 3px;
  --r-2: 6px;
  --r-3: 10px;
  --r-full: 999px;

  /* Shadows — almost none */
  --shadow-1: 0 1px 0 oklch(0.92 0.005 85);
  --shadow-2: 0 1px 2px oklch(0 0 0 / 0.04), 0 0 0 1px oklch(0 0 0 / 0.04);

  /* Motion — durations + easings. The whole motion vocabulary lives here. */
  --motion-fast: 120ms;       /* color/border on hover */
  --motion-base: 220ms;       /* UI state changes */
  --motion-slow: 360ms;       /* sheet opens, modals */
  --motion-hero: 600ms;       /* check-in success only */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);          /* standard out-quart */
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1); /* slight overshoot, check-in only */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}

body {
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

/* tabular figures everywhere by default; opt-out per element */
.tnum, [data-numeric] {
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: var(--font-mono);
  font-feature-settings: "ss01", "ss02", "cv01";
}

.serif {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: -0.01em;
}

/* — Layout primitives — */
.shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 32px;
}

.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; }
.gap-8 { gap: 32px; } .gap-10 { gap: 40px; }

/* — Top nav (cross-page) — */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: oklch(0.985 0.005 85 / 0.85);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 32px;
}
.brand-lockup { display: inline-flex; align-items: center; gap: 10px; }
.brand-lockup .mark { width: 24px; height: 24px; }
.brand-lockup .wordmark {
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 17px;
  color: var(--ink);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-links a {
  font-size: 13.5px;
  color: var(--fg-2);
  padding: 6px 10px;
  border-radius: var(--r-2);
  letter-spacing: -0.005em;
}
.nav-links a:hover { color: var(--ink); background: var(--bg-2); }
.nav-links a.is-active {
  color: var(--ink);
  background: var(--bg-2);
}

/* — Buttons — */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--r-2);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  transition: background 120ms, color 120ms, border 120ms;
  white-space: nowrap;
}
.btn-primary {
  background: var(--ink);
  color: var(--bg);
}
.btn-primary:hover { background: oklch(0.08 0.008 80); }
.btn-signal {
  background: var(--signal);
  color: var(--signal-ink);
}
.btn-signal:hover { background: oklch(0.62 0.17 148); }
.btn-ghost {
  background: transparent;
  color: var(--fg-2);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg-2); color: var(--ink); border-color: var(--border-2); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 42px; padding: 0 18px; font-size: 14px; }

/* — Badges / tags — */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-1);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.005em;
  background: var(--bg-3);
  color: var(--fg-2);
  border: 1px solid var(--border);
}
.badge-signal { background: var(--signal-soft); color: var(--signal-ink); border-color: oklch(0.88 0.05 148); }
.badge-gym    { background: var(--gym-soft); color: var(--gym); border-color: oklch(0.88 0.04 248); }
.badge-trainer{ background: var(--trainer-soft); color: oklch(0.45 0.12 75); border-color: oklch(0.88 0.05 75); }
.badge-diet   { background: var(--dietitian-soft); color: var(--dietitian); border-color: oklch(0.88 0.04 300); }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: oklch(0.88 0.05 25); }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

/* — Cards — */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
}
.card-flat {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
}

/* — Section header — */
.section-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
}

/* — Typography utilities — */
.display {
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.02;
  color: var(--ink);
}
h1, h2, h3, h4 {
  font-weight: 500;
  letter-spacing: -0.022em;
  color: var(--ink);
  margin: 0;
}
.muted { color: var(--fg-3); }
.muted-2 { color: var(--fg-2); }

/* — Tables — */
table.data {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
table.data th, table.data td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
table.data th {
  font-weight: 500;
  color: var(--fg-3);
  font-size: 12px;
  letter-spacing: -0.005em;
  background: var(--bg-2);
}
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: var(--bg-2); }

/* — Image placeholders (subtle stripes, mono caption) — */
.imgholder {
  background:
    repeating-linear-gradient(
      135deg,
      oklch(0.94 0.008 85) 0 8px,
      oklch(0.96 0.006 85) 8px 16px
    );
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: -0.005em;
  text-align: center;
  padding: 8px;
  overflow: hidden;
}

/* — Star rating — */
.stars { display: inline-flex; gap: 1px; color: var(--ink); }
.stars svg { width: 12px; height: 12px; }

/* — Skip-nav fallback — */
.sub-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 32px;
}

/* — Sidebar (dashboards) — */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}
.sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg);
  padding: 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar .brand-lockup { padding: 6px 8px 16px 8px; }
.sidebar-group {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-4);
  padding: 14px 8px 6px;
}
.sidebar a.item {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 30px;
  padding: 0 8px;
  border-radius: var(--r-2);
  font-size: 13px;
  color: var(--fg-2);
  letter-spacing: -0.005em;
}
.sidebar a.item:hover { background: var(--bg-2); color: var(--ink); }
.sidebar a.item.active { background: var(--bg-3); color: var(--ink); font-weight: 500; }
.sidebar a.item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.7; }
.sidebar a.item.active svg { opacity: 1; }
.sidebar .me {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-2);
  flex-shrink: 0;
}

.main {
  background: var(--bg);
  min-width: 0;
}
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: oklch(0.985 0.005 85 / 0.9);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 5;
}
.main-body {
  padding: 28px;
}
.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--fg-3);
  font-size: 13px;
}
.crumbs .sep { color: var(--border-2); }

/* — Stat card — */
.stat {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  background: var(--bg);
}
.stat .label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.stat .value {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.stat .delta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--signal-ink);
  margin-top: 4px;
}
.stat .delta.down { color: var(--danger); }
.stat .delta.flat { color: var(--fg-3); }

/* — Page title block — */
.page-title h1 {
  font-size: 28px;
  letter-spacing: -0.028em;
  font-weight: 500;
}
.page-title p {
  color: var(--fg-3);
  margin: 4px 0 0;
  font-size: 14px;
}

/* — Generic search input — */
.search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  background: var(--bg);
  width: 280px;
  color: var(--fg-3);
  font-size: 13px;
}
.search input {
  border: 0;
  background: transparent;
  outline: none;
  font-size: 13px;
  flex: 1;
  color: var(--ink);
  font-family: inherit;
}
.kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--fg-3);
  background: var(--bg-2);
}

/* — Scrollbars — */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }


/* ───────────────────── EMPTY STATES ─────────────────────
   Use any time a list, table, calendar slot, or panel has no items.
   Convention: 1 sentence of context + 1 primary action.
   Never an illustration — a single Lucide-style outline icon, max.
*/
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding: 56px 32px;
  color: var(--fg-3);
}
.empty-state .ico {
  width: 40px; height: 40px;
  color: var(--fg-3);
  margin-bottom: 16px;
  opacity: 0.7;
}
.empty-state .ico svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.3; }
.empty-state h4 {
  font-size: 17px; font-weight: 500; letter-spacing: -0.012em;
  color: var(--ink); margin-bottom: 8px; line-height: 1.3;
}
.empty-state p {
  font-size: 13.5px; color: var(--fg-2);
  line-height: 1.55; max-width: 38ch; margin-bottom: 20px;
}
.empty-state .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.empty-state.compact { padding: 32px 22px; }
.empty-state.compact .ico { width: 28px; height: 28px; margin-bottom: 10px; }
.empty-state.compact h4 { font-size: 14.5px; margin-bottom: 5px; }
.empty-state.compact p { font-size: 12.5px; margin-bottom: 12px; }
