/* Momo main window, drawn in HTML for the hero (see tools/react-app/src/MomoWindow.jsx).
   Values from MoUI/AffectPalette.swift and MoWorkspace/AffectTokens.swift. */

:root {
  --mw-shell: #eff0f0;
  --mw-page: #ffffff;
  --mw-tab: #ffffff;
  --mw-card: #ffffff;
  --mw-ink: rgba(0, 0, 0, 0.88);
  --mw-text: rgba(0, 0, 0, 0.61);
  --mw-muted: rgba(0, 0, 0, 0.45);
  --mw-faint: rgba(0, 0, 0, 0.27);
  --mw-line: rgba(0, 0, 0, 0.06);
  --mw-line-strong: rgba(0, 0, 0, 0.1);
  --mw-hover: rgba(0, 0, 0, 0.04);
  --mw-select: rgba(0, 0, 0, 0.055);
  --mw-pressed: rgba(0, 0, 0, 0.09);
  --mw-glyph: rgba(0, 0, 0, 0.75);
  --mw-accent: #0070d6;
  --mw-accent-soft: rgba(0, 112, 214, 0.1);
  --mw-hl: #fff3a3;
  --mw-anchor: rgba(255, 196, 0, 0.22);
  --mw-anchor-line: #e8b100;
  --mw-ins: rgba(30, 138, 79, 0.14);
  --mw-ins-fg: #1e7a46;
  --mw-del-fg: #c0392b;
  --mw-del: rgba(192, 57, 43, 0.1);
  --mw-claude: #7c5cff;
  --mw-dark-btn: #1d1d1f;
  --mw-dark-btn-fg: #ffffff;
  --mw-folder: #2b2b2e;
  --mw-win-edge: rgba(0, 0, 0, 0.14);
  --mw-win-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.12), 0 22px 70px -18px rgba(0, 0, 0, 0.32), 0 8px 24px -10px rgba(0, 0, 0, 0.14);
  --mw-page-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.04);
  --mw-card-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 16px -8px rgba(0, 0, 0, 0.08);
  --mw-pop: #ffffff;
  --mw-callout-tip: rgba(30, 138, 79, 0.07);
  --mw-callout-tip-edge: rgba(30, 138, 79, 0.28);
  --mw-callout-tip-fg: #2f8a3e;
  --mw-callout-note: rgba(0, 112, 214, 0.06);
  --mw-callout-note-edge: rgba(0, 112, 214, 0.24);
  --mw-callout-note-fg: #0063c0;
  --mw-raised: #f6f6f6;
  --mw-side-ink: rgba(0, 0, 0, 0.84);
  --mw-side-glyph: rgba(0, 0, 0, 0.6);
  --mw-seg-track: rgba(0, 0, 0, 0.06);
  --mw-badge-red: #e5484d;
  --mw-chip-bg: rgba(232, 118, 0, 0.1);
  --mw-chip-fg: #c96a00;
  --mw-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --mw-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
  --mw-mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --mw-shell: #252829;
    --mw-page: #222222;
    --mw-raised: #2e3031;
    --mw-side-ink: rgba(255, 255, 255, 0.84);
    --mw-side-glyph: rgba(255, 255, 255, 0.62);
    --mw-seg-track: rgba(255, 255, 255, 0.08);
    --mw-chip-bg: rgba(255, 159, 10, 0.14);
    --mw-chip-fg: #ffb340;

    --mw-tab: #3a3d3e;
    --mw-card: #2a2a2c;
    --mw-ink: rgba(255, 255, 255, 0.9);
    --mw-text: rgba(255, 255, 255, 0.62);
    --mw-muted: rgba(255, 255, 255, 0.45);
    --mw-faint: rgba(255, 255, 255, 0.28);
    --mw-line: rgba(255, 255, 255, 0.08);
    --mw-line-strong: rgba(255, 255, 255, 0.14);
    --mw-hover: rgba(255, 255, 255, 0.06);
    --mw-select: rgba(255, 255, 255, 0.1);
    --mw-pressed: rgba(255, 255, 255, 0.14);
    --mw-glyph: rgba(255, 255, 255, 0.86);
    --mw-accent: #4fb0fe;
    --mw-accent-soft: rgba(79, 176, 254, 0.14);
    --mw-hl: rgba(255, 214, 10, 0.32);
    --mw-anchor: rgba(255, 196, 0, 0.18);
    --mw-anchor-line: #c99a00;
    --mw-ins: rgba(95, 200, 138, 0.16);
    --mw-ins-fg: #6fd49a;
    --mw-del-fg: #ff8a7a;
    --mw-del: rgba(255, 110, 90, 0.12);
    --mw-claude: #9d86ff;
    --mw-dark-btn: #ededef;
    --mw-dark-btn-fg: #111113;
    --mw-folder: #303034;
    --mw-win-edge: rgba(255, 255, 255, 0.14);
    --mw-win-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.16), 0 30px 80px -20px rgba(0, 0, 0, 0.8);
    --mw-page-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.08);
    --mw-card-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.1);
    --mw-pop: #2a2a2d;
    --mw-callout-tip: rgba(95, 200, 138, 0.08);
    --mw-callout-tip-edge: rgba(95, 200, 138, 0.3);
    --mw-callout-tip-fg: #6fd49a;
    --mw-callout-note: rgba(79, 176, 254, 0.08);
    --mw-callout-note-edge: rgba(79, 176, 254, 0.3);
    --mw-callout-note-fg: #7cc3ff;
  }
}
:root[data-theme="dark"] {
  --mw-shell: #252829;
  --mw-page: #222222;
  --mw-raised: #2e3031;
  --mw-side-ink: rgba(255, 255, 255, 0.84);
  --mw-side-glyph: rgba(255, 255, 255, 0.62);
  --mw-seg-track: rgba(255, 255, 255, 0.08);
  --mw-chip-bg: rgba(255, 159, 10, 0.14);
  --mw-chip-fg: #ffb340;

  --mw-tab: #3a3d3e;
  --mw-card: #2a2a2c;
  --mw-ink: rgba(255, 255, 255, 0.9);
  --mw-text: rgba(255, 255, 255, 0.62);
  --mw-muted: rgba(255, 255, 255, 0.45);
  --mw-faint: rgba(255, 255, 255, 0.28);
  --mw-line: rgba(255, 255, 255, 0.08);
  --mw-line-strong: rgba(255, 255, 255, 0.14);
  --mw-hover: rgba(255, 255, 255, 0.06);
  --mw-select: rgba(255, 255, 255, 0.1);
  --mw-pressed: rgba(255, 255, 255, 0.14);
  --mw-glyph: rgba(255, 255, 255, 0.86);
  --mw-accent: #4fb0fe;
  --mw-accent-soft: rgba(79, 176, 254, 0.14);
  --mw-hl: rgba(255, 214, 10, 0.32);
  --mw-anchor: rgba(255, 196, 0, 0.18);
  --mw-anchor-line: #c99a00;
  --mw-ins: rgba(95, 200, 138, 0.16);
  --mw-ins-fg: #6fd49a;
  --mw-del-fg: #ff8a7a;
  --mw-del: rgba(255, 110, 90, 0.12);
  --mw-claude: #9d86ff;
  --mw-dark-btn: #ededef;
  --mw-dark-btn-fg: #111113;
  --mw-folder: #303034;
  --mw-win-edge: rgba(255, 255, 255, 0.14);
  --mw-win-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.16), 0 30px 80px -20px rgba(0, 0, 0, 0.8);
  --mw-page-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.08);
  --mw-card-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.1);
  --mw-pop: #2a2a2d;
  --mw-callout-tip: rgba(95, 200, 138, 0.08);
  --mw-callout-tip-edge: rgba(95, 200, 138, 0.3);
  --mw-callout-tip-fg: #6fd49a;
  --mw-callout-note: rgba(79, 176, 254, 0.08);
  --mw-callout-note-edge: rgba(79, 176, 254, 0.3);
  --mw-callout-note-fg: #7cc3ff;
}

