/* MosChip Financial Reporting System components (.m-*), ported from docs/ui-design/frs.css. Tokens: tokens.css. Geist is the only font.
   Differences from the design file: zero-specificity base resets (so older screens keep their own rules), link and focus rules
   adjusted for the app shell, input borders use --ctl (3:1 non-text contrast), and the layout hooks of the shell at the end. */


/* ── base ── */
.m, .m * { box-sizing: border-box; }
.m { font-family: var(--font); font-size: 14px; line-height: 20px; color: var(--ink); background: var(--canvas); -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1, "cv11" 1; min-height: 100vh; }
.m :where(h1, h2, h3, p, ul, ol) { margin: 0; }
.m :where(h1, h2, h3, h4) { font-weight: 600; }
.m :where(ul, ol) { padding: 0; list-style: none; }
.m :where(a) { color: var(--brand-deep); }
.m :where(.m-logo-link, a.m-task, a.m-btn, a.m-ask) { color: inherit; }
.m-menu a:hover, .m-subnav a:hover, .m-tabbar a:hover, a.m-task:hover, a.m-btn:hover, a.m-ask:hover, .m-logo-link:hover, .m-seg a:hover { text-decoration: none; }
.m :where(button) { font: inherit; color: inherit; }
.m :focus-visible { outline: var(--focus-ring); outline-offset: 2px; box-shadow: none; }
.m .num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.m .id { letter-spacing: 0.01em; font-weight: 500; white-space: nowrap; }
.m .muted { color: var(--ink-3); }
.m .t-xl { font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: -0.025em; }
.m .t-lg { font-size: 20px; line-height: 26px; font-weight: 600; letter-spacing: -0.015em; }
.m .t-md { font-size: 15px; line-height: 22px; font-weight: 600; letter-spacing: -0.005em; }
.m .t-sm { font-size: 12.5px; line-height: 16px; font-weight: 500; color: var(--ink-3); }
.m .fig { font-size: 30px; line-height: 34px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.m .fig small { font-size: 0.55em; font-weight: 500; color: var(--ink-3); margin-left: 3px; letter-spacing: 0; }

@keyframes m-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes m-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes m-pop { 0% { opacity: 0; transform: scale(.94); } 60% { opacity: 1; transform: scale(1.02); } 100% { transform: none; } }
@keyframes m-grow-x { from { transform: scaleX(0); } to { transform: none; } }
@keyframes m-grow-y { from { transform: scaleY(0); } to { transform: none; } }
@keyframes m-panel { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes m-sheet { from { transform: translateX(100%); } to { transform: none; } }
@keyframes m-check { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.12); opacity: 1; } 100% { transform: none; } }
@keyframes m-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(234,84,63,.35); } 50% { box-shadow: 0 0 0 5px rgba(234,84,63,0); } }
@keyframes m-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes m-spin { to { transform: rotate(1turn); } }
@keyframes m-toast { from { opacity: 0; transform: translateY(12px) scale(.98); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }

/* ── top navigation (menu: five items plus Assistant) ── */
.m-top { position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; gap: 28px; padding: 0 24px; background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.m-logo { display: block; height: 20px; width: auto; flex: none; }
.m-menu { display: flex; gap: 2px; height: 100%; }
.m-menu a { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; height: 100%; font-weight: 500; color: var(--ink-2); transition: color .15s ease; }
.m-menu a:hover { color: var(--ink); }
.m-menu a::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand); transform: scaleX(0); transition: transform .25s var(--ease-expo); }
.m-menu a[aria-current="page"] { color: var(--ink); }
.m-menu a[aria-current="page"]::after { transform: none; }
.m-menu em { font-style: normal; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--coral); color: var(--ink); font-size: 11.5px; font-weight: 600; display: inline-grid; place-items: center; }
.m-top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.m-period { display: inline-flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 500; cursor: pointer; }
.m-period .dot { width: 8px; height: 8px; border-radius: 50%; }
.m-ask { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 8px; border-radius: 999px; border: 1px solid var(--brand-line); background: var(--brand-tint); color: var(--brand-deep); font-weight: 600; cursor: pointer; transition: transform .15s var(--ease), box-shadow .15s ease; }
.m-ask:hover { box-shadow: 0 0 0 4px rgba(105,58,148,.10); }
.m-ask:active { transform: scale(.97); }
.m-ask kbd { font: inherit; font-size: 11.5px; font-weight: 500; color: var(--ink-3); padding: 0 5px; border-radius: 5px; background: rgba(255,255,255,.7); }
.m-me { display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 6px 0 4px; border-radius: 999px; border: 0; background: none; cursor: pointer; text-align: left; }
.m-me:hover { background: var(--hover); }
.m-me > span:last-child b { display: block; font-size: 13px; line-height: 16px; font-weight: 600; }
.m-me > span:last-child span { display: block; font-size: 12px; line-height: 15px; color: var(--ink-3); }
.m-av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: #fff; background: var(--brand); flex: none; }
.m-av--rev { background: #2b4c86; } .m-av--cfo { background: #0b6a4e; } .m-av--adm { background: #4b4655; }
.m-av--sm { width: 24px; height: 24px; font-size: 10.5px; }

/* ── page ── */
.m-page { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; display: flex; flex-direction: column; gap: 20px; }
.m-page > * { animation: m-rise .4s var(--ease) both; }
.m-page > *:nth-child(2) { animation-delay: 40ms; } .m-page > *:nth-child(3) { animation-delay: 80ms; } .m-page > *:nth-child(4) { animation-delay: 120ms; } .m-page > *:nth-child(n+5) { animation-delay: 160ms; }
.m-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; min-height: 40px; }
.m-head h1 { font-size: 26px; line-height: 32px; font-weight: 600; letter-spacing: -0.025em; }
.m-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.m-grid { display: grid; gap: 20px; }
.m-cols-3 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

