:root {
  --primary: #6549df;
  --primary-dark: #4e33c4;
  --primary-light: #8c74ef;
  --primary-soft: #f0edff;
  --primary-rgb: 101, 73, 223;
  --secondary: #151225;
  --background: #f7f6fc;
  --surface: #ffffff;
  --surface-soft: #faf9ff;
  --text-primary: #171426;
  --text-secondary: #716d82;
  --text-muted: #9a96a9;
  --success: #2fa776;
  --success-soft: #e8f8f1;
  --warning: #f2a541;
  --warning-soft: #fff3df;
  --danger: #d95774;
  --border: #e7e3ef;
  --border-strong: #d8d1ee;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --radius-xl: 38px;
  --shadow-sm: 0 6px 20px rgba(38, 28, 83, .055);
  --shadow-md: 0 18px 54px rgba(51, 37, 113, .11);
  --content-width: 1120px;
  --nav-height: 82px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-primary);
  background: var(--background);
  font-synthesis: none;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --secondary: #f5f2ff;
  --background: #0f0d17;
  --surface: #181521;
  --surface-soft: #201c2b;
  --text-primary: #f6f3ff;
  --text-secondary: #c0bacd;
  --text-muted: #938ca2;
  --success-soft: #173629;
  --warning-soft: #3b2a16;
  --border: #302a3d;
  --border-strong: #443b55;
  --shadow-sm: 0 7px 24px rgba(0, 0, 0, .24);
  --shadow-md: 0 20px 58px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--background); scroll-behavior: smooth; }
body { min-width: 0; min-height: 100vh; margin: 0; overflow-x: clip; background: radial-gradient(circle at 50% -10%, rgba(var(--primary-rgb), .12) 0, transparent 28rem), var(--background); color: var(--text-primary); }
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button, a { touch-action: manipulation; }
#appShell, .modal-layer, .secondary-view { touch-action: pan-x pan-y; }
@media (max-width: 600px) { input, select, textarea { font-size: 16px !important; } }
img, canvas { max-width: 100%; }
.app-icon { width: 1em; height: 1em; display: block; flex: 0 0 auto; overflow: visible; }
[data-icon] { display: inline-grid; place-items: center; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: -.035em; }
p { color: var(--text-secondary); line-height: 1.55; }
[hidden] { display: none !important; }

.app-shell { width: 100%; min-height: 100vh; padding-bottom: calc(var(--nav-height) + 38px + env(safe-area-inset-bottom)); }
.topbar { width: min(calc(100% - 32px), 1180px); height: 68px; margin: 14px auto 0; padding: 8px 10px 8px 18px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 10px; z-index: 20; border: 1px solid rgba(229, 225, 238, .88); border-radius: 22px; background: rgba(255,255,255,.9); box-shadow: var(--shadow-sm); backdrop-filter: blur(18px); }
.brand { display: inline-flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 4px 0; font-size: 20px; font-weight: 800; letter-spacing: -.05em; }
.brand b { color: var(--primary); }
.brand-mark { position: relative; width: 32px; height: 32px; display: inline-block; }
.brand-mark i { position: absolute; width: 11px; height: 19px; left: 10px; top: 1px; border-radius: 8px; background: var(--primary); }
.brand-mark i:nth-child(2) { transform: rotate(90deg); left: 4px; top: 7px; }
.brand-mark i:nth-child(3) { top: 13px; opacity: .46; }
.brand-mark i:nth-child(4) { transform: rotate(90deg); left: 16px; top: 7px; opacity: .24; }
.avatar-button { width: 46px; height: 46px; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 15px; background: var(--surface-soft); font-weight: 800; color: var(--primary); }
.avatar-button > span { width: 100%; height: 100%; display: grid; place-items: center; }
.avatar-button img, .profile-avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }
.topbar-actions{display:flex;align-items:center;gap:8px}.notification-button{width:46px;height:46px;position:relative;display:grid;place-items:center;border:1px solid var(--border);border-radius:15px;background:var(--surface-soft);color:var(--text-secondary)}.notification-button svg{width:21px;height:21px}.notification-button b{min-width:18px;height:18px;padding:0 4px;position:absolute;right:-4px;top:-4px;display:grid;place-items:center;border:2px solid var(--surface);border-radius:99px;color:#fff;background:var(--danger);font-size:8px}

main { width: min(calc(100% - 32px), var(--content-width)); margin: 40px auto 0; }
.screen { animation: screen-in .32s ease both; }
.screen-heading { margin-bottom: 28px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.screen-heading h1 { margin: 2px 0 5px; font-size: clamp(32px, 5vw, 48px); line-height: 1.05; }
.screen-heading p:not(.eyebrow) { margin: 0; font-size: 15px; }
.eyebrow { margin: 0 0 7px; color: var(--primary); font-size: 11px; line-height: 1.2; font-weight: 800; letter-spacing: .13em; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.bottom-nav { width: min(calc(100% - 28px), 680px); min-height: var(--nav-height); padding: 8px; display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 30; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%); border: 1px solid rgba(220, 215, 232, .9); border-radius: 24px; background: rgba(255,255,255,.93); box-shadow: 0 14px 46px rgba(31, 23, 71, .16); backdrop-filter: blur(20px); }
.bottom-nav button { min-width: 0; border: 0; border-radius: 17px; background: transparent; color: var(--text-secondary); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; font-size: 11px; font-weight: 750; transition: .2s ease; }
.bottom-nav button.active { color: var(--primary); background: var(--primary-soft); }
.nav-icon { font-size: 22px; line-height: 1; font-weight: 500; }
.nav-icon .app-icon { width: 22px; height: 22px; }
.coach-nav-icon { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: var(--primary); box-shadow: 0 6px 14px rgba(101,73,223,.3); }

:root[data-theme="dark"] .topbar { border-color: rgba(68, 59, 85, .9); background: rgba(24, 21, 33, .91); }
:root[data-theme="dark"] .bottom-nav { border-color: rgba(68, 59, 85, .9); background: rgba(24, 21, 33, .94); box-shadow: 0 16px 50px rgba(0,0,0,.42); }

@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(22px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