/* ------------------------------------------------------------------ frame (1280 × 764 pt) */

.mw-fit { position: relative; width: 100%; }
.mw-fit-fallback {
  aspect-ratio: 1280 / 764;
  border-radius: 16px;
  background: var(--mw-shell);
  box-shadow: var(--mw-win-shadow);
}

.mw-win {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 0px;
  grid-template-rows: 51px minmax(0, 1fr);
  border-radius: 16px;
  background: var(--mw-shell);
  box-shadow: var(--mw-win-shadow);
  color: var(--mw-ink);
  font: 400 13.5px/1.35 var(--mw-font);
  text-align: left;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: grid-template-columns 0.42s var(--mw-ease);
  user-select: none;
  -webkit-user-select: none;
  isolation: isolate;
}
.mw-win.no-side { grid-template-columns: 0px minmax(0, 1fr) 0px; }
.mw-win.with-panel { grid-template-columns: 220px minmax(0, 1fr) 294px; }
.mw-win.no-side.with-panel { grid-template-columns: 0px minmax(0, 1fr) 294px; }

:where(.mw-win) button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  cursor: default;
  letter-spacing: inherit;
  text-align: inherit;
}
.mw-win button:focus-visible,
.mw-win [role="tab"]:focus-visible,
.mw-win textarea:focus-visible,
.mw-win input:focus-visible { outline: 2px solid var(--mw-accent); outline-offset: 1px; }
.mw-win kbd {
  font: 500 11px/1 var(--mw-font);
  padding: 2px 5px;
  border-radius: 4px;
  box-shadow: 0 0 0 0.5px var(--mw-line-strong);
  color: var(--mw-muted);
  background: transparent;
}
.mw-sp { flex: 1; }

.mw-traffic { display: inline-flex; gap: 9px; flex: none; }
.mw-traffic i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: block;
  background: #ff5f57;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.14);
}
.mw-traffic i:nth-child(2) { background: #febc2e; }
.mw-traffic i:nth-child(3) { background: #28c840; }

.mw-pane-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--mw-glyph);
  transition: background-color 0.15s;
}
.mw-pane-btn.wide { width: 40px; gap: 2px; }
.mw-pane-btn:hover { background: var(--mw-hover); }
.mw-pane-btn:active, .mw-pane-btn.on { background: var(--mw-pressed); }
.mw-pane-chev { opacity: 0.75; }
.mw-badge {
  position: absolute;
  top: -3px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--mw-badge-red);
  color: #fff;
  font: 600 10.5px/16px var(--mw-font);
  text-align: center;
  box-shadow: 0 0 0 1.5px var(--mw-shell);
}

/* Glass controls of the browse headers (36 pt) */
.mw-glass {
  height: 36px;
  min-width: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 18px;
  background: var(--mw-raised);
  color: var(--mw-glyph);
  box-shadow: 0 0 0 0.5px var(--mw-line-strong), 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: background-color 0.15s;
}
.mw-glass.capsule { padding: 0 10px 0 12px; }
.mw-glass:hover { background: color-mix(in srgb, var(--mw-raised) 94%, var(--mw-ink)); }
.mw-seg.mw-glass-seg {
  height: 36px;
  padding: 3px;
  border-radius: 18px;
  background: var(--mw-raised);
  box-shadow: 0 0 0 0.5px var(--mw-line-strong), 0 1px 2px rgba(0, 0, 0, 0.05);
}
.mw-seg.mw-glass-seg button { height: 30px; width: 34px; min-width: 0; padding: 0; border-radius: 15px; color: var(--mw-glyph); }
.mw-seg.mw-glass-seg button.on { background: var(--mw-pressed); box-shadow: none; }

/* ------------------------------------------------------------------ sidebar */

.mw-side {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 220px;
  overflow: hidden;
}
.mw-side-top {
  height: 51px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 19px;
}
.mw-side-folders, .mw-side-doc { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.mw-side-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 20px 8px 12px;
  scrollbar-width: none;
}
.mw-side-scroll::-webkit-scrollbar { display: none; }
.mw-lib {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 0 0 7px;
  margin-bottom: 6px;
  font-weight: 600;
}
.mw-lib img { border-radius: 5px; }
.mw-side-rule { height: 0.5px; margin: 8px 0 4px 6px; background: var(--mw-line-strong); }

