/* Modules autonomes (13/11/2026) : tiers payeurs, trésorerie, continuité, transport,
   internat, anciens élèves, décrochage. Styles partagés, préfixe .ma-, couleurs
   par variables de thème uniquement. */

.ma-page { max-width: 1180px; }
.ma-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.ma-head h1 { margin: 0 0 4px; font-size: 26px; }
.ma-eyebrow { display: block; font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--primary); margin-bottom: 4px; }
.ma-lead { margin: 0; color: var(--muted); max-width: 760px; font-size: 14px; line-height: 1.5; }
.ma-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.ma-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 8px 0 16px; overflow-x: auto; }
.ma-tab { background: none; border: none; border-bottom: 3px solid transparent; padding: 10px 14px; min-height: 44px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.ma-tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.ma-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.ma-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg, 12px); box-shadow: var(--shadow-rest); padding: 16px; margin-bottom: 16px; }
.ma-card h2 { font-size: 16px; margin: 0 0 12px; }
.ma-card h3 { font-size: 14px; margin: 16px 0 8px; color: var(--primary); }

.ma-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.ma-kpi { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg, 12px); padding: 12px 14px; }
.ma-kpi span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.ma-kpi strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.ma-kpi small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.ma-kpi.is-danger strong { color: var(--danger); }
.ma-kpi.is-warning strong { color: var(--warning); }
.ma-kpi.is-success strong { color: var(--success); }

.ma-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; }
.ma-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ma-field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.ma-field.wide { grid-column: 1 / -1; }
.ma-field label { font-weight: 600; color: var(--text); }
.ma-field input, .ma-field select, .ma-field textarea { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-md, 8px); font-size: 14px; min-height: 44px; background: var(--card); color: var(--text); font-family: inherit; }
.ma-field textarea { min-height: 90px; resize: vertical; }
.ma-field input:focus-visible, .ma-field select:focus-visible, .ma-field textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ma-field .is-invalid { border-color: var(--danger); }
.ma-field small { color: var(--muted); font-size: 12px; }
.ma-field .ma-err { color: var(--danger); }
.ma-req { color: var(--danger); }
.ma-check { display: inline-flex; gap: 8px; align-items: center; min-height: 44px; font-size: 14px; }
.ma-checks { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.ma-form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

.ma-table-wrap { overflow-x: auto; }
.ma-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ma-table th { text-align: left; padding: 10px 12px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap; }
.ma-table td { padding: 10px 12px; border-top: 1px solid var(--border); vertical-align: top; }
.ma-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ma-table .act { text-align: right; white-space: nowrap; }
.ma-table .act > * + * { margin-left: 6px; }
.ma-table tr.is-low td { background: color-mix(in srgb, var(--danger) 7%, transparent); }
.ma-table tfoot td { font-weight: 700; border-top: 2px solid var(--border); }
.ma-muted { color: var(--muted); font-size: 13px; }
.ma-mono { font-variant-numeric: tabular-nums; }

.ma-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid currentColor; white-space: nowrap; }
.ma-badge.ok { color: var(--success); }
.ma-badge.warn { color: var(--warning); }
.ma-badge.danger { color: var(--danger); }
.ma-badge.info { color: var(--info); }
.ma-badge.muted { color: var(--muted); }

.ma-note { padding: 10px 14px; border-radius: var(--radius-md, 8px); margin: 0 0 12px; font-size: 14px; border: 1px solid; }
.ma-note.info { border-color: color-mix(in srgb, var(--info) 40%, transparent); background: color-mix(in srgb, var(--info) 8%, transparent); }
.ma-note.warn { border-color: color-mix(in srgb, var(--warning) 45%, transparent); background: color-mix(in srgb, var(--warning) 9%, transparent); }
.ma-note.danger { border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.ma-note.ok { border-color: color-mix(in srgb, var(--success) 40%, transparent); background: color-mix(in srgb, var(--success) 8%, transparent); }

.ma-empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius-lg, 12px); }
.ma-empty strong { display: block; color: var(--text); margin-bottom: 4px; }
.ma-skel { height: 180px; border-radius: var(--radius-lg, 12px); background: linear-gradient(90deg, var(--border) 25%, transparent 50%, var(--border) 75%); background-size: 200% 100%; animation: ma-shim 1.4s infinite; }
@keyframes ma-shim { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.ma-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--primary); color: #fff; border: 1px solid var(--primary); border-radius: var(--radius-md, 8px); padding: 10px 16px; font-weight: 600; cursor: pointer; min-height: 44px; font-size: 14px; text-decoration: none; }
.ma-btn:disabled { opacity: .5; cursor: not-allowed; }
.ma-btn.ghost { background: transparent; color: var(--primary); }
.ma-btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.ma-btn.sm { padding: 6px 12px; min-height: 36px; font-size: 13px; }
.ma-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ma-bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding: 8px 4px 0; border-bottom: 1px solid var(--border); }
.ma-bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.ma-bar i { display: block; width: 100%; max-width: 46px; background: var(--primary); border-radius: 4px 4px 0 0; }
.ma-bar i.neg { background: var(--danger); }
.ma-bar i.low { background: var(--warning); }
.ma-bar-labels { display: flex; gap: 6px; padding: 4px 4px 0; }
.ma-bar-labels span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ma-threshold { font-size: 12px; color: var(--muted); margin-top: 6px; }

