/* Desktop-only analytics. Existing mobile app is unchanged. */
@media(min-width:900px){
 #screen:has(.mia-desktop-dashboard)>.hero{margin-bottom:18px!important}
 #screen:has(.mia-desktop-dashboard)>.home-welcome{margin-bottom:20px!important}
 .mia-desktop-dashboard{display:grid;gap:20px;padding:0 0 18px;color:var(--ink)}
 .mia-dash-heading,.mia-card-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:18px}
 .mia-dash-heading h2{font-family:Georgia,serif;font-size:30px;line-height:1.2;margin:4px 0 7px;color:var(--ink)}
 .mia-dash-heading p,.mia-card-heading p,.mia-subline{margin:0;color:var(--muted);font-size:13px}
 .mia-eyebrow{font-size:11px;letter-spacing:.14em;font-weight:800;color:var(--primary)}
 .mia-local-pill{background:var(--surface);border:1px solid var(--line);border-radius:40px;padding:9px 13px;white-space:nowrap;font-size:12px;color:var(--muted)}
 .mia-analytics-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:13px}
 .mia-analytics-stat,.mia-analytics-card{background:var(--surface);border:1px solid var(--line);border-radius:20px;box-shadow:0 6px 22px #122a2510}
 .mia-analytics-stat{padding:22px 19px;display:flex;flex-direction:column;gap:7px}
 .mia-analytics-stat strong{font-size:30px;line-height:1.1;font-weight:750;color:var(--primary)}
 .mia-analytics-stat span{font-size:12px;color:var(--muted);line-height:1.4}
 .mia-analytics-card{padding:23px 24px;min-width:0}
 .mia-analytics-card h3{margin:0 0 6px;font-size:19px;color:var(--ink)}
 .mia-chart-controls{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
 .mia-chart-controls label{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--muted)}
 .mia-chart-controls select{min-height:35px;padding:6px 26px 6px 10px;font-size:12px;width:auto;max-width:180px}
 #mia-trend-svg{display:block;width:100%;height:auto;max-height:290px;margin:16px 0 3px;overflow:visible;color:var(--ink)}
 .mia-chart-note,.mia-dash-disclaimer{font-size:12px;line-height:1.5;color:var(--muted);margin:6px 0 0}
 .mia-dash-columns{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:20px}
 .mia-checkin .home-actions{display:grid!important;grid-template-columns:1fr!important;gap:10px!important;margin:18px 0 0!important}
 .mia-checkin .home-action{min-height:72px!important;width:100%!important;margin:0!important;padding:12px 15px!important}
 .mia-checkin .action-icon{width:40px!important;height:40px!important;flex-shrink:0}
 .mia-calendar-nav{display:flex;align-items:center;gap:7px;white-space:nowrap}
 .mia-calendar-nav strong{font-size:12px;min-width:104px;text-align:center}
 .mia-calendar-nav button{padding:5px 9px!important;min-height:30px!important;border-radius:9px!important;background:var(--page)!important;color:var(--ink)!important}
 .mia-mini-calendar{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:5px;margin-top:18px}
 .mia-weekday{text-align:center;font-size:11px;font-weight:750;color:var(--muted);padding:5px 0}
 .mia-cal-day{border-radius:9px!important;min-height:36px!important;padding:5px 0!important;font-size:12px!important;background:var(--page)!important;color:var(--ink)!important;border:1px solid transparent!important}
 .mia-cal-day.mig{background:#f5d8dc!important;color:#7b3547!important}.mia-cal-day.free{background:#d4eadd!important;color:#245b44!important}.mia-cal-day.other{background:#e7def5!important;color:#5d4c7a!important}
 .mia-cal-day.today{outline:2px solid var(--primary);outline-offset:1px}
 .mia-cal-legend{display:flex;gap:12px;flex-wrap:wrap;margin-top:14px}.mia-cal-legend span{display:flex;align-items:center;gap:5px;font-size:11px;color:var(--muted)}.mia-cal-legend i{width:9px;height:9px;border-radius:3px;background:#e7def5}.mia-cal-legend i.mig{background:#f0bfc9}.mia-cal-legend i.free{background:#b6dfc6}
 .mia-text-link{background:transparent!important;color:var(--primary)!important;padding:10px 0 0!important;text-decoration:underline;font-size:13px!important}
 .mia-summary-row{display:flex;justify-content:space-between;gap:12px;border-bottom:1px solid var(--line);padding:11px 0;font-size:13px}.mia-summary-row b,.mia-summary-row small{color:var(--primary)}
 .mia-empty{font-size:13px;color:var(--muted);margin:18px 0 0;line-height:1.5}
 .mia-dash-disclaimer{margin:0 0 12px}
}
@media(min-width:900px) and (max-width:1150px){.mia-analytics-stats{grid-template-columns:repeat(2,1fr)}.mia-dash-columns{grid-template-columns:1fr}.mia-card-heading{flex-wrap:wrap}}
@media(prefers-reduced-motion:reduce){.mia-desktop-dashboard *{animation:none!important;transition:none!important}}

/* V4.7.2 desktop layout refinement: compact check-in, paired calendar and trend */
@media (min-width:900px){
 .mia-desktop-dashboard{gap:15px}
 .mia-desktop-dashboard .mia-checkin{padding:13px 17px}
 .mia-desktop-dashboard .mia-checkin .mia-card-heading{margin-bottom:7px}
 .mia-desktop-dashboard .mia-checkin .mia-card-heading h3{font-size:15px;margin:0}
 .mia-desktop-dashboard .mia-checkin .mia-card-heading p{display:none}
 .mia-desktop-dashboard .mia-checkin .home-actions{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:12px!important;margin:8px 0 0!important}
 .mia-desktop-dashboard .mia-checkin .home-action{min-height:62px!important;max-height:76px!important;padding:8px 14px!important;display:flex!important;align-items:center!important;justify-content:center!important;gap:10px!important;flex-direction:row!important;border-radius:15px!important}
 .mia-desktop-dashboard .mia-checkin .home-action .action-icon{width:35px!important;height:35px!important;margin:0!important}
 .mia-desktop-dashboard .mia-checkin .home-action .action-icon svg{max-width:32px;max-height:32px}
 .mia-desktop-dashboard .mia-checkin .home-action *{line-height:1.2!important}
 .mia-desktop-dashboard .mia-analytics-stat{padding:13px 16px;gap:3px}
 .mia-desktop-dashboard .mia-analytics-stat strong{font-size:24px}
 .mia-desktop-dashboard .mia-main-panels{grid-template-columns:minmax(0,0.95fr) minmax(0,1.05fr);align-items:start;gap:15px}
 .mia-desktop-dashboard .mia-main-panels .mia-analytics-card{padding:18px;min-width:0}
 .mia-desktop-dashboard .mia-main-panels .mia-card-heading{gap:10px;flex-wrap:wrap}
 .mia-desktop-dashboard .mia-main-panels h3{font-size:17px}
 .mia-desktop-dashboard .mia-mini-calendar{gap:4px;margin-top:13px}
 .mia-desktop-dashboard .mia-cal-day{min-height:32px!important}
 .mia-desktop-dashboard #mia-trend-svg{max-height:240px;margin-top:10px}
 .mia-desktop-dashboard .mia-lower{gap:15px}
}
@media (min-width:900px) and (max-width:1150px){
 .mia-desktop-dashboard .mia-main-panels{grid-template-columns:1fr 1fr}
 .mia-desktop-dashboard .mia-checkin .home-actions{gap:8px!important}
}
@media (min-width:900px) and (max-width:1020px){
 .mia-desktop-dashboard .mia-main-panels{grid-template-columns:1fr}
}

/* V4.7.3: true full-width, low-profile desktop check-in buttons.
   Override the older #screen .home-action min-height:205px !important rule. */
@media (min-width:900px) {
  #screen .mia-desktop-dashboard .mia-checkin .home-actions {
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    width:100%!important;
    max-width:none!important;
    padding:0!important;
    margin:8px 0 0!important;
    gap:12px!important;
    box-sizing:border-box;
  }
  #screen .mia-desktop-dashboard .mia-checkin .home-action {
    box-sizing:border-box!important;
    width:100%!important;
    min-width:0!important;
    height:80px!important;
    min-height:80px!important;
    max-height:80px!important;
    padding:9px 13px!important;
    margin:0!important;
    display:flex!important;
    flex-direction:row!important;
    align-items:center!important;
    justify-content:center!important;
    gap:9px!important;
    border-radius:15px!important;
  }
  #screen .mia-desktop-dashboard .mia-checkin .home-action .action-icon {
    width:36px!important;height:36px!important;min-width:36px!important;
    flex:0 0 36px!important;margin:0!important;
  }
  #screen .mia-desktop-dashboard .mia-checkin .home-action .action-icon svg {
    width:31px!important;height:31px!important;
  }
  #screen .mia-desktop-dashboard .mia-checkin .home-action .action-copy {
    width:auto!important;min-width:0!important;flex:0 1 auto!important;
    align-items:flex-start!important;justify-content:center!important;
    gap:3px!important;text-align:left!important;
  }
  #screen .mia-desktop-dashboard .mia-checkin .home-action .action-copy strong {
    font-size:clamp(13px,1.2vw,17px)!important;
    line-height:1.2!important;
  }
  #screen .mia-desktop-dashboard .mia-checkin .home-action .action-copy small {
    font-size:11px!important;line-height:1.2!important;
    max-width:190px!important;
  }
  #screen .mia-desktop-dashboard .mia-checkin .home-action .action-arrow {
    font-size:20px!important;flex:0 0 auto!important;
  }
}
@media (min-width:900px) and (max-width:1100px) {
  #screen .mia-desktop-dashboard .mia-checkin .home-actions {gap:8px!important}
  #screen .mia-desktop-dashboard .mia-checkin .home-action {padding:8px!important;gap:5px!important}
  #screen .mia-desktop-dashboard .mia-checkin .home-action .action-copy small {display:none!important}
}

