:root{
  --green-900:#1f5f3a;
  --green-700:#2f7a48;
  --green-500:#43a35f;
  --bg:#f4f7f4;
  --card:#ffffff;
  --text:#183022;
  --muted:#6b7b71;
  --good:#1d7a3a;
  --bad:#b23b2f;
  --shadow: 0 10px 22px rgba(0,0,0,.08);
  --radius: 18px;
}

*{ box-sizing:border-box; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);

  display: flex;
  justify-content: center;   /* centers horizontally */
}


.app{
  width: 100%;
  max-width: 520px;  
  margin: 0 auto;       
  min-height: 100vh;
  display:flex;
  flex-direction:column;
}


.topbar{
  background: linear-gradient(180deg, var(--green-700), var(--green-900));
  color:#fff;
  padding: 18px 16px 14px;
  border-bottom-left-radius: 22px;
  border-bottom-right-radius: 22px;
  position: sticky;
  top:0;
  z-index:5;
}

.row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.brand{
  font-weight: 800;
  letter-spacing:.2px;
  font-size: 18px;
}

.datepill{
  background: rgba(255,255,255,.16);
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
  backdrop-filter: blur(8px);
}

.iconBtn{
  border:none;
  background: rgba(255,255,255,.18);
  color:#fff;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 18px;
  cursor:pointer;
  display:grid;
  place-items:center;
}
.iconBtnDark{
  border:none;
  background: #f0f6f2;
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 16px;
  cursor:pointer;
  display:grid;
  place-items:center;
}
.iconBtn:active, .iconBtnDark:active{ transform: scale(.98); }

.content{
  padding: 14px 14px 20px;
  flex:1;
}

.card{
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 50px;
}

.title{
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 8px;
  font-weight: 600;
}

.scoreWrap{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
  padding: 10px 10px 4px;
}

