/* Monk Family Studio. Loaded after the existing M3 theme. */
html[data-m3] {
  --mf-studio-ink: #f7f0e8;
  --mf-studio-muted: #c2bdca;
  --mf-studio-line: #474153;
  --mf-studio-accent: #d4c6f1;
}
html[data-m3][data-ui] body::before { background: #11121b !important; }
html[data-m3] ::selection { color: #171320; background: var(--mf-studio-accent); }
html[data-m3] .m3-side { overflow: hidden; border-radius: 18px; }
html[data-m3] .m3-side > .m3-brand, html[data-m3] .m3-side > .m3-me { flex: none; }
html[data-m3] .mf-side-scroll {
  flex: 1; min-height: 0; overflow-y: auto; padding: 3px 3px 8px;
  scrollbar-width: thin; scrollbar-color: #574d65 transparent;
}
html[data-m3] .m3-side > .m3-me { margin-top: 8px; }
html[data-m3] .m3-side > .m3-brand { padding-bottom: 16px; }
html[data-m3] .mf-home .m3-hero { height: clamp(142px, 16vw, 194px); border-radius: 16px; }
html[data-m3] .mf-home .m3-hero-img { object-position: 68% 60%; }
html[data-m3] .mf-home .m3-hero-in { bottom: 24px; }
html[data-m3] .mf-home .m3-hero-in h2 { font-size: clamp(30px, 3.7vw, 48px) !important; line-height: 1.13 !important; text-wrap: balance; }
html[data-m3] .mf-home .m3-hero-in p { color: var(--mf-studio-ink); }
html[data-m3] .mf-home-priority { grid-template-columns: minmax(0,1fr) minmax(0,1.72fr) minmax(0,1fr); }
html[data-m3] .mf-home-priority > * { min-height: 0; }
html[data-m3] .mf-home .m3-hxq { border-radius: 14px; }
html[data-m3] .m6-me .m6-hero-me, html[data-m3] .m6-us .m6-hero-us { min-height: 124px; padding-block: 16px; }
html[data-m3] .m6-me .m6-hero-me h2, html[data-m3] .m6-us .m6-hero-us h2 { font-size: clamp(25px, 3.1vw, 38px); }
html[data-m3] .m6-me .m6-hero-me h2 br, html[data-m3] .m6-us .m6-hero-us h2 br { display: none; }
html[data-m3] .m6-me-top { align-items: start; }
html[data-m3] .m6-me .m6-today, html[data-m3] .m6-me .m6-feel { min-height: 0; }
html[data-m3] .fz-bar { min-height: 44px; gap: 5px; }
html[data-m3] .fz-bar button, html[data-m3] .fz-bar button.on {
  min-height: 44px !important; display: grid; place-items: center; color: var(--mf-studio-ink);
  border: 1px solid var(--mf-studio-line) !important; border-radius: 8px !important;
  background: #272535 !important;
}
html[data-m3] .fz-bar button::before { display: none; }
html[data-m3] .fz-bar button[aria-checked="true"] {
  color: #211a30; background: var(--mf-studio-accent) !important; border-color: var(--mf-studio-accent) !important;
}
html[data-m3] .fz-bar button:focus-visible { outline: 2px solid var(--mf-studio-accent) !important; outline-offset: 2px; }
html[data-m3] .fz-bar button:not([aria-checked="true"]):hover { background: #373146 !important; }
html[data-m3] .mf-feel-score { font: 600 14px/1 var(--mf); font-variant-numeric: tabular-nums; }
html[data-m3] .fz-w { color: var(--mf-studio-muted); }
html[data-m3] .mf-duplicate-plan { display: none !important; }
html[data-m3] .m6-sport .m3-btn.pri { color: #211a30; background: var(--mf-studio-accent); }
html[data-m3] .mf-calendar-summary {
  width: 100%; display: flex; align-items: center; gap: 12px; min-height: 60px;
  padding: 10px 14px; margin: 0 0 12px; color: var(--mf-studio-ink);
  text-align: left; border: 1px solid var(--mf-studio-line); border-radius: 12px; background: #222030;
  cursor: pointer;
}
html[data-m3] .mf-calendar-summary > span { flex: 1; min-width: 0; display: grid; gap: 2px; }
html[data-m3] .mf-calendar-summary > .mi { color: var(--mf-studio-accent); }
html[data-m3] #mf-calendar-event { font-size: 13px; color: var(--mf-studio-muted); overflow-wrap: anywhere; }
html[data-m3] .m3-cban { height: 112px; }
html[data-m3] .m3-chat:has(.m3-hello) .msgs { flex: 0 1 auto; }
html[data-m3] .m3-chat:has(.m3-hello) .m3-comp { margin-top: auto; }
html[data-m3] .m3-chat .m3-hello > p { display: block; max-width: 42ch; color: var(--mf-studio-muted); }
html[data-m3] .m3-chat .bubble { min-width: 0; overflow-wrap: anywhere; }
html[data-m3] .m3-chat .bubble pre, html[data-m3] .m3-chat .bubble table { max-width: 100%; overflow-x: auto; }
html[data-m3] .m6-akempty .m6-aksug { display: flex; flex-wrap: wrap; gap: 8px; }
html[data-m3] .m6-akempty .m6-aksug button { min-height: 44px; white-space: normal; text-align: left; }
@media (min-width: 768px) and (max-width: 1099px) {
  html[data-m3] .mf-home-priority { grid-template-columns: repeat(2, minmax(0,1fr)); }
  html[data-m3] .mf-home-priority > .m3-cal { grid-column: auto; }
  html[data-m3] .mf-home-priority > .m3-baby { grid-column: auto; }
}
@media (max-width: 767px) {
  html[data-m3] .mf-home .m3-hero { height: 134px; }
  html[data-m3] .mf-home .m3-hero-in { bottom: 14px; left: 16px; right: 68px; }
  html[data-m3] .mf-home .m3-hero-in h2 { font-size: 27px !important; line-height: 1.12 !important; }
  html[data-m3] .mf-home .m3-hero-fam { top: 10px; right: 10px; }
  html[data-m3] .mf-home-priority { grid-template-columns: minmax(0,1fr); }
  html[data-m3] .mf-home .m3-hxb { display: flex; flex-wrap: wrap; gap: 8px; }
  html[data-m3] .mf-home .m3-hxb .m3-btn { flex: 1 1 auto; width: auto; min-height: 44px; }
  html[data-m3] .m3-cnear { min-height: 72px; }
  html[data-m3] .m3-chat .m3-hello { text-align: left; align-items: flex-start; }
  html[data-m3] .m3-chat .m3-hello > p { margin-inline: 0; font-size: 13px; }
  html[data-m3] .m3-chat .m3-sugg { align-items: flex-start; }
  html[data-m3] .m3-chat .m3-sugg button { min-height: 44px; font-size: 13px; }
}
@media (max-width: 767px) {
  html[data-m3] .m6-me .m6-head { margin-bottom: 12px; }
  html[data-m3] .m6-me .m6-today, html[data-m3] .m6-me .m6-feel { padding: 14px; }
  html[data-m3] .m6-me .m6-rowl { padding-block: 7px; min-height: 44px; }
  html[data-m3] .m6-me .m6-daybtn { min-height: 52px; padding-block: 8px; }
  html[data-m3] .m6-me .m6-rows { gap: 0; }
  html[data-m3] .m6-me .m6-rt small { font-size: 12px; line-height: 1.35; }
}
/* The dark palette already suits evening use. Keep contrast on text and controls. */
html[data-m3][data-night]::after { content: none; }

/* Atelier uses a warm paper foreground against an ink-colored shell. */
html[data-m3] {
  --mf-atelier-ink: #f3eadf;
  --mf-atelier-muted: #c9c0bb;
  --mf-atelier-panel: #22212b;
  --mf-atelier-border: #403a46;
  --mf-atelier-brass: #e4c29a;
}
html[data-m3][data-ui] body::before { background: #15141d !important; }
html[data-m3] .m3-side { background: #191820; border-color: #332e3b; }
html[data-m3] .m3-side .m3-ni.on { background: #2b2732; }
html[data-m3] .m3-side .m3-ni.on .mi { color: var(--mf-atelier-brass); }
html[data-m3] .m3-side .m7-sp[aria-pressed="true"] { border-color: #6a584b; }
html[data-m3] .m3-ht h1, html[data-m3] .m6-head h1 {
  color: var(--mf-atelier-ink) !important;
  font-family: var(--mp) !important;
  font-weight: 500 !important;
  letter-spacing: -.025em !important;
}
html[data-m3] .m3-ht p, html[data-m3] .m6-head .m6-cap { color: var(--mf-atelier-muted); }

html[data-m3] .mf-home .m3-hero {
  height: clamp(174px, 17vw, 238px);
  background: #1c1b29;
  border-radius: 18px;
}
html[data-m3] .mf-home .m3-hero-img { object-position: center 56%; }
html[data-m3] .mf-home .m3-hero-in { left: clamp(20px,3.3vw,44px); bottom: 27px; right: 35%; }
html[data-m3] .mf-home .m3-hero-in h2 { color: var(--mf-atelier-ink) !important; text-shadow: none; }
html[data-m3] .mf-home .m3-hero-in p { color: #e1d8d8; font-size: 13px; }
html[data-m3] .mf-home .m3-hero::after {
  background: linear-gradient(90deg, #171522e8 0%, #17152272 46%, transparent 75%);
}
html[data-m3] .mf-home-priority { grid-template-columns: minmax(0,1.65fr) minmax(0,1fr); gap: 14px; }
html[data-m3] .mf-home-priority.nobaby { grid-template-columns: repeat(2,minmax(0,1fr)); }
html[data-m3] .mf-home-summary > .mf-agenda {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto auto;
  align-items: center;
  justify-content: start;
  gap: 16px;
  min-height: 74px;
  padding: 12px 18px;
  background: var(--mf-atelier-panel);
  border: 1px solid var(--mf-atelier-border);
  border-radius: 14px;
  box-shadow: none;
}
html[data-m3] .mf-home-summary > .mf-agenda:hover { border-color: #9b7d68; }
html[data-m3] .mf-agenda-date { display: grid; min-width: 54px; padding-inline-end: 15px; border-inline-end: 1px solid var(--mf-atelier-border); }
html[data-m3] .mf-agenda-date b { color: var(--mf-atelier-brass); font: 500 30px/.98 var(--mp); }
html[data-m3] .mf-agenda-date span, html[data-m3] .mf-agenda-label, html[data-m3] .mf-agenda-more { font: 500 12px/1.35 var(--mf); color: var(--mf-atelier-muted); }
html[data-m3] .mf-agenda-main { display: grid; gap: 2px; min-width: 0; }
html[data-m3] .mf-agenda-main strong { color: var(--mf-atelier-ink); font: 550 16px/1.35 var(--mf); overflow-wrap: anywhere; }
html[data-m3] .mf-agenda-icon { display: flex; color: var(--mf-atelier-brass); }
html[data-m3] .mf-home-priority > .m3-baby, html[data-m3] .mf-home-priority > .m3-bd {
  grid-column: auto; border-radius: 15px; min-height: 0; box-shadow: none;
}
html[data-m3] .mf-home .m3-kph { height: clamp(164px,18vw,245px); border-radius: 11px; }
html[data-m3] .mf-home .m3-kph.noph { background: #211d29 url("/static/art/mf-story-nursery-small.jpg") center 58% / cover no-repeat; }
html[data-m3] .mf-home .m3-kpt b { color: var(--mf-atelier-ink); }
html[data-m3] .mf-home .m3-hxq, html[data-m3] .m6-me .m6-p, html[data-m3] .m6-us .m6-p {
  border-radius: 14px; border-color: var(--mf-atelier-border); box-shadow: none;
}
html[data-m3] .m6-me .m6-hero-me, html[data-m3] .m6-us .m6-hero-us {
  min-height: clamp(142px, 15vw, 204px);
  padding: 24px clamp(20px,3.1vw,38px);
  border-radius: 16px;
}
html[data-m3] .m6-me .m6-hero-me img, html[data-m3] .m6-us .m6-hero-us img { object-position: center 58%; }
html[data-m3] .m6-me .m6-hero-me img { scale: 1.035; }
html[data-m3] .m6-me .m6-hero-me::before, html[data-m3] .m6-us .m6-hero-us::before {
  background: linear-gradient(90deg, #171522eb 0%, #1715229c 47%, transparent 78%);
}
html[data-m3] .m6-me .m6-hero-me h2, html[data-m3] .m6-us .m6-hero-us h2 { color: var(--mf-atelier-ink); }
@media (min-width: 1100px) {
  html[data-m3] .m3-side { width: 224px; }
  html[data-m3] .m3-main { margin-left: 267px !important; }
  html[data-m3] .mf-home .m3-hxq { display: grid; grid-template-columns: minmax(0,1fr) auto; column-gap: 24px; align-items: center; }
  html[data-m3] .mf-home .m3-hxq > h3 { grid-column: 1; }
  html[data-m3] .mf-home .m3-hxq > .m3-hxb { grid-column: 2; grid-row: 1 / span 2; margin: 0; }
}
@media (max-width: 767px) {
  html[data-m3] .mf-home .m3-hero { height: 149px; }
  html[data-m3] .mf-home .m3-hero-img { object-position: 62% 54%; }
  html[data-m3] .mf-home .m3-hero-in { left: 17px; right: 52px; bottom: 15px; }
  html[data-m3] .mf-home .m3-hero-in p { font-size: 12px; }
  html[data-m3] .mf-home-priority, html[data-m3] .mf-home-priority.nobaby { grid-template-columns: minmax(0,1fr); gap: 11px; }
  html[data-m3] .mf-home-summary > .mf-agenda { gap: 10px; padding: 10px 12px; }
  html[data-m3] .mf-agenda-date { min-width: 48px; padding-inline-end: 9px; }
  html[data-m3] .mf-agenda-main strong { font-size: 14px; }
  html[data-m3] .mf-agenda-more { display: none; }
  html[data-m3] .mf-home .m3-kph { height: 174px; }
  html[data-m3] .m6-me .m6-hero-me, html[data-m3] .m6-us .m6-hero-us { min-height: 126px; padding: 16px; }
}
