/* ==========================================================================
   Medina SmartRoster — Design System
   Clinical Workforce Intelligence Platform
   --------------------------------------------------------------------------
   One token set, two appearances (light / dark). Every page uses these
   tokens; page stylesheets in asset/css/pages/ only arrange components.
   ========================================================================== */

/* ---------- 1. TOKENS ---------------------------------------------------- */
:root,
html[data-theme="light"] {
    color-scheme: light;

    --bg:               #F5F7F7;
    --surface:          #FFFFFF;
    --surface-2:        #EEF3F2;            /* secondary surface */
    --surface-elevated: #FFFFFF;
    --surface-sunken:   #F0F4F3;
    --glass:            rgba(255, 255, 255, .72);

    --text-primary:     #10201E;
    --text-secondary:   #60716F;
    --text-tertiary:    #8A9997;
    --text-on-primary:  #FFFFFF;

    --border:           #DDE7E5;
    --border-strong:    #C9D7D4;

    --primary:          #0B9F87;
    --primary-strong:   #087A69;
    --primary-soft:     #E2F4F0;
    --primary-ring:     rgba(11, 159, 135, .28);
    --accent:           #6377FF;
    --accent-soft:      #ECEEFF;

    --success:          #159A72;
    --success-soft:     #E2F5EE;
    --warning:          #D99B18;
    --warning-text:     #9A6A06;
    --warning-soft:     #FCF3DE;
    --danger:           #D94C5C;
    --danger-soft:      #FCE9EB;
    --info:             #3D8BD9;
    --info-soft:        #E6F1FC;

    --shadow-sm: 0 1px 2px rgba(16, 32, 30, .05);
    --shadow:    0 1px 2px rgba(16, 32, 30, .04), 0 4px 16px rgba(16, 32, 30, .05);
    --shadow-lg: 0 2px 6px rgba(16, 32, 30, .06), 0 18px 48px rgba(16, 32, 30, .12);
    --glow:      none;

    /* Roster status colours (same hues as the printed templates) */
    --st-am-bg: #FFF1BF;  --st-am-fg: #6E5300;
    --st-pm-bg: #DCEBFF;  --st-pm-fg: #1D4F8C;
    --st-al-bg: #D7F5E0;  --st-al-fg: #18693A;
    --st-el-bg: #FFE3C7;  --st-el-fg: #8A4500;
    --st-ul-bg: #ECE3FF;  --st-ul-fg: #533A99;
    --st-hl-bg: #FFDCDC;  --st-hl-fg: #9B2525;
    --st-mc-bg: #FFE0F4;  --st-mc-fg: #8C2468;
    --st-off-bg:#E9EDEC;  --st-off-fg:#4E5C5A;
    --st-night-bg: #E8E1FF; --st-night-fg: #4A3699;
    --st-long-bg:  #D7F5E0; --st-long-fg:  #18693A;
    --st-custom-bg:#FFE0F4; --st-custom-fg:#8C2468;
}

html[data-theme="dark"] {
    color-scheme: dark;

    --bg:               #071011;
    --surface:          #0C1719;
    --surface-2:        #102022;
    --surface-elevated: #14282A;
    --surface-sunken:   #091315;
    --glass:            rgba(16, 32, 34, .66);

    --text-primary:     #F3FAF8;
    --text-secondary:   #91A6A3;
    --text-tertiary:    #6A807D;
    --text-on-primary:  #042420;

    --border:           #20383A;
    --border-strong:    #2C4B4D;

    --primary:          #19C6A3;
    --primary-strong:   #5EEAD4;
    --primary-soft:     rgba(25, 198, 163, .13);
    --primary-ring:     rgba(25, 198, 163, .35);
    --accent:           #7488FF;
    --accent-soft:      rgba(116, 136, 255, .14);

    --success:          #35D49A;
    --success-soft:     rgba(53, 212, 154, .13);
    --warning:          #F3C65A;
    --warning-text:     #F3C65A;
    --warning-soft:     rgba(243, 198, 90, .13);
    --danger:           #FF6473;
    --danger-soft:      rgba(255, 100, 115, .13);
    --info:             #6FB2FF;
    --info-soft:        rgba(111, 178, 255, .13);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow:    0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .28);
    --shadow-lg: 0 2px 8px rgba(0, 0, 0, .45), 0 24px 64px rgba(0, 0, 0, .5);
    --glow:      0 0 0 1px rgba(25, 198, 163, .25), 0 0 22px rgba(25, 198, 163, .14);

    --st-am-bg: rgba(255, 216, 77, .16);  --st-am-fg: #FFD84D;
    --st-pm-bg: rgba(125, 187, 255, .16); --st-pm-fg: #9CCBFF;
    --st-al-bg: rgba(111, 219, 143, .15); --st-al-fg: #86E6A3;
    --st-el-bg: rgba(255, 159, 69, .16);  --st-el-fg: #FFB46E;
    --st-ul-bg: rgba(196, 168, 255, .16); --st-ul-fg: #CDB6FF;
    --st-hl-bg: rgba(255, 127, 127, .16); --st-hl-fg: #FF9C9C;
    --st-mc-bg: rgba(255, 166, 228, .15); --st-mc-fg: #FFB5E8;
    --st-off-bg:rgba(145, 166, 163, .14); --st-off-fg:#A9BBB8;
    --st-night-bg: rgba(196, 168, 255, .16); --st-night-fg: #CDB6FF;
    --st-long-bg:  rgba(111, 219, 143, .15); --st-long-fg:  #86E6A3;
    --st-custom-bg:rgba(255, 166, 228, .15); --st-custom-fg:#FFB5E8;
}

