/* Streamline Training & Nutrition: shared design tokens + components (office app, coach app, site, portal) */
:root {
  --red: #B23512; --red-600: #9A2C0D; --red-700: #7A230A; --red-50: #FBEDE7; --red-100: #F2D3C6;
  --gold: #E0532A; --gold-600: #B23512; --bone: #F4F1EC;
  --ink: #121212; --ink-2: #1E1E1E; --ink-3: #3A3836;
  --steel: #5F5B55; --steel-2: #8C8780; --chrome: #CAC4BA; --line: #E6E1D8; --line-2: #F0ECE5;
  --bg: #F6F4F0; --card: #FFFFFF; --text: #1B1A18; --muted: #625E57;
  --green: #1D7A45; --green-50: #E7F5EC; --amber: #9A5E05; --amber-50: #FBF1DF; --blue: #2B5BA8; --blue-50: #E9EFF9;
  --radius: 8px; --radius-sm: 5px; --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16,14,12,.06), 0 1px 1px rgba(16,14,12,.04);
  --shadow: 0 4px 14px rgba(16,14,12,.08), 0 1px 3px rgba(16,14,12,.06);
  --shadow-lg: 0 18px 50px rgba(16,14,12,.2);
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Archivo', 'Arial Narrow', sans-serif;
  --focus: 0 0 0 3px rgba(178,53,18,.35);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--red-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 650; font-stretch: 112%; line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.005em; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.45rem; } h3 { font-size: 1.15rem; } h4 { font-size: 1rem; }
p { margin: 0 0 1em; }
small, .small { font-size: .84rem; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45em; padding: .62em 1.1em; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 600 .92rem/1.2 var(--font); cursor: pointer; text-decoration: none !important;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s; white-space: nowrap; min-height: 40px; }
.btn:hover { background: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; box-shadow: var(--focus); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--bone); }
.btn-primary:hover { background: var(--ink-3); border-color: var(--ink-3); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--ink-3); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(0,0,0,.05); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { filter: brightness(.93); background: var(--green); }
.btn-danger { color: var(--red-600); border-color: var(--red-100); }
.btn-sm { padding: .38em .75em; font-size: .83rem; min-height: 32px; }
.btn-lg { padding: .85em 1.5em; font-size: 1.05rem; min-height: 50px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: .86rem; margin: 0 0 .3rem; color: var(--ink-2); }
.field { margin-bottom: 1rem; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .8rem; margin-top: .25rem; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], input[type=url], select, textarea {
  width: 100%; padding: .6em .75em; border: 1px solid #CDD1D6; border-radius: var(--radius-sm); background: #fff; font: 400 .95rem/1.35 var(--font); color: var(--text); min-height: 40px; }
textarea { min-height: 96px; resize: vertical; }
input[type=checkbox], input[type=radio] { accent-color: var(--red); width: 1.05em; height: 1.05em; }
.check { display: flex; gap: .5rem; align-items: flex-start; font-weight: 500; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- cards, tables, badges ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 1.25rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.25rem; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { margin: 0; font-size: 1.05rem; }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; padding: .65rem .9rem; border-bottom: 1px solid var(--line); background: #FAFAFB; white-space: nowrap; }
.table th.right, .table td.right { text-align: right; } .table th.center, .table td.center { text-align: center; }
.table td { padding: .7rem .9rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #FAFAFB; }
.badge { display: inline-flex; align-items: center; gap: .3em; padding: .18em .6em; border-radius: 999px; font-size: .74rem; font-weight: 600; background: var(--line-2); color: var(--ink-3); white-space: nowrap; }
.badge-red { background: var(--red-50); color: var(--red-600); }
.badge-green { background: var(--green-50); color: var(--green); }
.badge-amber { background: var(--amber-50); color: var(--amber); }
.badge-blue { background: var(--blue-50); color: var(--blue); }
.badge-dark { background: var(--ink); color: #fff; }
.dot { width: .6em; height: .6em; border-radius: 50%; display: inline-block; background: currentColor; }

.alert { padding: .8rem 1rem; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: 1rem; font-size: .92rem; }
.alert-info { background: var(--blue-50); border-color: #C8D8F8; color: #173F8A; }
.alert-success { background: var(--green-50); border-color: #BFE3CD; color: #145A33; }
.alert-warn { background: var(--amber-50); border-color: #F2D9A8; color: #6E4303; }
.alert-error { background: var(--red-50); border-color: var(--red-100); color: var(--red-700); }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.stack > * + * { margin-top: 1rem; }
.flex { display: flex; gap: .75rem; align-items: center; }
.flex-between { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ================= OFFICE APP SHELL ================= */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--ink); color: #D9DCE0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { padding: 1rem 1rem .75rem; display: block; border-bottom: 1px solid rgba(255,255,255,.07); }
.sidebar .brand img { width: 100%; max-width: 180px; margin: 0 auto; }
.sidebar nav { padding: .6rem .5rem; flex: 1; }
.sidebar nav a { display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border-radius: 8px; color: #C9CDD2; font-weight: 500; font-size: .92rem; text-decoration: none; }
.sidebar nav a svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: var(--red); color: #fff; }
.sidebar nav a.active svg { opacity: 1; }
.sidebar nav .nav-count { margin-left: auto; background: rgba(255,255,255,.14); color: #fff; font-size: .72rem; padding: .05em .5em; border-radius: 999px; }
.sidebar nav a.active .nav-count { background: rgba(0,0,0,.25); }
.sidebar .nav-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #7C828B; padding: .9rem .75rem .35rem; }
.sidebar .me { padding: .8rem 1rem; border-top: 1px solid rgba(255,255,255,.07); font-size: .85rem; display: flex; align-items: center; gap: .6rem; }
.sidebar .me a { color: #9AA0A8; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex: none; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: .9rem 1.75rem; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar h1 { margin: 0; font-size: 1.35rem; }
.topbar .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.content { padding: 1.5rem 1.75rem 3rem; max-width: 1400px; }
.menu-btn { display: none; }
.demo-banner { background: var(--amber-50); color: #6E4303; border-bottom: 1px solid #F2D9A8; font-size: .82rem; padding: .45rem 1.75rem; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: .75rem 1rem; }
  .content { padding: 1rem 1rem 3rem; }
  .demo-banner { padding: .45rem 1rem; }
}

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow-sm); }
.kpi .label, .kpi-label { font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.kpi .value, .kpi-value { font: 600 1.7rem/1.2 var(--font-display); margin-top: .25rem; color: var(--ink); }
.kpi .sub, .kpi-sub { font-size: .8rem; color: var(--muted); margin-top: .15rem; }

/* auth pages */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: #F4F1EC; }
.auth-card { width: 100%; max-width: 400px; background: #FFFDF9; color: var(--text); border: 1px solid #DDD3C4; border-radius: var(--radius-lg); padding: 2rem; box-shadow: 0 1px 2px rgba(22,19,15,.05), 0 12px 32px rgba(22,19,15,.08); }
.auth-card .logo { width: 240px; max-width: 80%; margin: -.25rem auto 1.5rem; }

/* ================= CREW (phone) SHELL ================= */
.crew-shell { max-width: 640px; margin: 0 auto; min-height: 100vh; background: var(--bg); }
.crew-top { background: var(--ink); color: #fff; padding: .7rem 1rem; display: flex; align-items: center; gap: .75rem; position: sticky; top: 0; z-index: 20; }
.crew-top img { height: 34px; width: auto; }
.crew-top .who { margin-left: auto; font-size: .82rem; color: #C9CDD2; text-align: right; }
.crew-top .who a { color: #fff; }
.crew-body { padding: 1rem; }
