/* ─── App shell (sidebar + main) ─────────────────── */
.app-shell {
  display: grid; grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
@media (max-width: 980px){ .app-shell { grid-template-columns: 1fr; } }

.sidebar {
  background: var(--c-surface); border-right: 1px solid var(--c-line-soft);
  padding: var(--s-5) var(--s-4); display: flex; flex-direction: column; gap: var(--s-5);
  position: sticky; top: 0; height: 100vh;
}
.side-burger {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; line-height: 1;
  background: transparent; color: var(--c-text);
  border: 1px solid var(--c-line); border-radius: var(--r-md);
  font-size: 18px; cursor: pointer;
}
.side-burger:hover { background: var(--c-surface-2); }
@media (max-width: 980px){
  .sidebar {
    position: relative; height: auto;
    border-right: 0; border-bottom: 1px solid var(--c-line-soft);
    padding: var(--s-3) var(--s-4);
  }
  .side-burger {
    display: inline-flex;
    position: absolute; top: 12px; right: 12px;
  }
  .sidebar > .side-nav,
  .sidebar > .side-foot { display: none; }
  .sidebar.open > .side-nav { display: flex; }
  .sidebar.open > .side-foot { display: block; }
}
.sidebar .brand { padding: 0 var(--s-2); }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-md);
  color: var(--c-text-soft); font-weight: 500;
}
.side-nav a:hover { background: var(--c-surface-2); color: var(--c-text); }
.side-nav a.active { background: var(--c-brand-50); color: var(--c-brand-700); }
.side-nav a .ico { width: 18px; height: 18px; }
.side-foot { margin-top: auto; padding-top: var(--s-3); border-top: 1px solid var(--c-line-soft); }

.app-main { padding: var(--s-7); display: flex; flex-direction: column; gap: var(--s-6); }
@media (max-width: 640px){ .app-main { padding: var(--s-4); } }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s-4); flex-wrap: wrap; }
.page-head h1 { font-size: var(--fs-2xl); letter-spacing: -.015em; }
.page-head .greeting { color: var(--c-text-mute); margin-top: 4px; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-4); }
@media (max-width: 980px){ .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px){ .stat-grid { grid-template-columns: 1fr; } }
.stat-card { padding: var(--s-5); border-radius: var(--r-lg); background: var(--c-surface); border: 1px solid var(--c-line-soft); }
.stat-card .label { color: var(--c-text-mute); font-size: var(--fs-sm); display: flex; gap: 6px; align-items: center; }
.stat-card .value { font-size: 30px; font-weight: 700; margin-top: 4px; }
.stat-card .delta { font-size: var(--fs-xs); color: var(--c-ok); margin-top: 4px; }
.stat-card.brand { background: linear-gradient(135deg, var(--c-brand-500), var(--c-brand-700)); color: #fff; border: 0; }
.stat-card.brand .label, .stat-card.brand .delta { color: rgba(255,255,255,.85); }

/* Two-col widget layout */
.widget-grid { display: grid; grid-template-columns: 2fr 1fr; gap: var(--s-5); }
@media (max-width: 980px){ .widget-grid { grid-template-columns: 1fr; } }
.widget { background: var(--c-surface); border: 1px solid var(--c-line-soft); border-radius: var(--r-lg); padding: var(--s-5); }
.widget h3 { font-size: var(--fs-md); margin-bottom: var(--s-4); }
.widget .h-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s-4); }

/* Quick start */
.quick-start { padding: var(--s-6); border-radius: var(--r-xl);
  background: linear-gradient(135deg, var(--c-brand-50), var(--c-surface));
  border: 1px solid var(--c-brand-100);
  display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--s-5); align-items: center;
}
@media (max-width: 980px){ .quick-start { grid-template-columns: 1fr; } }
.quick-start h2 { font-size: var(--fs-xl); }
.dur-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: var(--s-4); }
.dur-row .pill {
  padding: 8px 16px; border-radius: var(--r-pill);
  border: 1.5px solid var(--c-line); background: var(--c-surface); cursor: pointer; font-weight: 600;
}
.dur-row .pill.active { border-color: var(--c-brand-500); background: var(--c-brand-50); color: var(--c-brand-700); }

/* Heatmap */
.heatmap { display: grid; grid-template-columns: repeat(13, 1fr); gap: 4px; }
.heatmap span { aspect-ratio: 1; border-radius: 3px; background: var(--c-line-soft); }
.heatmap span.l1 { background: #d6dcff; }
.heatmap span.l2 { background: #aab6ff; }
.heatmap span.l3 { background: #7c8fff; }
.heatmap span.l4 { background: var(--c-brand-500); }

/* Streak ring */
.streak-card { text-align: center; }
.ring {
  --p: 65;
  width: 140px; height: 140px; margin: 0 auto var(--s-3);
  border-radius: 50%;
  background: conic-gradient(var(--c-brand-500) calc(var(--p) * 1%), var(--c-line-soft) 0);
  display: grid; place-items: center; position: relative;
}
.ring::before { content: ""; position: absolute; inset: 8px; background: var(--c-surface); border-radius: 50%; }
.ring .inner { position: relative; text-align: center; }
.ring .inner .n { font-size: 30px; font-weight: 800; }
.ring .inner .t { color: var(--c-text-mute); font-size: var(--fs-xs); }

/* Room cards */
.room-list { display: grid; gap: var(--s-3); }
.room-row {
  display: grid; grid-template-columns: auto 1fr auto auto; gap: var(--s-4); align-items: center;
  padding: var(--s-4); background: var(--c-surface); border: 1px solid var(--c-line-soft); border-radius: var(--r-md);
}
.room-row .ico {
  width: 40px; height: 40px; border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--c-brand-100), var(--c-accent-400));
  display: grid; place-items: center; color: #fff;
}
.room-row .title { font-weight: 600; }
.room-row .meta { color: var(--c-text-mute); font-size: var(--fs-sm); }

/* Pet card */
.pet-card { background: linear-gradient(180deg, #f1f4ff, #e8f9f4); border: 1px solid var(--c-brand-100); border-radius: var(--r-lg); padding: var(--s-5); text-align: center; }
.pet-emoji { font-size: 56px; }
.pet-card .name { font-weight: 700; }
.pet-card .lvl { color: var(--c-text-mute); font-size: var(--fs-sm); }

/* AI suggestions */
.ai-card { background: linear-gradient(135deg, #fff7ed, #fff); border: 1px solid #ffe1bf; border-radius: var(--r-lg); padding: var(--s-5); }
.ai-card .who { display: flex; gap: 10px; align-items: center; margin-bottom: var(--s-3); }
.ai-card .who .em { width: 32px; height: 32px; border-radius: var(--r-md); background: linear-gradient(135deg, var(--c-warm-400), var(--c-warm-500)); display: grid; place-items: center; color: #fff; font-weight: 700; }
.ai-card .tips { display: grid; gap: 10px; }
.ai-card .tip {
  padding: 10px 14px; border-radius: var(--r-md);
  background: var(--c-surface); border: 1px solid var(--c-line-soft);
  font-size: var(--fs-sm); color: var(--c-text-soft);
}