:root {
    --font-display: "Urbanist", "DM Sans", system-ui, sans-serif;
    --font-data:    "Space Grotesk", "DM Sans", system-ui, sans-serif;
    --font-ui:      "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-pill: 999px;

    --sidebar-w: 248px;
    --topbar-h: 64px;
    --content-pad: 32px;

    --ease: cubic-bezier(.2, .7, .2, 1);
    --t-fast: 150ms;
    --t: 220ms;
}

/* ---------- 2. BASE ------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--t) var(--ease), color var(--t) var(--ease);
}

h1, h2, h3, h4 { font-family: var(--font-display); color: var(--text-primary); letter-spacing: -.015em; margin: 0; }
h1 { font-size: 30px; font-weight: 700; line-height: 1.15; }
h2 { font-size: 19px; font-weight: 700; line-height: 1.25; }
h3 { font-size: 16px; font-weight: 700; }
h4 { font-size: 14px; font-weight: 700; }
p { margin: 0; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-strong); }

::selection { background: var(--primary-ring); }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

.t-num, .num { font-family: var(--font-data); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.t-display { font-family: var(--font-display); }
.t-muted { color: var(--text-secondary); }
.t-small { font-size: 12px; }

.msr-ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.msr-ic.sm { width: 15px; height: 15px; }
.msr-ic.lg { width: 22px; height: 22px; }

/* Scrollbars (subtle) */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }

/* ---------- 3. APP SHELL ------------------------------------------------- */
body:has(.msr-sidebar) { padding: var(--topbar-h) 0 0 var(--sidebar-w); min-height: 100vh; }

.msr-sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 60;
    width: var(--sidebar-w);
    display: flex; flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 18px 14px 14px;
    font-family: var(--font-ui);
}

.msr-brand { display: flex; align-items: center; color: var(--text-primary); }

/* Official logo (asset/images/logo.png, 1536×1024, transparent). The artwork
   sits inside x 250–1404 / y 29–997 of the canvas; the frame shows just that
   area, scaled proportionally (no stretching). Works on light and dark:
   the artwork has its own white outline. */
.msr-brand { justify-content: center; padding: 0 4px 14px; }
.msr-brand-logo { display: block; width: 150px; aspect-ratio: 1154 / 968; overflow: hidden; flex: none; }
.msr-brand-logo img { display: block; width: 133.1%; max-width: none; height: auto; margin: -2.51% 0 0 -21.66%; object-fit: contain; }

.msr-nav { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.msr-nav-section { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-tertiary); padding: 16px 10px 7px; }
.msr-nav-section:first-child { padding-top: 4px; }