/* ── buttons ── */
.m-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 500; white-space: nowrap; cursor: pointer; box-shadow: var(--sh-1); transition: background-color .15s ease, border-color .15s ease, transform .08s ease, box-shadow .15s ease; }
.m-btn:hover { background: var(--hover); border-color: var(--line-strong); }
.m-btn:active { transform: scale(.97); }
.m-btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 4px 14px -6px rgba(105,58,148,.7); }
.m-btn--primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
.m-btn--ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--ink-2); }
.m-btn--ghost:hover { background: var(--hover); border-color: transparent; color: var(--ink); }
.m-btn--danger { color: var(--bad); }
.m-btn--sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: var(--r-sm); }
.m-btn--lg { height: 44px; padding: 0 18px; font-size: 15px; border-radius: 12px; }
.m-btn--icon { width: 36px; padding: 0; } .m-btn--sm.m-btn--icon { width: 30px; }
.m-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.m-ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ── cards ── */
.m-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); min-width: 0; }
.m-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; min-height: 56px; }
.m-card__head h2 { font-size: 15px; line-height: 22px; font-weight: 600; }
.m-card__body { padding: 0 20px 20px; }
.m-card + .m-card { margin-top: 0; }
.m-divide > * + * { border-top: 1px solid var(--line); }

/* ── badges ── */
.m-badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; background: var(--sunken); color: var(--ink-2); }
.m-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.m-badge--plain::before { display: none; }
.m-badge--ok { background: var(--ok-tint); color: var(--ok); } .m-badge--warn { background: var(--warn-tint); color: var(--warn); }
.m-badge--bad { background: var(--bad-tint); color: var(--bad); } .m-badge--info { background: var(--info-tint); color: var(--info); }
.m-badge--brand { background: var(--brand-tint); color: var(--brand-deep); }
.m-badge--pop { animation: m-pop .45s var(--ease-pop) both; }
.m-count { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--coral); color: var(--ink); font-size: 12px; font-weight: 600; display: inline-grid; place-items: center; }
.m-count--quiet { background: var(--sunken); color: var(--ink-2); }