.mw-row {
  position: relative;
  display: flex;
  align-items: center;
  height: 30px;
  margin-bottom: 1px;
  border-radius: 10px;
  transition: background-color 0.15s;
}
.mw-row.child { height: 31px; margin-bottom: 1px; }
.mw-row:hover { background: var(--mw-hover); }
.mw-row.on { background: var(--mw-select); }
.mw-row-main {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 9px 0 10px;
}
.mw-row.folder .mw-row-main { padding-left: 0; gap: 7px; }
.mw-row.child .mw-row-main { padding-left: 35px; gap: 6px; }
.mw-disc {
  width: 20px;
  height: 22px;
  margin-left: -5px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--mw-side-glyph);
}
.mw-row-ic { color: var(--mw-side-glyph); flex: none; }
.mw-row.on .mw-row-ic { color: var(--mw-ink); }
.mw-row-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--mw-side-ink);
}
.mw-row.on .mw-row-label, .mw-row:hover .mw-row-label { color: var(--mw-ink); }
.mw-row.on .mw-row-label { font-weight: 500; }
.mw-row:hover .mw-row-ic { color: var(--mw-ink); }
.mw-row-count { color: var(--mw-muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.mw-side-h {
  margin: 0;
  padding: 16px 0 6px 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--mw-ink);
}
.mw-ai-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mw-accent);
  flex: none;
  display: inline-block;
}

.mw-side-foot {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  margin: 0 20px 0 12px;
  padding: 10px 0 14px;
  border-top: 0.5px solid var(--mw-line-strong);
}
.mw-side-utils { align-self: stretch; display: flex; gap: 4px; }
.mw-side-utils .mw-pane-btn { color: var(--mw-side-glyph); }
.mw-running {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 12px;
  background: var(--mw-select);
  color: var(--mw-text);
  font-size: 12.5px;
  white-space: nowrap;
}
.mw-running:hover { background: var(--mw-pressed); }
.mw-running i, .mw-live {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #30b85c;
  display: inline-block;
  animation: mw-pulse 2s infinite;
}
@keyframes mw-pulse {
  0% { box-shadow: 0 0 0 0 rgba(48, 184, 92, 0.45); }
  70% { box-shadow: 0 0 0 6px rgba(48, 184, 92, 0); }
  100% { box-shadow: 0 0 0 0 rgba(48, 184, 92, 0); }
}

/* Document mode */
.mw-doc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 24px 0 12px;
  padding: 0 0 14px 8px;
  border-bottom: 0.5px solid var(--mw-line-strong);
}
.mw-doc-thumb {
  width: 28px;
  height: 32px;
  flex: none;
  border-radius: 4px;
  background: var(--mw-page);
  box-shadow: 0 0 0 0.5px var(--mw-line-strong), 0 1px 2px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 2.5px;
  padding: 6px 5px;
}
.mw-doc-thumb i { display: block; height: 1.5px; border-radius: 1px; background: var(--mw-faint); }
.mw-doc-thumb i:first-child { width: 60%; height: 2px; background: var(--mw-muted); margin-bottom: 1px; }
.mw-doc-thumb i:nth-child(3) { width: 80%; }
.mw-doc-thumb i:nth-child(5) { width: 50%; }
.mw-doc-head > div { min-width: 0; }
.mw-doc-head b {
  display: block;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mw-doc-head small {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  color: var(--mw-muted);
  font-size: 12.5px;
}
.mw-seg.mw-doc-seg { display: flex; margin: 10px 24px 0 16px; height: 28px; padding: 2px; border-radius: 14px; }
.mw-seg.mw-doc-seg button { flex: 1; height: 24px; border-radius: 12px; color: var(--mw-glyph); }
.mw-side-h.toc { padding: 20px 0 10px 22px; }
.mw-side-doc .mw-side-scroll { padding-left: 12px; }
.mw-toc {
  display: block;
  width: 100%;
  height: 30px;
  padding: 0 10px;
  border-radius: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--mw-ink);
  transition: background-color 0.15s;
}
.mw-toc.sub { padding-left: 26px; }
.mw-toc:hover { background: var(--mw-hover); }
.mw-toc.on { background: var(--mw-select); color: var(--mw-ink); font-weight: 700; }
.mw-pager-wrap { display: flex; justify-content: center; padding: 8px 0 16px; flex: none; }
.mw-pager {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 6px;
  border-radius: 12px;
  background: var(--mw-page);
  box-shadow: 0 0 0 0.5px var(--mw-line-strong);
}
.mw-pager button { width: 18px; height: 24px; display: inline-flex; align-items: center; justify-content: center; }
.mw-pager i { width: 6px; height: 6px; border-radius: 50%; background: var(--mw-faint); display: block; }
.mw-pager .on i { background: var(--mw-ink); }

/* Segmented control */
.mw-seg {
  display: inline-flex;
  padding: 2px;
  border-radius: 14px;
  background: var(--mw-seg-track);
}
.mw-seg button {
  height: 24px;
  padding: 0 12px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--mw-text);
  font-size: 13px;
  transition: background-color 0.18s, color 0.18s;
}
.mw-seg button:hover { color: var(--mw-ink); }
.mw-seg button.on {
  background: var(--mw-tab);
  color: var(--mw-ink);
  font-weight: 500;
  box-shadow: 0 0 0 0.5px var(--mw-line), 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ------------------------------------------------------------------ title bar and tabs */

.mw-titlebar {
  grid-column: 2 / span 2;
  grid-row: 1;
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px 0 11px;
  min-width: 0;
  background: var(--mw-shell);
}
.mw-win.no-side .mw-titlebar { padding-left: 19px; }
.mw-win.no-side .mw-titlebar > .mw-traffic { margin-right: 14px; }
.mw-tabs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; overflow: hidden; }
.mw-tab {
  position: relative;
  flex: 0 1 auto;
  min-width: 70px;
  max-width: 220px;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 0 9px;
  border-radius: 16px;
  color: var(--mw-text);
  transition: background-color 0.18s;
}
.mw-tab:hover { background: var(--mw-hover); }
.mw-tab.on {
  background: var(--mw-tab);
  color: var(--mw-ink);
  box-shadow: 0 0 0 0.5px var(--mw-line-strong), 0 1px 2px rgba(0, 0, 0, 0.05);
}
.mw-tab-x {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--mw-muted);
  flex: none;
}
.mw-tab-x:hover { background: var(--mw-pressed); color: var(--mw-ink); }
.mw-tab-t { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.mw-tab:not(.on) .mw-tab-t { font-weight: 500; }
.mw-tab-plus {
  width: 28px;
  height: 28px;
  margin-left: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--mw-muted);
  flex: none;
}
.mw-tab-plus:hover { background: var(--mw-hover); }
.mw-title-end { display: inline-flex; align-items: center; gap: 8px; flex: none; }

