/* Journall — Timeline Day View */
:root{
  --bg:#f0ede8;
  --bg2:#f5f3f0;
  --card:#fff;
  --text:#1a1814;
  --text2:#555;
  --text3:#888;
  --border:rgba(26,24,20,0.1);
  --border2:rgba(26,24,20,0.2);
  --border3:rgba(26,24,20,0.08);
}
*{box-sizing:border-box;margin:0;padding:0;}
html{font-size:16px;}
body{
  font-family:'DM Sans',sans-serif;
  background:var(--bg);
  color:var(--text);
  min-height:100vh;
}

/* App container — phone width */
.app{max-width:420px;margin:0 auto;background:var(--card);min-height:100vh;}

/* ── Header ── */
.hdr{
  padding:16px 20px 12px;
  border-bottom:0.5px solid var(--border);
  display:flex;align-items:center;gap:14px;
}
.back-btn{
  font-size:13px;color:var(--text3);text-decoration:none;
  padding:4px;flex-shrink:0;
}
.back-btn:hover{color:var(--text);}
.hdr-center{flex:1;}
.hdr-date{font-family:'Fraunces',serif;font-size:17px;font-weight:300;}
.hdr-date em{font-style:italic;}
.hdr-meta{font-size:11px;color:var(--text3);margin-top:1px;font-weight:300;}

/* ── Sleep strip ── */
.sleep-strip{
  padding:12px 20px;
  border-bottom:0.5px solid var(--border);
  display:flex;align-items:center;gap:14px;
}
.sleep-icon{
  width:28px;height:28px;border-radius:8px;background:var(--bg2);
  display:flex;align-items:center;justify-content:center;flex-shrink:0;
}
.sleep-strip-main{flex:1;}
.sleep-strip-lbl{font-size:11px;color:var(--text3);font-weight:300;font-style:italic;}

