@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Fragment+Mono&display=swap");
/* Mosir App UI · component styles. Every value comes from tokens.css (var(--…)). Prefix: ma- */
.ma-root, .ma-root * { box-sizing: border-box; }
.ma-root { font-family: var(--font-sans); color: var(--text-strong); -webkit-font-smoothing: antialiased; font-size: 13px; line-height: 20px; }
body { background: var(--canvas); margin: 0; font-family: var(--font-sans); color: var(--text-strong); }
.ma-num { font-variant-numeric: tabular-nums; }
.ma-mono { font-family: var(--font-mono); font-size: 12px; }
.ma-icon { flex: none; display: inline-block; vertical-align: middle; }
.ma-caps { font-size: 10px; line-height: 14px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-meta); }
:where(.ma-root) :focus-visible { outline: 2px solid var(--accent-500); outline-offset: 2px; border-radius: 4px; }
.ma-row { display: flex; gap: var(--sp-8); align-items: center; flex-wrap: wrap; }
.ma-stack { display: flex; flex-direction: column; gap: var(--sp-16); }

/* ---------- buttons ---------- */
.ma-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--size-control); padding: 7px 12px; border-radius: var(--radius-control);
  border: 1px solid transparent; font: 600 12px/16px var(--font-sans); cursor: pointer; transition: background .14s, border-color .14s, color .14s, box-shadow .14s; white-space: nowrap; text-decoration: none; }
.ma-btn--md { min-height: 38px; padding: 8px 16px; font-size: 14px; font-weight: 500; line-height: 20px; }
.ma-btn--primary { background: var(--accent-500); border-color: var(--accent-500); color: var(--on-accent); }
.ma-btn--primary:hover { background: var(--accent-600); border-color: var(--accent-600); }
.ma-btn--secondary { background: var(--surface); border-color: var(--border); color: var(--text-body); }
.ma-btn--secondary:hover { background: var(--surface-subtle); color: var(--text-strong); }
.ma-btn--ghost { background: transparent; color: var(--text-body); }
.ma-btn--ghost:hover { background: var(--hover); color: var(--text-strong); }
.ma-btn--danger { background: var(--danger); border-color: var(--danger); color: #ffffff; }
.ma-btn--danger:hover { filter: brightness(.92); }
.ma-btn[disabled] { opacity: .45; cursor: not-allowed; }
.ma-spin { width: 14px; height: 14px; border-radius: 999px; border: 2px solid currentColor; border-right-color: transparent; animation: ma-gira .7s linear infinite; }
@keyframes ma-gira { to { transform: rotate(360deg); } }
.ma-iconbtn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-control); border: 0; background: transparent; color: var(--text-muted); cursor: pointer; position: relative; transition: background .14s, color .14s; }
.ma-iconbtn:hover { background: var(--hover); color: var(--text-strong); }

/* ---------- forms ---------- */
.ma-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ma-field__label { font-size: 11px; line-height: 16px; font-weight: 600; color: var(--text-body); }
.ma-field__label small { font-weight: 400; color: var(--text-meta); font-size: 11px; margin-left: 4px; }
.ma-field__hint { font-size: 11px; line-height: 16px; color: var(--text-muted); }
.ma-field__error { font-size: 11px; line-height: 16px; color: var(--late); }
.ma-input, .ma-select, .ma-textarea { width: 100%; font: 400 13px/20px var(--font-sans); color: var(--text-strong); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-control); padding: 7px 10px; transition: border-color .14s, box-shadow .14s; outline: none; }
.ma-input::placeholder, .ma-textarea::placeholder { color: var(--text-meta); }
.ma-input:focus, .ma-select:focus, .ma-textarea:focus { border-color: var(--accent-400); box-shadow: 0 0 0 3px rgba(242, 105, 59, .18); }
.ma-input[disabled], .ma-select[disabled] { background: var(--surface-subtle); color: var(--text-muted); }
.ma-input--invalid { border-color: var(--late); }
.ma-textarea { min-height: 84px; resize: vertical; }
.ma-select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.ma-search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-control); padding: 0 10px; height: var(--size-control); color: var(--text-meta); transition: border-color .14s, box-shadow .14s; }
.ma-search:focus-within { border-color: var(--accent-400); box-shadow: 0 0 0 3px rgba(242, 105, 59, .18); }
.ma-search input { border: 0; outline: none; background: transparent; font: 12px var(--font-sans); color: var(--text-strong); flex: 1; min-width: 0; }
.ma-search kbd { font: 10px var(--font-mono); color: var(--text-meta); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }
.ma-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; color: var(--text); background: none; border: 0; padding: 0; }
.ma-switch__track { width: 36px; height: 20px; border-radius: var(--radius-pill); background: var(--track); position: relative; transition: background .14s; flex: none; }
.ma-switch__knob { position: absolute; top: 3px; left: 4px; width: 14px; height: 14px; border-radius: 999px; background: #ffffff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .14s; }
.ma-switch[aria-checked="true"] .ma-switch__track { background: var(--accent-500); }
.ma-switch[aria-checked="true"] .ma-switch__knob { left: 18px; }
.ma-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.ma-check input { width: 16px; height: 16px; accent-color: var(--accent-500); margin: 0; }
.ma-seg { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-subtle); }
.ma-seg button { border: 0; background: transparent; padding: 5px 9px; border-radius: 7px; font: 500 12px/16px var(--font-sans); color: var(--text-muted); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; transition: background .14s, color .14s; }
.ma-seg button[aria-pressed="true"] { background: var(--surface); color: var(--accent-700); box-shadow: 0 1px 2px rgba(9, 13, 11, .08); }