.msr-nav-link {
    position: relative;
    display: flex; align-items: center; gap: 11px;
    padding: 9px 10px; margin: 1px 0;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13.5px; font-weight: 500;
    transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.msr-nav-link .msr-ic { width: 17px; height: 17px; }
.msr-nav-link:hover { background: var(--surface-2); color: var(--text-primary); }
.msr-nav-link.active { background: var(--primary-soft); color: var(--primary-strong); font-weight: 600; }
html[data-theme="dark"] .msr-nav-link.active { color: var(--primary-strong); box-shadow: inset 0 0 0 1px rgba(25, 198, 163, .18), 0 0 18px rgba(25, 198, 163, .08); }
.msr-nav-link.active::before {
    content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px;
    border-radius: 0 3px 3px 0; background: var(--primary);
}

.msr-sidebar-foot { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 8px; }

.msr-topbar {
    position: fixed; top: 0; left: var(--sidebar-w); right: 0; z-index: 50;
    height: var(--topbar-h);
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    padding: 0 var(--content-pad);
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--border);
}
.msr-crumbs { display: flex; flex-direction: column; min-width: 0; }
.msr-crumb-trail { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--text-tertiary); font-weight: 500; }
.msr-crumb-trail .msr-ic { width: 13px; height: 13px; }
.msr-crumb-title { font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.msr-topbar-right { display: flex; align-items: center; gap: 14px; flex: none; }
.msr-today { display: flex; align-items: center; gap: 7px; font-family: var(--font-data); font-size: 12.5px; color: var(--text-secondary); }

.msr-seg {
    display: inline-flex; padding: 3px; gap: 2px;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-pill);
}
.msr-seg button {
    appearance: none; border: 0; background: transparent; cursor: pointer;
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 10px; border-radius: var(--radius-pill);
    font: 500 12px var(--font-ui); color: var(--text-secondary);
    transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast);
}
.msr-seg button .msr-ic { width: 14px; height: 14px; }
.msr-seg button:hover { color: var(--text-primary); }
.msr-seg button[aria-pressed="true"] { background: var(--surface); color: var(--text-primary); box-shadow: var(--shadow-sm); }
html[data-theme="dark"] .msr-seg button[aria-pressed="true"] { background: var(--surface-elevated); box-shadow: 0 0 0 1px var(--border-strong); }

.msr-profile { display: flex; align-items: center; gap: 9px; padding-left: 14px; border-left: 1px solid var(--border); }
.msr-avatar {
    width: 32px; height: 32px; border-radius: 50%; flex: none;
    display: grid; place-items: center;
    background: var(--primary-soft); color: var(--primary-strong);
    font: 700 13px var(--font-display);
}
.msr-profile-name { font-size: 13px; font-weight: 600; line-height: 1.15; }
.msr-profile-role { font-size: 11px; color: var(--text-tertiary); }

/* Standard content wrapper for pages */
.msr-content { padding: 28px var(--content-pad) 56px; max-width: 1480px; }

/* ---------- 4. PAGE HEADER ---------------------------------------------- */
.msr-page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.msr-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--primary); margin-bottom: 6px; }
.msr-page-sub { color: var(--text-secondary); margin-top: 6px; font-size: 14px; max-width: 720px; }

/* ---------- 5. SURFACES -------------------------------------------------- */
.msr-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 22px;
}
.msr-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.msr-card-title { font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.msr-card-sub { color: var(--text-secondary); font-size: 13px; margin-top: 3px; }

.msr-glass {
    background: var(--glass);
    backdrop-filter: saturate(170%) blur(18px);
    -webkit-backdrop-filter: saturate(170%) blur(18px);
    border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.msr-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-tertiary); }

/* ---------- 6. BUTTONS --------------------------------------------------- */
.msr-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 38px; padding: 0 15px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font: 600 13.5px var(--font-ui);
    cursor: pointer; white-space: nowrap; text-decoration: none;
    transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast), transform 80ms;
}
.msr-btn:active { transform: translateY(1px); }
.msr-btn .msr-ic { width: 16px; height: 16px; }
.msr-btn-primary { background: var(--primary); color: var(--text-on-primary); }
.msr-btn-primary:hover { background: var(--primary-strong); color: var(--text-on-primary); }
html[data-theme="dark"] .msr-btn-primary:hover { background: #2BD9B5; box-shadow: var(--glow); }
.msr-btn-secondary { background: var(--surface); color: var(--text-primary); border-color: var(--border-strong); }
.msr-btn-secondary:hover { background: var(--surface-2); color: var(--text-primary); }
.msr-btn-ghost { background: transparent; color: var(--text-secondary); }
.msr-btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); }
.msr-btn-danger { background: var(--danger-soft); color: var(--danger); }
.msr-btn-danger:hover { background: var(--danger); color: #fff; }
.msr-btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; }
.msr-btn[disabled], .msr-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ---------- 7. FORMS (element defaults; pages may refine) --------------- */
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="time"], input[type="month"], input[type="search"], input[type="tel"],
select, textarea {
    font: 400 14px var(--font-ui);
    color: var(--text-primary);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    min-height: 40px;
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background-color var(--t-fast);
}
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border-strong)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--text-tertiary); cursor: not-allowed; }
input[type="date"], input[type="time"] { font-family: var(--font-data); }
textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: var(--text-tertiary); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea { background: var(--surface-sunken); }
label { color: var(--text-secondary); font-size: 12.5px; font-weight: 600; }