.mw-bell-pop {
  position: absolute;
  top: 44px;
  right: 46px;
  z-index: 20;
  width: 310px;
  padding: 8px;
  border-radius: 18px;
  background: var(--mw-pop);
  box-shadow: 0 0 0 0.5px var(--mw-line-strong), 0 16px 40px -10px rgba(0, 0, 0, 0.28);
  animation: mw-pop 0.22s var(--mw-ease) both;
}
@keyframes mw-pop {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.mw-pop-h { margin: 8px 10px 4px; font-size: 12px; font-weight: 700; color: var(--mw-ink); }
.mw-pop-i { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 10px; }
.mw-pop-i:hover { background: var(--mw-hover); }
.mw-pop-i > :first-child { margin-top: 1px; color: var(--mw-side-glyph); }
.mw-pop-i b { display: block; font-weight: 600; }
.mw-pop-i small { display: block; color: var(--mw-muted); font-size: 12.5px; margin-top: 1px; }
.mw-pop-none { margin: 2px 10px 8px; color: var(--mw-muted); }

/* ------------------------------------------------------------------ content: browse on the shell, a document on a raised page */

.mw-content {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mw-win.is-doc .mw-content {
  margin: 0 8px 8px 0;
  border-radius: 14px;
  background: var(--mw-page);
  box-shadow: var(--mw-page-shadow);
}
.mw-win.is-doc.with-panel .mw-content { margin-right: 9px; }
.mw-win.no-side.is-doc .mw-content { margin-left: 8px; }
.mw-page-head {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 14px;
  background: linear-gradient(to bottom, var(--mw-page) 66%, transparent 100%);
  pointer-events: none;
}
.mw-page-head > * { pointer-events: auto; }
.mw-circle {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--mw-ink);
  background: var(--mw-page);
  box-shadow: 0 0 0 0.5px var(--mw-line-strong), 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: background-color 0.15s;
}
.mw-circle:hover { background: color-mix(in srgb, var(--mw-page) 94%, var(--mw-ink)); }

.mw-page-scroll {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--mw-line-strong) transparent;
}

/* Browse pages */
.mw-browse { padding: 4px 18px 40px 22px; }
.mw-browse-head {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 46px;
  margin-top: 5px;
}
.mw-browse-head h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }

.mw-greet { display: flex; align-items: center; gap: 14px; margin: 18px 22px 30px 10px; }
.mw-spirit { width: 46px; height: 46px; flex: none; mix-blend-mode: darken; background: url("/assets/icon/spirit-light.webp") center / contain no-repeat; }
:root[data-theme="dark"] .mw-spirit { background-image: url("/assets/icon/spirit-dark.webp"); mix-blend-mode: lighten; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mw-spirit { background-image: url("/assets/icon/spirit-dark.webp"); mix-blend-mode: lighten; }
}
.mw-greet h2 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.mw-greet p { margin: 5px 0 0; color: var(--mw-text); font-size: 14px; }
.mw-greet-actions { margin-left: auto; display: inline-flex; gap: 10px; }

.mw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--mw-page);
  color: var(--mw-ink);
  font-weight: 600;
  box-shadow: 0 0 0 0.5px var(--mw-line-strong), 0 1px 2px rgba(0, 0, 0, 0.05);
  white-space: nowrap;
  transition: background-color 0.15s, opacity 0.15s;
}
.mw-btn:hover { background: color-mix(in srgb, var(--mw-page) 94%, var(--mw-ink)); }
.mw-btn.dark { background: var(--mw-dark-btn); color: var(--mw-dark-btn-fg); box-shadow: none; }
.mw-btn.dark:hover { opacity: 0.88; background: var(--mw-dark-btn); }
.mw-btn.grey { background: var(--mw-select); box-shadow: none; }
.mw-btn.grey:hover { background: var(--mw-pressed); }
.mw-btn.small { height: 30px; padding: 0 12px; border-radius: 8px; font-size: 13px; }
.mw-btn:disabled { opacity: 0.4; }

.mw-masonry { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; margin: 0 22px 0 10px; }
.mw-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.mw-card {
  display: flex !important;
  flex-direction: column;
  padding: 18px 20px 20px !important;
  border-radius: 14px;
  background: var(--mw-card) !important;
  box-shadow: var(--mw-card-shadow);
  transition: transform 0.24s var(--mw-ease), box-shadow 0.24s var(--mw-ease);
}
.mw-card:hover { transform: translateY(-2px); box-shadow: var(--mw-card-shadow), 0 14px 30px -14px rgba(0, 0, 0, 0.2); }
.mw-card-t { font-size: 19px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.25; }
.mw-card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 4px; color: var(--mw-muted); font-size: 13px; }
.mw-card-rule { display: block; height: 0.5px; background: var(--mw-line-strong); margin: 14px 0 12px; }
.mw-card-body {
  display: block;
  font-size: 12px;
  line-height: 1.6;
  color: var(--mw-ink);
  opacity: 0.72;
  max-height: 176px;
  overflow: hidden;
  pointer-events: none;
}
.mw-card-empty { color: var(--mw-faint); font-size: 13.5px; }
.mw-card-body .mw-h2, .mw-card-body .mw-h3, .mw-tile-page .mw-h2, .mw-tile-page .mw-h3 { font-size: 12.5px; margin: 8px 0 4px; font-weight: 700; }
.mw-card-body .mw-p, .mw-tile-page .mw-p { margin: 0 0 6px; font-size: inherit; line-height: inherit; }
.mw-card-body .mw-ul, .mw-card-body .mw-ol, .mw-card-body .mw-task,
.mw-tile-page .mw-ul, .mw-tile-page .mw-ol, .mw-tile-page .mw-task { margin: 0 0 6px; font-size: inherit; line-height: inherit; }
.mw-card-body .mw-ol li, .mw-card-body .mw-ul li, .mw-card-body .mw-task li { margin: 2px 0; }
.mw-card-body .mw-callout, .mw-tile-page .mw-callout { padding: 7px 10px; margin: 4px 0 8px; font-size: inherit; border-radius: 8px; }
.mw-card-body .mw-table, .mw-tile-page .mw-table { font-size: 11px; }
.mw-card-body .mw-table th, .mw-card-body .mw-table td,
.mw-tile-page .mw-table th, .mw-tile-page .mw-table td { padding: 4px 6px; }
.mw-card-body .mw-code, .mw-tile-page .mw-code { font-size: 10.5px; padding: 8px 10px; margin: 4px 0 8px; }
.mw-card-body .mw-quote, .mw-tile-page .mw-quote { font-size: inherit; margin: 0 0 6px; }
.mw-card-body .mw-check, .mw-tile-page .mw-check { width: 12px; height: 12px; border-radius: 3px; }