/* ---------- tabs and settings nav ---------- */
.ma-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.ma-tab { padding: 8px 14px 10px; font: 500 14px/20px var(--font-sans); color: var(--text-muted); border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; transition: color .14s, border-color .14s; }
.ma-tab:hover { color: var(--text-strong); }
.ma-tab[aria-selected="true"] { color: var(--accent-700); border-bottom-color: var(--accent-500); font-weight: 600; }
.ma-tab__count { font: 600 11px/16px var(--font-sans); background: var(--hover); color: var(--text-body); border-radius: var(--radius-pill); padding: 0 6px; }
.ma-setnav { display: flex; flex-direction: column; gap: 24px; position: sticky; top: 16px; }
.ma-setnav__group { display: flex; flex-direction: column; }
.ma-setnav__group .ma-caps { margin-bottom: 8px; font-size: 11px; }
.ma-setnav a { border-left: 2px solid var(--border); padding: 6px 0 6px 12px; font-size: 14px; line-height: 20px; color: var(--text-muted); text-decoration: none; transition: color .14s, border-color .14s; }
.ma-setnav a:hover { color: var(--text-strong); border-left-color: var(--border-strong); }
.ma-setnav a[aria-current="page"] { border-left-color: var(--accent-500); color: var(--accent-700); font-weight: 500; }

/* ---------- pills, badges, avatars ---------- */
.ma-badge { display: inline-flex; align-items: center; gap: 4px; border-radius: var(--radius-pill); padding: 2px 10px; font: 500 11px/16px var(--font-sans); background: var(--accent-50); color: var(--accent-700); white-space: nowrap; }
.ma-badge--neutral { background: var(--surface-subtle); color: var(--text-body); border: 1px solid var(--border); padding: 1px 7px; border-radius: var(--radius-xs); }
.ma-pill { display: inline-flex; align-items: center; gap: 6px; border-radius: var(--radius-pill); padding: 2px 9px 2px 7px; font: 600 11px/16px var(--font-sans); white-space: nowrap; }
.ma-pill::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.ma-pill--ok { background: var(--ok-bg); color: var(--ok); }
.ma-pill--warn { background: var(--warn-bg); color: var(--warn); }
.ma-pill--late { background: var(--late-bg); color: var(--late); }
.ma-pill--idle { background: var(--idle-bg); color: var(--idle); }
.ma-pill--accent { background: var(--accent-50); color: var(--accent-700); }
.ma-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--accent-50); color: var(--accent-700); font: 700 11px/1 var(--font-sans); }
.ma-avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: var(--radius-tile); font-weight: 700; letter-spacing: .04em; overflow: hidden; }
.ma-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ma-avatar--round { border-radius: 999px; }
.ma-avatar--t0 { background: #fff0e8; color: #a2502a; } .ma-avatar--t1 { background: #e6f6f0; color: #0f7a5a; } .ma-avatar--t2 { background: #e8ecfd; color: #3b3aa8; }
.ma-avatar--t3 { background: #f3e9fb; color: #6b3a9e; } .ma-avatar--t4 { background: #e6f2fb; color: #1c5f8f; } .ma-avatar--t5 { background: #fbe9ee; color: #9c3357; } .ma-avatar--t6 { background: #f0f3e6; color: #5a6b21; }

/* ---------- card ---------- */
.ma-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.ma-card__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--divider); }
.ma-card__title { display: flex; align-items: center; gap: 8px; font: 600 14px/20px var(--font-sans); color: var(--text-strong); margin: 0; }
.ma-card__title .ma-icon { color: var(--accent-500); }
.ma-card__link { font: 600 13px/20px var(--font-sans); color: var(--accent-600); text-decoration: none; white-space: nowrap; }
.ma-card__link:hover { color: var(--accent-800); }
.ma-card__body { padding: 12px 20px 16px; overflow: auto; flex: 1; }
.ma-card__body--flush { padding: 0; }
.ma-card__foot { padding: 12px 20px 16px; border-top: 1px solid var(--divider); text-align: center; }
.ma-card--click { cursor: pointer; transition: border-color .14s, box-shadow .14s; }
.ma-card--click:hover { border-color: var(--accent-300); box-shadow: var(--shadow-hover); }
.ma-empty-text { font-size: 13px; color: var(--text-meta); max-width: 26rem; margin: 0; }