/* ---------- 8. TABLES ---------------------------------------------------- */
.msr-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.msr-table th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-tertiary); padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.msr-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text-primary); }
.msr-table tr:last-child td { border-bottom: 0; }
.msr-table tbody tr { transition: background-color var(--t-fast); }
.msr-table tbody tr:hover { background: color-mix(in srgb, var(--primary-soft) 55%, transparent); }

/* ---------- 9. STATUS / BADGES ------------------------------------------ */
.msr-badge {
    display: inline-flex; align-items: center; gap: 5px;
    height: 22px; padding: 0 9px; border-radius: var(--radius-pill);
    font: 600 11.5px var(--font-ui); white-space: nowrap;
    background: var(--surface-2); color: var(--text-secondary);
}
.msr-badge .msr-ic { width: 12px; height: 12px; stroke-width: 2.2; }
.msr-badge.ok      { background: var(--success-soft); color: var(--success); }
.msr-badge.warn    { background: var(--warning-soft); color: var(--warning-text); }
.msr-badge.danger  { background: var(--danger-soft);  color: var(--danger); }
.msr-badge.info    { background: var(--info-soft);    color: var(--info); }
.msr-badge.primary { background: var(--primary-soft); color: var(--primary-strong); }
.msr-badge.accent  { background: var(--accent-soft);  color: var(--accent); }

.msr-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--text-tertiary); }
.msr-dot.ok { background: var(--success); } .msr-dot.warn { background: var(--warning); } .msr-dot.danger { background: var(--danger); }

/* Roster status chips: colour + text label (never colour alone) */
.msr-st {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    min-width: 34px; height: 22px; padding: 0 7px;
    border-radius: 6px;
    font: 700 11px var(--font-data); letter-spacing: .02em;
    background: var(--surface-2); color: var(--text-secondary);
    white-space: nowrap;
}
.msr-st.am, .msr-st.s1, .msr-st.j1, .msr-st.morning { background: var(--st-am-bg); color: var(--st-am-fg); }
.msr-st.pm, .msr-st.s2, .msr-st.s3, .msr-st.s4, .msr-st.s5, .msr-st.j2, .msr-st.afternoon { background: var(--st-pm-bg); color: var(--st-pm-fg); }
.msr-st.malam, .msr-st.j3, .msr-st.night { background: var(--st-night-bg); color: var(--st-night-fg); }
.msr-st.long { background: var(--st-long-bg); color: var(--st-long-fg); }
.msr-st.custom { background: var(--st-custom-bg); color: var(--st-custom-fg); }
.msr-st.al  { background: var(--st-al-bg);  color: var(--st-al-fg); }
.msr-st.el  { background: var(--st-el-bg);  color: var(--st-el-fg); }
.msr-st.ul  { background: var(--st-ul-bg);  color: var(--st-ul-fg); }
.msr-st.hl  { background: var(--st-hl-bg);  color: var(--st-hl-fg); }
.msr-st.mc  { background: var(--st-mc-bg);  color: var(--st-mc-fg); }
.msr-st.off { background: var(--st-off-bg); color: var(--st-off-fg); }
.msr-st.leave::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.msr-st.off { background-image: repeating-linear-gradient(135deg, transparent 0 5px, color-mix(in srgb, var(--st-off-fg) 10%, transparent) 5px 6px); }
.msr-st.empty { background: transparent; color: var(--text-tertiary); font-weight: 500; }

