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

:root {
  --bg: #0e0f11;
  --bg2: #16181c;
  --bg3: #1e2126;
  --border: #2a2d34;
  --border2: #373b44;
  --text: #f0f1f3;
  --text2: #9099a8;
  --text3: #5a6170;
  --accent: #c8f564;
  --accent2: #a8e040;
  --accent-dim: rgba(200,245,100,0.12);
  --blue: #5b9cf6;
  --blue-dim: rgba(91,156,246,0.12);
  --orange: #f59e42;
  --orange-dim: rgba(245,158,66,0.12);
  --red: #f06565;
  --red-dim: rgba(240,101,101,0.12);
  --teal: #4dd9c0;
  --teal-dim: rgba(77,217,192,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 220px;
  --font-head: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --transition: 0.18s ease;
}

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 15px; }

/* SCREENS */
.screen { display: none; }
.screen.active { display: flex; }
#user-screen { min-height: 100vh; align-items: center; justify-content: center; background: var(--bg); }
#app-screen { height: 100vh; overflow: hidden; }

/* USER SCREEN */
.user-screen-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; max-width: 400px; padding: 32px 16px; }
.logo-mark { width: 64px; height: 64px; background: var(--accent); border-radius: 16px; display: flex; align-items: center; justify-content: center; font-family: var(--font-head); font-weight: 800; font-size: 22px; color: #0e0f11; margin-bottom: 4px; }
.brand { font-family: var(--font-head); font-size: 36px; font-weight: 800; color: var(--text); }
.brand-sub { color: var(--text3); font-size: 13px; letter-spacing: 0.08em; margin-bottom: 24px; text-transform: uppercase; }
.user-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; width: 100%; display: flex; flex-direction: column; gap: 12px; }
.user-card h2 { font-family: var(--font-head); font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.hint { color: var(--text3); font-size: 13px; text-align: center; }

/* INPUTS */
input[type="text"], input[type="email"], input[type="number"], input[type="date"], input[type="password"],
select, textarea {
  width: 100%; background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 10px 14px; font-family: var(--font-body); font-size: 14px;
  outline: none; transition: border var(--transition);
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder { color: var(--text3); }
select option { background: var(--bg3); }
.date-picker { width: auto; }

/* BUTTONS */
.btn-primary { background: var(--accent); color: #0e0f11; border: none; border-radius: var(--radius-sm); padding: 10px 20px; font-family: var(--font-head); font-weight: 700; font-size: 14px; cursor: pointer; transition: background var(--transition), transform 0.1s; white-space: nowrap; }
.btn-primary:hover { background: var(--accent2); }
.btn-primary:active { transform: scale(0.98); }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 18px; font-family: var(--font-body); font-size: 14px; cursor: pointer; transition: border var(--transition); }
.btn-secondary:hover { border-color: var(--border2); }
.btn-ghost { background: none; border: none; color: var(--text2); cursor: pointer; font-size: 13px; padding: 4px 8px; border-radius: 6px; transition: color var(--transition); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: var(--red-dim); color: var(--red); border: 1px solid rgba(240,101,101,0.25); border-radius: var(--radius-sm); padding: 7px 14px; font-size: 13px; cursor: pointer; }

/* SIDEBAR */
.sidebar { width: var(--sidebar-w); height: 100vh; background: var(--bg2); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 20px 12px; gap: 4px; flex-shrink: 0; }
.sidebar-top { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sidebar-bottom { display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid var(--border); }
.nav-logo { font-family: var(--font-head); font-weight: 800; font-size: 20px; color: var(--accent); padding: 4px 8px 16px; letter-spacing: -0.02em; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: none; border: none; color: var(--text2); font-family: var(--font-body); font-size: 14px; cursor: pointer; transition: background var(--transition), color var(--transition); width: 100%; text-align: left; }
.nav-item svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; flex-shrink: 0; }
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }
.user-pill { padding: 8px 12px; font-size: 12px; color: var(--text3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* MAIN */
.main-content { flex: 1; overflow-y: auto; background: var(--bg); }
.page { display: none; padding: 32px 36px; max-width: 1100px; }
.page.active { display: block; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; gap: 16px; flex-wrap: wrap; }
.page-header h1 { font-family: var(--font-head); font-size: 28px; font-weight: 700; }
.page-date { color: var(--text3); font-size: 13px; margin-top: 2px; }

/* CARDS */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.card-title { font-family: var(--font-head); font-size: 15px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 16px; }

/* STATS GRID */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text3); margin-bottom: 6px; }
.stat-value { font-family: var(--font-head); font-size: 32px; font-weight: 700; line-height: 1; }
.stat-unit { font-size: 14px; font-weight: 400; color: var(--text2); margin-left: 3px; }
.stat-sub { font-size: 12px; color: var(--text3); margin-top: 4px; }
.stat-accent { color: var(--accent); }
.stat-blue { color: var(--blue); }
.stat-orange { color: var(--orange); }
.stat-teal { color: var(--teal); }

/* MACROS BAR */
.macro-row { display: flex; flex-direction: column; gap: 10px; }
.macro-item { display: flex; flex-direction: column; gap: 4px; }
.macro-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--text2); }
.macro-bar-bg { height: 6px; background: var(--bg3); border-radius: 99px; overflow: hidden; }
.macro-bar { height: 100%; border-radius: 99px; transition: width 0.6s ease; }

