:root {
  color-scheme: light;
  --paper: #f5f2eb;
  --card: #fffefa;
  --ink: #17211c;
  --muted: #6f766f;
  --line: #deddd5;
  --green: #245c45;
  --green-soft: #dceade;
  --lime: #c9e85a;
  --orange: #ef8f5a;
  --shadow: 0 20px 60px rgba(32, 48, 39, 0.08);
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(201, 232, 90, 0.2), transparent 25rem),
    radial-gradient(circle at 90% 90%, rgba(36, 92, 69, 0.09), transparent 28rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button { cursor: pointer; }
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.07'/%3E%3C/svg%3E");
}
.login-shell {
  width: min(680px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 72px 0;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 28px;
  border-radius: 19px;
  color: white;
  background: var(--green);
  font: 800 25px/1 Georgia, serif;
  box-shadow: 0 12px 28px rgba(36, 92, 69, 0.22);
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
}
h1, h2, p { margin-top: 0; }
h1 {
  margin-bottom: 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(44px, 7vw, 76px);
  line-height: 0.99;
  letter-spacing: -0.045em;
  font-weight: 500;
}
.login-copy {
  max-width: 570px;
  margin-bottom: 38px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}
.login-form { width: 100%; }
.login-form label { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 750; }
.token-row { display: flex; gap: 10px; }
.token-row input {
  min-width: 0;
  flex: 1;
  height: 58px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  color: var(--ink);
  background: rgba(255, 254, 250, 0.85);
  box-shadow: 0 8px 28px rgba(32, 48, 39, 0.05);
}
.token-row input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(36, 92, 69, 0.1); }
.token-row button {
  height: 58px;
  padding: 0 26px;
  border: 0;
  border-radius: 14px;
  color: white;
  background: var(--green);
  font-weight: 800;
}
.token-row button:hover { filter: brightness(1.08); }
.error { min-height: 20px; margin: 10px 0 0; color: #a73e35; font-size: 13px; }
.security-note { margin-top: 34px; color: #8b918a; font-size: 12px; }
.dashboard { min-height: 100vh; }
.topbar {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px clamp(20px, 4vw, 64px);
  border-bottom: 1px solid rgba(222, 221, 213, 0.8);
  background: rgba(245, 242, 235, 0.86);
  backdrop-filter: blur(18px);
}
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-mark-small { width: 40px; height: 40px; margin: 0; border-radius: 13px; font-size: 18px; }
.brand-lockup .eyebrow { margin-bottom: 1px; font-size: 8px; }
.product-name { margin: 0; font-family: Georgia, serif; font-size: 20px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.freshness { color: var(--muted); font-size: 12px; }
.icon-button, .quiet-button { border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: var(--card); }
.icon-button { width: 40px; height: 40px; font-size: 22px; }
.quiet-button { height: 40px; padding: 0 15px; font-size: 12px; font-weight: 700; }
.dashboard-content { width: min(1440px, calc(100% - 40px)); margin: 0 auto; padding: 58px 0 80px; }
.hero-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 34px; }
.hero-row h1 { max-width: 780px; margin-bottom: 12px; font-size: clamp(38px, 5vw, 64px); }
.muted { margin-bottom: 0; color: var(--muted); }
.range-picker { display: flex; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.5); }
.range-picker button { padding: 10px 14px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 750; }
.range-picker button.active { color: white; background: var(--green); }
.loading-card, .panel, .today-strip, .privacy-card { border: 1px solid var(--line); border-radius: 20px; background: rgba(255, 254, 250, 0.88); box-shadow: var(--shadow); }
.loading-card { padding: 34px; text-align: center; color: var(--muted); }
.dashboard-error { margin-bottom: 18px; }
.today-strip { display: grid; grid-template-columns: repeat(4, 1fr); overflow: hidden; margin-bottom: 18px; }
.today-strip > div { padding: 24px; border-right: 1px solid var(--line); }
.today-strip > div:last-child { border-right: 0; }
.today-strip span, .today-strip small { display: block; color: var(--muted); font-size: 11px; }
.today-strip strong { display: block; margin: 8px 0 5px; font-family: Georgia, serif; font-size: 30px; font-weight: 500; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 18px; }
.metric-card { min-height: 174px; padding: 24px; border-radius: 20px; color: white; background: var(--green); }
.metric-card:nth-child(2) { color: var(--ink); background: var(--lime); }
.metric-card:nth-child(3) { color: var(--ink); background: var(--card); border: 1px solid var(--line); }
.metric-card:nth-child(4) { color: var(--ink); background: #f3c9af; }
.metric-label { display: block; min-height: 32px; font-size: 11px; font-weight: 800; letter-spacing: .08em; opacity: .72; text-transform: uppercase; }
.metric-value { display: block; margin: 13px 0 10px; font-family: Georgia, serif; font-size: clamp(34px, 4vw, 48px); font-weight: 500; line-height: 1; }
.metric-detail { font-size: 12px; opacity: .74; }
.panel { padding: clamp(22px, 3vw, 32px); margin-bottom: 18px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 26px; }
.panel h2 { margin: 0; font-family: Georgia, serif; font-size: 28px; font-weight: 500; }
.legend { display: flex; gap: 16px; color: var(--muted); font-size: 11px; }
.dot { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 99px; }
.dot-time { background: var(--green); }
.dot-exercises { background: var(--orange); }
.activity-chart { display: flex; align-items: flex-end; gap: 7px; height: 250px; padding-top: 20px; overflow-x: auto; }
.day-column { min-width: 24px; flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 7px; }
.bar-wrap { position: relative; width: min(34px, 70%); flex: 1; display: flex; align-items: flex-end; }
.bar-time { width: 100%; min-height: 2px; border-radius: 7px 7px 2px 2px; background: var(--green); transition: height .3s ease; }
.exercise-pin { position: absolute; left: 50%; width: 7px; height: 7px; border: 2px solid var(--card); border-radius: 50%; background: var(--orange); transform: translate(-50%, 50%); }
.day-label { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.two-columns .panel { margin: 0; }
.page-item { margin-bottom: 22px; }
.page-line { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.page-name { font-weight: 750; }
.page-value { color: var(--muted); font-size: 12px; }
.progress { height: 8px; border-radius: 99px; background: #e8e8e1; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.page-meta { margin-top: 6px; color: var(--muted); font-size: 10px; }
.leader-row { width: 100%; display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px; padding: 14px 0; border: 0; border-bottom: 1px solid var(--line); color: inherit; background: transparent; text-align: left; }
.leader-row:hover { color: var(--green); }
.leader-row:last-child { border-bottom: 0; }
.rank { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; color: var(--green); background: var(--green-soft); font-size: 11px; font-weight: 800; }
.leader-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.leader-stats { color: var(--muted); font-size: 11px; text-align: right; }
.empty { padding: 28px 0; color: var(--muted); text-align: center; }
.user-panel { margin-top: 18px; }
.user-heading { align-items: flex-end; }
.user-search { min-width: min(360px, 100%); color: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.user-search input { display: block; width: 100%; height: 42px; margin-top: 7px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; outline: none; color: var(--ink); background: var(--card); }
.user-search input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(36, 92, 69, .1); }
.user-workspace { display: grid; grid-template-columns: minmax(240px, .75fr) minmax(0, 2fr); min-height: 540px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; }
.user-list { max-height: 680px; overflow-y: auto; border-right: 1px solid var(--line); background: rgba(245, 242, 235, .55); }
.user-list-button { width: 100%; padding: 16px; border: 0; border-bottom: 1px solid var(--line); color: var(--ink); background: transparent; text-align: left; }
.user-list-button:hover, .user-list-button.active { background: var(--card); }
.user-list-button.active { box-shadow: inset 4px 0 var(--green); }
.user-list-button strong, .user-list-button span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-list-button strong { font-size: 13px; }
.user-list-button span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.user-profile { min-width: 0; padding: clamp(20px, 3vw, 34px); }
.profile-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 22px; }
.profile-head h3 { margin: 0 0 5px; font-family: Georgia, serif; font-size: 30px; font-weight: 500; }
.profile-identity { margin: 0; color: var(--muted); font-size: 12px; }
.profile-badge { padding: 7px 10px; border-radius: 99px; color: var(--green); background: var(--green-soft); font-size: 10px; font-weight: 800; }
.profile-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-bottom: 25px; }
.profile-metric { padding: 14px; border-radius: 13px; background: var(--paper); }
.profile-metric strong, .profile-metric span { display: block; }
.profile-metric strong { margin-bottom: 4px; font: 500 22px/1 Georgia, serif; }
.profile-metric span { color: var(--muted); font-size: 9px; }
.profile-section { margin-top: 26px; }
.profile-section h4 { margin: 0 0 13px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.profile-pages { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.profile-page { padding: 13px; border: 1px solid var(--line); border-radius: 12px; }
.profile-page div { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; font-weight: 750; }
.profile-page small { display: block; margin-top: 5px; color: var(--muted); }
.event-list { max-height: 420px; overflow-y: auto; }
.event-row { display: grid; grid-template-columns: 92px 100px minmax(0, 1fr) auto; align-items: start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.event-time, .event-page, .event-meta { color: var(--muted); font-size: 10px; }
.event-kind { display: inline-block; width: fit-content; padding: 4px 7px; border-radius: 7px; color: var(--green); background: var(--green-soft); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.event-copy strong, .event-copy small { display: block; }
.event-copy strong { font-size: 12px; }
.event-copy small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.event-meta { text-align: right; white-space: nowrap; }
.privacy-card { display: flex; align-items: flex-start; gap: 16px; margin-top: 18px; padding: 22px 24px; box-shadow: none; }
.privacy-icon { display: grid; place-items: center; flex: 0 0 32px; height: 32px; border-radius: 50%; color: white; background: var(--green); font-weight: 900; }
.privacy-card p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
@media (max-width: 900px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .two-columns { grid-template-columns: 1fr; }
  .user-workspace { grid-template-columns: 1fr; }
  .user-list { display: flex; max-height: none; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .user-list-button { min-width: 190px; border-right: 1px solid var(--line); border-bottom: 0; }
  .user-list-button.active { box-shadow: inset 0 -4px var(--green); }
}
@media (max-width: 650px) {
  .login-shell { width: min(100% - 28px, 680px); }
  .token-row { flex-direction: column; }
  .topbar { padding: 12px 14px; }
  .freshness, .quiet-button { display: none; }
  .dashboard-content { width: min(100% - 24px, 1440px); padding-top: 34px; }
  .hero-row { align-items: flex-start; flex-direction: column; }
  .range-picker { width: 100%; }
  .range-picker button { flex: 1; }
  .today-strip { grid-template-columns: repeat(2, 1fr); }
  .today-strip > div:nth-child(2) { border-right: 0; }
  .today-strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .metric-grid { grid-template-columns: 1fr; }
  .activity-chart { height: 220px; }
  .legend { display: none; }
  .user-heading { align-items: stretch; flex-direction: column; }
  .profile-metrics { grid-template-columns: repeat(2, 1fr); }
  .profile-pages { grid-template-columns: 1fr; }
  .event-row { grid-template-columns: 70px minmax(0, 1fr); }
  .event-page, .event-meta { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