.mw-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 26px 18px; margin: 22px 22px 0 10px; }
.mw-tile { display: flex !important; flex-direction: column; gap: 3px; min-width: 0; }
.mw-tile-page {
  display: block;
  aspect-ratio: 4 / 3.3;
  margin-bottom: 8px;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--mw-card);
  box-shadow: var(--mw-card-shadow);
  overflow: hidden;
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--mw-ink);
  pointer-events: none;
  transition: transform 0.24s var(--mw-ease), box-shadow 0.24s var(--mw-ease);
}
.mw-tile-page > * { opacity: 0.72; }
.mw-tile-page .mw-h1 { display: block; font-size: 14px; margin: 0 0 6px; opacity: 0.9; }
.mw-tile:hover .mw-tile-page { transform: translateY(-2px); box-shadow: var(--mw-card-shadow), 0 14px 30px -14px rgba(0, 0, 0, 0.2); }
.mw-tile-t { display: flex; align-items: center; gap: 6px; font-weight: 600; padding: 0 2px; }
.mw-tile-m { color: var(--mw-muted); font-size: 12.5px; padding: 0 2px; }
.mw-mini-h1 { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }

.mw-list { display: flex; flex-direction: column; margin: 16px 22px 0 10px; }
.mw-list-h, .mw-list-r {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 12px;
  align-items: center;
  padding: 0 12px;
}
.mw-list-h { color: var(--mw-muted); font-size: 12.5px; height: 32px; border-bottom: 0.5px solid var(--mw-line-strong); }
.mw-list-r { height: 40px !important; border-radius: 10px; color: var(--mw-text); }
.mw-list-r:hover { background: var(--mw-hover); }
.mw-list-r span:first-child { display: flex; align-items: center; gap: 9px; color: var(--mw-ink); font-weight: 500; }
.mw-list-r span:first-child .mo-ic { color: var(--mw-side-glyph); }
.mw-list-marks { display: inline-flex; gap: 6px; }

/* AI Projects: the folder cards (181 × 160 pt, five a row) */
.mw-folders { display: grid; grid-template-columns: repeat(5, 181px); gap: 40px 20px; margin: 51px 0 0 10px; }
.mw-folder { position: relative; display: block !important; width: 181px; height: 162px; }
.mw-folder-back {
  position: absolute;
  left: 0;
  right: 0;
  top: 12px;
  bottom: 0;
  border-radius: 14px;
  background: #3d3d40;
}
.mw-papers { position: absolute; z-index: 0; left: 16px; right: 10px; top: 0; height: 90px; transition: transform 0.34s var(--mw-ease); }
.mw-papers i {
  position: absolute;
  top: 4px;
  width: 58%;
  height: 86px;
  padding: 8px 9px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.18), 0 -1px 4px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}