/* TABS */
.tab-bar { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.tab { background: none; border: none; color: var(--text2); font-family: var(--font-body); font-size: 14px; padding: 10px 16px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color var(--transition), border-color var(--transition); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* WORKOUT CARDS */
.session-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 22px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; transition: border-color var(--transition); }
.session-card:hover { border-color: var(--border2); }
.session-date { font-family: var(--font-head); font-weight: 600; font-size: 15px; }
.session-meta { font-size: 12px; color: var(--text3); margin-top: 3px; }
.session-badge { background: var(--accent-dim); color: var(--accent); border-radius: 6px; padding: 4px 10px; font-size: 12px; font-weight: 600; }

/* EXERCISE TABLE */
.ex-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ex-table th { text-align: left; padding: 8px 12px; color: var(--text3); font-weight: 500; border-bottom: 1px solid var(--border); }
.ex-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.ex-table tr:last-child td { border-bottom: none; }
.ex-table tr:hover td { background: var(--bg3); }

/* NUTRITION */
.nutrition-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.meal-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.meal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.meal-type { font-family: var(--font-head); font-weight: 600; font-size: 15px; }
.meal-cals { color: var(--accent); font-size: 13px; font-weight: 600; }
.food-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.food-row:last-child { border-bottom: none; }
.food-name { color: var(--text); }
.food-cals { color: var(--text2); }

/* HYDRATION */
.hydration-big { text-align: center; padding: 40px 0; }
.water-display { font-family: var(--font-head); font-size: 72px; font-weight: 800; color: var(--teal); line-height: 1; }
.water-unit { font-size: 24px; color: var(--text2); }
.water-goal { font-size: 15px; color: var(--text3); margin-top: 8px; }
.water-progress { width: 100%; max-width: 320px; height: 8px; background: var(--bg3); border-radius: 99px; overflow: hidden; margin: 20px auto; }
.water-progress-fill { height: 100%; background: var(--teal); border-radius: 99px; transition: width 0.6s ease; }
.quick-add-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.quick-btn { background: var(--teal-dim); border: 1px solid rgba(77,217,192,0.25); color: var(--teal); border-radius: 8px; padding: 10px 18px; font-size: 14px; cursor: pointer; font-weight: 600; transition: background var(--transition); }
.quick-btn:hover { background: rgba(77,217,192,0.22); }
.hydration-log-list { margin-top: 24px; }
.hydration-log-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }

/* GOALS */
.goal-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 12px; }
.goal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.goal-status { padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.status-active { background: var(--accent-dim); color: var(--accent); }
.status-achieved { background: var(--teal-dim); color: var(--teal); }
.status-abandoned { background: var(--red-dim); color: var(--red); }
.goal-targets { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--text2); }
.goal-target span { color: var(--text); font-weight: 500; }
.goal-actions { display: flex; gap: 8px; margin-top: 12px; }

/* MODAL */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.65); z-index: 100; }
.modal-overlay.open { display: block; }
.modal { display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; z-index: 101; width: min(560px, 95vw); max-height: 90vh; overflow-y: auto; }
.modal.open { display: block; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.modal-header h2 { font-family: var(--font-head); font-size: 20px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text2); font-size: 18px; cursor: pointer; padding: 4px; border-radius: 6px; }
.modal-close:hover { color: var(--text); }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-label { font-size: 12px; font-weight: 500; color: var(--text2); text-transform: uppercase; letter-spacing: 0.06em; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.sets-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.sets-table th { text-align: left; color: var(--text3); padding: 6px 8px; font-weight: 500; }
.sets-table td { padding: 6px 8px; }

/* SEARCH BOX */
.search-box { position: relative; margin-bottom: 16px; }
.search-box input { padding-left: 36px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: 14px; pointer-events: none; }
.food-search-results { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 200px; overflow-y: auto; margin-top: -8px; }
.food-result-item { padding: 10px 14px; cursor: pointer; font-size: 13px; display: flex; justify-content: space-between; border-bottom: 1px solid var(--border); }
.food-result-item:last-child { border-bottom: none; }
.food-result-item:hover { background: var(--bg2); }

/* DASH TWO COL */
.dash-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
@media (max-width: 768px) { .dash-two-col { grid-template-columns: 1fr; } .sidebar { width: 60px; } .nav-item span { display: none; } .page { padding: 20px 16px; } }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text3); }
.empty-state-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

/* TOAST */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 20px; font-size: 14px; z-index: 200; animation: toast-in 0.25s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; } ::-webkit-scrollbar-track { background: transparent; } ::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* PROGRAM CARD */
.program-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 22px; margin-bottom: 12px; }
.program-name { font-family: var(--font-head); font-size: 16px; font-weight: 600; }
.program-meta { font-size: 12px; color: var(--text3); margin-top: 4px; }

/* AUTH TABS */
.auth-tabs { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.auth-tab { flex: 1; background: none; border: none; color: var(--text2); font-family: var(--font-body); font-size: 14px; padding: 10px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color var(--transition), border-color var(--transition); }
.auth-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.auth-panel { display: none; }
.auth-panel.active { display: block; }