.ma-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.ma-list { list-style: none; padding: 0; margin: 0; }
.ma-list li { padding: 10px 0; border-top: 1px solid var(--border); }
.ma-list li:first-child { border-top: none; }

.ma-modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 60; }
.ma-modal { position: fixed; z-index: 61; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; background: var(--card); border-radius: var(--radius-lg, 12px); padding: 20px; box-shadow: var(--shadow-modal); }
.ma-modal h2 { font-size: 18px; margin: 0 0 6px; }

.ma-point { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-top: 1px solid var(--border); }
.ma-point:first-child { border-top: none; }
.ma-point-name strong { display: block; }
.ma-point-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ma-point-btns .ma-btn { min-width: 92px; justify-content: center; }
.ma-point-btns .is-on { background: var(--success); border-color: var(--success); color: #fff; }
.ma-point-btns .is-absent { background: var(--danger); border-color: var(--danger); color: #fff; }

.ma-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

.ma-picker-results { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.ma-picker-results button { text-align: left; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md, 8px); padding: 8px 12px; cursor: pointer; min-height: 44px; display: flex; justify-content: space-between; gap: 8px; }
.ma-picker-results button:hover, .ma-picker-results button:focus-visible { border-color: var(--primary); }
.ma-picked { display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 1px solid var(--primary); border-radius: var(--radius-md, 8px); padding: 8px 12px; min-height: 44px; }

.ma-mb { margin-bottom: 12px; }
.ma-mt { margin-top: 12px; }
.ma-kpis.flush { margin: 0; }
.ma-fieldset { border: none; padding: 0; margin: 0; }
.ma-legend { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.ma-pre { white-space: pre-line; }
.ma-q { margin-bottom: 28px; }
.ma-sign { margin-top: 32px; }

/* Documents imprimables (rapport, fiche, billet) */
.ma-print { max-width: 820px; margin: 0 auto; background: #fff; color: #111; padding: 24px; }
.ma-print h1 { font-size: 22px; margin: 0 0 4px; }
.ma-print table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0 16px; }
.ma-print th, .ma-print td { border: 1px solid #ccc; padding: 6px 8px; text-align: left; }
.ma-print .num { text-align: right; }
.ma-print-bar { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 12px; }
@media print {
  .ma-print-bar, nav, header.app-header, .sidebar, .bottom-nav { display: none !important; }
  .ma-print { padding: 0; }
}

@media (max-width: 860px) {
  .ma-grid, .ma-grid.two, .ma-split { grid-template-columns: 1fr; }
  .ma-point { flex-direction: column; align-items: stretch; }
  .ma-point-btns { justify-content: stretch; }
  .ma-point-btns .ma-btn { flex: 1; }
}

/* Évaluation diagnostique (13/11/2026) */
.ma-table tr.is-selected td { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.ma-note-input { width: 88px; min-height: 44px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-md, 8px); text-align: right; background: var(--card); color: var(--text); font-size: 14px; }
.ma-note-input.is-invalid { border-color: var(--danger); }
.ma-note-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Argent de poche (13/11/2026) */
.ma-pocket-list { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.ma-pocket-list li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.ma-amount-in { color: var(--success); font-weight: 600; }
.ma-amount-out { color: var(--danger); font-weight: 600; }