/* ── Sleep card ── */
.sleep-card{
  margin:0;padding:14px 20px 16px;
  border-bottom:0.5px solid var(--border);
  background:linear-gradient(135deg,#1a1832 0%,#2d2650 50%,#1a1832 100%);
  color:#e8e4f0;
}
.sleep-top{display:flex;align-items:center;gap:12px;}
.sleep-card .sleep-icon{
  width:28px;height:28px;border-radius:8px;
  background:rgba(91,91,168,0.2);
  display:flex;align-items:center;justify-content:center;flex-shrink:0;
}
.sleep-info{flex:1;}
.sleep-times{
  font-family:'Fraunces',serif;font-size:17px;font-weight:300;
  letter-spacing:0.02em;color:#fff;
}
.sleep-dur{font-size:11px;color:rgba(255,255,255,0.5);font-weight:300;margin-top:1px;}

/* Score ring */
.sleep-score-ring{width:48px;height:48px;position:relative;flex-shrink:0;}
.score-svg{width:100%;height:100%;}
.score-val{
  position:absolute;inset:0;
  display:flex;align-items:center;justify-content:center;
  font-family:'Fraunces',serif;font-size:15px;font-weight:300;color:#fff;
}

/* Hypnogram */
.hypno-wrap{margin-top:14px;}
.hypno-bar{
  display:flex;height:20px;border-radius:6px;overflow:hidden;
  background:rgba(255,255,255,0.06);
}
.hypno-seg{min-width:1px;}
.hypno-deep{background:#3d3da8;}
.hypno-light{background:#7b7bcc;}
.hypno-rem{background:#a87bcc;}
.hypno-wake{background:#cc9b7b;}
.hypno-awake{background:#cc9b7b;}
.hypno-restless{background:#8b7a4a;}
.hypno-asleep{background:#5b5ba8;}
.hypno-labels{
  display:flex;justify-content:space-between;
  margin-top:4px;font-size:10px;color:rgba(255,255,255,0.35);font-weight:300;
}

/* Stage breakdown */
.sleep-stages{
  margin-top:14px;display:flex;flex-direction:column;gap:8px;
}
.stage-row{display:flex;align-items:center;gap:8px;}
.stage-dot{width:6px;height:6px;border-radius:50%;flex-shrink:0;}
.stage-name{font-size:11px;color:rgba(255,255,255,0.6);width:42px;flex-shrink:0;font-weight:300;}
.stage-bar-wrap{flex:1;height:4px;border-radius:100px;background:rgba(255,255,255,0.06);overflow:hidden;}
.stage-bar{height:100%;border-radius:100px;transition:width 0.4s ease;}
.stage-val{
  font-size:11px;color:rgba(255,255,255,0.8);
  font-variant-numeric:tabular-nums;width:48px;text-align:right;flex-shrink:0;font-weight:300;
}
.stage-avg{
  font-size:9px;font-weight:300;width:32px;text-align:right;flex-shrink:0;
  font-variant-numeric:tabular-nums;
}
.stage-avg.above{color:#7bcc7b;}
.stage-avg.below{color:#cc7b7b;}

/* Naps */
.sleep-naps{
  margin-top:10px;padding-top:10px;
  border-top:0.5px solid rgba(255,255,255,0.1);
}
.nap-row{
  display:flex;align-items:center;gap:8px;
  font-size:11px;color:rgba(255,255,255,0.5);font-weight:300;
}

/* ── Weather compact ── */
.weather-compact{
  padding:12px 20px;
  border-bottom:0.5px solid var(--border);
  display:flex;align-items:center;gap:14px;
}
.wc-temp{font-family:'Fraunces',serif;font-size:28px;font-weight:300;line-height:1;flex-shrink:0;}
.wc-detail{
  flex:1;display:flex;flex-wrap:wrap;gap:4px 10px;
  font-size:12px;color:var(--text3);font-weight:300;
}
.wc-sun{
  display:flex;flex-direction:column;gap:1px;
  font-size:11px;color:var(--text3);font-weight:300;
  flex-shrink:0;
}

/* ── All-day events ── */
.allday-strip{
  padding:8px 20px;
  border-bottom:0.5px solid var(--border3);
  display:flex;align-items:center;gap:10px;
  font-size:12px;
}
.allday-dot{width:6px;height:6px;border-radius:50%;flex-shrink:0;}
.allday-title{flex:1;font-weight:400;}
.allday-label{font-size:11px;color:var(--text3);font-weight:300;font-style:italic;}

/* ── Timeline ── */
.timeline{padding:0 20px;}

.tl-item{
  display:flex;gap:14px;
  padding:16px 0 0;
}
.tl-item:last-child{padding-bottom:16px;}

/* Left rail */
.tl-rail{
  display:flex;flex-direction:column;align-items:center;
  width:36px;flex-shrink:0;
}
.tl-time{
  font-size:10px;color:var(--text3);font-weight:300;
  font-variant-numeric:tabular-nums;white-space:nowrap;margin-bottom:5px;
}
.tl-dot{
  width:10px;height:10px;border-radius:50%;
  border:1.5px solid var(--border2);
  background:var(--card);flex-shrink:0;
}
.tl-dot.done{background:var(--text);border-color:var(--text);}
.tl-dot.active{background:#f0522a;border-color:#f0522a;box-shadow:0 0 0 3px rgba(240,82,42,0.15);}
.tl-dot.soft{background:var(--bg2);border-color:var(--border);}
.tl-line{width:1px;flex:1;min-height:16px;}
.tl-line.done{background:var(--text);opacity:0.12;}
.tl-line.soft{background:var(--border);}

/* ── Now line ── */
.tl-now{
  display:flex;align-items:center;gap:8px;
  padding:12px 20px;
}
.tl-now-line{flex:1;height:1px;background:#f0522a;opacity:0.4;}
.tl-now-label{
  font-size:10px;font-weight:500;letter-spacing:0.06em;text-transform:uppercase;
  color:#f0522a;flex-shrink:0;
}

/* ── Future items dimmed ── */
.tl-future{opacity:0.4;transition:opacity 0.2s ease;}
.tl-future:hover{opacity:0.7;}

/* ── Active item glow ── */
.tl-active .ev-card{border-color:rgba(240,82,42,0.25);}

/* ── Event card ── */
.ev-card{
  flex:1;border-radius:14px;
  border:0.5px solid var(--border);
  background:var(--card);overflow:hidden;
}
.ev-hdr{padding:12px 14px 10px;display:flex;align-items:flex-start;gap:10px;}
.ev-stripe{width:3px;border-radius:2px;align-self:stretch;flex-shrink:0;}
.ev-hdr-main{flex:1;}
.ev-title{font-size:14px;font-weight:500;line-height:1.2;margin-bottom:2px;}
.ev-sub{font-size:11px;color:var(--text3);font-weight:300;}
.ev-dur{font-size:11px;color:var(--text3);font-weight:300;white-space:nowrap;}

/* People inside event */
.ev-people{
  padding:0 14px 10px;
  display:flex;gap:5px;flex-wrap:wrap;align-items:center;
}
.ev-av{
  width:24px;height:24px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  font-size:9px;font-weight:500;flex-shrink:0;
}
.ev-people-names{font-size:11px;color:var(--text3);margin-left:2px;}

/* Walks inside event */
.ev-walks{padding:0 14px 10px;}
.ev-walk-row{
  display:flex;align-items:center;gap:8px;
  padding:6px 10px;border-radius:8px;
  background:#eaf3de;
  font-size:12px;color:#3a6a3a;font-weight:300;
  margin-bottom:4px;
}
.ev-walk-row:last-child{margin-bottom:0;}

/* Photos inside event */
.ev-photos{padding:0 14px 12px;}
.ev-photos-label{
  font-size:10px;color:var(--text3);margin-bottom:6px;
  display:flex;align-items:center;gap:5px;
}

/* Mic row */
.ev-mic-row{
  padding:0 14px 12px;
  display:flex;align-items:center;gap:9px;
}
.mini-mic{
  width:26px;height:26px;border-radius:50%;
  border:0.5px solid var(--border2);
  background:transparent;cursor:pointer;
  display:flex;align-items:center;justify-content:center;flex-shrink:0;
}
.mic-lbl{font-size:12px;color:var(--text3);font-family:'Fraunces',serif;font-style:italic;}

/* ── Photo grids ── */
.photo-grid-1{border-radius:8px;overflow:hidden;}
.photo-grid-1 .ph-c{display:block;}
.photo-grid-1 img,.photo-grid-1 video{width:100%;display:block;border-radius:8px;aspect-ratio:16/9;object-fit:cover;}

.photo-grid-2{display:grid;grid-template-columns:1fr 1fr;gap:3px;border-radius:8px;overflow:hidden;}
.photo-grid-3{display:grid;grid-template-columns:2fr 1fr;grid-template-rows:1fr 1fr;gap:3px;border-radius:8px;overflow:hidden;}
.photo-grid-3 .ph-c.tall{grid-row:span 2;}
.photo-grid-4{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:auto auto;gap:3px;border-radius:8px;overflow:hidden;}

.ph-c{overflow:hidden;display:block;position:relative;}
.ph-c img,.ph-c video{width:100%;height:100%;object-fit:cover;display:block;}
.ph-empty{
  display:flex;align-items:center;justify-content:center;
  background:var(--bg2);font-size:10px;color:var(--text3);
  padding:12px;text-align:center;min-height:60px;
}

/* ── Walk card ── */
.walk-card{
  flex:1;border-radius:14px;
  border:0.5px solid var(--border);
  background:var(--card);overflow:hidden;
}
.walk-hdr{
  padding:12px 14px 10px;
  display:flex;align-items:flex-start;gap:10px;
}
.walk-icon{
  width:28px;height:28px;border-radius:8px;background:#eaf3de;
  display:flex;align-items:center;justify-content:center;flex-shrink:0;
}
.walk-hdr-main{flex:1;}
.walk-title{font-size:14px;font-weight:500;line-height:1.2;margin-bottom:2px;}
.walk-sub{font-size:11px;color:var(--text3);font-weight:300;}
.walk-stats{
  padding:10px 14px;
  border-top:0.5px solid var(--border);
  display:flex;gap:16px;
}
.ws-item{font-size:12px;color:var(--text3);font-weight:300;}
.ws-item b{color:var(--text2);font-weight:400;}

/* ── Photo moment card (standalone) ── */
.photo-moment-card{
  flex:1;border-radius:14px;
  border:0.5px solid var(--border);overflow:hidden;
  background:var(--card);
}
.pm-label{
  padding:8px 12px 6px;
  font-size:11px;color:var(--text3);
  display:flex;align-items:center;gap:6px;font-weight:300;
}
.pm-photos{padding:0 10px 10px;}

/* ── Steps summary ── */
.steps-summary{
  margin:0 20px;padding:16px 0;
  border-top:0.5px solid var(--border);
  display:flex;align-items:center;gap:14px;
}
.steps-icon{
  width:28px;height:28px;border-radius:8px;background:var(--bg2);
  display:flex;align-items:center;justify-content:center;flex-shrink:0;
}
.steps-main{flex-shrink:0;}
.steps-val{font-family:'Fraunces',serif;font-size:16px;font-weight:300;}
.steps-extra{font-size:11px;color:var(--text3);font-weight:300;margin-top:1px;}
.steps-bar-wrap{flex:1;}
.steps-bar{height:3px;border-radius:100px;background:var(--bg2);overflow:hidden;}
.steps-fill{height:100%;border-radius:100px;background:var(--text);}

/* ── People summary ── */
.people-summary{
  margin:0 20px;padding:16px 0;
  border-top:0.5px solid var(--border);
}
.ps-label{font-size:11px;letter-spacing:0.09em;text-transform:uppercase;color:var(--text3);margin-bottom:10px;font-weight:400;}
.ps-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;}
.ps-person{
  display:flex;align-items:center;gap:10px;
  padding:10px 12px;border-radius:10px;
  border:0.5px solid var(--border);
}
.ps-av{
  width:28px;height:28px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  font-size:10px;font-weight:500;flex-shrink:0;
}
.ps-name{font-size:12px;font-weight:400;}
.ps-ctx{font-size:10px;color:var(--text3);font-weight:300;}

/* ── To:Co cards (timeline) ── */
.toco-card{
  flex:1;border-radius:14px;
  border:0.5px solid var(--border);
  background:var(--card);overflow:hidden;
}

/* Layer 1: collapsed bar */
.toco-layer1{border:none;}
.toco-layer1 summary{list-style:none;}
.toco-layer1 summary::-webkit-details-marker{display:none;}
.toco-bar{
  display:flex;align-items:center;gap:8px;
  padding:12px 14px;cursor:pointer;
  font-size:12px;color:var(--text2);font-weight:300;
}
.toco-bar:hover{background:var(--bg2);}
.toco-bar b{font-weight:500;color:var(--text);}
.toco-count{
  margin-left:auto;
  font-size:11px;font-weight:500;color:var(--text3);
  background:var(--bg2);border-radius:10px;
  padding:1px 7px;flex-shrink:0;
}

/* Layer 2: task list */
.toco-tasks{
  padding:0 14px 10px;
  display:flex;flex-direction:column;gap:2px;
}
.toco-layer2{border:none;}
.toco-layer2 summary{list-style:none;}
.toco-layer2 summary::-webkit-details-marker{display:none;}
.toco-task-dot{
  display:flex;align-items:center;gap:8px;
  padding:6px 8px;border-radius:8px;cursor:pointer;
  font-size:12px;color:var(--text);font-weight:300;
}
.toco-task-dot:hover{background:var(--bg2);}
.td-dot{width:6px;height:6px;border-radius:50%;flex-shrink:0;}
.td-dot.td-new{background:#d4882a;}
.td-dot.td-done{background:#4a9a4a;}
.td-title{flex:1;line-height:1.3;}

/* Layer 3: task detail */
.toco-detail{
  padding:4px 8px 10px 22px;
  font-size:11px;color:var(--text3);font-weight:300;line-height:1.5;
}
.toco-tag{
  display:inline-block;margin-top:4px;
  font-size:10px;color:var(--text3);
  background:var(--bg2);border-radius:6px;
  padding:1px 6px;
}

/* Daily summary */
.ds-summary{
  font-size:12px;color:var(--text2);font-weight:300;
  line-height:1.5;font-style:italic;
  padding:12px 14px;border-radius:10px;background:var(--bg2);
}

/* ── Day story ── */
.day-story{
  margin:0 20px;padding:16px 0;
  border-top:0.5px solid var(--border);
}
.ds-label{font-size:11px;letter-spacing:0.09em;text-transform:uppercase;color:var(--text3);margin-bottom:10px;font-weight:400;}
.ds-placeholder{
  display:flex;align-items:center;gap:10px;
  padding:14px;border-radius:12px;
  background:var(--bg2);border:0.5px dashed var(--border2);
  font-size:13px;color:var(--text3);
  font-family:'Fraunces',serif;font-style:italic;
}

/* ── Day nav ── */
.day-nav{
  padding:16px 20px 32px;
  border-top:0.5px solid var(--border);
  display:flex;justify-content:space-between;align-items:center;
}
.day-nav-link{
  font-size:12px;color:var(--text3);text-decoration:none;font-weight:300;
  padding:8px 0;min-height:44px;display:flex;align-items:center;
}
.day-nav-link:hover{color:var(--text);}

/* ── Mobile ── */
@media(max-width:600px){
  .app{max-width:100%;}
  .ps-grid{grid-template-columns:1fr;}
}