/* V4.7.4 desktop polish — preserve all phone styling */
@media (min-width:900px){
 /* Remove the rounded bottom corners that expose the header's horizontal seam. */
 #screen:has(.mia-desktop-dashboard) .hero-art{border-radius:0!important;}
 #screen:has(.mia-desktop-dashboard) .home-welcome{isolation:isolate;}
 .mia-desktop-dashboard .mia-main-panels{align-items:stretch;}
 .mia-desktop-dashboard .mia-main-panels > .mia-analytics-card{height:100%;box-sizing:border-box;}
 .mia-desktop-dashboard .mia-lower > .mia-analytics-card{padding:17px 20px;align-self:stretch;}
 .mia-desktop-dashboard .mia-lower h3{font-size:17px;margin:0 0 5px;}
 .mia-desktop-dashboard .mia-lower .mia-subline{margin-bottom:7px;}
 .mia-desktop-dashboard .mia-lower .mia-summary-row{padding:8px 0;}
 .mia-desktop-dashboard .mia-lower .mia-empty{margin:9px 0 0;}
 .mia-desktop-dashboard .mia-chart-controls{gap:8px;}
 .mia-desktop-dashboard .mia-compare-toggle{white-space:nowrap;cursor:pointer;}
 .mia-desktop-dashboard .mia-compare-toggle input{width:15px;height:15px;margin:0;accent-color:var(--primary);}
 .mia-desktop-dashboard .mia-compare-field[hidden],.mia-desktop-dashboard .mia-chart-legend[hidden]{display:none!important;}
 .mia-desktop-dashboard .mia-chart-legend{display:flex;flex-wrap:wrap;gap:13px;margin-top:12px;font-size:11px;color:var(--muted);}
 .mia-desktop-dashboard .mia-chart-legend span{display:inline-flex;align-items:center;gap:6px;}
 .mia-desktop-dashboard .mia-legend-dot{display:inline-block;width:11px;height:11px;border-radius:50%;}
 .mia-desktop-dashboard .mia-legend-dot.primary{background:var(--primary);}
 .mia-desktop-dashboard .mia-legend-dot.secondary{background:var(--accent,#9878b5);}
}

/* V4.7.5 — align calendar/trend columns with the two summary cards below.
   Keep the four-stat row and all mobile styling unchanged. */
@media (min-width:900px) {
  #screen .mia-desktop-dashboard .mia-main-panels,
  #screen .mia-desktop-dashboard .mia-lower {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    column-gap:15px!important;
    width:100%;
    box-sizing:border-box;
  }
  #screen .mia-desktop-dashboard .mia-main-panels > *,
  #screen .mia-desktop-dashboard .mia-lower > * {
    min-width:0;
    width:100%;
    box-sizing:border-box;
  }
  /* Remove a hairline at the scenic header / welcome overlap. */
  #screen:has(.mia-desktop-dashboard) .hero,
  #screen:has(.mia-desktop-dashboard) .hero-art {
    border:0!important;
    border-bottom:0!important;
    box-shadow:none!important;
  }
  #screen:has(.mia-desktop-dashboard) .hero-art {
    -webkit-mask-image:linear-gradient(to bottom,#000 0%,#000 calc(100% - 22px),transparent 100%);
    mask-image:linear-gradient(to bottom,#000 0%,#000 calc(100% - 22px),transparent 100%);
  }
}
@media (min-width:900px) and (max-width:1020px) {
  #screen .mia-desktop-dashboard .mia-main-panels,
  #screen .mia-desktop-dashboard .mia-lower {grid-template-columns:minmax(0,1fr)!important;}
}