/* ---------- 10. ALERTS / TOASTS ----------------------------------------- */
.msr-alert {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px 14px; border-radius: var(--radius-md);
    border: 1px solid var(--border); background: var(--surface-2);
    color: var(--text-primary); font-size: 13.5px; margin-bottom: 16px;
}
.msr-alert .msr-ic { margin-top: 1px; }
.msr-alert.ok     { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.msr-alert.ok .msr-ic { color: var(--success); }
.msr-alert.warn   { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.msr-alert.warn .msr-ic { color: var(--warning-text); }
.msr-alert.danger { background: var(--danger-soft);  border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.msr-alert.danger .msr-ic { color: var(--danger); }
.msr-alert.info   { background: var(--info-soft);    border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.msr-alert.info .msr-ic { color: var(--info); }

.msr-toast-stack { position: fixed; right: 24px; bottom: 24px; z-index: 300; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.msr-toast {
    pointer-events: auto; min-width: 280px; max-width: 420px;
    display: flex; gap: 10px; align-items: flex-start;
    padding: 13px 15px; border-radius: var(--radius-md);
    background: var(--surface-elevated); border: 1px solid var(--border);
    box-shadow: var(--shadow-lg); font-size: 13.5px;
    animation: msr-toast-in var(--t) var(--ease) both;
}
.msr-toast.leaving { animation: msr-toast-out var(--t) var(--ease) both; }
.msr-toast.ok .msr-ic { color: var(--success); } .msr-toast.danger .msr-ic { color: var(--danger); }
@keyframes msr-toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes msr-toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ---------- 11. PROGRESS / METERS --------------------------------------- */
.msr-meter { height: 6px; border-radius: var(--radius-pill); background: var(--surface-2); overflow: hidden; }
.msr-meter > span {
    display: block; height: 100%; border-radius: inherit; background: var(--primary);
    transform-origin: left; animation: msr-grow 700ms var(--ease) both;
}
.msr-meter.warn > span { background: var(--warning); }
.msr-meter.danger > span { background: var(--danger); }
.msr-meter.accent > span { background: var(--accent); }
@keyframes msr-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- 12. MODAL + DRAWER ------------------------------------------ */
.msr-scrim { position: fixed; inset: 0; z-index: 200; background: rgba(5, 15, 14, .32); backdrop-filter: blur(2px); opacity: 0; transition: opacity var(--t) var(--ease); }
html[data-theme="dark"] .msr-scrim { background: rgba(0, 0, 0, .55); }
.msr-scrim.open { opacity: 1; }

.msr-drawer {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 210;
    width: min(420px, 94vw);
    background: var(--glass);
    backdrop-filter: saturate(170%) blur(22px); -webkit-backdrop-filter: saturate(170%) blur(22px);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: translateX(104%);
    transition: transform 260ms var(--ease);
    display: flex; flex-direction: column;
}
.msr-drawer.open { transform: none; }
.msr-drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.msr-drawer-body { padding: 20px; overflow-y: auto; flex: 1; }
.msr-icon-btn {
    width: 34px; height: 34px; border-radius: var(--radius-sm); border: 1px solid transparent;
    display: inline-grid; place-items: center; background: transparent; color: var(--text-secondary); cursor: pointer;
    transition: background-color var(--t-fast), color var(--t-fast);
}
.msr-icon-btn:hover { background: var(--surface-2); color: var(--text-primary); }

/* ---------- 13. SKELETON -------------------------------------------------- */
.msr-skel { border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--surface-2) 40%, var(--surface)) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: msr-skel 1.3s ease infinite; }
@keyframes msr-skel { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* ---------- 14. EMPTY STATE ---------------------------------------------- */
.msr-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 28px 16px; color: var(--text-secondary); }
.msr-empty .msr-ic { width: 26px; height: 26px; color: var(--text-tertiary); margin-bottom: 4px; }

/* ---------- 15. UTILITIES ------------------------------------------------ */
.msr-grid { display: grid; gap: 18px; }
.msr-row { display: flex; align-items: center; gap: 10px; }
.msr-sep { height: 1px; background: var(--border); border: 0; margin: 16px 0; }
.msr-hide { display: none !important; }

/* ---------- 16. RESPONSIVE ----------------------------------------------- */
@media (max-width: 1280px) {
    :root { --content-pad: 24px; }
    .msr-today { display: none; }
}
@media (max-width: 1024px) {
    :root { --sidebar-w: 72px; }
    .msr-sidebar { padding: 16px 10px; }
    .msr-brand { justify-content: center; padding: 0 0 12px; }
    .msr-brand-logo { width: 50px; }
    .msr-nav-section, .msr-nav-link span { display: none; }
    .msr-nav-link { justify-content: center; padding: 11px; }
    .msr-nav-link.active::before { left: -10px; }
    .msr-profile-meta { display: none; }
    .msr-seg button span { display: none; }
}
@media (max-width: 640px) {
    :root { --content-pad: 16px; }
    .msr-crumb-trail { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* ---------- 17. PRINT ---------------------------------------------------- */
@media print {
    html, html[data-theme="dark"] { color-scheme: light; }
    body, body:has(.msr-sidebar) { padding: 0 !important; background: #fff !important; color: #000; }
    .msr-sidebar, .msr-topbar, .msr-toast-stack, .msr-drawer, .msr-scrim { display: none !important; }
}
