/* MY LIFE v14｜六大統計｜電腦版可閱讀四分區 V3｜2026-11-05
   左：記一筆；右：統計約 56% + 紀錄約 44%。
   允許不同圖表獨立排版，手機完全不受本檔影響。
   不變更資料讀寫、透明度、水彩顏色或表單邏輯。
*/
@media (min-width:901px){
 body[data-page="category"]{
  --life-desktop-stats-share: 56%; /* 建議 52%～62%；越高，統計越清楚 */
  --life-desktop-calendar-cell: 20px; /* 較矮的桌機：確保最後一排完整 */
 }
 body[data-page="category"] #category-records,
 body[data-page="category"] #category-records:has(.summary-box[open]){
  display:flex;flex-direction:column;height:100%;min-height:0;overflow:hidden!important;
 }
 body[data-page="category"] #category-records>.record-panel-tools:has(.summary-box[open]){
  display:flex;flex-direction:column;flex:0 0 var(--life-desktop-stats-share);
  min-height:0;overflow:hidden;
 }
 body[data-page="category"] #category-records>.record-panel-tools:not(:has(.summary-box[open])){
  flex:0 0 auto;overflow:visible;
 }
 body[data-page="category"] #category-records .record-panel-tools>.toolbar{
  flex:none;margin:0 0 6px;
 }
 body[data-page="category"] #category-records .summary-box[open]{
  display:flex;flex-direction:column;flex:1 1 0;min-height:0;overflow:hidden;
  margin:0;padding:4px 7px;
 }
 body[data-page="category"] #category-records .summary-box[open]>summary{
  flex:none;margin:0;padding:2px 0;line-height:1.3;
 }
 body[data-page="category"] #category-records .summary-box[open]>.stats-month{
  flex:none;margin:2px 0 4px;padding:0;
 }
 body[data-page="category"] #category-records .summary-box[open]>.summary-content{
  flex:none;min-height:0;
  height:clamp(150px,calc(56dvh - 188px),360px)!important;max-height:clamp(150px,calc(56dvh - 188px),360px)!important;
  overflow:hidden!important;padding:0;
 }
 body[data-page="category"] #category-records>#listArea,
 body[data-page="category"] #category-records:has(.summary-box[open])>#listArea{
  display:block!important;flex:1 1 0;min-height:0;
  overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;
 }
 /* Sleep has no month selector, so its chart can use more height. */
 body[data-page="category"] #category-records .summary-box[open]:has(.v245-sleep)>.summary-content{
   height:clamp(170px,calc(56dvh - 150px),380px)!important;max-height:clamp(170px,calc(56dvh - 150px),380px)!important;
 }
 /* Shrink the framing, not the content: SVGs get desktop-specific viewBoxes in stats-v245.js */
 body[data-page="category"] .v245-card{
  display:flex;flex-direction:column;width:100%;height:100%;min-height:0;
  border-radius:14px;padding:7px 10px;overflow:hidden;
 }
 body[data-page="category"] .v245-card .chart-titlebar{flex:none;gap:4px;}
 body[data-page="category"] .v245-card .chart-titlebar h3{font-size:15px;}
 body[data-page="category"] .v245-card .chart-titlebar span{font-size:10px;}
 body[data-page="category"] .v245-card .chart-summary{
  flex:none;margin:2px 0 3px;min-height:0;line-height:1.4;font-size:11px;
 }
 body[data-page="category"] .v245-card .chart-summary strong{font-size:13px;}
 body[data-page="category"] .v245-card .chart-content{
  flex:1 1 0;min-height:0;overflow:hidden;position:relative;
 }
 body[data-page="category"] .v245-card .chart-footer{
  flex:none;margin:3px 0 0;padding-top:4px;line-height:1.25;font-size:9px;
 }
 /* Food: full horizontal width with shorter plot coordinates; no squeezing all text down. */
 body[data-page="category"] .v245-food .chart-content{
  display:flex;align-items:center;justify-content:center;
 }
 body[data-page="category"] .v245-food svg.chart-svg{
  display:block;width:100%;height:100%;min-height:0;max-height:100%;
 }
 /* Sleep: bigger dots, labels and stars retain their seven distinct columns. */
 body[data-page="category"] .v245-sleep .sleep-avg-pair>div{padding:3px 7px;gap:1px;}
 body[data-page="category"] .v245-sleep .sleep-avg-pair strong{font-size:12px;}
 body[data-page="category"] .v245-sleep .sleep-avg-pair small{font-size:9px;}
 body[data-page="category"] .v245-sleep .chart-content{
  display:flex;flex-direction:column;justify-content:center;gap:0;
 }
 body[data-page="category"] .v245-sleep .sleep-dot-svg{
  display:block;width:100%;height:100%;min-height:0;max-height:100%;
  flex:1 1 0;
 }
 body[data-page="category"] .v245-sleep .plain-note{flex:none;font-size:9px;line-height:1.25;margin:1px 0;}
 /* Money: 44% watercolor donut, 56% readable category rows. */
 body[data-page="category"] .v245-money .money-v242{
  display:grid;grid-template-columns:minmax(0,44%) minmax(0,1fr);
  width:100%;height:100%;min-height:0;align-items:center;gap:11px;padding:0;
 }
 body[data-page="category"] .v245-money .donut-graphic{
  display:block;width:100%;height:100%;max-height:100%;max-width:100%;
  min-width:0;min-height:0;overflow:visible;
 }
 body[data-page="category"] .v245-money .money-table{gap:2px;width:100%;min-width:0;}
 body[data-page="category"] .v245-money .money-heading{margin:0 0 2px;padding-bottom:2px;font-size:10px;}
 body[data-page="category"] .v245-money .money-row{line-height:1.34;font-size:11px;}
 body[data-page="category"] .v245-money .money-row strong,
 body[data-page="category"] .v245-money .money-row .money-percent{font-size:10px;}
 /* Exercise: each date has a comfortable target and the final row still fits. */
 body[data-page="category"] .v245-exercise .chart-content{
  display:flex;flex-direction:column;justify-content:center;
 }
 body[data-page="category"] .v245-card .calendar{
  display:grid;grid-template-columns:repeat(7,minmax(0,1fr));
  gap:3px;margin:0;align-content:start;min-width:0;
 }
 body[data-page="category"] .v245-card .cal-head{padding:2px 0;font-size:10px;}
 body[data-page="category"] .v245-card .cal-day{
  font-size:11px;height:var(--life-desktop-calendar-cell);
  min-height:0;padding:1px;border-radius:7px;
 }
 body[data-page="category"] .v245-exercise .exercise-total{margin:1px 0 2px;}
 body[data-page="category"] .v245-exercise .plain-note{font-size:9px;margin:1px 0;}
 /* Study: 55/45 chart/calendar. */
 body[data-page="category"] .v245-study .chart-content{
  display:grid;grid-template-columns:minmax(0,55%) minmax(0,45%);
  align-items:center;gap:8px;
 }
 body[data-page="category"] .v245-study .study-chart-wrap{
  display:flex;align-items:center;justify-content:center;width:100%;height:100%;min-height:0;padding:0;
 }
 body[data-page="category"] .v245-study .study-chart-wrap svg{
  display:block;width:100%;height:100%;max-width:100%;max-height:100%;
 }
 body[data-page="category"] .v245-study .study-calendar{margin:0;gap:2px;min-width:0;}
 body[data-page="category"] .v245-study .cal-day{height:clamp(22px,2.8dvh,30px);font-size:10px;}
 /* Note: recompute bubble locations in the available stage; labels stay below icons. */
 body[data-page="category"] .v245-note .mood-stage{height:100%;min-height:0;overflow:visible;}
 body[data-page="category"] .v245-card .center-note,
 body[data-page="category"] .v245-card .mood-full-empty{
  display:grid;place-items:center;height:100%;padding:2px;font-size:11px;
 }
}

/* 較高螢幕的日期格可稍大，仍保留最後一排 */
@media(min-width:901px) and (min-height:800px){
 body[data-page="category"]{--life-desktop-calendar-cell:25px;}
}