/* V4.7.9 — desktop History summary mirrors Home's four compact stat cards.
   Presentation only: retain existing counts, date controls, and mobile styles. */
@media (min-width:900px) {
  #screen .history-overview .history-metrics {
    display:grid!important;
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    gap:13px!important;
    width:100%;
    box-sizing:border-box;
  }
  #screen .history-overview .history-metrics > .history-metric {
    min-width:0!important;
    min-height:0!important;
    padding:13px 16px!important;
    border-radius:20px!important;
    display:flex;
    flex-direction:column;
    justify-content:center;
    gap:3px;
    box-sizing:border-box;
  }
  #screen .history-overview .history-metric-icon {display:none!important;}
  #screen .history-overview .history-metric b {
    display:block;
    font-size:24px!important;
    line-height:1.1!important;
    margin:0!important;
  }
  #screen .history-overview .history-metric .muted {
    display:block;
    font-size:12px!important;
    line-height:1.4!important;
  }
}

/* V4.8.0 optional period overlay inside desktop trend card */
.mia-period-overlay:not([hidden]){margin-top:14px;padding:14px;border:1px solid var(--line,rgba(130,160,150,.3));border-radius:14px}
.mia-period-overlay h4{margin:0 0 5px;font-size:14px}.mia-period-overlay p{font-size:12px;margin:4px 0 9px}