.ring{
  width: 170px;
  height: 170px;
  border-radius: 50%;
  display:grid;
  place-items:center;
  background:
    radial-gradient(circle at center, #ffffff 58%, transparent 59%),
    conic-gradient(#43a35f calc(var(--p)*1%), #e7efe9 0);
  box-shadow: inset 0 0 0 10px rgba(67,163,95,.12);
}

.ring.low{
  background:
    radial-gradient(circle at center, #ffffff 58%, transparent 59%),
    conic-gradient(#c93b3b calc(var(--p)*1%), #f1dede 0);
  box-shadow: inset 0 0 0 10px rgba(201,59,59,.15);
}

.ring.mid{
  background:
    radial-gradient(circle at center, #ffffff 58%, transparent 59%),
    conic-gradient(#e3c23b calc(var(--p)*1%), #f6f0d6 0);
  box-shadow: inset 0 0 0 10px rgba(227,194,59,.18);
}

.ring.high{
  background:
    radial-gradient(circle at center, #ffffff 58%, transparent 59%),
    conic-gradient(#43a35f calc(var(--p)*1%), #e7efe9 0);
  box-shadow: inset 0 0 0 10px rgba(67,163,95,.12);
}

.ringInner{
  width: 118px;
  height: 118px;
  border-radius: 50%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  background: radial-gradient(circle at 30% 25%, #eafff0, #ffffff);
  box-shadow: 0 10px 18px rgba(0,0,0,.06);
}

.score{
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  color: var(--green-900);
}

.scoreLabel{
  font-size: 12px;
  font-weight: 700;
  color: var(--green-700);
  margin-top: 4px;
}

.subline{
  display:flex;
  align-items:center;
  gap:10px;
  justify-content:center;
  flex-wrap:wrap;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.streak{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.streakLeft{
  display:flex;
  align-items:center;
  gap:10px;
}
.streakIcon{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display:grid;
  place-items:center;
  background: #fff2e6;
  font-size: 22px;
}
.streakText .big{
  font-weight: 800;
  font-size: 18px;
  line-height: 1.1;
}
.streakText .small{
  font-size: 12px;
  color: var(--muted);
}
.streakBtn{
  border:none;
  background: rgba(67,163,95,.12);
  color: var(--green-900);
  font-weight: 700;
  padding: 10px 12px;
  border-radius: 12px;
  cursor:pointer;
}

.hlRow{ display:flex; flex-direction:column; gap:10px; }
.hlItem{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 10px 10px;
  border-radius: 14px;
  background: #f6faf7;
  border: 1px solid #e7efe9;
}
.hlLeft{
  display:flex;
  align-items:center;
  gap:10px;
  min-width: 0;
}
.badge{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display:grid;
  place-items:center;
  font-size: 16px;
  background: #eaf7ee;
  flex: 0 0 auto;
}
.hlText{ min-width:0; }
.hlText .main{
  font-weight: 800;
  font-size: 14px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.hlText .sub{
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.delta{
  font-weight: 900;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #e7efe9;
  flex: 0 0 auto;
}
.delta.good{ color: var(--good); }
.delta.bad{ color: var(--bad); }

.placeholder{
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
  z-index: 20;
}

.sidebar{
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 280px;
  background: #ffffff;
  box-shadow: 18px 0 40px rgba(0,0,0,.18);
  transform: translateX(-105%);
  transition: transform .22s ease;
  z-index: 25;
  padding: 14px;
  display:flex;
  flex-direction:column;
  gap: 10px;
}

.sidebarHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e7efe9;
}

.sidebarTitle{
  font-weight: 900;
  color: var(--text);
}

.sideLink{
  width: 100%;
  text-align:left;
  border: 1px solid #e7efe9;
  background: #f6faf7;
  padding: 12px 12px;
  border-radius: 14px;
  cursor:pointer;
  font-weight: 800;
  color: var(--text);
}

.sideLink.active{
  background: rgba(67,163,95,.14);
  border-color: rgba(67,163,95,.25);
  color: var(--green-900);
}

.sidebarFooter{
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #e7efe9;
  color: var(--muted);
}

body.menuOpen .overlay{
  opacity: 1;
  pointer-events: auto;
}
body.menuOpen .sidebar{
  transform: translateX(0);
}

.page{ display:none; }
.page.active{ display:block; }

.logGrid{
  display: grid;
  gap: 12px;
}

.logSection{
  border: 1px solid #e7efe9;
  background: #ffffff;
  border-radius: 16px;
  padding: 12px;
}

.secHeader{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.secTitle{
  font-weight: 900;
  color: var(--text);
}

.secHint{
  font-size: 12px;
  color: var(--muted);
}

.check, .radio{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: #f6faf7;
  border: 1px solid #e7efe9;
  margin-bottom: 8px;
  cursor:pointer;
  font-weight: 650;
}

.check input, .radio input{
  transform: scale(1.1);
}

.logActions{
  display:flex;
  gap: 10px;
  margin-top: 10px;
}

.btnGhost{
  flex: 1;
  border: 1px solid #dfeae3;
  background: #ffffff;
  padding: 12px;
  border-radius: 14px;
  font-weight: 800;
  cursor:pointer;
}

.btnPrimary{
  flex: 2;
  border: none;
  background: linear-gradient(180deg, var(--green-500), var(--green-700));
  color: #fff;
  padding: 12px;
  border-radius: 14px;
  font-weight: 900;
  cursor:pointer;
}

.tiny{
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.acInput{
  border: 1px solid #e7efe9;
  background: #f6faf7;
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 8px;
}
.acLabel{
  display:block;
  font-weight: 800;
}
.acInput input{
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #dfeae3;
  font-size: 14px;
  margin-top: 6px;
}
.acHint{
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.statsRow{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:10px;
  margin-top: 8px;
}

.statBox{
  background:#f6faf7;
  border:1px solid #e7efe9;
  border-radius:14px;
  padding:12px;
  text-align:center;
}

.statNum{
  font-weight: 900;
  font-size: 22px;
  color: var(--green-900);
}

.statLabel{
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 700;
}

.impactGrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:22px;
  align-items:start;

}


.impactHeading{
  font-weight: 900;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 8px;
}

.impactList{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.impactItem{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px;  
  border-radius:16px;
  border:1px solid #e7efe9;
  background:#f6faf7;
}


.impactLeft{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
}

.impactName{
  font-weight: 800;
  font-size: 13px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.impactDelta{
  font-weight: 900;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid #e7efe9;
  background:#fff;
  font-size: 13px;
}

.catRow{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap:10px;
  margin-top: 12px;
}

.catBox{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid #e7efe9;
  background:#ffffff;
  font-weight: 800;
}

.catBox span{ color: var(--muted); font-weight: 800; }
.catBox strong{ color: var(--text); }

.chartWrap{
  background:#ffffff;
  border:1px solid #e7efe9;
  border-radius:16px;
  padding:10px;
}

#weekChart{
  width:100%;
  height:120px;
  display:block;
}

.chartLabels{
  display:grid;
  grid-template-columns: repeat(7, 1fr);
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  text-align:center;
  font-weight: 800;
}

#page-impact .card:nth-of-type(2){
  margin-left: -14px;
  margin-right: -14px;
}

#page-impact .card:nth-of-type(2){
  margin-left: -14px;
  margin-right: -14px;
}

#impactWideCard{
  width: calc(100% + 28px);   
  transform: translateX(-14px);
}


.summaryGrid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:12px;
  margin-top: 8px;
}

.summaryBox{
  background:#f6faf7;
  border:1px solid #e7efe9;
  border-radius:16px;
  padding:14px 10px;
  text-align:center;
}

.summaryNum{
  font-weight: 900;
  font-size: 22px;
  color: var(--green-900);
}

.summaryLabel{
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 800;
}

.badgeGrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}

.badgeCard{
  border:1px solid #e7efe9;
  background:#ffffff;
  border-radius:18px;
  padding:12px;
  display:flex;
  gap:10px;
  align-items:flex-start;
  box-shadow: 0 8px 18px rgba(0,0,0,.05);
  min-width:0;
}

.badgeCard.locked{
  opacity:.55;
}

.badgeIcon{
  width:44px;
  height:44px;
  border-radius:16px;
  display:grid;
  place-items:center;
  font-size:20px;
  background:#f6faf7;
  border:1px solid #e7efe9;
  flex: 0 0 auto;
}

.badgeInfo{
  min-width:0;
  flex:1;
}

.badgeName{
  font-weight:900;
  font-size:13px;
  margin:0;
}

.badgeDesc{
  margin:4px 0 0;
  color: var(--muted);
  font-size:12px;
  line-height:1.35;
}

.badgeMeta{
  margin-top:10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}

.badgeTag{
  font-size:11px;
  font-weight:900;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid #e7efe9;
  background:#f6faf7;
  color: var(--text);
}

.badgeTag.locked{
  background:#fff;
  color: var(--muted);
}

.progressPill{
  font-size:11px;
  font-weight:900;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid #e7efe9;
  background:#ffffff;
  color: var(--text);
}

.impactGrid{
  width: 100%;
}

.impactList{
  min-width: 0;
}

.impactItem{
  width: 100%;
  min-width: 0;       
  max-width: 100%;
  overflow: hidden;      
}

.impactLeft{
  min-width: 0;    
  max-width: 100%;
}

.impactName{
  min-width: 0;        
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;  
}

.impactDelta{
  flex: 0 0 auto;
  max-width: 90px;
}

html, body{
  overflow-x: hidden;
}