/* ── month status (Open → In review → Published) ── */
.m-status { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.m-status li { position: relative; padding: 12px 14px; border-radius: 12px; background: var(--sunken); color: var(--ink-3); font-weight: 500; overflow: hidden; }
.m-status li b { display: block; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-3); }
.m-status li span { display: block; margin-top: 2px; font-size: 15px; line-height: 20px; font-weight: 600; color: var(--ink-2); }
.m-status li[data-s="done"] { background: var(--brand-tint); } .m-status li[data-s="done"] span { color: var(--brand-deep); }
.m-status li[data-s="now"] { background: var(--brand); } .m-status li[data-s="now"] b { color: rgba(255,255,255,.8); } .m-status li[data-s="now"] span { color: #fff; }
.m-status li[data-s="now"]::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent); background-size: 200% 100%; animation: m-shimmer 2.4s linear infinite; }

/* ── task list ── */
.m-task { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto auto 20px; gap: 14px; align-items: center; padding: 14px 20px; transition: background-color .12s ease; }
a.m-task:hover { background: var(--hover); }
a.m-task:hover .chev { transform: translateX(3px); color: var(--ink); }
.m-task .ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand-deep); }
.m-task .ico--coral { background: var(--coral-tint); color: var(--coral-text); }
.m-task .ico--ok { background: var(--ok-tint); color: var(--ok); }
.m-task b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-task small { display: block; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-task .chev { color: var(--ink-3); transition: transform .15s var(--ease), color .15s ease; }
.m-task .big { font-size: 22px; line-height: 26px; font-weight: 600; letter-spacing: -0.02em; text-align: right; min-width: 32px; }
.m-task[data-done="true"] b { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--line-strong); }

/* ── activity ── */
.m-feed li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 20px; }
.m-feed p { font-size: 13.5px; line-height: 19px; color: var(--ink-2); }
.m-feed p b { color: var(--ink); font-weight: 600; }
.m-feed time { font-size: 12px; color: var(--ink-3); white-space: nowrap; }

/* ── KPI tiles ── */
.m-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.m-kpi { padding: 16px 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh-1); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.m-kpi > span { font-size: 12.5px; font-weight: 500; color: var(--ink-3); }
.m-kpi .fig { animation: m-pop .5s var(--ease) .15s both; }
.m-delta { font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.m-delta--up, .m-kpi > .m-delta--up { color: var(--ok); } .m-delta--down, .m-kpi > .m-delta--down { color: var(--bad); }

/* ── segmented / tabs ── */
.m-seg { position: relative; display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--sunken); }
.m-seg button, .m-seg a { position: relative; z-index: 1; height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-3); font-weight: 500; font-size: 13px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; transition: color .15s ease, background-color .15s ease, box-shadow .2s ease; }
.m-seg [aria-pressed="true"], .m-seg [aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(27,23,34,.08), 0 0 0 1px var(--line); }
.m-toggle { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.m-switch { position: relative; width: 36px; height: 20px; border-radius: 999px; background: var(--line-2); transition: background-color .2s ease; flex: none; }
.m-switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .25s var(--ease-pop); }
.m-switch[data-on="true"] { background: var(--brand); } .m-switch[data-on="true"]::after { transform: translateX(16px); }

/* ── tables ── */
.m-tablewrap { overflow-x: auto; }
.m-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.m-table th { height: 38px; padding: 0 12px; text-align: left; font-size: 12.5px; font-weight: 500; color: var(--ink-3); border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); }
.m-table td { height: 44px; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; color: var(--ink-2); }
.m-table th:first-child, .m-table td:first-child { padding-left: 20px; }
.m-table th:last-child, .m-table td:last-child { padding-right: 20px; }
.m-table th.num, .m-table td.num { text-align: right; }
.m-table tbody tr { transition: background-color .12s ease; }
.m-table tbody tr:hover { background: var(--hover); }
.m-table tbody tr:last-child td { border-bottom: 0; }
.m-table .key { color: var(--ink); font-weight: 500; }
.m-table .sub { display: block; font-size: 12.5px; color: var(--ink-3); line-height: 16px; }
.m-act { display: flex; justify-content: flex-end; gap: 6px; }

