/*
 * Modern admin UI design system.
 * Pages built on it include parts/modern_head.php; pages whose content still uses Bootstrap
 * markup include parts/head.php, which adds Bootstrap themed with these tokens and
 * css/modern-bootstrap.css on top.
 */

:root {
    --m-ground: #F4F6FA;
    --m-surface: #FFFFFF;
    --m-surface-2: #F8FAFC;
    --m-surface-3: #F1F4F8;
    --m-border: #E4E8EF;
    --m-border-strong: #DCE1E9;
    --m-divider: #EEF1F5;
    --m-ink: #0F172A;
    --m-ink-2: #334155;
    --m-ink-3: #475569;
    --m-muted: #64748B;
    --m-brand: #222B5C;
    --m-primary: #1C5CAB;
    --m-primary-hover: #174D90;
    --m-primary-soft: #E8F0FB;

    --m-series-1: #2A78D6;
    --m-series-2: #EB6834;
    --m-series-3: #1BAF7A;

    --m-good: #0CA30C;
    --m-good-ink: #0A6B0A;
    --m-good-soft: #E7F6E7;
    --m-warn-ink: #6B4600;
    --m-warn-soft: #FFF7E6;
    --m-warn-border: #E9C77A;
    --m-bad: #D03B3B;
    --m-bad-ink: #A32020;
    --m-bad-soft: #FDECEC;

    --m-radius: 16px;
    --m-radius-sm: 12px;
    --m-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    --m-shadow-hover: 0 10px 28px rgba(15, 23, 42, .08);
    --m-font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    --m-font-display: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

/* Components set their own display; [hidden] must still win */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body.m-body {
    margin: 0;
    background: var(--m-ground);
    color: var(--m-ink);
    font: 400 14px/1.5 var(--m-font);
    -webkit-font-smoothing: antialiased;
}

/* Element defaults use :where() so component classes (including Bootstrap's) always win */
:where(.m-body) a { color: var(--m-primary); }
:where(.m-body) a:hover { color: #123F78; }
.m-body :focus-visible { outline: 2px solid var(--m-primary); outline-offset: 2px; }
:where(.m-body) h1, :where(.m-body) h2, :where(.m-body) h3, :where(.m-body) p { margin: 0; }
:where(.m-body) button, :where(.m-body) input, :where(.m-body) select { font: inherit; color: inherit; }
.m-body table { border-collapse: collapse; }

.m-sr {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

.m-icon { flex: 0 0 auto; display: inline-block; vertical-align: middle; }
.m-num { font-variant-numeric: tabular-nums; }

/* ---------- App shell ---------- */

.m-app { display: flex; min-height: 100vh; }

.m-side {
    flex: 0 0 256px;
    width: 256px;
    background: var(--m-surface);
    border-right: 1px solid var(--m-border);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.m-brand {
    display: flex; align-items: center; justify-content: center;
    padding: 14px 16px; border-radius: 14px; background: var(--m-brand);
}
.m-brand img { height: 72px; width: auto; display: block; }

.m-nav { display: flex; flex-direction: column; gap: 4px; }

.m-navlink {
    display: flex; align-items: center; gap: 12px;
    min-height: 40px; padding: 0 12px; border-radius: 10px;
    color: var(--m-ink-2) !important; text-decoration: none;
    font-size: 14px; font-weight: 500;
    transition: background .15s ease, color .15s ease;
}
.m-navlink:hover { background: #EEF2F8; color: var(--m-ink) !important; }
.m-navlink.is-active { background: var(--m-primary-soft); color: var(--m-primary) !important; font-weight: 600; }

.m-navgroup { border-radius: 10px; }
.m-navgroup > summary {
    list-style: none; cursor: pointer;
    display: flex; align-items: center; gap: 12px;
    min-height: 40px; padding: 0 12px; border-radius: 10px;
    color: var(--m-ink-2); font-size: 14px; font-weight: 500;
    transition: background .15s ease;
}
.m-navgroup > summary::-webkit-details-marker { display: none; }
.m-navgroup > summary:hover { background: #EEF2F8; color: var(--m-ink); }
.m-navgroup > summary .m-chev { margin-left: auto; transition: transform .2s ease; color: var(--m-muted); }
.m-navgroup[open] > summary .m-chev { transform: rotate(90deg); }
.m-navgroup.has-active > summary { color: var(--m-ink); font-weight: 600; }
.m-subnav { display: flex; flex-direction: column; gap: 2px; padding: 2px 0 6px 30px; }
.m-subnav .m-navlink { min-height: 36px; font-size: 13.5px; }

.m-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.m-topbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
    padding: 14px 32px; background: rgba(255, 255, 255, .9);
    border-bottom: 1px solid var(--m-border);
    position: sticky; top: 0; z-index: 20;
    backdrop-filter: saturate(1.4) blur(8px);
}
.m-icon-btn.m-menu-btn { display: none; }

.m-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; font-size: 14px; color: var(--m-ink-3); }
.m-crumbs a { color: var(--m-ink-3); text-decoration: none; }
.m-crumbs a:hover { color: var(--m-ink); text-decoration: underline; }
.m-crumbs [aria-current] { color: var(--m-ink); font-weight: 500; }

.m-user { position: relative; margin-left: auto; }
.m-user > summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
    padding: 4px 8px 4px 4px; border-radius: 12px;
}
.m-user > summary::-webkit-details-marker { display: none; }
.m-user > summary:hover { background: var(--m-surface-3); }
.m-user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.m-user-meta strong { font-size: 14px; font-weight: 600; }
.m-user-meta span { font-size: 12px; color: var(--m-muted); }

.m-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--m-primary); color: #fff; font-weight: 600; font-size: 14px; flex: 0 0 auto;
}
.m-avatar.is-sm { width: 32px; height: 32px; font-size: 12px; }
.m-avatar.is-md { width: 36px; height: 36px; font-size: 13px; }
.m-avatar.tint-0 { background: #E8F0FB; color: #1C4F8F; }
.m-avatar.tint-1 { background: #FDEEE7; color: #9A3A12; }
.m-avatar.tint-2 { background: #E4F6EE; color: #0B6B48; }
.m-avatar.tint-3 { background: #F1EEFC; color: #4B3BB0; }
.m-avatar.is-neutral { background: #EEF2F8; color: var(--m-ink-2); }

.m-menu {
    position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; z-index: 30;
    background: var(--m-surface); border: 1px solid var(--m-border); border-radius: 12px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .14); padding: 6px;
    display: flex; flex-direction: column;
}
.m-menu a, .m-menu button {
    display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px;
    border-radius: 8px; border: 0; background: none; text-align: left; cursor: pointer;
    color: var(--m-ink-2) !important; text-decoration: none; font-size: 14px; width: 100%;
}
.m-menu a:hover, .m-menu button:hover { background: var(--m-surface-3); color: var(--m-ink) !important; }

.m-content { padding: 32px; display: flex; flex-direction: column; gap: 24px; width: 100%; max-width: 1400px; }

.m-footer { margin-top: auto; padding: 20px 32px; font-size: 13px; color: var(--m-muted); }

.m-scrim { display: none; }

/* ---------- Typography ---------- */

.m-eyebrow { font-size: 14px; color: var(--m-ink-3); }
.m-h1 { font-family: var(--m-font-display); font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.m-h2 { font-size: 16px; font-weight: 600; }
.m-sub { font-size: 13px; color: var(--m-ink-3); }
.m-label-caps { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--m-muted); }

.m-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.m-page-head > div:first-child { display: flex; flex-direction: column; gap: 6px; }
.m-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* ---------- Buttons ---------- */

.m-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
    font: 600 14px var(--m-font); cursor: pointer; text-decoration: none !important; white-space: nowrap;
    transition: transform .12s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.m-btn:active { transform: translateY(1px) scale(.98); }
.m-btn-primary { background: var(--m-primary); color: #fff !important; box-shadow: 0 1px 2px rgba(28, 92, 171, .3); }
.m-btn-primary:hover { background: var(--m-primary-hover); box-shadow: 0 4px 12px rgba(28, 92, 171, .25); }
.m-btn-ghost { background: var(--m-surface); color: var(--m-ink) !important; border-color: var(--m-border-strong); }
.m-btn-ghost:hover { background: var(--m-surface-2); border-color: #C5CDD8; }
.m-btn-danger { background: #B42323; color: #fff !important; }
.m-btn-danger:hover { background: #961B1B; }
.m-btn-link { background: transparent; color: var(--m-primary) !important; padding: 0 8px; }
.m-btn-link:hover { background: var(--m-primary-soft); }
.m-btn-sm { min-height: 36px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.m-btn-block { width: 100%; }

.m-icon-btn {
    width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--m-border-strong);
    background: var(--m-surface); color: var(--m-ink-2) !important; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.m-icon-btn:hover { background: var(--m-surface-3); border-color: #C5CDD8; color: var(--m-ink) !important; }
.m-icon-btn.is-quiet { width: 36px; height: 36px; border-radius: 10px; border-color: transparent; background: transparent; color: var(--m-ink-3) !important; }
.m-icon-btn.is-quiet:hover { background: var(--m-surface-3); }
.m-icon-btn.is-danger:hover { background: var(--m-bad-soft); color: #B42323 !important; }

/* ---------- Cards & tiles ---------- */

.m-card {
    background: var(--m-surface); border: 1px solid var(--m-border);
    border-radius: var(--m-radius); box-shadow: var(--m-shadow);
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.m-card-pad { padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.m-card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.m-card-head > div:first-child { display: flex; flex-direction: column; gap: 4px; }
.m-lift:hover { box-shadow: var(--m-shadow-hover); transform: translateY(-2px); border-color: #D3DAE4; }

.m-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.m-kpi { padding: 22px 24px; display: flex; flex-direction: column; gap: 10px; }
.m-kpi-label { font-size: 13px; font-weight: 500; color: var(--m-ink-3); }
.m-kpi-value { font-family: var(--m-font-display); font-size: 34px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.m-kpi-note { font-size: 13px; color: var(--m-ink-3); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.m-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.m-stat { padding: 18px 20px; display: flex; align-items: center; gap: 14px; }
.m-stat-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.m-stat-icon.is-blue { background: var(--m-primary-soft); color: var(--m-primary); }
.m-stat-icon.is-green { background: var(--m-good-soft); color: var(--m-good-ink); }
.m-stat-icon.is-amber { background: #FFF4DB; color: #8A5A00; }
.m-stat-icon.is-red { background: var(--m-bad-soft); color: var(--m-bad-ink); }
.m-stat-body { display: flex; flex-direction: column; }
.m-stat-value { font-family: var(--m-font-display); font-size: 22px; font-weight: 700; line-height: 1.25; }
.m-stat-value small { font-family: var(--m-font); font-size: 14px; font-weight: 500; color: var(--m-ink-3); }

.m-row-21 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; }
.m-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }

/* ---------- Pills, badges, chips ---------- */

.m-pill {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
    border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.m-pill.is-neutral { background: var(--m-surface-3); color: var(--m-ink-2); font-weight: 500; }
.m-pill.is-good { background: var(--m-good-soft); color: var(--m-good-ink); }
.m-pill.is-bad { background: var(--m-bad-soft); color: var(--m-bad-ink); }
.m-pill.is-warn { background: #FFF4DB; color: #7A4F00; }
.m-pill.is-info { background: var(--m-primary-soft); color: var(--m-primary); }
.m-pill.lvl-foundation { background: #E8F0FB; color: #1C4F8F; }
.m-pill.lvl-basic { background: #FDEEE7; color: #9A3A12; }
.m-pill.lvl-intermediate { background: #E4F6EE; color: #0B6B48; }
.m-pill.lvl-advanced { background: #F1EEFC; color: #4B3BB0; }
.m-pill.lvl-other { background: var(--m-surface-3); color: var(--m-ink-2); }

a.m-pill { text-decoration: none; }
a.m-pill.is-good:hover { background: #D5EFD5; color: var(--m-good-ink); }

.m-badge-count { padding: 2px 9px; border-radius: 99px; background: var(--m-bad-soft); color: var(--m-bad-ink); font-size: 12px; font-weight: 600; }

.m-chip {
    min-height: 36px; padding: 0 14px; border-radius: 99px; cursor: pointer;
    border: 1px solid var(--m-border-strong); background: var(--m-surface); color: var(--m-ink-2);
    font: 500 13px var(--m-font); display: inline-flex; align-items: center; gap: 6px;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.m-chip:hover { border-color: #C5CDD8; }
.m-chip span { font-size: 12px; opacity: .8; }
.m-chip[aria-pressed="true"] { background: var(--m-ink); border-color: var(--m-ink); color: #fff; }

.m-seg { display: inline-flex; max-width: 100%; overflow-x: auto; padding: 3px; border-radius: 12px; background: var(--m-surface-3); }
.m-seg button, .m-seg a {
    min-height: 36px; padding: 0 14px; border: 0; border-radius: 9px; cursor: pointer;
    background: transparent; color: var(--m-ink); font: 500 13px var(--m-font);
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; flex: none; white-space: nowrap;
}
.m-seg button span { font-size: 12px; color: var(--m-ink-3); }
.m-seg [aria-pressed="true"], .m-seg [aria-current="page"] { background: var(--m-surface); box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }
.m-seg.is-icons button { width: 40px; padding: 0; }

/* ---------- Inputs ---------- */

.m-search { position: relative; flex: 1 1 260px; max-width: 360px; }
.m-search .m-icon { position: absolute; left: 14px; top: 13px; color: var(--m-muted); pointer-events: none; }
.m-input, .m-select {
    width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--m-border-strong);
    border-radius: 12px; background: var(--m-surface); font: 400 14px var(--m-font); color: var(--m-ink);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.m-search .m-input { padding-left: 42px; }
.m-input:focus, .m-select:focus { outline: none; border-color: var(--m-primary); box-shadow: 0 0 0 3px rgba(28, 92, 171, .15); }
.m-input.is-sm { height: 36px; padding: 0 10px; border-radius: 10px; font-size: 13px; }
/* Input and button side by side inside a table cell */
.m-inline-form { display: flex; align-items: center; gap: 6px; margin: 0; }
.m-inline-form .m-input { width: 120px; }
.m-doc-actions { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.m-doc-actions label { width: 100%; justify-content: flex-start; }
/* Small document thumbnails that open large (certificates) */
.m-thumbs { position: relative; display: flex; flex-wrap: wrap; gap: 6px; }
.m-thumbs:has(img) { margin-top: 8px; }
.m-thumbs img { width: 64px; height: 48px; object-fit: cover; border: 1px solid var(--m-border); border-radius: 8px; cursor: pointer; background: var(--m-surface-2); }
.m-thumbs-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; border-radius: 2px; background: var(--m-surface-3); overflow: hidden; }
.m-thumbs-progress span { display: block; width: 0; height: 100%; background: var(--m-good); transition: width .1s linear; }
.m-field { display: flex; flex-direction: column; gap: 6px; }
.m-field label { font-size: 14px; font-weight: 500; }
.m-field label small { font-weight: 400; color: var(--m-muted); font-size: 14px; }
.m-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.m-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

/* ---------- Forms ---------- */

.m-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.m-form-grid > .is-wide { grid-column: 1 / -1; }
.m-field .m-req { color: var(--m-bad); margin-left: 2px; }
.m-field-hint { font-size: 12px; color: var(--m-muted); }
.m-input.is-invalid, .m-input.is-invalid:focus { border-color: var(--m-bad); box-shadow: 0 0 0 3px rgba(208, 59, 59, .15); }
.m-field-error { font-size: 12px; font-weight: 500; color: var(--m-bad-ink); }
.m-input::placeholder { color: #94A3B8; }
.m-input[readonly] { background: var(--m-surface-2); color: var(--m-ink-3); }
textarea.m-input { height: auto; min-height: 96px; padding: 10px 14px; resize: vertical; }
select.m-select {
    appearance: none; -webkit-appearance: none; padding-right: 40px;
    background: var(--m-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center;
}

.m-section-head { display: flex; align-items: flex-start; gap: 12px; }
.m-section-head > div { display: flex; flex-direction: column; gap: 2px; }
.m-step {
    width: 32px; height: 32px; border-radius: 10px; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--m-primary-soft); color: var(--m-primary);
}

/* Option tiles: a checkbox or radio inside a <label class="m-option"> */
.m-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.m-options.is-compact { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.m-option {
    display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 14px; margin: 0;
    border: 1px solid var(--m-border-strong); border-radius: 12px; background: var(--m-surface);
    font-size: 14px; font-weight: 500; color: var(--m-ink-2); cursor: pointer; user-select: none;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease, transform .12s ease;
}
.m-option:hover { border-color: #C5CDD8; }
.m-option:active { transform: scale(.98); }
.m-option input { width: 18px; height: 18px; margin: 0; flex: 0 0 auto; accent-color: var(--m-primary); }
.m-option small { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--m-muted); white-space: nowrap; }
.m-option:has(input:checked) { border-color: var(--m-primary); background: var(--m-primary-soft); color: var(--m-ink); box-shadow: inset 0 0 0 1px var(--m-primary); }
.m-option:has(input:checked) small { color: var(--m-primary); }

/* Extra fields that appear for a chosen option */
.m-reveal {
    display: flex; flex-direction: column; gap: 14px; padding: 16px; border-radius: 12px;
    background: var(--m-surface-2); border: 1px solid var(--m-divider); animation: m-pop .2s ease-out;
}
.m-reveal-title { font-size: 13px; font-weight: 600; color: var(--m-ink-3); }
@keyframes m-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* File picker with a round preview */
.m-upload {
    position: relative; display: flex; align-items: center; gap: 16px; padding: 14px 16px; margin: 0;
    border: 1px dashed #C5CDD8; border-radius: 14px; background: var(--m-surface-2); cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.m-upload:hover, .m-upload:focus-within { border-color: var(--m-primary); background: var(--m-primary-soft); }
.m-upload input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.m-upload-preview {
    width: 64px; height: 64px; border-radius: 50%; flex: 0 0 auto; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: var(--m-surface-3) center / cover no-repeat; color: var(--m-muted);
}
.m-upload-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 14px; }
.m-upload-text strong { font-weight: 600; color: var(--m-ink); }
.m-upload-text span { font-size: 12px; color: var(--m-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Form beside a sticky summary */
.m-form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.m-form-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.m-sticky { position: sticky; top: 96px; }
.m-total { font-family: var(--m-font-display); font-size: 40px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.m-summary-rows { display: flex; flex-direction: column; gap: 14px; padding-top: 18px; border-top: 1px solid var(--m-divider); }

/* Save bar that stays in reach at the bottom of long forms */
.m-actionbar {
    position: sticky; bottom: 16px; z-index: 10;
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 12px 12px 20px; border: 1px solid var(--m-border); border-radius: 16px;
    background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); box-shadow: 0 10px 30px rgba(15, 23, 42, .08);
}

/* ---------- Detail lists & profile ---------- */

.m-dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px 24px; margin: 0; }
.m-dl > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.m-dl dt { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--m-muted); }
.m-dl dd { margin: 0; font-size: 14px; color: var(--m-ink); overflow-wrap: anywhere; }
.m-dl dd.is-empty { color: #94A3B8; }

.m-profile { padding: 24px 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 24px; }
.m-profile-photo {
    width: 104px; height: 104px; border-radius: 50%; object-fit: cover; flex: 0 0 auto;
    background: var(--m-surface-3); box-shadow: 0 0 0 4px #fff, 0 0 0 5px var(--m-border);
}
.m-profile-main { flex: 1 1 320px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.m-profile-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 13px; color: var(--m-ink-3); }
.m-profile-meta > span { display: inline-flex; align-items: center; gap: 6px; }

.m-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.m-timeline li { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 0 10px 24px; font-size: 14px; }
.m-timeline li::before { content: ""; position: absolute; left: 5px; top: 0; bottom: 0; width: 2px; background: var(--m-divider); }
.m-timeline li:first-child::before { top: 50%; }
.m-timeline li:last-child::before { bottom: 50%; }
.m-timeline li::after {
    content: ""; position: absolute; left: 0; top: 50%; width: 12px; height: 12px; margin-top: -6px;
    border-radius: 50%; background: var(--m-surface); border: 2px solid var(--m-series-1);
}
.m-timeline li:first-child::after { background: var(--m-series-1); }
.m-timeline-when { margin-left: auto; font-size: 13px; color: var(--m-muted); white-space: nowrap; }

/* ---------- Data tables (plain DataTables build, laid out with dom: m-dt-top / t / m-dt-bottom) ---------- */

.m-dt-top, .m-dt-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; }
.m-dt-bottom { border-top: 1px solid var(--m-divider); }
/* DataTables writes a measured pixel width on the table, which can come out a few pixels wider than the card */
.m-table-wrap > table.dataTable { width: 100% !important; }
.m-body .dataTables_length label, .m-body .dataTables_filter label { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; color: var(--m-ink-3); }
.m-body .dataTables_length select, .m-body .dataTables_filter input {
    height: 40px; padding: 0 12px; border: 1px solid var(--m-border-strong); border-radius: 10px;
    background: var(--m-surface); font: 400 14px var(--m-font); color: var(--m-ink);
}
.m-body .dataTables_filter input { width: 260px; max-width: 100%; }
.m-body .dataTables_filter input:focus, .m-body .dataTables_length select:focus { outline: none; border-color: var(--m-primary); box-shadow: 0 0 0 3px rgba(28, 92, 171, .15); }
.m-body .dataTables_info { font-size: 14px; color: var(--m-ink-3); }
.m-body .dataTables_paginate { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; max-width: 100%; }
.m-body .dataTables_paginate span { display: flex; flex-wrap: wrap; gap: 4px; }
.m-body .paginate_button {
    min-width: 36px; height: 36px; padding: 0 10px; border-radius: 10px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 14px; color: var(--m-ink-2) !important; text-decoration: none; user-select: none;
}
.m-body .paginate_button:hover { background: var(--m-surface-3); }
.m-body .paginate_button.current { background: var(--m-primary); color: #fff !important; font-weight: 600; }
.m-body .paginate_button.disabled { color: #94A3B8 !important; cursor: default; background: none; }
.m-body table.dataTable thead th { cursor: pointer; position: relative; padding-right: 26px; }
.m-body table.dataTable thead th.sorting_disabled { cursor: default; padding-right: 12px; }
.m-body table.dataTable thead .sorting::after,
.m-body table.dataTable thead .sorting_asc::after,
.m-body table.dataTable thead .sorting_desc::after { position: absolute; right: 10px; font-size: 11px; color: #94A3B8; }
.m-body table.dataTable thead .sorting::after { content: "\2195"; }
.m-body table.dataTable thead .sorting_asc::after { content: "\2191"; color: var(--m-primary); }
.m-body table.dataTable thead .sorting_desc::after { content: "\2193"; color: var(--m-primary); }
.m-body table.dataTable td.dataTables_empty { text-align: center; color: var(--m-ink-3); padding: 32px; }
/* Server-side tables: while a page loads, dim the rows and run a bar across the top */
.m-body .dataTables_processing {
    position: absolute; inset: 0; z-index: 2; overflow: hidden;
    background: rgba(255, 255, 255, .55); pointer-events: none;
}
.m-body .dataTables_processing::before {
    content: ""; position: absolute; top: 0; left: 0; height: 3px; width: 35%;
    background: var(--m-primary); border-radius: 0 3px 3px 0; animation: m-progress 1s ease-in-out infinite;
}
@keyframes m-progress { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

/* ---------- Sign-in ---------- */

.m-auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.m-auth-brand {
    position: relative; overflow: hidden; padding: 48px; color: #fff;
    display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
    background: radial-gradient(120% 90% at 0% 0%, #2F3C7E 0%, var(--m-brand) 55%, #171D40 100%);
}
.m-auth-brand::after {
    content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%;
    border: 60px solid rgba(255, 255, 255, .05); pointer-events: none;
}
.m-auth-brand img { height: 84px; width: auto; align-self: flex-start; }
.m-auth-brand h1 { font-family: var(--m-font-display); font-size: 40px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; max-width: 460px; }
.m-auth-brand p { color: #C7CEEA; font-size: 16px; max-width: 420px; margin-top: 12px; }
.m-auth-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; color: #DCE1F5; font-size: 14px; }
.m-auth-points li { display: flex; align-items: center; gap: 10px; }
.m-auth-main { display: flex; align-items: center; justify-content: center; padding: 48px 24px; background: var(--m-surface); }
.m-auth-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 24px; }
.m-auth-card form { display: flex; flex-direction: column; gap: 18px; }
.m-input-wrap { position: relative; }
.m-input-wrap .m-input { padding-right: 48px; }
.m-input-wrap .m-icon-btn { position: absolute; right: 4px; top: 4px; width: 36px; height: 36px; }

/* ---------- Meters & charts ---------- */

.m-meter { height: 8px; border-radius: 99px; background: #E8EDF4; overflow: hidden; display: flex; }
.m-meter > span { display: block; height: 100%; border-radius: 99px; background: var(--m-series-1); }

.m-split { display: flex; gap: 2px; height: 8px; border-radius: 99px; overflow: hidden; background: var(--m-surface-3); }
.m-split.is-lg { height: 14px; }
.m-split .is-paid { background: var(--m-good); }
.m-split .is-unpaid { background: var(--m-bad); flex: 1 1 auto; }
.m-split .is-pending { background: #FAB219; }

.m-trend { display: inline-flex; align-items: center; gap: 2px; padding: 2px 8px; border-radius: 99px; font-weight: 600; }
.m-trend.is-down { background: var(--m-bad-soft); color: var(--m-bad-ink); }
.m-trend.is-up { background: var(--m-good-soft); color: var(--m-good-ink); }
.m-trend.is-flat { background: var(--m-surface-3); color: var(--m-ink-2); }

.m-colchart { display: flex; gap: 12px; }
.m-colchart-y {
    display: flex; flex-direction: column; justify-content: space-between; height: 240px;
    font-size: 12px; color: var(--m-muted); text-align: right; font-variant-numeric: tabular-nums;
    margin-top: -7px; margin-bottom: 7px; white-space: nowrap;
}
.m-colchart-plot { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.m-colchart-area { position: relative; height: 240px; }
.m-colchart-grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; }
.m-colchart-grid div { border-top: 1px solid var(--m-divider); }
.m-colchart-grid div:last-child { border-top-color: #CBD3DE; }
.m-colchart-avg { position: absolute; left: 0; right: 0; border-top: 1.5px dashed #94A3B8; }
.m-colchart-bars { position: absolute; inset: 0; display: flex; align-items: flex-end; }
.m-bar {
    flex: 1 1 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
    position: relative; background: none; border: 0; padding: 0 3px; cursor: default;
}
.m-bar-fill {
    width: 100%; max-width: 40px; min-height: 2px; border-radius: 4px 4px 0 0;
    background: var(--m-series-1); transition: background .15s ease;
}
.m-bar:hover .m-bar-fill, .m-bar:focus-visible .m-bar-fill { background: var(--m-primary); }
.m-bar-tip {
    position: absolute; left: 50%; transform: translate(-50%, 4px); opacity: 0; pointer-events: none;
    white-space: nowrap; padding: 8px 12px; border-radius: 10px; background: var(--m-ink); color: #fff;
    font-size: 12px; line-height: 1.4; text-align: left; box-shadow: 0 8px 24px rgba(15, 23, 42, .18);
    z-index: 2; display: flex; flex-direction: column; transition: opacity .12s ease, transform .12s ease;
}
.m-bar-tip span { color: #CBD5E1; }
.m-bar-tip strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.m-bar:hover .m-bar-tip, .m-bar:focus-visible .m-bar-tip { opacity: 1; transform: translate(-50%, 0); }
/* Edge bars: keep the tooltip inside the chart instead of centring it past the edge */
.m-bar:last-child .m-bar-tip { left: auto; right: 0; transform: translate(0, 4px); }
.m-bar:last-child:hover .m-bar-tip, .m-bar:last-child:focus-visible .m-bar-tip { transform: none; }
.m-bar:first-child .m-bar-tip { left: 0; transform: translate(0, 4px); }
.m-bar:first-child:hover .m-bar-tip, .m-bar:first-child:focus-visible .m-bar-tip { transform: none; }
.m-colchart-x { display: flex; }
.m-colchart-x span { flex: 1 1 0; text-align: center; font-size: 12px; color: var(--m-muted); }

.m-legend { display: flex; flex-wrap: wrap; gap: 20px; font-size: 13px; color: var(--m-ink-3); align-items: center; }
.m-legend > span { display: flex; align-items: center; gap: 8px; }
.m-swatch { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto; }
.m-swatch.is-1 { background: var(--m-series-1); }
.m-swatch.is-2 { background: var(--m-series-2); }
.m-swatch.is-3 { background: var(--m-series-3); }
.m-swatch.is-line { width: 18px; height: 0; border-radius: 0; border-top: 1.5px dashed #94A3B8; }

.m-hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.m-hbar { display: grid; grid-template-columns: 116px minmax(0, 1fr) 32px; align-items: center; gap: 12px; font-size: 13px; }
.m-hbar-name { color: var(--m-ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-hbar-track { height: 12px; background: var(--m-surface-3); border-radius: 0 4px 4px 0; display: flex; }
.m-hbar-track span { background: var(--m-series-1); border-radius: 0 4px 4px 0; }
.m-hbar-val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

.m-shares { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.m-share { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.m-share-top { display: flex; justify-content: space-between; gap: 8px; }
.m-share-top span:first-child { color: var(--m-ink-2); }
.m-share-top em { font-style: normal; color: var(--m-muted); }
.m-share-track { height: 8px; border-radius: 99px; background: var(--m-surface-3); display: flex; }
.m-share-track span { background: var(--m-series-1); border-radius: 99px; }

.m-stack { display: flex; gap: 2px; height: 28px; }
.m-stack span:first-child { border-radius: 6px 0 0 6px; }
.m-stack span:last-child { border-radius: 0 6px 6px 0; }
.m-stack span:only-child { border-radius: 6px; }

.m-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.m-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--m-divider); font-size: 14px; }
.m-list li:last-child { border-bottom: 0; }
.m-list-grow { flex: 1 1 auto; }

.m-alerts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.m-alert { display: flex; gap: 12px; padding: 14px; border-radius: 12px; background: var(--m-surface-3); font-size: 14px; }
.m-alert .m-icon { margin-top: 1px; color: var(--m-ink-2); }
.m-alert > div { display: flex; flex-direction: column; gap: 4px; }
.m-alert strong { font-weight: 600; }
.m-alert a { font-size: 13px; font-weight: 600; text-decoration: none; }
.m-alert.is-warn { background: var(--m-warn-soft); }
.m-alert.is-warn .m-icon { color: #8A5A00; }
.m-alert.is-bad { background: var(--m-bad-soft); }
.m-alert.is-bad .m-icon { color: #B42323; }
.m-alert.is-good { background: var(--m-good-soft); }
.m-alert.is-good .m-icon { color: var(--m-good-ink); }

.m-empty { padding: 48px 24px; text-align: center; color: var(--m-ink-3); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.m-empty strong { color: var(--m-ink); font-size: 16px; }

/* ---------- Tables ---------- */

/* position: relative keeps absolutely positioned screen-reader labels inside the scroll box */
.m-table-wrap { overflow-x: auto; position: relative; }
.m-table { width: 100%; font-size: 14px; }
.m-table th {
    text-align: left; padding: 12px; font-size: 13px; font-weight: 600; color: var(--m-ink-3);
    background: var(--m-surface-2); white-space: nowrap;
}
.m-table td { padding: 12px; border-top: 1px solid var(--m-divider); vertical-align: middle; }
.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 tbody tr { transition: background .12s ease; }
.m-table tbody tr:hover { background: var(--m-surface-2); }
.m-table .is-right { text-align: right; }
.m-table td.m-num { white-space: nowrap; }
.m-table.is-plain th { background: transparent; border-bottom: 1px solid var(--m-border); }
.m-table.is-plain td:first-child, .m-table.is-plain th:first-child { padding-left: 12px; }
.m-person { display: flex; align-items: center; gap: 12px; }
.m-person-meta { display: flex; flex-direction: column; min-width: 0; }
.m-person-meta a, .m-person-meta strong { font-weight: 600; color: var(--m-ink) !important; text-decoration: none; }
.m-person-meta a:hover { text-decoration: underline; }
.m-person-meta span { font-size: 12px; color: var(--m-muted); }
.m-row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.m-row-actions.is-wrap { flex-wrap: wrap; width: 210px; margin-left: auto; }
.m-row-actions.is-wrap .m-btn { padding: 0 10px; }
.m-table.is-clickable tbody tr { cursor: pointer; }
.m-table.is-clickable tbody tr:hover td { background: var(--m-surface-2); }
.m-table td.m-country { min-width: 120px; }
.m-break { overflow-wrap: anywhere; }
.m-table-foot {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 20px; border-top: 1px solid var(--m-divider); font-size: 14px; color: var(--m-ink-3);
}

/* ---------- Roster cards ---------- */

.m-roster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.m-roster { padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.m-roster-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.m-roster-top > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.m-roster-title { font-family: var(--m-font-display); font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.m-roster-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--m-muted); }
.m-teacher { display: flex; align-items: center; gap: 10px; }
.m-teacher-meta { display: flex; flex-direction: column; line-height: 1.3; }
.m-teacher-meta strong { font-size: 14px; font-weight: 500; }
.m-teacher-meta span { font-size: 12px; color: var(--m-muted); }
.m-noteacher {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 8px 8px 8px 12px; border-radius: 12px; background: var(--m-warn-soft);
}
.m-noteacher span { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--m-warn-ink); }
.m-noteacher a {
    min-height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--m-warn-border);
    background: #fff; color: var(--m-warn-ink) !important; font-weight: 600; font-size: 13px;
    display: inline-flex; align-items: center; text-decoration: none;
}
.m-roster-fees { display: flex; flex-direction: column; gap: 8px; }
.m-roster-fees > div:first-child { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--m-ink-3); }
.m-roster-fees strong { font-size: 15px; color: var(--m-ink); }
.m-roster-foot { display: flex; gap: 8px; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--m-divider); }
.m-roster-foot .m-btn { flex: 1 1 auto; }

.m-dropdown { position: relative; }
.m-dropdown > summary { list-style: none; }
.m-dropdown > summary::-webkit-details-marker { display: none; }

.m-monthnav {
    display: flex; align-items: center; gap: 4px; padding: 4px;
    background: var(--m-surface); border: 1px solid var(--m-border-strong); border-radius: 14px;
}
.m-monthnav a {
    width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
    color: var(--m-ink-2) !important;
}
.m-monthnav a:hover { background: var(--m-surface-3); }
.m-monthnav strong { padding: 0 10px; font-size: 14px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.m-monthnav strong .m-icon { color: var(--m-primary); }

/* ---------- Roster header ---------- */

.m-hero { padding: 24px 28px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; }
.m-hero > div:first-child { display: flex; flex-direction: column; gap: 12px; }
.m-hero-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.m-hero-tags > span:last-child { font-size: 12px; color: var(--m-muted); }
/* Roster actions stay in the right-hand column beside the title, right-aligned */
.m-hero-actions { flex: 1 1 300px; justify-content: flex-end; max-width: 760px; }

.m-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--m-muted); }
.m-status .m-dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid #94A3B8; }
.m-status.is-done { color: var(--m-good-ink); font-weight: 500; }
.m-status.is-done .m-dot { background: var(--m-good); border-color: var(--m-good); }

/* ---------- Flash messages ---------- */

.m-flash {
    display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 12px;
    font-size: 14px; border: 1px solid transparent;
}
.m-flash.is-good { background: var(--m-good-soft); border-color: #BFE5BF; color: #0A5A0A; }
.m-flash.is-bad { background: var(--m-bad-soft); border-color: #F3C2C2; color: #8E1C1C; }
.m-flash .m-flash-close {
    margin-left: auto; background: none; border: 0; cursor: pointer; color: inherit;
    width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
}
.m-flash .m-flash-close:hover { background: rgba(0, 0, 0, .06); }

/* ---------- Dialogs (works with Bootstrap 4 modal JS) ---------- */

.m-body .modal {
    position: fixed; inset: 0; z-index: 1050; display: none; overflow-x: hidden; overflow-y: auto; outline: 0;
}
.m-body .modal-dialog { position: relative; width: auto; max-width: 500px; margin: 80px auto; padding: 0 16px; pointer-events: none; }
.m-body .modal.fade .modal-dialog { transition: transform .2s ease-out; transform: translateY(-16px); }
.m-body .modal.show .modal-dialog { transform: none; }
.m-body .modal-content {
    position: relative; display: flex; flex-direction: column; pointer-events: auto;
    background: var(--m-surface); border-radius: 20px; box-shadow: 0 24px 60px rgba(15, 23, 42, .25); outline: 0;
}
.m-body .modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 24px 28px 0; }
.m-body .modal-title { font-family: var(--m-font-display); font-size: 20px; font-weight: 700; margin: 0; }
.m-body .modal-header p { margin-top: 4px; font-size: 14px; color: var(--m-ink-3); }
.m-body .modal-body { padding: 20px 28px 28px; display: flex; flex-direction: column; gap: 16px; }
.m-body .modal-body form { display: flex; flex-direction: column; gap: 16px; }
.m-body .modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.m-body .modal-backdrop { position: fixed; inset: 0; z-index: 1040; background: #0F172A; }
.m-body .modal-backdrop.fade { opacity: 0; transition: opacity .15s linear; }
.m-body .modal-backdrop.show { opacity: .45; }
.m-body.modal-open { overflow: hidden; }
.m-body.modal-open .modal { overflow-y: auto; }
.m-body .fade:not(.show) { opacity: 0; }
.m-body .fade { transition: opacity .15s linear; }
.m-dialog-icon { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.m-dialog-icon.is-bad { background: var(--m-bad-soft); color: #B42323; }
.m-body .modal-body p { font-size: 14px; line-height: 1.55; color: var(--m-ink-3); }

.m-check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--m-ink-2); cursor: pointer; }
.m-check input { width: 18px; height: 18px; accent-color: var(--m-primary); }

/* Select2 inside the modern dialogs */
.m-body .select2-container { width: 100% !important; }
.m-body .select2-container .select2-selection--single,
.m-body .select2-container .select2-selection--multiple {
    min-height: 44px; border: 1px solid var(--m-border-strong); border-radius: 12px; padding: 4px 6px;
}
.m-body .select2-container .select2-selection--single .select2-selection__rendered { line-height: 34px; }
.m-body .select2-container .select2-selection--single .select2-selection__arrow { height: 42px; }
.m-body .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background: var(--m-primary-soft); border: 0; border-radius: 8px; color: #1C4F8F; padding: 2px 8px 2px 22px;
}
.m-body .select2-dropdown { border-color: var(--m-border-strong); border-radius: 12px; overflow: hidden; z-index: 1060; }

/* ---------- Loading skeleton ---------- */

.m-dash { display: flex; flex-direction: column; gap: 24px; }
.m-skel {
    display: block; max-width: 100%; border-radius: 8px;
    background: linear-gradient(90deg, #EBEFF4 25%, #F6F8FB 40%, #EBEFF4 60%) 0 0 / 300% 100%;
    animation: m-shimmer 1.4s ease-in-out infinite;
}
@keyframes m-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.m-skel-bars { display: flex; align-items: flex-end; gap: 12px; height: 240px; padding-top: 12px; }
.m-skel-bars .m-skel { flex: 1 1 0; border-radius: 6px 6px 0 0; }

/* ---------- Entrance motion (js/modern.js adds .m-animate, then .is-in per card in view) ---------- */

.m-animate .m-card { opacity: 0; transform: translateY(10px); }
.m-animate .m-card.is-in {
    opacity: 1; transform: none;
    transition: opacity .45s ease, transform .45s cubic-bezier(.22, 1, .36, 1), box-shadow .2s ease, border-color .2s ease;
}
.m-animate .m-bar-fill { clip-path: inset(100% 0 0 0); }
.m-animate .m-hbar-track > span,
.m-animate .m-share-track > span,
.m-animate .m-split,
.m-animate .m-stack { clip-path: inset(0 100% 0 0); }
.m-animate .m-spark { stroke-dasharray: 1; stroke-dashoffset: 1; }
.m-animate .m-colchart-avg { opacity: 0; }
.m-animate .is-in .m-bar-fill,
.m-animate .is-in .m-hbar-track > span,
.m-animate .is-in .m-share-track > span,
.m-animate .is-in .m-split,
.m-animate .is-in .m-stack {
    clip-path: inset(0 0 0 0);
    transition: clip-path .9s cubic-bezier(.22, 1, .36, 1) calc(.15s + var(--m-i, 0) * 55ms), background .15s ease;
}
.m-animate .is-in .m-spark { stroke-dashoffset: 0; transition: stroke-dashoffset 1.2s ease .2s; }
.m-animate .is-in .m-colchart-avg { opacity: 1; transition: opacity .4s ease 1s; }

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
    .m-body *, .m-body *::before, .m-body *::after { transition: none !important; animation: none !important; }
}

/* ---------- Print: only the page content ---------- */

@media print {
    .m-side, .m-scrim, .m-topbar, .m-footer, .scroll-to-top { display: none !important; }
    body.m-body { background: #fff; }
    .m-content { padding: 0; }
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
    .m-row-21, .m-row-3, .m-form-layout { grid-template-columns: minmax(0, 1fr); }
    .m-sticky { position: static; }
}

@media (max-width: 900px) {
    .m-auth { grid-template-columns: minmax(0, 1fr); }
    .m-auth-brand { padding: 24px; gap: 16px; justify-content: flex-start; }
    .m-auth-brand img { height: 56px; }
    .m-auth-brand h1 { font-size: 26px; }
    .m-auth-brand p, .m-auth-points { display: none; }
    .m-auth-main { padding: 32px 16px 48px; align-items: flex-start; }
}

@media (max-width: 960px) {
    .m-side {
        position: fixed; left: 0; top: 0; z-index: 60; height: 100vh;
        transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(15, 23, 42, .2);
    }
    .is-nav-open > .m-side { transform: none; }
    .is-nav-open > .m-scrim { display: block; position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, .45); }
    .m-icon-btn.m-menu-btn { display: inline-flex; }
    .m-topbar { padding: 12px 16px; }
    .m-content { padding: 20px 16px; }
    .m-footer { padding: 20px 16px; }
}

@media (max-width: 640px) {
    .m-hide-sm { display: none !important; }
    /* Phones: the top bar keeps one row; the breadcrumb shows only the current page */
    .m-topbar { flex-wrap: nowrap; }
    .m-crumbs { flex-wrap: nowrap; flex: 1 1 auto; }
    .m-crumbs > :not(:last-child) { display: none !important; }
    .m-crumbs > :last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .m-h1 { font-size: 24px; }
    .m-kpi-value { font-size: 28px; }
    .m-hero { padding: 20px; }
    .m-card-pad { padding: 18px; }
    .m-colchart-y { display: none; }
    .m-page-head .m-actions, .m-hero .m-actions { width: 100%; }
    .m-page-head .m-actions .m-btn, .m-hero .m-actions .m-btn { flex: 1 1 auto; }
    .m-grid-2, .m-form-grid { grid-template-columns: minmax(0, 1fr); }
    .m-profile { padding: 20px; }
    .m-actionbar { bottom: 8px; padding: 12px; }
    .m-actionbar .m-btn { flex: 1 1 auto; }
    .m-dt-top, .m-dt-bottom { padding: 14px 16px; }
    .m-body .dataTables_filter, .m-body .dataTables_filter label, .m-body .dataTables_filter input { width: 100%; }
}