/* ---------- KPI tally ---------- */
.ma-tally { display: flex; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.ma-tally > div { flex: 1; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ma-tally > div + div { border-left: 1px solid var(--border); }
.ma-tally b { font-size: 17px; line-height: 19px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-strong); }
.ma-tally b.is-late { color: var(--late); }
.ma-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 14px 16px; display: flex; gap: 12px; align-items: center; }
.ma-stat__icon { width: 40px; height: 40px; border-radius: var(--radius-tile); display: flex; align-items: center; justify-content: center; background: var(--accent-50); color: var(--accent-600); flex: none; }
.ma-stat b { display: block; font-size: 22px; line-height: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; color: var(--text-strong); }
.ma-stat span { font-size: 12px; color: var(--text-muted); }

/* ---------- list rows ---------- */
.ma-list { display: flex; flex-direction: column; gap: 1px; }
.ma-trow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 9px; align-items: center; padding: 6.5px 10px; border-radius: var(--radius-control); transition: background .12s; }
.ma-trow:hover { background: var(--surface-subtle); }
.ma-trow__dot { width: 9px; height: 9px; border-radius: 999px; background: var(--accent-500); margin: 0 3px; }
.ma-trow__title { font-size: 12.5px; line-height: 18px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ma-trow__sub { display: block; font-size: 11px; line-height: 15px; color: var(--text-meta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ma-trow__date { font-size: 10.5px; color: var(--text-body); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ma-trow__date.is-late { color: var(--late); font-weight: 600; }
.ma-trow--done .ma-trow__title { text-decoration: line-through; color: var(--text-meta); }
.ma-chip { width: 21px; height: 21px; border-radius: 999px; background: var(--accent-100); color: var(--accent-700); font: 600 9px/21px var(--font-sans); text-align: center; flex: none; }
.ma-alert { display: flex; gap: 10px; padding: 8px 10px; border-radius: var(--radius-control); border: 1px solid transparent; transition: background .14s, border-color .14s; text-decoration: none; }
.ma-alert:hover { background: var(--surface-subtle); border-color: var(--border); }
.ma-alert__dot { width: 8px; height: 8px; border-radius: 999px; margin-top: 6px; flex: none; }
.ma-alert__title { font: 600 13px/20px var(--font-sans); color: var(--text); }
.ma-alert__title.is-grave { color: var(--late); }
.ma-alert__sub { font-size: 12px; line-height: 18px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ma-qa { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius-control); text-decoration: none; transition: background .14s; min-width: 0; }
.ma-qa:hover { background: var(--surface-subtle); }
.ma-qa__title { font: 600 13px/18px var(--font-sans); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ma-qa__meta { font-size: 11px; line-height: 16px; color: var(--text-meta); }
.ma-recent { flex: 0 0 15rem; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-tile); background: var(--surface); text-decoration: none; transition: border-color .14s, box-shadow .14s; min-width: 0; }
.ma-recent:hover { border-color: var(--accent-300); box-shadow: var(--shadow-card); }
.ma-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }

/* ---------- table ---------- */
.ma-table-wrap { overflow-x: auto; }
.ma-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ma-table th { text-align: left; padding: 10px 16px; background: var(--surface-subtle); border-top: 1px solid var(--divider); border-bottom: 1px solid var(--border); font: 600 10px/14px var(--font-sans); letter-spacing: .04em; text-transform: uppercase; color: var(--text-meta); white-space: nowrap; }
.ma-table td { padding: 10px 16px; border-bottom: 1px solid var(--divider); color: var(--text); vertical-align: middle; }
.ma-table th:first-child, .ma-table td:first-child { padding-left: 20px; }
.ma-table th:last-child, .ma-table td:last-child { padding-right: 20px; }
.ma-table tbody tr { transition: background .12s; }
.ma-table tbody tr:hover { background: var(--surface-subtle); }
.ma-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- metadata strip ---------- */
.ma-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 14px 18px; margin: 0; padding: 14px 18px; border-radius: var(--radius-card); border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--accent-50), var(--surface) 140%); }
.ma-meta > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ma-meta dt { font: 600 9.5px/14px var(--font-sans); letter-spacing: .09em; text-transform: uppercase; color: var(--text-meta); }
.ma-meta dd { margin: 0; font: 500 13px/18px var(--font-sans); color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ma-meta dd.is-empty { color: var(--text-meta); font-weight: 400; }

/* ---------- donut ---------- */
.ma-donut { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.ma-donut__ring { position: relative; width: 112px; height: 112px; flex: none; }
.ma-donut__ring svg { width: 100%; height: 100%; display: block; transform: rotate(-90deg); filter: drop-shadow(0 5px 12px rgba(17, 20, 17, .13)); }
.ma-donut__ring circle { transition: opacity .18s, stroke-width .18s; }
.ma-donut__center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.ma-donut__center b { font-size: 27px; line-height: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--text-strong); }
.ma-legend { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 2px; }
.ma-legend button { display: grid; grid-template-columns: auto minmax(0, 1fr) 1.75rem 2.5rem; gap: 8px; align-items: center; padding: 5px 7px; border-radius: 6px; border: 0; background: none; font: 13px/18px var(--font-sans); text-align: left; cursor: default; }
.ma-legend button:hover { background: var(--surface-subtle); }
.ma-legend i { width: 8px; height: 8px; border-radius: 999px; transition: transform .18s; }
.ma-legend button:hover i { transform: scale(1.45); }
.ma-legend span { color: var(--text-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ma-legend b { font-weight: 600; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.ma-legend em { font-style: normal; color: var(--text-meta); text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- mini calendar ---------- */
.ma-cal { display: flex; flex-direction: column; gap: 8px; }
.ma-cal__head { display: flex; justify-content: space-between; align-items: center; }
.ma-cal__month { font: 600 12px/16px var(--font-sans); color: var(--text); }
.ma-cal__nav { display: flex; gap: 4px; }
.ma-cal__nav button { width: 24px; height: 24px; border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--surface); color: var(--text-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.ma-cal__nav button:hover { border-color: var(--accent-300); color: var(--accent-600); }
.ma-cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.ma-cal__wd { font: 700 10px/22px var(--font-sans); text-transform: uppercase; color: var(--text-meta); text-align: center; border-bottom: 1px solid var(--divider); margin-bottom: 2px; }
.ma-cal__day { height: 32px; border-radius: var(--radius-control); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: 600 12px/14px var(--font-sans); color: var(--text); font-variant-numeric: tabular-nums; cursor: pointer; border: 0; background: none; transition: background .14s; }
.ma-cal__day:hover { background: var(--hover); }
.ma-cal__day.is-out { color: var(--text-disabled); }
.ma-cal__day.is-today { background: var(--accent-500); color: var(--on-accent); font-weight: 700; }
.ma-cal__day.is-selected { background: var(--accent-50); box-shadow: inset 0 0 0 1.5px var(--accent-400); }
.ma-cal__dots { display: flex; gap: 2px; height: 4px; }
.ma-cal__dots i { width: 4px; height: 4px; border-radius: 999px; background: var(--accent-500); }
.ma-cal__day.is-today .ma-cal__dots i { background: var(--on-accent); }

/* ---------- empty states, notices ---------- */
.ma-empty { border: 1px dashed var(--border-strong); border-radius: var(--radius-card); background: var(--surface); padding: 40px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.ma-empty__icon { width: 44px; height: 44px; border-radius: var(--radius-tile); background: var(--accent-50); color: var(--accent-600); display: flex; align-items: center; justify-content: center; }
.ma-empty h3 { margin: 0; font: 600 16px/24px var(--font-sans); color: var(--text-strong); }
.ma-empty p { margin: 0; font-size: 13px; color: var(--text-muted); max-width: 30rem; }
.ma-empty ul { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 6px; text-align: left; font-size: 13px; color: var(--text-body); }
.ma-empty li { display: flex; gap: 8px; align-items: center; }
.ma-empty li::before { content: ""; width: 4px; height: 4px; border-radius: 999px; background: var(--accent-400); flex: none; }
.ma-notice { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 16px; border-radius: var(--radius-control); font-size: 13px; line-height: 18px; border: 1px solid var(--accent-200); background: var(--accent-50); color: var(--accent-800); }
.ma-notice--warn { border-color: #f3ddb4; background: var(--warn-bg); color: var(--warn); }
.ma-notice--late { border-color: #f6cdc8; background: var(--late-bg); color: var(--late); }
.ma-notice__text { flex: 1; min-width: 0; }
.ma-notice .ma-btn { min-height: 30px; background: transparent; border-color: currentColor; color: inherit; }
.ma-savebar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; background: var(--shell-800); color: var(--on-shell); border-radius: var(--radius-pill); padding: 8px 10px 8px 18px; font-size: 12px; box-shadow: var(--shadow-savebar); z-index: 50; white-space: nowrap; }
.ma-savebar--static { position: static; transform: none; display: inline-flex; }
.ma-savebar .ma-btn--ghost { color: var(--on-shell-muted); }
.ma-savebar .ma-btn--ghost:hover { background: rgba(255,255,255,.08); color: var(--on-shell); }

/* ---------- menu and modal ---------- */
.ma-menu { min-width: 11rem; padding: 5px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-menu); display: flex; flex-direction: column; }
.ma-menu button { display: flex; gap: 8px; align-items: center; padding: 7px 9px; border-radius: 6px; border: 0; background: none; font: 12.5px/18px var(--font-sans); color: var(--text-body); text-align: left; cursor: pointer; }
.ma-menu button:hover { background: var(--hover); color: var(--text-strong); }
.ma-menu button.is-danger { color: var(--danger); }
.ma-menu button.is-danger:hover { background: var(--danger-bg); }
.ma-menu hr { border: 0; border-top: 1px solid var(--divider); margin: 4px 0; }
.ma-backdrop { position: fixed; inset: 0; background: rgba(9, 10, 8, .42); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.ma-backdrop--static { position: relative; inset: auto; min-height: 340px; border-radius: var(--radius-card); }
.ma-modal { width: min(30rem, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-modal); box-shadow: var(--shadow-modal); text-align: left; display: flex; flex-direction: column; overflow: hidden; }
.ma-modal__head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.ma-modal__head h2 { margin: 0; font: 600 16px/24px var(--font-sans); color: var(--text-strong); }
.ma-modal__head p { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); }
.ma-modal__body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.ma-modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); }

/* ---------- shell ---------- */
.ma-app { display: grid; grid-template-columns: var(--size-sidebar) minmax(0, 1fr); min-height: 100vh; background: var(--canvas); }
.ma-app--compact { grid-template-columns: var(--size-sidebar-compact) minmax(0, 1fr); }
/* the sidebar paints from its own variables; a theme class swaps them (graphite, light, violet, coral) */
.ma-side, .ma-sbtheme { --sb-top: var(--shell-800); --sb-bottom: var(--shell-900); --sb-ink: var(--on-shell); --sb-idle: rgba(245, 245, 242, .72); --sb-muted: var(--on-shell-muted);
  --sb-hover: rgba(255, 255, 255, .08); --sb-raised: rgba(255, 255, 255, .07); --sb-line: rgba(255, 255, 255, .14); --sb-edge: transparent;
  --sb-active-bg: var(--on-shell); --sb-active-ink: var(--shell-900); --sb-active-icon: var(--accent-600); --sb-mark-bg: var(--accent-500); --sb-mark-ink: var(--on-accent); }
.ma-side--light { --sb-top: var(--surface); --sb-bottom: var(--surface); --sb-ink: var(--text-strong); --sb-idle: var(--text-body); --sb-muted: var(--text-meta);
  --sb-hover: var(--hover); --sb-raised: var(--surface-subtle); --sb-line: var(--divider); --sb-edge: var(--border);
  --sb-active-bg: var(--accent-50); --sb-active-ink: var(--accent-700); --sb-active-icon: var(--accent-600); }
.ma-side--violet { --sb-top: var(--shell-violet-800); --sb-bottom: var(--shell-violet-900); --sb-active-ink: var(--shell-violet-800); --sb-active-icon: var(--shell-violet-800);
  --sb-mark-bg: var(--on-shell); --sb-mark-ink: var(--shell-violet-800); --sb-muted: rgba(237, 236, 255, .62); }
.ma-side--coral { --sb-top: var(--shell-coral-700); --sb-bottom: var(--shell-coral-900); --sb-active-ink: var(--shell-coral-900); --sb-active-icon: var(--shell-coral-700);
  --sb-mark-bg: var(--on-shell); --sb-mark-ink: var(--shell-coral-900); --sb-muted: rgba(255, 236, 226, .72); --sb-idle: rgba(255, 246, 241, .82); }
.ma-side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; color: var(--sb-ink); background: linear-gradient(180deg, var(--sb-top), var(--sb-bottom)); border-right: 1px solid var(--sb-edge); overflow-y: auto; }
.ma-side__brand { margin: 0 12px 12px; padding: 24px 8px 18px; border-bottom: 1px solid var(--sb-line); display: flex; align-items: center; gap: 10px; min-height: 84px; }
.ma-side__logo { max-width: 172px; max-height: 44px; object-fit: contain; }
.ma-side__mark { width: 34px; height: 34px; border-radius: 9px; background: var(--sb-mark-bg); color: var(--sb-mark-ink); display: flex; align-items: center; justify-content: center; font: 700 15px/1 var(--font-sans); flex: none; }
.ma-side__name { font: 600 16px/20px var(--font-sans); color: var(--sb-ink); display: flex; flex-direction: column; min-width: 0; }
.ma-side__name small { font: 400 11px/14px var(--font-sans); color: var(--sb-muted); }
.ma-side__switch { margin: 0 12px 6px; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-control); background: var(--sb-raised); color: var(--sb-ink); font: 500 13px/18px var(--font-sans); border: 0; cursor: pointer; text-align: left; }
.ma-side__switch:hover { background: var(--sb-hover); }
.ma-side__nav { padding: 0 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.ma-side__panel { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ma-side__panelhead { display: none; justify-content: space-between; align-items: center; padding: 6px 12px 14px 24px; margin-bottom: 8px; border-bottom: 1px solid var(--sb-line); }
.ma-side__burger { display: none; width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: var(--radius-control); border: 0; background: transparent; color: var(--sb-ink); cursor: pointer; }
.ma-side__burger:hover { background: var(--sb-hover); }
.ma-side__scrim { display: none; position: fixed; inset: 0; background: rgba(9, 10, 8, .42); z-index: 60; }
@keyframes ma-gaveta { from { transform: translateX(-100%); } }
.ma-side__group { font: 500 10px/14px var(--font-sans); letter-spacing: .09em; color: var(--sb-muted); padding: 20px 12px 4px; }
.ma-side__item { display: flex; align-items: center; gap: 12px; min-height: var(--size-nav-item); padding: 10px 12px; border-radius: var(--radius-control); font: 500 14px/20px var(--font-sans); color: var(--sb-idle); text-decoration: none; transition: background .14s, color .14s; }
.ma-side__item:hover { background: var(--sb-hover); color: var(--sb-ink); }
.ma-side__item[aria-current="page"] { background: var(--sb-active-bg); color: var(--sb-active-ink); }
.ma-side__item[aria-current="page"] .ma-icon { color: var(--sb-active-icon); }
.ma-side__item .ma-side__badge { margin-left: auto; font: 600 10px/16px var(--font-sans); padding: 0 6px; border-radius: 999px; background: var(--sb-mark-bg); color: var(--sb-mark-ink); }
.ma-side__item--new { border: 1px dashed var(--sb-line); color: var(--sb-muted); }
.ma-side__foot { padding: 16px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.ma-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--sb-raised); color: var(--sb-ink); border: 0; text-align: left; cursor: pointer; width: 100%; font-family: var(--font-sans); }
.ma-user:hover { background: var(--sb-hover); }
.ma-user__text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ma-user__text b { font: 500 12px/16px var(--font-sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ma-user__text span { font-size: 11px; line-height: 15px; color: var(--sb-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ma-sbthemes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ma-sbtheme { border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); padding: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; font: 600 12px/16px var(--font-sans); color: var(--text); text-align: left; transition: border-color .14s, box-shadow .14s; }
.ma-sbtheme:hover { border-color: var(--accent-300); }
.ma-sbtheme[aria-checked="true"] { border-color: var(--accent-500); box-shadow: 0 0 0 3px rgba(242, 105, 59, .18); }
.ma-sbtheme__mini { display: grid; grid-template-columns: 34% 1fr; height: 72px; border-radius: 8px; overflow: hidden; border: 1px solid var(--divider); }
.ma-sbtheme__side { background: linear-gradient(180deg, var(--sb-top), var(--sb-bottom)); border-right: 1px solid var(--sb-edge); padding: 8px 6px; display: flex; flex-direction: column; gap: 4px; }
.ma-sbtheme__side i { height: 5px; border-radius: 3px; background: var(--sb-idle); opacity: .5; }
.ma-sbtheme__side i:nth-child(2) { background: var(--sb-active-bg); opacity: 1; height: 8px; }
.ma-sbtheme__page { background: var(--canvas); padding: 8px; display: flex; flex-direction: column; gap: 5px; }
.ma-sbtheme__page i { height: 14px; border-radius: 4px; background: var(--surface); border: 1px solid var(--border); }
.ma-user .ma-avatar { background: var(--accent-400); color: var(--accent-900); }
.ma-app--compact .ma-side__name, .ma-app--compact .ma-side__group, .ma-app--compact .ma-side__item span, .ma-app--compact .ma-user__text, .ma-app--compact .ma-side__switch span, .ma-app--compact .ma-side__badge { display: none; }
.ma-app--compact .ma-side__brand { justify-content: center; margin: 0 10px 10px; padding-inline: 0; }
.ma-app--compact .ma-side__nav, .ma-app--compact .ma-side__foot { padding-inline: 10px; }
.ma-app--compact .ma-side__item { justify-content: center; padding-inline: 0; }
.ma-app--compact .ma-side__switch { justify-content: center; margin-inline: 10px; }
.ma-app--compact .ma-user { justify-content: center; padding: 8px; background: transparent; }
.ma-main { min-width: 0; display: flex; flex-direction: column; }
.ma-header { min-height: var(--size-header); padding: 0 clamp(16px, 2vw, var(--sp-36)); display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.ma-header__crumbs { font-size: 12px; line-height: 16px; color: var(--text-meta); display: flex; gap: 8px; margin-bottom: 4px; }
.ma-header__crumbs a { color: var(--text-meta); text-decoration: none; }
.ma-header__crumbs a:hover { color: var(--accent-600); }
.ma-header h1 { margin: 0; font: 600 20px/28px var(--font-sans); color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ma-header__actions { display: flex; gap: 8px; align-items: center; }
.ma-content { padding: 0 clamp(16px, 2vw, var(--sp-36)) 48px; display: flex; flex-direction: column; gap: 16px; }
.ma-copy { max-width: var(--size-copy); font-size: 14px; line-height: 22px; color: var(--text-muted); margin: 0 0 8px; }
.ma-fresh { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: var(--radius-pill); border: 1px solid transparent; font: 600 11px/14px var(--font-sans); color: var(--text-meta); background: none; cursor: pointer; transition: background .14s, border-color .14s; }
.ma-fresh:hover { border-color: var(--border); background: var(--surface-subtle); }
.ma-fresh:hover .ma-icon { transform: rotate(180deg); transition: transform .5s; }
.ma-fresh--stale { border-color: #fcd34d; background: #fffbeb; color: #b45309; }
.ma-bell__badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--accent-500); color: var(--on-accent); font: 700 10px/16px var(--font-sans); text-align: center; }

/* ---------- greeting banner ---------- */
.ma-banner { position: relative; overflow: hidden; border-radius: var(--radius-card); min-height: 15rem; padding: 32px 36px; color: #f5f5f2; display: flex; flex-direction: column; justify-content: space-between; gap: 16px;
  background: radial-gradient(circle at 76% 38%, rgba(242, 105, 59, .28), transparent 36%), linear-gradient(100deg, var(--shell-950) 0%, var(--shell-800) 55%, #3a2c24 100%); box-shadow: 0 8px 24px rgba(20, 16, 12, .14); }
.ma-banner__hello { font: 700 clamp(18px, 1.9vw, 26px)/1.2 var(--font-sans); letter-spacing: -.02em; margin: 0; }
.ma-banner__clock { font: 500 clamp(36px, 4.2vw, 54px)/1 var(--font-sans); letter-spacing: -.045em; font-variant-numeric: tabular-nums; margin: 6px 0 4px; }
.ma-banner__date { font: 500 15px/20px var(--font-sans); opacity: .84; }
.ma-banner__sun { position: absolute; right: 18%; top: 50%; width: 140px; height: 140px; margin-top: -70px; border-radius: 999px; background: radial-gradient(circle at 40% 38%, #ffd7a8, var(--accent-500) 62%, rgba(242,105,59,0) 72%); opacity: .9; }
.ma-banner__ticker { display: flex; align-items: center; gap: 12px; font-size: 12px; position: relative; }
.ma-banner__ticker b { font: 700 12px/16px var(--font-sans); letter-spacing: .08em; text-transform: uppercase; color: rgba(245,245,242,.72); display: inline-flex; gap: 8px; align-items: center; }
.ma-banner__ticker b::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: var(--accent-400); box-shadow: 0 0 0 4px rgba(247,128,79,.25); }
.ma-banner__ticker span { border-left: 1px solid rgba(255,255,255,.16); padding-left: 12px; font-weight: 600; }

/* ---------- module page ---------- */
.ma-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.ma-filters .ma-search { flex: 1 1 18rem; }
.ma-filters .ma-field { flex: 0 1 11rem; }
.ma-grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: 16px; }
.ma-rcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); overflow: hidden; display: flex; flex-direction: column; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.ma-rcard:hover { border-color: var(--border-strong); box-shadow: var(--shadow-hover); }
.ma-rcard__cover { aspect-ratio: 16 / 10; position: relative; display: flex; align-items: center; justify-content: center; font: 700 28px/1 var(--font-sans); letter-spacing: .04em; }
.ma-rcard__cover .ma-pill { position: absolute; left: 10px; top: 10px; background: rgba(255,255,255,.92); }
.ma-rcard__body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.ma-rcard__title { font: 600 14px/20px var(--font-sans); color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ma-rcard:hover .ma-rcard__title { color: var(--accent-700); }
.ma-rcard__meta { font-size: 11px; line-height: 16px; color: var(--text-meta); }
.ma-rcard__foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--divider); display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-body); }
.ma-progress { width: 80px; height: 6px; border-radius: 999px; background: var(--track); overflow: hidden; }
.ma-progress i { display: block; height: 100%; background: var(--accent-500); border-radius: 999px; transition: width .5s; }

@media (max-width: 1180px) {
  .ma-app { grid-template-columns: var(--size-sidebar-compact) minmax(0, 1fr); }
  .ma-app .ma-side__name, .ma-app .ma-side__group, .ma-app .ma-side__item span, .ma-app .ma-user__text, .ma-app .ma-side__switch span, .ma-app .ma-side__badge { display: none; }
  .ma-app .ma-side__item { justify-content: center; padding-inline: 0; }
  .ma-app .ma-side__brand { justify-content: center; }
}
@media (max-width: 800px) {
  .ma-app { grid-template-columns: minmax(0, 1fr); }
  .ma-side { position: sticky; top: 0; height: auto; min-height: 0; flex-direction: row; align-items: center; justify-content: space-between; padding: 10px 12px 10px 16px; z-index: 30; overflow: visible; }
  .ma-side__brand { border: 0; margin: 0; padding: 0; min-height: 0; }
  .ma-side__burger { display: inline-flex; }
  .ma-side__panel { display: none; position: fixed; top: 0; bottom: 0; left: 0; width: min(300px, 86vw); padding-top: 12px; background: linear-gradient(180deg, var(--sb-top), var(--sb-bottom)); border-right: 1px solid var(--sb-edge); box-shadow: 18px 0 48px rgba(8, 9, 7, .28); z-index: 61; overflow-y: auto; }
  .ma-side__panelhead { display: flex; }
  .ma-side.is-open .ma-side__panel { display: flex; animation: ma-gaveta .22s cubic-bezier(.2, .8, .2, 1); }
  .ma-side.is-open .ma-side__scrim { display: block; }
  /* in the drawer the labels come back (the ≤1180px icon-only rules would hide them) */
  .ma-app .ma-side__name { display: flex; } .ma-app .ma-side__group { display: block; } .ma-app .ma-user__text { display: flex; }
  .ma-app .ma-side__item span, .ma-app .ma-side__switch span { display: inline; }
  .ma-app .ma-side__item { justify-content: flex-start; padding-inline: 12px; } .ma-app .ma-side__brand { justify-content: flex-start; }
  .ma-header { flex-direction: column; align-items: flex-start; padding-top: 16px; gap: 12px; }
}
@media (prefers-reduced-motion: reduce) { .ma-root *, .ma-root *::before { transition: none !important; animation: none !important; } }
/* phones: the settings menu becomes a row of tabs */
@media (max-width: 800px) {
  .ma-setnav { position: static; flex-direction: row; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); }
  .ma-setnav__group { flex-direction: row; gap: 4px; }
  .ma-setnav__group .ma-caps { display: none; }
  .ma-setnav a { white-space: nowrap; border-left: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 8px 10px; }
  .ma-setnav a:hover { border-bottom-color: var(--border-strong); }
  .ma-setnav a[aria-current="page"] { border-bottom-color: var(--accent-500); }
}