/* MIS statement */
.m-mis th.num { min-width: 112px; }
.m-mis td { height: 40px; }
.m-mis tr.grp td { background: var(--sunken); color: var(--ink); font-weight: 600; height: 36px; font-size: 12.5px; }
.m-mis tr.subt td { color: var(--ink); font-weight: 600; background: #faf9f7; }
.m-mis tr.total td { color: var(--ink); font-weight: 600; border-top: 1px solid var(--line-2); }
.m-mis tr.hero td { color: var(--ink); font-weight: 600; background: var(--brand-tint); font-size: 15px; }
.m-mis tr.pct td { color: var(--ink-3); font-size: 12.5px; height: 32px; }
.m-mis td.ind { padding-left: 36px; }
.m-mis td.ind2 { padding-left: 52px; }
.m-cell { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 88px; padding: 4px 8px; margin: -4px -8px; border-radius: 8px; border: 0; background: transparent; cursor: pointer; font-variant-numeric: tabular-nums; transition: background-color .12s ease, box-shadow .12s ease; }
.m-cell:hover { background: var(--brand-tint); box-shadow: 0 0 0 1px var(--brand-line); color: var(--brand-deep); }
.m-cell[aria-pressed="true"] { background: var(--brand); color: #fff; box-shadow: none; }
.m-cell i { width: 6px; height: 6px; border-radius: 50%; background: var(--coral); flex: none; }
.m-up, .m-table td.m-up { color: var(--ok); } .m-down, .m-table td.m-down { color: var(--bad); }

/* ── stepper (monthly close) ── */
.m-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.m-step { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); text-align: left; cursor: pointer; transition: border-color .15s ease, box-shadow .2s ease, background-color .15s ease; }
.m-step:hover { border-color: var(--line-strong); }
.m-step .n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; background: var(--sunken); color: var(--ink-2); flex: none; transition: background-color .2s ease, color .2s ease; }
.m-step b { display: block; font-weight: 600; font-size: 14px; }
.m-step small { display: block; font-size: 12.5px; color: var(--ink-3); }
.m-step[data-s="done"] .n { background: var(--ok-tint); color: var(--ok); }
.m-step[data-s="now"] { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(105,58,148,.12); }
.m-step[data-s="now"] .n { background: var(--brand); color: #fff; }
.m-step[data-s="blocked"] .n { background: var(--coral); color: var(--ink); }

/* ── drop zone and file result ── */
.m-drop { display: flex; align-items: center; gap: 16px; padding: 20px; border-radius: var(--r-lg); border: 1.5px dashed var(--line-2); background: var(--surface); transition: border-color .15s ease, background-color .15s ease; cursor: pointer; text-align: left; width: 100%; }
.m-drop:hover { border-color: var(--brand); background: var(--brand-tint); }
.m-drop .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand-deep); flex: none; }
.m-drop b { display: block; font-size: 15px; font-weight: 600; }
.m-drop small { display: block; color: var(--ink-3); font-size: 12.5px; }
.m-drop[data-s="done"] { border-style: solid; border-color: var(--ok-tint); background: var(--surface); cursor: default; }
.m-drop[data-s="done"] .ico { background: var(--ok-tint); color: var(--ok); animation: m-check .45s var(--ease-pop) both; }
.m-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.m-facts > div { padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; }
.m-facts > div + div { border-left: 1px solid var(--line); }
.m-facts span { font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.m-facts b { font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -0.02em; animation: m-pop .45s var(--ease) both; }
.m-facts > div:nth-child(2) b { animation-delay: 60ms; } .m-facts > div:nth-child(3) b { animation-delay: 120ms; } .m-facts > div:nth-child(4) b { animation-delay: 180ms; }

/* ── checks list ── */
.m-check { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 20px; }
.m-check .st { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; }
.m-check[data-s="pass"] .st { background: var(--ok-tint); color: var(--ok); }
.m-check[data-s="warn"] .st { background: var(--warn-tint); color: var(--warn); }
.m-check[data-s="block"] .st { background: var(--coral); color: var(--ink); animation: m-pulse 2.2s ease-in-out infinite; }
.m-check[data-s="wait"] .st { background: var(--sunken); color: var(--ink-3); }
.m-check b { display: block; font-weight: 600; }
.m-check p { font-size: 13px; color: var(--ink-3); margin-top: 1px; }
.m-check[data-s="block"] p { color: var(--coral-text); }
.m-check[data-s="pass"] b { color: var(--ink-2); }

/* ── review rows ── */
.m-review { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 12px 20px; transition: background-color .3s ease; }
.m-review[data-done="true"] { background: #f7fbf9; }
.m-review b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-review small { display: block; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-arrow { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.m-arrow .chip { padding: 3px 9px; border-radius: 8px; background: var(--sunken); font-size: 13px; font-weight: 500; white-space: nowrap; }
.m-arrow .chip--to { background: var(--brand-tint); color: var(--brand-deep); }
.m-select { height: 30px; padding: 0 30px 0 10px; border-radius: 8px; border: 1px solid var(--ctl); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 6.5L8 10l3.5-3.5' fill='none' stroke='%2355505f' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 8px center; appearance: none; font: inherit; font-size: 13px; color: var(--ink); }

/* ── banner (blocked / published) ── */
.m-banner { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh-1); }
.m-banner .ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.m-banner--block { border-color: #f4c9c0; background: linear-gradient(90deg, var(--coral-tint), var(--surface) 60%); }
.m-banner--block .ico { background: var(--coral); color: var(--ink); }
.m-banner--ok { border-color: #c6e6d8; background: linear-gradient(90deg, var(--ok-tint), var(--surface) 60%); }
.m-banner--ok .ico { background: var(--ok); color: #fff; animation: m-check .5s var(--ease-pop) both; }
.m-banner b { font-weight: 600; font-size: 15px; }
.m-banner .grow { flex: 1; min-width: 0; }

/* ── empty ── */
.m-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 56px 24px; text-align: center; }
.m-empty .ico { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand-deep); }
.m-empty .ico .m-ic { width: 24px; height: 24px; }
.m-empty b { font-size: 17px; font-weight: 600; }

/* ── side sheet (source of a figure) ── */
.m-scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); animation: m-fade .25s ease both; }
.m-sheet { position: fixed; z-index: 41; top: 10px; right: 10px; bottom: 10px; width: min(560px, calc(100vw - 20px)); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-3); overflow: hidden; animation: m-sheet .45s var(--ease-drawer) both; }
.m-sheet__head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.m-sheet__body { flex: 1; overflow: auto; }

/* ── board pack ── */
.m-deck { display: grid; grid-template-columns: 184px minmax(0, 1000px); gap: 24px; align-items: start; justify-content: center; }
.m-thumbs { display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 230px); overflow: auto; padding: 2px; }
.m-thumb { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; align-items: start; padding: 6px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; text-align: left; }
.m-thumb:hover { background: var(--hover); }
.m-thumb > span { font-size: 12px; color: var(--ink-3); padding-top: 2px; text-align: right; }
.m-thumb .mini { position: relative; aspect-ratio: 16 / 9; border-radius: 6px; background: #fff; border: 1px solid var(--line); overflow: hidden; padding: 6px 7px; font-size: 8px; line-height: 10px; font-weight: 600; color: var(--ink); text-align: left; display: block; }
.m-thumb .mini i { display: block; height: 3px; border-radius: 2px; background: var(--line-2); margin-top: 3px; }
.m-thumb .mini i.b { background: var(--brand); width: 60%; }
.m-thumb[aria-current="true"] .mini { outline: 2px solid var(--brand); outline-offset: 1px; }
.m-thumb .flag { position: absolute; right: 4px; bottom: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); }
.m-slide { aspect-ratio: 16 / 9; background: #fff; border-radius: 12px; border: 1px solid var(--line); box-shadow: var(--sh-2); padding: 4.2% 5%; display: flex; flex-direction: column; gap: 3%; overflow: hidden; animation: m-fade .35s ease both; }
.m-slide__bar { display: flex; align-items: center; justify-content: space-between; }
.m-slide__bar img { height: 16px; }
.m-slide h2 { font-size: 24px; line-height: 30px; font-weight: 600; letter-spacing: -0.02em; }
.m-flow { display: flex; align-items: center; gap: 4px; }
.m-flow li { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 500; background: var(--sunken); color: var(--ink-3); }
.m-flow li[data-s="done"] { background: var(--ok-tint); color: var(--ok); }
.m-flow li[data-s="now"] { background: var(--brand); color: #fff; }
.m-flow .sep { width: 14px; height: 1px; background: var(--line-2); }

/* ── charts ── */
.m-bars { display: flex; align-items: flex-end; gap: 10px; height: 140px; border-bottom: 1px solid var(--line); }
.m-bars > div { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.m-bars i { display: block; width: 100%; max-width: 16px; border-radius: 4px 4px 1px 1px; background: var(--chart-1); transform-origin: bottom; animation: m-grow-y .6s var(--ease) both; }
.m-bars i.c2 { background: var(--chart-3); }
.m-bars i.c3 { background: var(--line-2); }
.m-bars:hover > div i { opacity: .4; transition: opacity .15s ease; } .m-bars > div:hover i { opacity: 1; }
.m-axis { display: flex; gap: 10px; padding-top: 6px; } .m-axis span { flex: 1; text-align: center; font-size: 11.5px; color: var(--ink-3); }
.m-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.m-legend span { display: inline-flex; align-items: center; gap: 6px; }
.m-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--chart-1); }
.m-legend i.c2 { background: var(--chart-3); } .m-legend i.c3 { background: var(--line-2); }
.m-meter { height: 6px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.m-meter i { display: block; height: 100%; border-radius: 999px; background: var(--brand); transform-origin: left; animation: m-grow-x .8s var(--ease-expo) .2s both; }
.m-meter i.warn { background: var(--coral); } .m-meter i.ok { background: var(--chart-3); }

/* ── forms ── */
.m-field { display: flex; flex-direction: column; gap: 6px; }
.m-field label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.m-input { height: 36px; padding: 0 12px; border-radius: var(--r-md); border: 1px solid var(--ctl); background: var(--surface); font: inherit; color: var(--ink); transition: border-color .15s ease, box-shadow .15s ease; }
.m-input:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(105,58,148,.14); }
.m-input--num { text-align: right; font-variant-numeric: tabular-nums; }
.m-input--cell { height: 30px; width: 104px; text-align: right; }

/* ── assistant panel ── */
.m-ai { position: fixed; z-index: 30; top: 70px; right: 10px; bottom: 10px; width: 420px; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--sh-3); overflow: hidden; animation: m-panel .4s var(--ease-drawer) both; }
.m-ai__head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line); }
.m-ai__head b { font-size: 15px; font-weight: 600; flex: 1; }
.m-ai__stream { flex: 1; overflow: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 16px; background: var(--canvas); }
.m-ai__stream > * { animation: m-rise .4s var(--ease) both; }
.m-q { align-self: flex-end; max-width: 86%; padding: 10px 14px; border-radius: 16px 16px 4px 16px; background: var(--ink); color: #fff; font-size: 14px; line-height: 20px; }
.m-a { display: flex; flex-direction: column; gap: 10px; }
.m-a > p { font-size: 14px; line-height: 21px; color: var(--ink); }
.m-src { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-2); font-size: 12px; font-weight: 500; color: var(--brand-deep); cursor: pointer; white-space: nowrap; }
.m-src:hover { border-color: var(--brand); }
.m-answer { border-radius: 12px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.m-answer .row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 9px 12px; font-size: 13.5px; }
.m-answer .row + .row { border-top: 1px solid var(--line); }
.m-answer .row b { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.m-confirm { border-radius: 14px; background: var(--surface); border: 1px solid var(--brand-line); box-shadow: var(--sh-2); overflow: hidden; }
.m-confirm__head { padding: 12px 14px 10px; display: flex; flex-direction: column; gap: 4px; }
.m-confirm__head b { font-size: 14.5px; font-weight: 600; }
.m-ba { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border-top: 1px solid var(--line); }
.m-ba > div { padding: 10px 14px; display: flex; flex-direction: column; gap: 3px; }
.m-ba > div + div { border-left: 1px solid var(--line); background: var(--brand-tint); }
.m-ba span { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.m-ba b { font-size: 14px; font-weight: 600; }
.m-ba del { color: var(--ink-3); text-decoration-color: var(--line-strong); }
.m-confirm__foot { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--sunken); justify-content: flex-end; }
.m-done { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid #c6e6d8; }
.m-done .tick { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-tint); color: var(--ok); animation: m-check .45s var(--ease-pop) both; flex: none; }
.m-limit { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--line-strong); background: var(--surface); font-size: 13.5px; line-height: 19px; color: var(--ink-2); }
.m-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.m-chips button { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; transition: border-color .15s ease, transform .15s var(--ease); }
.m-chips button:hover { border-color: var(--brand); color: var(--ink); transform: translateY(-1px); }
.m-composer { padding: 10px 12px 12px; border-top: 1px solid var(--line); background: var(--surface); }
.m-composer__box { display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 12px; border-radius: 14px; border: 1px solid var(--line-2); transition: border-color .15s ease, box-shadow .15s ease; }
.m-composer__box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(105,58,148,.12); }
.m-composer textarea { flex: 1; border: 0; outline: 0; resize: none; font: inherit; font-size: 14px; line-height: 20px; min-height: 40px; padding-top: 2px; color: var(--ink); background: transparent; }
.m-send { width: 32px; height: 32px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--brand); color: #fff; cursor: pointer; flex: none; }
.m-spark { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; color: #fff; background: conic-gradient(from 200deg, #693a94, #ea543f, #693a94); flex: none; }
.m-spark .m-ic { width: 13px; height: 13px; stroke-width: 2; }
.m-spark--lg { width: 48px; height: 48px; border-radius: 14px; } .m-spark--lg .m-ic { width: 24px; height: 24px; }
.m-thinking { font-size: 13px; font-weight: 500; background: linear-gradient(90deg, var(--ink-3) 0%, var(--ink) 40%, var(--ink-3) 60%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: m-shimmer 1.8s linear infinite; }

/* ── toast ── */
.m-toast { position: fixed; z-index: 50; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 14px; border-radius: 14px; background: var(--ink); color: #fff; box-shadow: var(--sh-3); animation: m-toast .4s var(--ease) both; }
.m-toast .m-btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.22); box-shadow: none; }

/* ── admin ── */
.m-admin { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.m-subnav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 84px; }
.m-subnav a { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border-radius: 10px; font-weight: 500; color: var(--ink-2); }
.m-subnav a:hover { background: var(--hover); color: var(--ink); }
.m-subnav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1), 0 0 0 1px var(--line); }