.mw-papers i:nth-child(1) { left: 0; transform: rotate(-3deg); }
.mw-papers i:nth-child(2) { left: 26%; top: 0; z-index: 1; }
.mw-papers i:nth-child(3) { left: 46%; top: 6px; transform: rotate(4deg); z-index: 0; }
.mw-papers em { display: block; height: 2px; margin-bottom: 3px; border-radius: 1px; background: rgba(0, 0, 0, 0.18); width: 70%; }
.mw-papers em:first-child { width: 45%; background: rgba(0, 0, 0, 0.5); }
.mw-papers s { position: absolute; left: 14px; right: 14px; top: 22px; bottom: 0; border-radius: 2px; }
.mw-folder:hover .mw-papers { transform: translateY(-8px); }
.mw-folder-front {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 181px;
  height: 128px;
  fill: #29292b;
  filter: drop-shadow(0 -0.5px 0 rgba(255, 255, 255, 0.14)) drop-shadow(0 6px 12px rgba(0, 0, 0, 0.18));
}
.mw-folder.on .mw-folder-front { fill: #232326; }
.mw-folder-text {
  position: absolute;
  left: 16px;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  color: #fff;
}
.mw-folder-text b { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.mw-folder-text small { margin-top: 1px; font-size: 12.5px; color: rgba(255, 255, 255, 0.72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mw-folder-foot { margin-top: 13px; display: flex; align-items: center; justify-content: space-between; }
.mw-marks { display: inline-flex; gap: 2px; }
.mw-mark {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.mw-mark .mo-mono-mark { filter: none !important; }
.mw-kind {
  height: 19px;
  padding: 0 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  color: #3a3a3a;
  font-size: 12px;
  font-weight: 500;
  line-height: 19px;
}

/* AI Projects Cover Flow inside MomoWindow */
.mw-browse-flow { padding-bottom: 24px; }
.mw-flow-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  gap: 18px;
  align-items: start;
  margin: 14px 14px 0 4px;
}
.mw-flow-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.mw-barrel {
  min-height: 274px;
  padding: 18px 0 10px;
}
.mw-collector {
  background: var(--mw-card);
  border-radius: 14px;
  padding: 16px 20px;
  box-shadow: var(--mw-card-shadow);
}
.mw-flow-crew {
  padding-top: 8px;
}
.mw-win.narrow .mw-flow-split {
  grid-template-columns: 1fr;
}

/* Editable scratchpad for New document (draft) */
.mw-scratch {
  display: flex;
  flex-direction: column;
}
.mw-scratch-title {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  font-family: var(--mw-font);
  outline: none;
}
.mw-scratch-title::placeholder { color: var(--mw-faint); }
.mw-scratch-body {
  width: 100%;
  min-height: 360px;
  border: 0;
  padding: 0;
  resize: none;
  background: transparent;
  color: var(--mw-ink);
  font: 400 16px/26px var(--mw-font);
  outline: none;
}
.mw-scratch-body::placeholder { color: var(--mw-faint); }

/* ------------------------------------------------------------------ the document page */

.mw-doc {
  width: min(680px, calc(100% - 132px));
  margin: 0 auto;
  padding: 104px 0 96px;
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}
.mw-doc-body { color: var(--mw-ink); font-size: 16px; line-height: 26px; }
.mw-doc-meta { margin: -6px 0 22px; color: var(--mw-muted); font-size: 12.5px; line-height: 1.4; }
.mw-h1 { margin: 0 0 12px; font-size: 34px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; color: var(--mw-ink); }
.mw-h2 { margin: 30px 0 10px; font-size: 22px; line-height: 1.3; font-weight: 700; letter-spacing: -0.012em; color: var(--mw-ink); }
.mw-h3 { margin: 22px 0 8px; font-size: 18px; line-height: 1.35; font-weight: 700; color: var(--mw-ink); }
.mw-p { margin: 0 0 9px; }
.mw-p code, .mw-table code, .mw-ul code {
  font: 0.86em var(--mw-mono);
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--mw-select);
  box-shadow: 0 0 0 0.5px var(--mw-line);
}
.mw-hl { background: var(--mw-hl); color: inherit; padding: 1px 0; }
.mw-link { color: var(--mw-accent); }
.mw-placeholder { color: var(--mw-faint); }
.mw-ul, .mw-ol { margin: 0 0 9px; padding-left: 24px; }
.mw-ul li::marker { color: var(--mw-accent); }
.mw-ul li, .mw-ol li { margin: 0 0 8px; padding-left: 4px; }
.mw-task { list-style: none; margin: 0 0 9px; padding: 0; }
.mw-task li { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; }
.mw-task li.done span { color: var(--mw-muted); text-decoration: line-through; text-decoration-color: var(--mw-faint); }
.mw-check {
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 5px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1.3px var(--mw-faint);
  color: #fff;
  transition: background-color 0.15s;
}
.mw-task li.done .mw-check { background: var(--mw-accent); box-shadow: none; }
.mw-quote { margin: 0 0 12px; padding: 0 0 0 14px; border-left: 3px solid var(--mw-line-strong); color: var(--mw-text); }
.mw-callout {
  margin: 6px 0 16px;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid var(--mw-callout-note-edge);
  background: var(--mw-callout-note);
}
.mw-callout b { display: flex; align-items: center; gap: 7px; font-weight: 600; color: var(--mw-callout-note-fg); }
.mw-callout span { display: block; margin-top: 4px; }
.mw-callout.tip { border-color: var(--mw-callout-tip-edge); background: var(--mw-callout-tip); }
.mw-callout.tip b { color: var(--mw-callout-tip-fg); }
.mw-table-wrap { margin: 8px 0 16px; overflow: hidden; border: 1px solid var(--mw-line-strong); }
.mw-table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.4; }
.mw-table th, .mw-table td { padding: 11px 13px; text-align: left; border-bottom: 1px solid var(--mw-line-strong); border-right: 1px solid var(--mw-line-strong); }
.mw-table th:last-child, .mw-table td:last-child { border-right: 0; }
.mw-table tr:last-child td { border-bottom: 0; }
.mw-table th { font-weight: 500; background: var(--mw-hover); }
.mw-code {
  margin: 6px 0 16px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--mw-hover);
  box-shadow: 0 0 0 1px var(--mw-line);
  font: 13px/1.65 var(--mw-mono);
  white-space: pre-wrap;
  color: var(--mw-ink);
}

/* Comment anchors, the change and the agent's cursor */
.mw-anchor {
  background: var(--mw-anchor);
  box-shadow: inset 0 -1.5px 0 var(--mw-anchor-line);
  cursor: pointer;
  transition: background-color 0.2s;
}
.mw-anchor.on { background: color-mix(in srgb, var(--mw-anchor-line) 34%, transparent); }
.mw-anchor.working { animation: mw-working 1.2s ease-in-out infinite; }
@keyframes mw-working {
  50% { background: color-mix(in srgb, var(--mw-claude) 18%, transparent); box-shadow: inset 0 -1.5px 0 var(--mw-claude); }
}
.mw-diff { cursor: pointer; }
.mw-diff del { color: var(--mw-del-fg); background: var(--mw-del); text-decoration-color: var(--mw-del-fg); }
.mw-diff ins { margin-left: 3px; color: var(--mw-ins-fg); background: var(--mw-ins); text-decoration: none; animation: mw-ins 0.6s var(--mw-ease) both; }
.mw-diff.on ins { box-shadow: inset 0 -1.5px 0 var(--mw-ins-fg); }
@keyframes mw-ins { from { background: color-mix(in srgb, var(--mw-ins-fg) 40%, transparent); } }

.mw-sel-btn {
  position: absolute;
  z-index: 6;
  transform: translate(-50%, -100%);
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 8px 0 11px !important;
  border-radius: 10px;
  background: var(--mw-pop) !important;
  box-shadow: 0 0 0 0.5px var(--mw-line-strong), 0 8px 20px -6px rgba(0, 0, 0, 0.25);
  font-weight: 500;
  white-space: nowrap;
  animation: mw-pop 0.18s var(--mw-ease) both;
}
.mw-agent-cursor {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  display: flex;
  align-items: flex-start;
  transition: left 0.6s var(--mw-ease), top 0.6s var(--mw-ease);
}
.mw-agent-cursor svg { fill: var(--mw-claude); flex: none; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2)); }
.mw-agent-cursor span {
  margin: 12px 0 0 -2px;
  padding: 5px 10px 6px;
  border-radius: 4px 12px 12px 12px;
  background: var(--mw-claude);
  color: #fff;
  font-size: 12.5px;
  line-height: 1.3;
  white-space: nowrap;
  box-shadow: 0 6px 16px -6px rgba(80, 50, 200, 0.5);
}
.mw-agent-cursor b { display: block; font-weight: 600; }

.mw-float-send {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 4;
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 16px !important;
  border-radius: 18px;
  background: var(--mw-dark-btn) !important;
  color: var(--mw-dark-btn-fg) !important;
  font-weight: 600;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.45);
  animation: mw-pop 0.3s var(--mw-ease) both;
}
.mw-float-send:hover { opacity: 0.9; }

/* ------------------------------------------------------------------ right panel: comments and info */