/* ── phone (read only) ── */
.m-phone { width: 390px; min-height: 844px; }
.m-phone .m-top { height: 56px; padding: 0 16px; gap: 12px; }
.m-phone .m-page { padding: 16px 16px 40px; gap: 14px; }
.m-tabbar { position: sticky; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); background: rgba(255,255,255,.95); border-top: 1px solid var(--line); padding: 6px 4px 18px; }
.m-tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 11.5px; font-weight: 500; color: var(--ink-3); }
.m-tabbar a[aria-current="page"] { color: var(--brand-deep); }
.m-tabbar .m-ic { width: 20px; height: 20px; }

@media (max-width: 1100px) { .m-cols-3 { grid-template-columns: minmax(0, 1fr); } .m-deck { grid-template-columns: minmax(0, 1fr); } .m-thumbs { flex-direction: row; overflow-x: auto; } .m-thumb { width: 150px; flex: none; } }
@media (max-width: 760px) { .m-menu { display: none; } .m-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } .m-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } .m-ai { left: 10px; width: auto; } .m-admin { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .m *, .m *::before, .m *::after { animation: none !important; transition: none !important; } }
.m-table tr.total td { font-weight: 600; color: var(--ink); border-top: 1px solid var(--line-2); background: #faf9f7; }
.m-ba-t { width: 100%; border-collapse: collapse; font-size: 13.5px; border-top: 1px solid var(--line); }
.m-ba-t th { font-size: 12px; font-weight: 500; color: var(--ink-3); text-align: right; padding: 8px 14px 4px; }
.m-ba-t td { padding: 6px 14px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-3); }
.m-ba-t td:first-child, .m-ba-t th:first-child { text-align: left; color: var(--ink-2); }
.m-ba-t td:last-child { color: var(--ink); font-weight: 600; background: var(--brand-tint); }
.m-ba-t th:last-child { background: var(--brand-tint); color: var(--brand-deep); }
.m-ba-t tr:last-child td { padding-bottom: 10px; }