.mw-panel {
  grid-column: 3;
  grid-row: 2;
  width: 294px;
  min-width: 294px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 8px 12px 0;
}
.mw-panel-tabs {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 47px;
  margin: 0 10px 0 10px;
  border-bottom: 0.5px solid var(--mw-line-strong);
}
.mw-panel-tabs > button:not(.mw-more) {
  position: relative;
  height: 47px;
  font-size: 14px;
  color: var(--mw-text);
}
.mw-panel-tabs > button.on { color: var(--mw-ink); font-weight: 700; }
.mw-panel-tabs > button.on::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  height: 2px;
  border-radius: 1px;
  background: var(--mw-ink);
}
.mw-more {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--mw-glyph);
}
.mw-more:hover { background: var(--mw-hover); }
.mw-presence { display: flex; align-items: center; gap: 10px; margin: 12px 10px 0 12px; font-size: 14px; }
.mw-av {
  flex: none;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--mw-page);
  box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--mw-claude) 55%, transparent);
}
.mw-seg.mw-cm-seg { display: flex; margin: 16px 10px 4px 10px; height: 28px; }
.mw-seg.mw-cm-seg button { flex: 1; font-size: 14px; }
.mw-cm-group { display: flex; align-items: center; justify-content: space-between; margin: 10px 10px 2px 14px; }
.mw-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--mw-chip-bg);
  color: var(--mw-chip-fg);
  font-size: 12.5px;
  font-weight: 600;
}
.mw-chip i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.mw-cm-group button { color: var(--mw-muted); font-size: 13px; }
.mw-cm-group button:hover { color: var(--mw-ink); }
.mw-cm-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 0 6px 4px; scrollbar-width: none; }
.mw-cm-list::-webkit-scrollbar { display: none; }
.mw-cm {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 10px 10px 10px 12px !important;
  border-radius: 12px;
  transition: background-color 0.15s;
}
.mw-cm:hover { background: var(--mw-hover); }
.mw-cm .mw-av { margin-top: 1px; }
.mw-ring { width: 18px; height: 18px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 1.3px var(--mw-faint); display: inline-block; }
.mw-ring.big { width: 22px; height: 22px; margin-top: 1px; }
.mw-cm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mw-cm-t { font-size: 14px; line-height: 1.45; color: var(--mw-ink); }
.mw-cm.done .mw-cm-t { color: var(--mw-text); }
.mw-cm-sub { color: var(--mw-muted); font-size: 13px; }
.mw-cm-sub.working { color: var(--mw-claude); }
.mw-cm-sub.review { color: var(--mw-accent); }
.mw-cm-time { color: var(--mw-faint); font-size: 12px; white-space: nowrap; margin-top: 2px; }
.mw-cm-card {
  margin: 4px 0 8px;
  padding: 12px 12px 12px 12px;
  border-radius: 14px;
  background: var(--mw-page);
  box-shadow: 0 0 0 0.5px var(--mw-line-strong), 0 2px 8px -2px rgba(0, 0, 0, 0.08);
  animation: mw-pop 0.22s var(--mw-ease) both;
}
.mw-cm-card .mw-cm-q {
  margin: 0 0 6px;
  padding-left: 9px;
  border-left: 2px solid var(--mw-line-strong);
  color: var(--mw-muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mw-cm-card .mw-cm-t { margin: 0; font-weight: 600; }
.mw-reply {
  margin: 10px 0 0;
  padding: 8px 10px 9px 11px;
  border-radius: 8px;
  background: var(--mw-hover);
  box-shadow: inset 2px 0 0 var(--mw-claude);
}
.mw-reply-h { display: flex; align-items: center; gap: 6px; }
.mw-reply-h b { font-weight: 600; }
.mw-reply-h small { margin-left: auto; color: var(--mw-faint); font-size: 12px; }
.mw-reply p { margin: 3px 0 0; font-size: 13.5px; line-height: 1.5; }
.mw-cm-status { display: flex; align-items: center; gap: 6px; margin-top: 10px; color: var(--mw-text); font-size: 13px; }
.mw-cm-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--mw-faint); }
.mw-cm-status.working i { background: var(--mw-claude); animation: mw-blink 1s infinite; }
.mw-cm-status.review i { background: #e87600; }
.mw-cm-status.resolved i { background: #30b85c; }
.mw-cm-status .mw-ring { width: 13px; height: 13px; }
.mw-cm-status small { color: var(--mw-muted); font-size: 12.5px; }
@keyframes mw-blink { 50% { opacity: 0.35; } }
.mw-file-chip {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  height: 24px;
  margin-top: 8px;
  padding: 0 9px !important;
  border-radius: 12px;
  background: var(--mw-hover) !important;
  box-shadow: 0 0 0 0.5px var(--mw-line);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
}
.mw-file-chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--mw-accent); flex: none; }
.mw-file-chip small { color: var(--mw-muted); font-size: 12.5px; }
.mw-cm-actions { display: flex; gap: 6px; margin-top: 10px; }
.mw-cm-actions.end { justify-content: flex-end; }
.mw-cm-card textarea {
  display: block;
  width: 100%;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--mw-ink);
  font: 14px/1.45 var(--mw-font);
  padding: 0;
}
.mw-cm-empty { margin: 20px 10px; color: var(--mw-muted); font-size: 13px; text-align: center; }
.mw-cm-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  margin: 0 0 0 10px;
  padding: 10px 0 0;
  border-top: 0.5px solid var(--mw-line-strong);
}
.mw-text-btn { color: var(--mw-muted); font-size: 14px; }
.mw-text-btn:hover { color: var(--mw-ink); }
.mw-send {
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 14px !important;
  border-radius: 9px;
  background: var(--mw-dark-btn) !important;
  color: var(--mw-dark-btn-fg) !important;
  font-weight: 600;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.mw-send:hover { opacity: 0.88; }
.mw-send:disabled { background: var(--mw-select) !important; color: var(--mw-muted) !important; opacity: 1; }
.mw-info { padding: 4px 10px 4px 12px; overflow-y: auto; }
.mw-info-h { margin: 16px 0 8px; font-size: 12.5px; font-weight: 700; color: var(--mw-ink); }
.mw-info dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 9px 14px; font-size: 13px; }
.mw-info dt { display: flex; align-items: center; gap: 6px; color: var(--mw-muted); }
.mw-info dd { margin: 0; color: var(--mw-ink); }
.mw-info-path { margin: 0; font: 12px/1.5 var(--mw-mono); color: var(--mw-text); word-break: break-all; }
.mw-info-act {
  display: flex !important;
  align-items: center;
  width: 100%;
  height: 34px;
  margin-bottom: 6px;
  padding: 0 12px !important;
  border-radius: 10px;
  background: var(--mw-select) !important;
  font-weight: 500;
}
.mw-info-act:hover { background: var(--mw-pressed) !important; }

/* ------------------------------------------------------------------ search, toast */

.mw-search-veil {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 110px;
  background: rgba(0, 0, 0, 0.08);
  animation: mw-fade 0.18s both;
}
@keyframes mw-fade { from { opacity: 0; } }
.mw-search {
  width: 540px;
  border-radius: 18px;
  background: var(--mw-pop);
  box-shadow: 0 0 0 0.5px var(--mw-line-strong), 0 24px 60px -16px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  animation: mw-pop 0.22s var(--mw-ease) both;
}
.mw-search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 0 16px;
  border-bottom: 0.5px solid var(--mw-line-strong);
  color: var(--mw-muted);
}
.mw-search-field input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--mw-ink); font: 17px var(--mw-font); }
.mw-search-list { max-height: 340px; overflow-y: auto; padding: 6px; }
.mw-search-list button { display: flex !important; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 10px !important; border-radius: 10px; }
.mw-search-list button .mo-ic { color: var(--mw-side-glyph); }
.mw-search-list button:hover { background: var(--mw-hover); }
.mw-search-list small { margin-left: auto; color: var(--mw-muted); }

.mw-toast {
  position: absolute;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  transform: translate(-50%, 12px);
  padding: 10px 16px;
  border-radius: 14px;
  background: var(--mw-dark-btn);
  color: var(--mw-dark-btn-fg);
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.3s var(--mw-ease);
}
.mw-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .mw-win, .mw-win * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* Hero stage around the window */
.win-stage#stage {
  border: 0;
  border-radius: 16px;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}
.stage-hint {
  margin: 22px auto 0;
  max-width: 640px;
  text-align: center;
  color: var(--muted, #6b6b6b);
  font-size: 14px;
  line-height: 1.6;
}

/* Sidebar doc rows draw a thumbnail of the page, as the app does */
.mw-row-thumb {
  width: 13px;
  height: 16px;
  flex: none;
  margin: 0 1px 0 1.5px;
  padding: 3px 2.5px;
  display: flex;
  flex-direction: column;
  gap: 1.5px;
  border-radius: 2.5px;
  background: var(--mw-page);
  box-shadow: 0 0 0 0.5px var(--mw-line-strong), 0 0.5px 1px rgba(0, 0, 0, 0.06);
}
.mw-row-thumb i { display: block; height: 1px; border-radius: 1px; background: var(--mw-faint); }
.mw-row-thumb i:first-child { width: 70%; background: var(--mw-muted); }
.mw-row-thumb i:nth-child(3) { width: 80%; }
.mw-row-thumb i:last-child { width: 45%; }
.mw-tab-ic { flex: none; color: var(--mw-ink); }

/* An AI edit waiting for review: 0.1.3 paints a 3 pt bar 12 pt left of the text (Theme.changeModified, b500) */
.mw-p:has(.mw-changed), .mw-ul li:has(.mw-changed) { position: relative; }
.mw-p:has(.mw-changed)::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 2px;
  bottom: 2px;
  width: 3px;
  border-radius: 1.5px;
  background: #3a85f7;
}
.mw-changed { animation: mw-changed-wash 1.2s var(--mw-ease) both; }
@keyframes mw-changed-wash { from { background: rgba(58, 133, 247, 0.28); } }

/* A hidden sidebar keeps its 220 pt width while its column closes; take it out of view so it never covers the tabs */
.mw-side { transition: opacity 0.2s var(--mw-ease), visibility 0s; }
.mw-win.no-side .mw-side { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.15s var(--mw-ease), visibility 0s 0.15s; }

/* ------------------------------------------------------------------ narrow windows
   Below 1280 the window is laid out at a smaller real width, like resizing it on the Mac. Under 700pt (sidebar + the
   480pt page minimum) the sidebar folds away and, asked for, slides in over the page; the panel floats over the page
   once there is no room for it beside the page. */

.mw-content { container: mw-content / inline-size; }

.mw-win.side-float .mw-side {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 15;
  background: var(--mw-shell);
  border-radius: 16px 0 0 16px;
  box-shadow: 0.5px 0 0 var(--mw-line-strong), 14px 0 36px rgba(0, 0, 0, 0.14);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  animation: mw-side-in 0.26s var(--mw-ease) both;
}
@keyframes mw-side-in { from { transform: translateX(-24px); opacity: 0; } }
.mw-scrim {
  position: absolute;
  inset: 0;
  z-index: 14;
  background: rgba(0, 0, 0, 0.1);
  animation: mw-fade-in 0.2s var(--mw-ease) both;
}
@keyframes mw-fade-in { from { opacity: 0; } }

.mw-win.panel-float .mw-panel {
  position: absolute;
  top: 51px;
  right: 0;
  bottom: 0;
  z-index: 6;
  padding-left: 8px;
  background: var(--mw-shell);
  border-radius: 14px 0 16px 0;
  box-shadow: -0.5px 0 0 var(--mw-line-strong), -14px 0 36px rgba(0, 0, 0, 0.12);
  animation: mw-panel-in 0.26s var(--mw-ease) both;
}
@keyframes mw-panel-in { from { transform: translateX(24px); opacity: 0; } }

.mw-grid { grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); }
.mw-folders { grid-template-columns: repeat(auto-fill, 181px); margin-right: 18px; }
.mw-search { max-width: calc(100% - 40px); }
.mw-bell-pop { max-width: calc(100% - 60px); }

@container mw-content (max-width: 640px) {
  .mw-greet { flex-wrap: wrap; row-gap: 16px; }
  .mw-greet > div:not(.mw-greet-actions) { flex: 1; min-width: 0; }
  .mw-greet-actions { margin-left: 0; flex-basis: 100%; }
  .mw-browse-head:has(h2) { flex-wrap: wrap; row-gap: 10px; height: auto; min-height: 46px; }
  .mw-browse-head h2 { flex-basis: 100%; }
  .mw-browse-head:has(h2) .mw-sp { display: none; }
  .mw-doc { width: calc(100% - 72px); padding-top: 84px; }
}
@container mw-content (max-width: 520px) {
  .mw-browse { padding-left: 14px; padding-right: 12px; }
  .mw-greet { margin-left: 4px; margin-right: 8px; }
  .mw-masonry, .mw-grid, .mw-list { margin-left: 4px; margin-right: 8px; }
  .mw-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; margin-top: 18px; }
  .mw-tile-page { padding: 12px 13px; border-radius: 12px; }
  .mw-tile-page > * { zoom: 0.8; }
  .mw-list-h, .mw-list-r { grid-template-columns: minmax(0, 1fr) auto; column-gap: 14px; }
  .mw-list-h > :nth-child(2), .mw-list-r > :nth-child(2) { display: none; }
  .mw-folders { zoom: 0.86; gap: 32px 16px; margin-left: 4px; margin-right: 0; }
  .mw-doc { width: calc(100% - 48px); }
}
