﻿/* ==========================================================================
   sendmn-ui.css — SendmnOffice v3 design system
   --------------------------------------------------------------------------
   Ported from the Claude Design prototype "SendmnOffice v3 (all pages)".

   The prototype computed every colour in JS and emitted inline styles. That
   does not survive a move to Razor, so the same values live here as CSS
   custom properties with a [data-theme="dark"] override on <html>.

   Everything is prefixed `sm-` and no bare element selectors are used, so
   this can sit alongside Bootstrap 3 / AdminLTE / DevExtreme without
   fighting them. Where we DO have to beat Bootstrap (tables, buttons) the
   specificity is raised deliberately and commented.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */

:root {
    /* surfaces */
    --sm-bg: #f5f7fa;
    --sm-panel: #ffffff;
    --sm-panel2: #f7f9fc;
    --sm-head: #f7f9fc;
    /* borders — bd is structural, bd2 is the lighter row divider */
    --sm-bd: #e8ebf0;
    --sm-bd2: #f0f2f6;
    /* text ramp: tx primary, tx2 secondary, tx3 muted/labels */
    --sm-tx: #0f1728;
    --sm-tx2: #5a6474;
    --sm-tx3: #98a0ae;
    --sm-sh: 0 1px 2px rgba(16, 24, 40, .05);
    --sm-sh-pop: 0 14px 34px rgba(8, 14, 26, .14);
    --sm-sh-notif: 0 22px 60px rgba(15, 23, 40, .22);
    /* accent */
    --sm-acc: #1a6fd4;
    --sm-acc-dk: #12539f;
    --sm-accbg: #eaf2fe;
    --sm-hover: #f2f5f9;
    /* Hover lift for a surface that already carries a tone — laid over the
       tone as a gradient so one token covers every tint. Darkens in light
       mode, lightens in dark, which is the direction "raised" reads as in
       each. --sm-hover only works for untinted rows; this is its counterpart. */
    --sm-lift: rgba(16, 24, 40, .05);
    /* tone pairs — background / foreground.
       Re-saturated 2026-08-07: the first set sat ΔE2000 3–8 from plain white,
       so a tinted row read as "slightly off-white" rather than as a colour, and
       the two tints that matter most to tell apart — pending purple against
       approved blue — were only 6.4 apart. Chroma is roughly doubled at the
       same lightness, which puts every tint 11–14 from white and every pair at
       7 or more (pending vs approved is now 10.7). The foregrounds are
       unchanged except --sm-nw-fg: the stronger blue tint dropped its badge
       text to 3.9:1, under AA, so it goes one step deeper for 4.9:1. It is only
       ever used as a text colour; --sm-acc still carries the button blue. */
    --sm-nw-bg: #d7e7fd;
    --sm-nw-fg: #1560bd;
    --sm-ok-bg: #d9f2e3;
    --sm-ok-fg: #1f7a44;
    --sm-bad-bg: #fcdcd8;
    --sm-bad-fg: #b42318;
    --sm-wn-bg: #fdeccc;
    --sm-wn-fg: #95590a;
    /* Purple — a leave request nobody has decided yet. Red and blue mixed,
       which is exactly what the state is: not yet resolved into declined or
       approved. Only the two outcomes get a pure hue. */
    --sm-pd-bg: #e6dffc;
    --sm-pd-fg: #5b3fc4;
    --sm-mt-bg: #e9ecf2;
    --sm-mt-fg: #5a6474;
    /* Teal — Илүү цаг and Бүх нийтийн амралт, i.e. "this day is not ordinary
       work". A type, not a status, so it deliberately sits outside the
       red → purple → blue status progression below. Held midway between
       --sm-nw and --sm-ok: pushed toward either one it stops being its own
       colour. Amber is never free for any of this — it means Хоцорсон /
       Эрт тарсан and is in the Цаг legend under that meaning. */
    --sm-tl-bg: #d3ecf0;
    --sm-tl-fg: #0e6b74;
    /* tone borders, used by the approve/decline row buttons and by the
       status-tinted request cards on Цагийн хүсэлт. Deepened alongside the
       tints above: against the old borders the new fills left only ΔE 1.7–3.6,
       so the outline all but vanished. These hold ΔE 7–8 from their own fill,
       which is where the original pairs sat. */
    --sm-ok-bd: #b3ddc4;
    --sm-bad-bd: #f3bdb6;
    --sm-nw-bd: #b3d3fa;
    --sm-pd-bd: #cdc0f6;
    --sm-tl-bd: #aedde4;
    /* the "already punched" chip — a slightly warmer green than --sm-ok */
    --sm-punch-done-bg: #eaf7ef;
    --sm-punch-done-fg: #1c7a48;
    --sm-punch-done-bd: #bfe3cd;
    /* The two big punch buttons get their own pair rather than borrowing
       --sm-ok / --sm-bad: those are shared by every badge in the app, and
       these need to be tuned for a large solid area without dragging the
       badges along with them. Light mode keeps the soft tints. */
    --sm-punch-in-bg: #eaf7ef;
    --sm-punch-in-bd: #bfe3cd;
    --sm-punch-in-fg: #1c7a48;
    --sm-punch-out-bg: #fdeeec;
    --sm-punch-out-bd: #f5cfcb;
    --sm-punch-out-fg: #b42318;
    /* calendar day tints */
    --sm-cal-work: #fbfcfe;
    --sm-cal-late: #fffdf7;
    --sm-cal-late-bd: #f2e6cc;
    /* Holiday / Илүү цаг day wash — teal, following the tone but NOT equal to
       it: the day washes below are a separate family, kept quieter than the
       badge tints because seven of them sit side by side in a week with text
       on top. It was held near the old --sm-tl-bg rather than washed out the
       way the purple it replaced was — teal and the green "worked" cell are
       neighbouring hues, so a paler teal collapses into it (ΔE 2.7 at
       #f1fafb). This clears every neighbouring cell state by ≥5, including the
       blue leave wash the old purple only managed 2.9 against. The 2026-08-07
       re-saturation deliberately stopped at the tones and left this family
       alone; the chips ON the cells carry the stronger colour. */
    --sm-cal-hol: #e2f5f9;
    --sm-cal-hol-bd: #c8e6ea;
    --sm-cal-off: #f6f8fb;
    --sm-cal-weekend: #f7f8fa;
    /* A finished day with nothing wrong, and the two request outcomes. Washes
       rather than fills: seven of these sit side by side in a week, so the
       tint has to name the day without shouting over the text on it. */
    --sm-cal-done: #f4fbf7;
    --sm-cal-done-bd: #cdead6;
    --sm-cal-leave: #f2f7fe;
    --sm-cal-leave-bd: #cfe2fb;
    --sm-cal-rej: #fdf4f3;
    --sm-cal-rej-bd: #f5cfcb;
    /* status dots on calendar cells */
    --sm-dot-ok: #5cb488;
    --sm-dot-wn: #e0a53c;
    --sm-dot-nw: #6fa8e8;
    --sm-dot-bad: #e08078;
    --sm-dot-mt: #cfd5df;
    --sm-dot-tl: #4fb3bd;
    --sm-dot-pd: #9b87e0;
    /* input surface inside data tables */
    --sm-inp-bg: #ffffff;
    --sm-inp-td-bg: #fcfdff;
    /* geometry */
    --sm-side-w: 248px;
    --sm-side-w-collapsed: 64px;
    --sm-topbar-h: 64px;
    --sm-cell-y: 13px;
    --sm-cell-x: 14px;
    --sm-th-y: 12px;
    --sm-scroll: rgba(120, 132, 155, .4);
    --sm-scroll-hover: rgba(120, 132, 155, .62);
    color-scheme: light;
}

/* Dark theme. Set by the toggle in the topbar (writes data-theme on <html>
   and mirrors it to localStorage). */
:root[data-theme="dark"] {
    --sm-bg: #0e131c;
    --sm-panel: #151c28;
    --sm-panel2: #1b2431;
    --sm-head: #1b2431;
    --sm-bd: #252f3f;
    --sm-bd2: #1f2836;
    /* The light thumb is a translucent grey that composites to about #3d4656
       over a panel — against a dark surface that reads as a bright bar. These
       are solid and a couple of steps down from it: still clearly a scrollbar,
       no longer the brightest thing on the card. */
    --sm-scroll: #2b3546;
    --sm-scroll-hover: #3b4759;
    --sm-tx: #e8ecf3;
    --sm-tx2: #a3adbe;
    --sm-tx3: #6f7b8e;
    --sm-sh: 0 1px 2px rgba(0, 0, 0, .5);
    --sm-sh-pop: 0 14px 34px rgba(8, 14, 26, .6);
    --sm-accbg: #16304f;
    --sm-hover: #1e2836;
    --sm-lift: rgba(255, 255, 255, .05);
    --sm-nw-bg: #16304f;
    --sm-nw-fg: #7db4f5;
    --sm-ok-bg: #123024;
    --sm-ok-fg: #5fcf92;
    --sm-bad-bg: #3a1a17;
    --sm-bad-fg: #f0938a;
    --sm-wn-bg: #3a2b12;
    --sm-wn-fg: #e0b45c;
    --sm-pd-bg: #241f47;
    --sm-pd-fg: #a996f0;
    --sm-mt-bg: #222b39;
    --sm-mt-fg: #a3adbe;
    --sm-tl-bg: #10333a;
    --sm-tl-fg: #63cad6;
    --sm-ok-bd: #1d4a32;
    --sm-bad-bd: #52251f;
    --sm-nw-bd: #2b4a63;
    --sm-pd-bd: #3a3068;
    --sm-tl-bd: #1d525c;
    --sm-punch-done-bg: #16321f;
    --sm-punch-done-fg: #7fd6a2;
    --sm-punch-done-bd: #2c5a3f;
    /* Dark mode runs these considerably richer than the badge tints — a large
       button needs real colour to read against the dark surface, where a
       subtle wash just looks grey. Ирсэн is a brighter, greener green; Явсан
       a deep apple red, so the pair separates at a glance. */
    --sm-punch-in-bg: #123f26;
    --sm-punch-in-bd: #2f8a52;
    --sm-punch-in-fg: #6ff0a5;
    --sm-punch-out-bg: #571712;
    --sm-punch-out-bd: #932c22;
    --sm-punch-out-fg: #ffa094;
    --sm-cal-work: #131b26;
    --sm-cal-late: #221b12;
    --sm-cal-late-bd: #4a3a1c;
    --sm-cal-hol: #10333a;
    --sm-cal-hol-bd: #1d525c;
    --sm-cal-off: #1a2331;
    --sm-cal-weekend: #141a23;
    --sm-cal-done: #10241a;
    --sm-cal-done-bd: #1d4a32;
    --sm-cal-leave: #121f31;
    --sm-cal-leave-bd: #2b4a63;
    --sm-cal-rej: #291614;
    --sm-cal-rej-bd: #52251f;
    --sm-dot-ok: #3f9c68;
    --sm-dot-wn: #b98a2e;
    --sm-dot-nw: #3d7ab8;
    --sm-dot-bad: #b0554b;
    --sm-dot-mt: #3a4553;
    --sm-dot-tl: #35848d;
    --sm-dot-pd: #6f5fb8;
    --sm-inp-bg: #0f1620;
    --sm-inp-td-bg: #131b26;
    color-scheme: dark;
}

/* Compact tables. Toggled from the topbar; the class goes on <html>. */
:root[data-density="dense"] {
    --sm-cell-y: 8px;
    --sm-th-y: 9px;
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */

.sm-app,
.sm-app input,
.sm-app select,
.sm-app textarea,
.sm-app button {
    font-family: 'Golos Text', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

.sm-app {
    background: var(--sm-bg);
    color: var(--sm-tx);
}

.sm-app a {
    color: var(--sm-acc);
    text-decoration: none;
}

    .sm-app a:hover,
    .sm-app a:focus {
        color: var(--sm-acc-dk);
        text-decoration: none;
    }

/* Thin scrollbars everywhere inside the app shell. */
.sm-app *::-webkit-scrollbar {
    height: 9px;
    width: 9px;
}

.sm-app *::-webkit-scrollbar-thumb {
    background: var(--sm-scroll);
    border-radius: 9px;
}

    .sm-app *::-webkit-scrollbar-thumb:hover {
        background: var(--sm-scroll-hover);
    }

.sm-app *::-webkit-scrollbar-track {
    background: transparent;
}

@keyframes sm-fadeup {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.sm-fadeup {
    animation: sm-fadeup .3s ease both;
}

/* --------------------------------------------------------------------------
   3. Shell — sidebar + main column
   -------------------------------------------------------------------------- */

.sm-shell {
    height: 100vh;
    display: flex;
    background: var(--sm-bg);
    overflow: hidden;
}

.sm-side {
    width: var(--sm-side-w);
    flex: 0 0 var(--sm-side-w);
    display: flex;
    flex-direction: column;
    background: var(--sm-panel);
    border-right: 1px solid var(--sm-bd);
    padding: 14px 12px 12px;
    box-sizing: border-box;
    transition: width .18s ease, flex-basis .18s ease;
}

/* Collapsed state is driven by data-side on <html> rather than a class on the
   element itself, so _LoginLayout's head script can restore it before first
   paint — a class added after DOMContentLoaded makes the sidebar visibly snap
   from 248px to 64px on every navigation. */
:root[data-side="collapsed"] .sm-side {
    width: var(--sm-side-w-collapsed);
    flex-basis: var(--sm-side-w-collapsed);
    padding-left: 8px;
    padding-right: 8px;
    /* the toggle button is hidden at 64px, so the strip itself is what you
       click to get back — see the expand handler in _Layout */
    cursor: pointer;
}

/* brand */
.sm-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 6px 18px;
}

.sm-brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: #0f1728;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .sm-brand-mark img {
        width: 19px;
        height: 23px;
        object-fit: contain;
    }

.sm-brand-name {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--sm-tx);
    letter-spacing: -.01em;
    white-space: nowrap;
}

.sm-side-toggle {
    margin-left: auto;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--sm-tx3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

    .sm-side-toggle svg {
        transition: transform .18s ease;
    }

:root[data-side="collapsed"] .sm-side-toggle svg {
    transform: rotate(180deg);
}

:root[data-side="collapsed"] .sm-brand {
    justify-content: center;
    padding-bottom: 14px;
}

    :root[data-side="collapsed"] .sm-brand-name,
    :root[data-side="collapsed"] .sm-side-toggle {
        display: none;
    }

/* nav */
.sm-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    margin: 0 -4px;
    padding: 0 4px;
    list-style: none;
}

.sm-nav-foot {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 12px;
    margin-top: 8px;
    border-top: 1px solid var(--sm-bd);
}

/* One row in the sidebar — used for both <a> links and <button> group headers
   so they line up exactly. Bootstrap styles buttons heavily, hence the resets.

   SPECIFICITY: these are prefixed with .sm-app because the generic
   `.sm-app a { color: var(--sm-acc) }` rule is (0,1,1) and would otherwise
   beat a bare `.sm-nav-item` at (0,1,0) — which is exactly why the nav kept
   rendering blue no matter what colour was set here. */
.sm-app .sm-nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 11px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--sm-tx2);
    background: transparent;
    border: none;
    font-family: inherit;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    -webkit-appearance: none;
    appearance: none;
}

    .sm-app .sm-nav-item:hover,
    .sm-app .sm-nav-item:focus {
        background: var(--sm-hover);
        color: var(--sm-tx2);
        text-decoration: none;
    }

    /* Only the CURRENT page is blue. Every other row stays neutral, so the
       accent marks where you are instead of colouring the whole sidebar. */
    .sm-app .sm-nav-item.is-active {
        font-weight: 600;
        color: var(--sm-acc);
        background: var(--sm-accbg);
    }

        .sm-app .sm-nav-item.is-active:hover {
            color: var(--sm-acc);
            background: var(--sm-accbg);
        }

    /* Гарах stays red — it is the one row that should stand out. */
    .sm-app .sm-nav-item.sm-nav-logout,
    .sm-app .sm-nav-item.sm-nav-logout:hover {
        color: #e5484d;
    }

    .sm-nav-item > svg {
        flex-shrink: 0;
        opacity: .92;
    }

.sm-nav-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

.sm-nav-chev {
    flex-shrink: 0;
    opacity: .6;
    transition: transform .2s;
}

.sm-nav-group.is-open .sm-nav-chev {
    transform: rotate(180deg);
}

/* red count pill on a nav row */
.sm-nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--sm-bad-bg);
    color: var(--sm-bad-fg);
    font-size: 11.5px;
    font-weight: 700;
    flex-shrink: 0;
}

/* submenu */
.sm-nav-sub {
    display: none;
    flex-direction: column;
    gap: 1px;
    padding: 2px 0 6px;
    list-style: none;
    margin: 0;
}

.sm-nav-group.is-open > .sm-nav-sub {
    display: flex;
}

/* .sm-app prefix for the same reason as .sm-nav-item above — the generic
   link rule would otherwise win and paint these blue. */
.sm-app .sm-nav-subitem {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 11px 8px 4px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 500;
    color: var(--sm-tx2);
}

    .sm-app .sm-nav-subitem:hover,
    .sm-app .sm-nav-subitem:focus {
        background: var(--sm-hover);
        color: var(--sm-tx2);
        text-decoration: none;
    }

    /* Same as the top-level rows — blue only for the page you are on. */
    .sm-app .sm-nav-subitem.is-active {
        font-weight: 600;
        color: var(--sm-acc);
        background: var(--sm-accbg);
    }

    /* The bullet before a submenu label. An explicit colour rather than
       currentColor, so it cannot inherit the generic link colour and turn
       blue on every row again. */
    .sm-app .sm-nav-subitem::before {
        content: "";
        width: 5px;
        height: 5px;
        border-radius: 99px;
        background: var(--sm-tx3);
        opacity: .7;
        flex-shrink: 0;
        margin-left: 9px;
    }

        /* …except on the current page, where it follows the blue label. */
        .sm-app .sm-nav-subitem.is-active::before {
            background: var(--sm-acc);
            opacity: 1;
        }

    .sm-nav-subitem .sm-nav-badge {
        min-width: 19px;
        height: 19px;
        padding: 0 5px;
        font-size: 11px;
    }

/* collapsed sidebar: icons only */
:root[data-side="collapsed"] .sm-nav-item {
    justify-content: center;
    gap: 0;
    padding: 10px 0;
}

:root[data-side="collapsed"] .sm-nav-label,
:root[data-side="collapsed"] .sm-nav-chev,
:root[data-side="collapsed"] .sm-nav-badge,
:root[data-side="collapsed"] .sm-nav-sub {
    display: none;
}

/* --------------------------------------------------------------------------
   4. Main column + topbar
   -------------------------------------------------------------------------- */

.sm-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.sm-topbar {
    height: var(--sm-topbar-h);
    flex: 0 0 var(--sm-topbar-h);
    background: var(--sm-panel);
    border-bottom: 1px solid var(--sm-bd);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 24px;
    box-sizing: border-box;
}

.sm-topbar-title {
    flex: 1 1 auto;
    min-width: 90px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
}

    .sm-topbar-title h1 {
        margin: 0;
        font-size: 15.5px;
        font-weight: 600;
        color: var(--sm-tx);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.3;
    }

.sm-topbar-sub {
    font-size: 12px;
    color: var(--sm-tx3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sm-topbar-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sm-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    border: 1px solid var(--sm-bd);
    background: var(--sm-panel2);
    color: var(--sm-tx2);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    position: relative;
}

    .sm-icon-btn:hover {
        background: var(--sm-hover);
        color: var(--sm-tx);
    }

    .sm-icon-btn.is-on {
        border-color: var(--sm-acc);
        background: var(--sm-accbg);
        color: var(--sm-acc);
    }

.sm-topbar-divider {
    width: 1px;
    height: 24px;
    background: var(--sm-bd);
    flex-shrink: 0;
}

/* DEV_ROLE_L:BEGIN
   Development-only role switcher in the topbar. Removed before release along
   with DevRoleController, the 'L' branch in LoginController and the block in
   _Layout.cshtml. */
.sm-devrole {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.sm-devrole-cap {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .09em;
    color: var(--sm-tx3);
    white-space: nowrap;
}

.sm-devrole-seg {
    display: flex;
    align-items: center;
    gap: 3px;
    background: var(--sm-panel2);
    border: 1px solid var(--sm-bd);
    border-radius: 11px;
    padding: 3px;
}

.sm-devrole-btn {
    height: 26px;
    padding: 0 10px;
    border: none;
    border-radius: 8px;
    font: inherit;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    background: transparent;
    color: var(--sm-tx2);
}

    .sm-devrole-btn:hover {
        background: var(--sm-hover);
    }

    .sm-devrole-btn.is-on {
        background: var(--sm-acc);
        color: #fff;
    }

/* Full role names while there is room, single letters once things get tight. */
.sm-devrole-ab {
    display: none;
}

@media (max-width: 1250px) {
    .sm-devrole-cap {
        display: none;
    }
}

@media (max-width: 1150px) {
    .sm-devrole-full {
        display: none;
    }

    .sm-devrole-ab {
        display: inline;
    }
}

@media (max-width: 900px) {
    .sm-devrole {
        display: none;
    }
}
/* DEV_ROLE_L:END */

/* user block */
.sm-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.sm-user-text {
    line-height: 1.25;
    text-align: right;
}

.sm-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--sm-tx);
    white-space: nowrap;
}

.sm-user-pos {
    font-size: 11.5px;
    color: var(--sm-tx3);
    white-space: nowrap;
}

.sm-user-av {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    object-fit: cover;
    background: var(--sm-accbg);
    flex-shrink: 0;
}

/* notifications */
.sm-notif {
    position: relative;
    flex-shrink: 0;
}

.sm-notif-dot {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: #e5484d;
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--sm-panel);
    box-sizing: content-box;
}

.sm-notif-panel {
    position: absolute;
    top: 46px;
    right: 0;
    width: 376px;
    max-width: calc(100vw - 32px);
    max-height: 440px;
    display: none;
    flex-direction: column;
    background: var(--sm-panel);
    border: 1px solid var(--sm-bd);
    border-radius: 14px;
    box-shadow: var(--sm-sh-notif);
    z-index: 1061;
    overflow: hidden;
    animation: sm-fadeup .16s ease both;
}

.sm-notif.is-open .sm-notif-panel {
    display: flex;
}

.sm-notif-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--sm-bd2);
}

    .sm-notif-head strong {
        font-size: 14px;
        font-weight: 600;
        color: var(--sm-tx);
    }

.sm-notif-list {
    overflow-y: auto;
    flex: 1;
}

.sm-notif-item {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--sm-bd2);
}

    .sm-notif-item:hover {
        background: var(--sm-hover);
        text-decoration: none;
    }

.sm-notif-body {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sm-notif-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--sm-tx);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sm-notif-sub {
    font-size: 12px;
    color: var(--sm-tx2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sm-notif-when {
    font-size: 11.5px;
    color: var(--sm-tx3);
    white-space: nowrap;
    flex-shrink: 0;
}

.sm-notif-empty {
    padding: 28px 16px;
    text-align: center;
    font-size: 12.5px;
    color: var(--sm-tx3);
}

/* click-catcher behind open popovers */
.sm-scrim {
    position: fixed;
    inset: 0;
    z-index: 1060;
}

/* content area */
.sm-content {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 22px 24px 40px;
}

/* --------------------------------------------------------------------------
   5. Tone helpers — badges, icon chips
   -------------------------------------------------------------------------- */

.sm-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
    background: var(--sm-mt-bg);
    color: var(--sm-mt-fg);
}

/* rounded-square icon chip — geometry only. Its colour comes from a tone
   class, which is why no background is set here: .sm-ico and .sm-t-* have the
   same specificity, so whichever is declared LAST wins. With a grey default
   on .sm-ico declared after the tones, every stat-tile icon rendered grey no
   matter which tone the view asked for. The tone block now comes last. */
.sm-ico {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sm-ico-lg {
    width: 34px;
    height: 34px;
    border-radius: 10px;
}

/* ── tones ──────────────────────────────────────────────────────────────
   Declared after .sm-badge and .sm-ico so they win on both. Any element
   carrying one of these gets the pair; nothing else sets these two
   properties at this specificity. */
.sm-t-nw {
    background: var(--sm-nw-bg);
    color: var(--sm-nw-fg);
}

.sm-t-ok {
    background: var(--sm-ok-bg);
    color: var(--sm-ok-fg);
}

.sm-t-bad {
    background: var(--sm-bad-bg);
    color: var(--sm-bad-fg);
}

.sm-t-wn {
    background: var(--sm-wn-bg);
    color: var(--sm-wn-fg);
}

.sm-t-pd {
    background: var(--sm-pd-bg);
    color: var(--sm-pd-fg);
}

.sm-t-mt {
    background: var(--sm-mt-bg);
    color: var(--sm-mt-fg);
}

.sm-t-tl {
    background: var(--sm-tl-bg);
    color: var(--sm-tl-fg);
}

/* scope chip in the page toolbar */
.sm-scope {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border-radius: 9px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   6. Panels, cards, stat tiles
   -------------------------------------------------------------------------- */

.sm-panel {
    background: var(--sm-panel);
    border: 1px solid var(--sm-bd);
    border-radius: 15px;
    box-shadow: var(--sm-sh);
}

.sm-panel-pad {
    padding: 17px 18px;
}

.sm-panel-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--sm-bd2);
}

    .sm-panel-head h2 {
        margin: 0;
        font-size: 14px;
        font-weight: 600;
        color: var(--sm-tx);
    }

.sm-panel-meta {
    margin-left: auto;
    font-size: 11.5px;
    color: var(--sm-tx3);
    white-space: nowrap;
}

/* 4-up stat tiles on the dashboard */
.sm-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.sm-stat {
    background: var(--sm-panel);
    border: 1px solid var(--sm-bd);
    border-radius: 15px;
    box-shadow: var(--sm-sh);
    padding: 16px 17px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.sm-stat-top {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sm-stat-label {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--sm-tx2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sm-stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--sm-tx);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.sm-stat-unit {
    font-size: 13px;
    font-weight: 500;
    color: var(--sm-tx3);
}

.sm-stat-note {
    font-size: 11.5px;
    color: var(--sm-tx3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

    /* A tile may carry a second note line; tighten the gap so the pair reads
       as one block rather than two separate captions. */
    .sm-stat-note + .sm-stat-note {
        margin-top: -6px;
    }

/* document / news cards (Журам, Мэдээлэл) */
.sm-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
}

.sm-card {
    background: var(--sm-panel);
    border: 1px solid var(--sm-bd);
    border-radius: 15px;
    box-shadow: var(--sm-sh);
    padding: 17px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.sm-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sm-card-title {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--sm-tx);
    line-height: 1.35;
}

.sm-card-body {
    font-size: 12.5px;
    color: var(--sm-tx2);
    line-height: 1.55;
    flex: 1;
}

.sm-card-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11.5px;
    color: var(--sm-tx3);
    padding-top: 4px;
    border-top: 1px solid var(--sm-bd2);
    margin-top: 2px;
}

/* key/value rows inside the dashboard side cards */
.sm-kv {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--sm-bd2);
}

    .sm-kv:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

.sm-kv-k {
    font-size: 12.5px;
    color: var(--sm-tx2);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sm-kv-sub {
    display: block;
    font-size: 11px;
    color: var(--sm-tx3);
}

.sm-kv-v {
    font-size: 12.5px;
    color: var(--sm-tx2);
    white-space: nowrap;
    flex-shrink: 0;
}

.sm-kv-av {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--sm-accbg);
    flex-shrink: 0;
}

/* 7-day bar chart */
.sm-chart {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 132px;
    padding: 4px 2px 0;
}

.sm-chart-col {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    position: relative;
    cursor: default;
    outline: none;
}

/* Hover / keyboard focus: only the bar changes colour — the column itself
   stays untouched, so nothing shifts around it. */
.sm-chart-col:hover .sm-chart-bar,
.sm-chart-col:focus-visible .sm-chart-bar {
    background: linear-gradient(180deg, #6aa8ef, #1a6fd4);
    box-shadow: 0 2px 10px rgba(26, 111, 212, .35);
}

:root[data-theme="dark"] .sm-chart-col:hover .sm-chart-bar,
:root[data-theme="dark"] .sm-chart-col:focus-visible .sm-chart-bar {
    background: linear-gradient(180deg, #8cc2ff, #3d8ae8);
    box-shadow: 0 2px 12px rgba(61, 138, 232, .45);
}

/* The tooltip itself — data-tip carries the text, so no extra markup and
   nothing to keep in sync when the range filter re-renders the bars. */
.sm-chart-col[data-tip]:hover::after,
.sm-chart-col[data-tip]:focus-visible::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 9px;
    background: var(--sm-tx);
    color: var(--sm-panel);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .01em;
    box-shadow: var(--sm-sh-pop);
    pointer-events: none;
    animation: sm-fadeup .14s ease both;
}

/* Columns at the very edges would push their tooltip outside the card. */
.sm-chart-col:first-child[data-tip]:hover::after,
.sm-chart-col:first-child[data-tip]:focus-visible::after {
    left: 0;
    transform: none;
}

.sm-chart-col:last-child[data-tip]:hover::after,
.sm-chart-col:last-child[data-tip]:focus-visible::after {
    left: auto;
    right: 0;
    transform: none;
}

.sm-chart-val {
    font-size: 11px;
    font-weight: 600;
    color: var(--sm-tx2);
    font-variant-numeric: tabular-nums;
}

.sm-chart-bar {
    width: 100%;
    max-width: 44px;
    border-radius: 8px 8px 4px 4px;
    background: linear-gradient(180deg, #4d94e8, #1a6fd4);
    min-height: 6px;
    transition: background .15s ease, box-shadow .15s ease;
}

/* Columns are bottom-aligned, so an empty label collapses and lets that bar
   sit lower than its labelled neighbours — which reads as a bump every nth
   bar once longer ranges start thinning the labels. Reserving the line height
   whether or not there is text keeps every baseline level. */
.sm-chart-lbl {
    font-size: 11px;
    line-height: 15px;
    min-height: 15px;
    color: var(--sm-tx3);
    white-space: nowrap;
}

/* Longer ranges pack in far more bars: the per-bar value is dropped and the
   spacing tightens so 30 days still reads as a shape rather than a smear.
   Labels are already thinned server-side. */
.sm-chart.is-dense {
    gap: 3px;
}

    .sm-chart.is-dense .sm-chart-val {
        display: none;
    }

    .sm-chart.is-dense .sm-chart-bar {
        max-width: 18px;
        border-radius: 4px 4px 2px 2px;
    }

    /* font-size only — the reserved height stays put so the baseline holds */
    .sm-chart.is-dense .sm-chart-lbl {
        font-size: 10px;
    }

/* --------------------------------------------------------------------------
   7. Page toolbar
   -------------------------------------------------------------------------- */

.sm-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 14px;
}

.sm-toolbar-spacer {
    flex: 1 1 auto;
}

/* dropdown trigger + menu (period pickers, subject picker, filters) */
.sm-dd {
    position: relative;
    display: inline-block;
}

.sm-dd-btn {
    height: 34px;
    padding: 0 11px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: 9px;
    border: 1px solid var(--sm-bd);
    background: var(--sm-panel2);
    color: var(--sm-tx2);
    font: inherit;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

    .sm-dd-btn:hover {
        background: var(--sm-hover);
    }

.sm-dd.is-open .sm-dd-btn {
    border-color: var(--sm-acc);
    background: var(--sm-accbg);
    color: var(--sm-acc);
}

.sm-dd-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 1070;
    min-width: 168px;
    max-height: 270px;
    overflow-y: auto;
    background: var(--sm-panel);
    border: 1px solid var(--sm-bd);
    border-radius: 11px;
    padding: 5px;
    box-shadow: var(--sm-sh-pop);
}

.sm-dd.is-open .sm-dd-menu {
    display: block;
}

.sm-dd-menu.is-right {
    left: auto;
    right: 0;
}

.sm-dd-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: none;
    border-radius: 8px;
    font: inherit;
    font-size: 12.5px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    background: transparent;
    color: var(--sm-tx);
}

    .sm-dd-item:hover,
    .sm-dd-item:focus {
        background: var(--sm-hover);
        color: var(--sm-tx);
        text-decoration: none;
    }

    .sm-dd-item.is-active {
        font-weight: 600;
        background: var(--sm-accbg);
        color: var(--sm-acc);
    }

.sm-dd-item-sub {
    font-size: 11px;
    color: var(--sm-tx3);
    display: block;
}

/* segmented control (calendar / table view toggle) */
.sm-seg {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: var(--sm-panel2);
    border: 1px solid var(--sm-bd);
    border-radius: 11px;
    padding: 3px;
}

.sm-seg-btn {
    min-width: 30px;
    height: 28px;
    padding: 0 9px;
    border: none;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    background: transparent;
    color: var(--sm-tx3);
    font: inherit;
    font-size: 12.5px;
    font-weight: 500;
}

    .sm-seg-btn.is-on {
        background: var(--sm-acc);
        color: #fff;
        font-weight: 600;
    }

/* --------------------------------------------------------------------------
   8. Buttons
   -------------------------------------------------------------------------- */

.sm-btn {
    height: 34px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-radius: 9px;
    border: 1px solid var(--sm-bd);
    background: var(--sm-panel2);
    color: var(--sm-tx2);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
}

    .sm-btn:hover,
    .sm-btn:focus {
        background: var(--sm-hover);
        color: var(--sm-tx);
        text-decoration: none;
    }

.sm-btn-primary {
    background: var(--sm-acc);
    border-color: var(--sm-acc);
    color: #fff;
}

    .sm-btn-primary:hover,
    .sm-btn-primary:focus {
        background: var(--sm-acc-dk);
        border-color: var(--sm-acc-dk);
        color: #fff;
    }

.sm-btn-lg {
    height: 44px;
    border-radius: 11px;
    font-size: 14px;
    padding: 0 18px;
}

.sm-btn-block {
    width: 100%;
}

/* small square row-action buttons inside tables */
.sm-act {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--sm-bd);
    background: var(--sm-panel2);
    color: var(--sm-tx2);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

    .sm-act:hover {
        background: var(--sm-hover);
        color: var(--sm-tx);
    }

.sm-act-ok {
    border-color: var(--sm-ok-bd);
    background: var(--sm-ok-bg);
    color: var(--sm-ok-fg);
}

.sm-act-no {
    border-color: var(--sm-bad-bd);
    background: var(--sm-bad-bg);
    color: var(--sm-bad-fg);
}

.sm-act-mail {
    border-color: var(--sm-ok-bd);
    background: var(--sm-ok-bg);
    color: var(--sm-ok-fg);
}

.sm-act-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* --------------------------------------------------------------------------
   9. Tables
   --------------------------------------------------------------------------
   These deliberately out-specify Bootstrap's `.table > tbody > tr > td`
   (specificity 0,0,4) — hence the `.sm-table > tbody > tr > td` shape below.
   -------------------------------------------------------------------------- */

.sm-table-wrap {
    background: var(--sm-panel);
    border: 1px solid var(--sm-bd);
    border-radius: 15px;
    box-shadow: var(--sm-sh);
    overflow: auto;
    max-width: 100%;
}

.sm-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: transparent;
    font-size: 13px;
}

    .sm-table > thead > tr > th {
        text-align: left;
        padding: var(--sm-th-y) var(--sm-cell-x);
        background: var(--sm-head);
        border-bottom: 1px solid var(--sm-bd);
        border-top: none;
        font-size: 11px;
        font-weight: 600;
        letter-spacing: .05em;
        text-transform: uppercase;
        color: var(--sm-tx3);
        white-space: nowrap;
        position: sticky;
        top: 0;
        z-index: 2;
    }

    /* two-tier header (Цалин) — centred, with a divider between groups */
    .sm-table.sm-table-grouped > thead > tr > th {
        text-align: center;
        border-left: 1px solid var(--sm-bd2);
        letter-spacing: .04em;
        padding-left: 12px;
        padding-right: 12px;
    }

    .sm-table.sm-table-grouped > thead > tr:nth-child(2) > th {
        top: 41px;
    }

    .sm-table > tbody > tr > td {
        padding: var(--sm-cell-y) var(--sm-cell-x);
        border-bottom: 1px solid var(--sm-bd2);
        border-top: none;
        color: var(--sm-tx);
        white-space: nowrap;
        vertical-align: middle;
    }

    .sm-table > tbody > tr:last-child > td {
        border-bottom: none;
    }

    .sm-table > tbody > tr:hover > td {
        background: var(--sm-panel2);
    }

/* numeric column */
.sm-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Figures that stay in the column's normal alignment but still line up
   digit-for-digit — clock times and durations, which the design leaves
   left-aligned outside the salary sheet. */
.sm-tnum {
    font-variant-numeric: tabular-nums;
}

/* person cell: avatar + name */
.sm-person {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.sm-person-av {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--sm-accbg);
    flex-shrink: 0;
}

.sm-person-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* file chip */
.sm-file {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 190px;
    padding: 4px 9px;
    border-radius: 8px;
    background: var(--sm-panel2);
    border: 1px solid var(--sm-bd);
    font-size: 11.5px;
    color: var(--sm-tx2);
}

    .sm-file span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

/* editable numeric cell (Цалин) */
.sm-table > tbody > tr > td.sm-inp-td {
    padding: 8px 10px;
    background: var(--sm-inp-td-bg);
}

:root[data-density="dense"] .sm-table > tbody > tr > td.sm-inp-td {
    padding: 5px 10px;
}

.sm-inp {
    width: 100%;
    min-width: 88px;
    height: 32px;
    box-sizing: border-box;
    text-align: right;
    border-radius: 8px;
    border: 1px solid var(--sm-bd);
    background: var(--sm-inp-bg);
    padding: 0 9px;
    font: inherit;
    font-size: 12.5px;
    color: var(--sm-tx);
    font-variant-numeric: tabular-nums;
}

    .sm-inp:focus {
        outline: none;
        border-color: var(--sm-acc);
        box-shadow: 0 0 0 3px rgba(26, 111, 212, .13);
    }

/* empty state */
.sm-empty {
    padding: 48px 20px;
    text-align: center;
    color: var(--sm-tx3);
    font-size: 13px;
}

/* --------------------------------------------------------------------------
   10. Form fields (modals, filters)
   -------------------------------------------------------------------------- */

.sm-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.sm-field-wide {
    grid-column: span 2;
}

.sm-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--sm-tx2);
}

.sm-input,
.sm-select,
.sm-textarea {
    width: 100%;
    box-sizing: border-box;
    border-radius: 11px;
    border: 1px solid var(--sm-bd);
    background: var(--sm-panel2);
    padding: 0 13px;
    height: 44px;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--sm-tx);
    box-shadow: none;
}

.sm-textarea {
    height: auto;
    min-height: 92px;
    padding: 12px 13px;
    resize: vertical;
    line-height: 1.5;
}

    .sm-input:focus,
    .sm-select:focus,
    .sm-textarea:focus {
        outline: none;
        border-color: var(--sm-acc);
        background: var(--sm-accbg);
        box-shadow: 0 0 0 3px rgba(26, 111, 212, .13);
    }

.sm-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

/* jQuery UI's own stylesheet pins every datepicker to `width: 17em` (~272px).
   The app-wide $.datepicker.setDefaults in _Layout uses full Mongolian weekday
   names, so seven columns of "Мягмар"/"Лхагва" need roughly twice that, and
   the calendar table spills straight out of its own white box — the picker
   reads as though only its left half rendered. The pre-redesign layout carried
   this rule; it was lost when _Layout was rewritten, so it lives here now,
   next to everything else the shell owns.

   Pickers that opt into the `dp-modern` skin (datepicker-modern.css) size
   themselves to a fixed 320px and are unaffected: their rules are
   `#ui-datepicker-div.dp-modern`, one class more specific than this. */
#ui-datepicker-div {
    width: auto;
    min-width: 300px;
}

/* --------------------------------------------------------------------------
   10b. Нууц үг шинэчлэх — the password dialog _Layout owns
   --------------------------------------------------------------------------
   The markup carried `pwd-*` class names from the start but nothing anywhere
   ever defined them, so the dialog rendered as raw HTML: unstyled inputs,
   plain-text buttons, and all three validation lines showing at once.

   Everything below is token-only, so dark mode comes for free. Do NOT add a
   [data-theme="dark"] override for these in §12g — the generic
   `.modal-content` rule there is enough for the box, and a second set of
   colours would drift out of step with this one.

   modern-ui.css:509 already claims `.modal .form-control` (two classes, no
   !important). `.pwd-modal-content .pwd-input` is three, so it wins on
   specificity rather than on the fragile load-order tie. */

.pwd-modal-dialog {
    max-width: 424px;
    margin: 7vh auto 30px;
}

.pwd-modal-content {
    background: var(--sm-panel);
    border: 1px solid var(--sm-bd);
    border-radius: 18px;
    box-shadow: var(--sm-sh-pop);
    color: var(--sm-tx);
    padding: 24px;
}

/* ── head ─────────────────────────────────────────────────────────────── */

.pwd-modal-head {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    margin-bottom: 20px;
}

.pwd-modal-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 11px;
    background: var(--sm-accbg);
    color: var(--sm-acc);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwd-modal-heading {
    flex: 1;
    min-width: 0;
}

.pwd-modal-title {
    margin: 0 0 3px;
    font-size: 16.5px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--sm-tx);
}

/* --sm-tx2, not the --sm-tx3 that subtitles elsewhere use: at 12.5px tx3 is
   2.63:1 on the light panel and 3.99:1 on the dark one, both under AA. This is
   the line that tells someone why the dialog opened, so it has to be read. */
.pwd-modal-hint {
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--sm-tx2);
}

    /* Replaces the inline .css('color', '#ce3131') the old JS used, which was a
       hardcoded literal and stayed the same red in dark mode. */
    .pwd-modal-hint.is-warn {
        color: var(--sm-bad-fg);
        font-weight: 600;
    }

.pwd-modal-x {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    margin: -3px -3px 0 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--sm-tx3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

    .pwd-modal-x:hover {
        background: var(--sm-hover);
        color: var(--sm-tx);
    }

/* ── fields ───────────────────────────────────────────────────────────── */

.pwd-fieldset {
    border: none;
    margin: 0;
    padding: 0;
}

.pwd-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 15px;
}

.pwd-label {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--sm-tx2);
}

.pwd-input-wrap {
    position: relative;
    display: flex;
}

.pwd-modal-content .pwd-input {
    width: 100%;
    box-sizing: border-box;
    height: 44px;
    /* room for the reveal button */
    padding: 0 44px 0 13px;
    border: 1px solid var(--sm-bd);
    border-radius: 11px;
    background: var(--sm-panel2);
    color: var(--sm-tx);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    box-shadow: none;
    min-height: 0;
}

    .pwd-modal-content .pwd-input::placeholder {
        color: var(--sm-tx3);
        font-weight: 400;
    }

    .pwd-modal-content .pwd-input:focus {
        outline: none;
        border-color: var(--sm-acc);
        background: var(--sm-accbg);
        box-shadow: 0 0 0 3px rgba(26, 111, 212, .13);
    }

    .pwd-modal-content .pwd-input.is-bad {
        border-color: var(--sm-bad-bd);
        background: var(--sm-bad-bg);
    }

.pwd-reveal {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--sm-tx3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

    .pwd-reveal:hover {
        background: var(--sm-hover);
        color: var(--sm-tx2);
    }

/* ── validation ───────────────────────────────────────────────────────── */

/* Hidden until something actually fails. The old markup left all three of
   these on screen permanently, which is what made the dialog read as an
   error report rather than a form. */
.pwd-error {
    display: none;
    align-items: flex-start;
    gap: 6px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--sm-bad-fg);
}

    .pwd-error.is-shown {
        display: flex;
    }

    .pwd-error::before {
        content: "!";
        width: 14px;
        height: 14px;
        margin-top: 1px;
        flex-shrink: 0;
        border-radius: 50%;
        background: var(--sm-bad-fg);
        color: var(--sm-panel);
        font-size: 10px;
        font-weight: 700;
        line-height: 14px;
        text-align: center;
    }

/* The requirement chips under Шинэ нууц үг. Neutral until the field has
   content, then each one answers for itself. */
.pwd-reqs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 1px;
}

.pwd-req {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px 3px 7px;
    border-radius: 999px;
    background: var(--sm-mt-bg);
    color: var(--sm-mt-fg);
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

    .pwd-req::before {
        content: "•";
        font-size: 13px;
        line-height: 1;
    }

    .pwd-req.is-ok {
        background: var(--sm-ok-bg);
        color: var(--sm-ok-fg);
    }

        .pwd-req.is-ok::before {
            content: "✓";
            font-size: 10px;
        }

    .pwd-req.is-bad {
        background: var(--sm-bad-bg);
        color: var(--sm-bad-fg);
    }

        .pwd-req.is-bad::before {
            content: "✕";
            font-size: 9px;
        }

/* ── actions ──────────────────────────────────────────────────────────── */

.pwd-btn-row {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.pwd-btn {
    flex: 1;
    height: 42px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-radius: 11px;
    border: 1px solid var(--sm-bd);
    background: var(--sm-panel2);
    color: var(--sm-tx2);
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

    .pwd-btn:hover,
    .pwd-btn:focus {
        outline: none;
        background: var(--sm-hover);
        color: var(--sm-tx);
    }

.pwd-btn-submit {
    background: var(--sm-acc);
    border-color: var(--sm-acc);
    color: #fff;
}

    .pwd-btn-submit:hover,
    .pwd-btn-submit:focus {
        background: var(--sm-acc-dk);
        border-color: var(--sm-acc-dk);
        color: #fff;
    }

@media (max-width: 520px) {
    .pwd-modal-dialog {
        max-width: none;
        margin: 16px;
    }

    .pwd-modal-content {
        padding: 20px;
    }
}

/* --------------------------------------------------------------------------
   11. Calendar (Цаг month view)
   -------------------------------------------------------------------------- */

/* The grid keeps a floor width and scrolls sideways inside this wrapper
   rather than letting seven columns squeeze down to unreadable slivers. */
.sm-cal-scroll {
    overflow-x: auto;
    margin: 0 -2px;
    padding: 0 2px 2px;
}

.sm-cal {
    display: grid;
    grid-template-columns: repeat(7, minmax(104px, 1fr));
    gap: 8px;
    min-width: 780px;
}

.sm-cal-dow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--sm-tx3);
    text-align: center;
    padding-bottom: 2px;
}

.sm-cal-day {
    min-height: 116px;
    border-radius: 11px;
    padding: 9px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-sizing: border-box;
    min-width: 0;
    border: 1px solid var(--sm-bd);
    background: var(--sm-cal-work);
}

:root[data-density="dense"] .sm-cal-day {
    min-height: 92px;
}

.sm-cal-day.is-empty {
    border: 1px dashed var(--sm-bd2);
    background: transparent;
}

.sm-cal-day.is-late {
    background: var(--sm-cal-late);
    border-color: var(--sm-cal-late-bd);
}

/* A public holiday, a day worked at the weekend, and a day covered by an
   approved Илүү цаг / Бүх нийтийн амралтын өдөр / Томилолт all share the teal:
   each is "this was not a normal working day". */
.sm-cal-day.is-holiday,
.sm-cal-day.is-extra {
    background: var(--sm-cal-hol);
    border-color: var(--sm-cal-hol-bd);
}

.sm-cal-day.is-off {
    background: var(--sm-cal-off);
}

/* A full day worked with nothing wrong. */
.sm-cal-day.is-done {
    background: var(--sm-cal-done);
    border-color: var(--sm-cal-done-bd);
}

/* The two request outcomes, so the day carries the decision rather than
   leaving it to a chip: granted reads blue, declined red. */
.sm-cal-day.is-leave {
    background: var(--sm-cal-leave);
    border-color: var(--sm-cal-leave-bd);
}

/* A working day that simply did not happen: no attendance, no granted
   request. A declined request does NOT paint the day — the chip carries that
   on its own — so red here always means "nothing was recorded". */
.sm-cal-day.is-absent {
    background: var(--sm-cal-rej);
    border-color: var(--sm-cal-rej-bd);
}

.sm-cal-day.is-weekend {
    background: var(--sm-cal-weekend);
    border-color: var(--sm-bd2);
}

.sm-cal-day.is-today {
    border-color: var(--sm-acc);
    box-shadow: 0 0 0 2px var(--sm-accbg);
}

.sm-cal-head {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sm-cal-n {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--sm-tx);
    font-variant-numeric: tabular-nums;
}

.sm-cal-day.is-weekend .sm-cal-n,
.sm-cal-day.is-holiday .sm-cal-n {
    color: var(--sm-tx3);
}

.sm-cal-day.is-today .sm-cal-n {
    font-weight: 700;
    color: var(--sm-acc);
}

.sm-cal-hrs {
    margin-left: auto;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--sm-tx2);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.sm-cal-times {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--sm-tx2);
    white-space: nowrap;
}

.sm-cal-dot {
    width: 7px;
    height: 7px;
    border-radius: 2px;
    flex-shrink: 0;
    background: var(--sm-dot-mt);
}

.sm-cal-dot.is-ok {
    background: var(--sm-dot-ok);
}

.sm-cal-dot.is-wn {
    background: var(--sm-dot-wn);
}

.sm-cal-dot.is-nw {
    background: var(--sm-dot-nw);
}

.sm-cal-dot.is-bad {
    background: var(--sm-dot-bad);
}

/* The time-adding states — a weekend or holiday somebody worked, and an
   approved Илүү цаг / Бүх нийтийн амралтын өдөр / Томилолт. Shares the teal
   the .sm-t-tl chip and the .is-extra / .is-holiday cell wash use. */
.sm-cal-dot.is-tl {
    background: var(--sm-tl-fg);
}

.sm-cal-chips {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

/* Geometry only — the colour comes from a .sm-t-* tone class, the same
   arrangement .sm-ico uses. A default background here would beat the tone:
   both are single-class selectors and this rule is declared later, so
   .sm-t-ok on the same element would lose and every chip would render grey. */
.sm-cal-chip {
    padding: 2px 7px;
    font-size: 10.5px;
    border-radius: 999px;
    font-weight: 600;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

/* The hours an Илүү цаг chip covers, printed directly beneath it. .sm-cal-chips
   is a column, so this needs no rule of its own to sit on the next line; the
   indent is what ties it to the chip above rather than to the next one, and
   the negative top margin closes the column gap so the two read as one item.
   Ellipsis rather than wrap: it is a value, and a value broken across two
   lines in a 104px cell is worse than a clipped one. */
.sm-cal-ot {
    margin: -2px 0 1px 8px;
    font-size: 10.5px;
    line-height: 1.3;
    color: var(--sm-tx2);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sits at the bottom of the cell and is allowed to wrap — these are phrases
   ("Бүх нийтийн амралт"), not values, and a 104px column would otherwise
   ellipsis them into nothing. */
.sm-cal-note {
    margin-top: auto;
    font-size: 11px;
    line-height: 1.35;
    color: var(--sm-tx3);
}

/* month totals strip under the calendar */
.sm-totals {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1px;
    background: var(--sm-bd2);
    border: 1px solid var(--sm-bd);
    border-radius: 13px;
    overflow: hidden;
}

.sm-total {
    background: var(--sm-panel);
    padding: 13px 15px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sm-total-k {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--sm-tx3);
    white-space: nowrap;
}

.sm-total-v {
    font-size: 15px;
    font-weight: 700;
    color: var(--sm-tx);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Same figures, but sitting inside the calendar card under a hairline rule
   instead of standing alone as a bordered strip. Reuses .sm-total-k/-v.

   Each figure is its own tinted tile, and the tint is one of the .sm-t-*
   tones the month view above already uses — amber for Хоцролт, teal for
   Чөлөө, blue for the day counts — so the strip reads as a continuation of
   the calendar's colour language rather than seven unrelated numbers.

   Grid rather than the one-row scrolling strip this was: seven tiles do not
   fit a narrow card side by side, and a figure you have to scroll sideways
   to reach is a figure nobody reads. auto-fit puts all seven across a
   desktop card and folds them onto a second row when it cannot. */
.sm-cal-foot {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--sm-bd2);
}

/* Geometry only — the background and the text colour both come from the
   .sm-t-* tone the view puts on the tile, the same arrangement .sm-ico and
   .sm-cal-chip use. A background here would beat the tone: the two are
   equally specific and this rule is declared later.

   justify-content matters more than it looks: grid rows stretch, so when one
   figure wraps to two lines every tile in that row grows with it. Centred,
   the short ones stay optically level with the tall one instead of hanging
   from its top edge.

   The inset ring is currentColor held right back — the tone's own hue rather
   than a grey line. The pale light-theme tints already separate from the card
   on their own, but the dark ones are close enough to the panel that without
   an edge the tiles dissolve into it. */
.sm-total-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 16px 12px 15px;
    border-radius: 14px;
    text-align: center;
    min-width: 0;
}

    /* The ring rides a pseudo-element rather than a border or box-shadow on
       the tile itself because it has to be currentColor at low strength, and
       opacity cannot be applied to a colour inside box-shadow. Its own layer
       can carry the opacity; inherit keeps the corners with the tile. */
    .sm-total-tile::after {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: inherit;
        box-shadow: inset 0 0 0 1px currentColor;
        opacity: .22;
        pointer-events: none;
    }

.sm-total-i {
    display: flex;
    line-height: 0;
    opacity: .9;
}

/* Label and figure both ride the tile's own tone instead of the neutral text
   tokens .sm-total-k/-v carry for the bordered .sm-totals strip, so they have
   to out-specify .sm-t-* — two classes beats one. The label is the same
   colour held back, not a grey: a grey that reads on a pale tint in the light
   theme is invisible on the dark one. */
.sm-cal-foot .sm-total-k {
    color: currentColor;
    opacity: .75;
    font-size: 10px;
    letter-spacing: .06em;
    white-space: normal;
}

.sm-cal-foot .sm-total-v {
    color: currentColor;
    font-size: 18px;
    letter-spacing: -.01em;
    /* Хоцролт states two things — "80 мин · 1 удаа" — and is the one figure
       that will not always fit a tile on one line. */
    white-space: normal;
}

/* --------------------------------------------------------------------------
   11b. Dashboard layout + attendance punch card
   --------------------------------------------------------------------------
   The punch card is not in the Claude Design prototype — it carries the
   Ирсэн / Явсан controls the old Нүүр page owned, restyled into the new
   language so the function survives the redesign.
   -------------------------------------------------------------------------- */

.sm-dash {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sm-dash-split {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.sm-dash-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

/* The card stacks: readout row on top, punch controls beneath. */
.sm-punch {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 17px 20px;
}

.sm-punch-row {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

/* Pinned to the top-right of the readout row. align-self keeps it at the top
   rather than centred against the tall clock.

   Carries the accent rather than the default neutral button styling — it was
   disappearing into the card. Tinted rather than solid so it reads as a link
   out, not as the card's primary action: the punch buttons below are that. */
.sm-punch-link {
    margin-left: auto;
    align-self: flex-start;
    flex-shrink: 0;
    height: 36px;
    padding: 0 16px;
    background: var(--sm-accbg);
    border-color: rgba(26, 111, 212, .32);
    color: var(--sm-acc);
    font-weight: 600;
}

    .sm-punch-link:hover,
    .sm-punch-link:focus {
        background: var(--sm-acc);
        border-color: var(--sm-acc);
        color: #fff;
    }

/* left block: date caption over the live clock */
.sm-punch-now {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 165px;
}

.sm-punch-date {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--sm-tx3);
}

.sm-punch-clock {
    font-size: 36px;
    font-weight: 600;
    letter-spacing: -.02em;
    color: var(--sm-tx);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.sm-punch-divider {
    width: 1px;
    height: 52px;
    background: var(--sm-bd);
    flex-shrink: 0;
}

/* the four labelled readouts */
.sm-punch-facts {
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
}

.sm-punch-fact {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sm-punch-k {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--sm-tx3);
}

.sm-punch-v {
    font-size: 17px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    color: var(--sm-tx);
}

    /* an unrecorded punch reads as muted, a recorded arrival as green */
    .sm-punch-v.is-empty {
        color: var(--sm-tx3);
    }

    .sm-punch-v.is-in {
        color: var(--sm-punch-done-fg);
    }

.sm-punch-sched {
    color: var(--sm-tx2);
}

/* ── the punch bar ───────────────────────────────────────────────────────
   Sits inside the card, full width beneath the readout row. The controls
   used to be in the row's right-hand corner, where people were missing
   them. A hairline separates the two halves. */
.sm-punch-bar {
    display: flex;
    gap: 14px;
    padding-top: 16px;
    border-top: 1px solid var(--sm-bd2);
}

/* 8 шарга and Нисэх have no punch controls — the bar carries the day's
   schedule instead. It keeps the hairline and the top padding so the card
   holds its shape, but the single readout is left-aligned rather than
   stretched the way the two buttons are. */
.sm-punch-bar.sm-punch-schedbar {
    align-items: center;
}

    .sm-punch-bar.sm-punch-schedbar .sm-punch-fact {
        flex: 0 0 auto;
    }

.sm-punch-big {
    flex: 1 1 0;
    min-width: 0;
    height: 76px;
    padding: 0 22px;
    border: 1px solid transparent;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    cursor: pointer;
    font: inherit;
    transition: background .15s ease, border-color .15s ease, transform .1s ease;
}

    .sm-punch-big:active:not(:disabled) {
        transform: scale(.985);
    }

    .sm-punch-big svg {
        flex-shrink: 0;
        opacity: .95;
    }

.sm-punch-big-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
    min-width: 0;
}

.sm-punch-big-label {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.sm-punch-big-time {
    font-size: 13px;
    font-weight: 600;
    opacity: .85;
    font-variant-numeric: tabular-nums;
}

/* Tinted rather than solid — big enough to be unmissable without shouting
   over the rest of the page. Ирсэн green, Явсан its red counterpart. The
   tokens run richer in dark mode; see the :root blocks. */
.sm-punch-big.sm-punch-in {
    background: var(--sm-punch-in-bg);
    border-color: var(--sm-punch-in-bd);
    color: var(--sm-punch-in-fg);
}

    .sm-punch-big.sm-punch-in:hover:not(:disabled) {
        border-color: var(--sm-punch-in-fg);
    }

.sm-punch-big.sm-punch-out {
    background: var(--sm-punch-out-bg);
    border-color: var(--sm-punch-out-bd);
    color: var(--sm-punch-out-fg);
}

    .sm-punch-big.sm-punch-out:hover {
        border-color: var(--sm-punch-out-fg);
    }

/* Recorded: keeps its tint so the pair still reads green/red, but fades back
   and stops responding rather than inviting another press. */
.sm-punch-big.is-done,
.sm-punch-big:disabled {
    opacity: .6;
    cursor: default;
}

@media (max-width: 640px) {
    .sm-punch-bar {
        flex-direction: column;
        gap: 10px;
    }

    .sm-punch-big {
        height: 68px;
    }
}

/* NOTE: the old small punch buttons (.sm-punch-btn, .sm-punch-locked and
   the 90%-profile lock) lived here. They are gone from the markup — the
   card uses .sm-punch-big now. The rules were removed rather than left in
   place because `:root[data-theme="dark"] .sm-punch-out` is (0,3,0) and was
   beating `.sm-punch-big.sm-punch-out` (0,2,0), painting Явсан grey in dark
   mode no matter what the token said. */
@media (max-width: 1100px) {
    .sm-dash-split {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 760px) {
    .sm-punch {
        gap: 16px;
        padding: 16px;
    }

    .sm-punch-divider {
        display: none;
    }

    .sm-punch-actions {
        margin-left: 0;
        flex: 1 1 100%;
    }

    .sm-punch-btn {
        flex: 1;
        height: 44px;
    }

    .sm-punch-locked {
        margin-left: 0;
        flex: 1 1 100%;
        max-width: none;
    }
}

/* --------------------------------------------------------------------------
   11c. Full-screen overlays (month-end reminder, weak-password warning)
   --------------------------------------------------------------------------
   These are plain fixed-position panels rather than Bootstrap modals — the
   old page built them the same way, and keeping them independent means they
   cannot collide with the password modal that _Layout owns.
   -------------------------------------------------------------------------- */

.sm-overlay {
    position: fixed;
    inset: 0;
    z-index: 1090;
    background: rgba(8, 14, 26, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.sm-overlay-card {
    background: var(--sm-panel);
    border: 1px solid var(--sm-bd);
    border-radius: 16px;
    padding: 28px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 24px 64px rgba(8, 14, 26, .28);
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* the tone badge should hug its text, not stretch to the card */
    align-items: flex-start;
}

.sm-overlay-title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--sm-tx);
    line-height: 1.45;
}

.sm-overlay-text {
    margin: 0;
    font-size: 13px;
    color: var(--sm-tx2);
    line-height: 1.6;
}

.sm-overlay-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

    .sm-overlay-list li {
        display: flex;
        align-items: center;
        gap: 9px;
        font-size: 13px;
        color: var(--sm-tx2);
    }

        .sm-overlay-list li::before {
            content: "✓";
            width: 19px;
            height: 19px;
            border-radius: 50%;
            background: var(--sm-accbg);
            color: var(--sm-acc);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 11px;
            flex-shrink: 0;
        }

.sm-overlay-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: 4px;
}

    .sm-overlay-actions .sm-btn {
        flex: 1;
    }

/* --------------------------------------------------------------------------
   11c-bday. Birthday greeting ribbon
   --------------------------------------------------------------------------
   Shown on Нүүр, to everyone, whenever DashboardVM.BirthdayToday is non-empty
   — it stays up the whole day. Its icon button just pops confetti. Festive
   tints are literal (a party colour is not a token) with an explicit
   [data-theme="dark"] counterpart so neither theme renders dark text on a dark
   wash. Text stays on --sm-* tokens, so it flips with the theme on its own.
   -------------------------------------------------------------------------- */

.sm-bday {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    margin-bottom: 16px;
    border-radius: 15px;
    overflow: hidden;
    background: linear-gradient(100deg, #fff2f6 0%, #fef4e8 46%, #f1f0ff 100%);
    border: 1px solid #f4d3de;
    box-shadow: var(--sm-sh);
    animation: sm-fadeup .3s ease both;
}

:root[data-theme="dark"] .sm-bday {
    background: linear-gradient(100deg, #2b1b25 0%, #2a2417 46%, #231f33 100%);
    border-color: #48303c;
}

.sm-bday-cake {
    flex: none;
    position: relative;
    z-index: 2;
}

.sm-bday-main {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 2;
}

.sm-bday-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--sm-tx);
    line-height: 1.35;
}

.sm-bday-people {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.sm-bday-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 3px 11px 3px 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .72);
    border: 1px solid #f0d6df;
    font-size: 12px;
    font-weight: 500;
    color: var(--sm-tx);
}

:root[data-theme="dark"] .sm-bday-chip {
    background: rgba(255, 255, 255, .08);
    border-color: #4a3340;
}

.sm-bday-av {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    flex: none;
}

.sm-bday-act {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

/* The confetti button — icon only, no label. A solid party pink that holds up
   in both themes, so it is stated once rather than tokenised. Squared to 34px
   (the base .sm-btn height) so the lone emoji sits centred; the tap scale is a
   little tactile feedback for a control whose whole job is the pop. */
.sm-bday-greet {
    width: 34px;
    padding: 0;
    flex: none;
    font-size: 17px;
    line-height: 1;
    background: #e64980;
    border-color: #e64980;
    color: #ffffff;
    transition: background .15s, border-color .15s, transform .1s;
}

    .sm-bday-greet:hover,
    .sm-bday-greet:focus {
        background: #d63384;
        border-color: #d63384;
        color: #ffffff;
    }

    .sm-bday-greet:active {
        transform: scale(.92);
    }

/* Confetti — a handful of drifting bits shared by the ribbon's ambient drift
   and the JS burst the button fires. Absolutely placed by inline left/top. */
.sm-cf {
    position: absolute;
    z-index: 1;
    border-radius: 2px;
    pointer-events: none;
    animation: sm-cf-float 4.5s ease-in-out infinite;
}

@keyframes sm-cf-float {
    0%   { transform: translateY(0) rotate(0); }
    50%  { transform: translateY(-7px) rotate(10deg); }
    100% { transform: translateY(0) rotate(0); }
}

/* The full-screen burst the button fires — a fixed, click-through layer above
   everything (overlays and even the select2 dropdown at 100060), holding
   JS-positioned pieces. bdayBurst() removes the layer once the last piece has
   left the screen. */
.sm-cf-layer {
    position: fixed;
    inset: 0;
    z-index: 100070;
    overflow: hidden;
    pointer-events: none;
}

.sm-cf-piece {
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 2px;
    will-change: transform, opacity;
}

/* The candle flames on the drawn cake. */
.sm-flame {
    transform-origin: center bottom;
    animation: sm-flame-flicker 1.6s ease-in-out infinite;
}

@keyframes sm-flame-flicker {
    0%, 100% { transform: scaleY(1); opacity: 1; }
    50%      { transform: scaleY(.86); opacity: .9; }
}

@media (prefers-reduced-motion: reduce) {
    .sm-cf,
    .sm-flame,
    .sm-bday {
        animation: none;
    }
}

/* --------------------------------------------------------------------------
   11d. Ирцийн жагсаалт — the day roster behind the Ирсэн tile and the
        attendance chart's bars
   --------------------------------------------------------------------------
   Same .sm-overlay backdrop as 11c, but the card is a list rather than a
   message: wider, capped at the viewport height, and scrolling in its body
   only so the header and the count chips stay put.
   -------------------------------------------------------------------------- */

/* What says "this number opens something". Applied to the Ирсэн stat tile and
   to every chart column on a team dashboard; both are otherwise inert. */
.sm-stat.is-open,
.sm-chart-col.is-open {
    cursor: pointer;
}

.sm-stat.is-open {
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

    .sm-stat.is-open:hover,
    .sm-stat.is-open:focus-visible {
        border-color: var(--sm-acc);
        box-shadow: var(--sm-sh-pop);
        transform: translateY(-1px);
        outline: none;
    }

.sm-roster-card {
    max-width: 680px;
    max-height: min(80vh, 720px);
    padding: 0;
    gap: 0;
    align-items: stretch;
    overflow: hidden;
}

.sm-roster-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--sm-bd2);
}

.sm-roster-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--sm-tx);
}

.sm-roster-meta {
    font-size: 11.5px;
    color: var(--sm-tx3);
}

/* Pushed to the far end of the header row. */
.sm-roster-x {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--sm-bd);
    border-radius: 9px;
    background: var(--sm-panel);
    color: var(--sm-tx2);
    cursor: pointer;
    flex-shrink: 0;
}

    .sm-roster-x:hover {
        background: var(--sm-hover);
        color: var(--sm-tx);
    }

/* The three counts, doubling as filters — clicking one narrows the list to
   that tone, clicking it again puts everyone back. */
.sm-roster-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--sm-bd2);
}

.sm-roster-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    /* the tone classes (.sm-t-ok …) supply background and colour */
}

    .sm-roster-chip.is-on {
        border-color: currentColor;
    }

    .sm-roster-chip[disabled] {
        opacity: .45;
        cursor: default;
    }

/* The shell's thin-scrollbar rule (§2) is scoped to `.sm-app *`, and this
   overlay is appended to <body> — outside it. Left to the platform the list
   gets an overlay scrollbar that fades away, so on a card that is plainly cut
   off mid-row there is nothing saying the rest is below. Declaring a width
   also opts Chromium out of overlay scrollbars: the bar stays put whenever the
   list scrolls, and the track gives the thumb something to read against. */
.sm-roster-list {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--sm-scroll) var(--sm-bd2);
}

    .sm-roster-list::-webkit-scrollbar {
        width: 11px;
    }

    .sm-roster-list::-webkit-scrollbar-track {
        background: var(--sm-bd2);
    }

    .sm-roster-list::-webkit-scrollbar-thumb {
        background: var(--sm-scroll);
        border-radius: 11px;
        /* inset off the track, so the thumb reads as a pill rather than as a
           block filling the gutter */
        border: 3px solid var(--sm-panel);
    }

        .sm-roster-list::-webkit-scrollbar-thumb:hover {
            background: var(--sm-scroll-hover);
        }

.sm-roster-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--sm-bd2);
}

    .sm-roster-row:last-child {
        border-bottom: none;
    }

    /* A left edge in the row's own colour, so the list reads as three groups
       at a glance rather than as a column of badges to be parsed one by one. */
    .sm-roster-row::before {
        content: "";
        width: 3px;
        align-self: stretch;
        border-radius: 2px;
        background: var(--sm-tx3);
        flex-shrink: 0;
    }

    .sm-roster-row.is-ok::before {
        background: var(--sm-ok-fg);
    }

    .sm-roster-row.is-wn::before {
        background: var(--sm-wn-fg);
    }

    .sm-roster-row.is-bad::before {
        background: var(--sm-bad-fg);
    }

    .sm-roster-row.is-mt::before {
        background: var(--sm-bd);
    }

.sm-roster-av {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--sm-accbg);
    flex-shrink: 0;
}

.sm-roster-who {
    min-width: 0;
    flex: 1;
}

.sm-roster-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--sm-tx);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sm-roster-sub {
    font-size: 11.5px;
    color: var(--sm-tx3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Clock-in / clock-out. Tabular figures so the times line up down the list. */
.sm-roster-time {
    font-size: 12px;
    color: var(--sm-tx2);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
}

/* .sm-badge is nowrap everywhere else, which a capped width turns into text
   spilling straight out of the pill — "Хоцорсон 355 мин · Эрт тарсан 64 мин"
   ran over both ends of its own background and into the times beside it. In
   this list it wraps instead and the pill grows to fit. The status strings
   glue each figure to its unit with a non-breaking space, so a break can only
   land on the · between the two halves. */
.sm-roster-row .sm-badge {
    flex-shrink: 0;
    max-width: 200px;
    white-space: normal;
    text-align: center;
    line-height: 1.4;
}

/* Filtering hides rows rather than rebuilding the list, so scroll position and
   the chip states survive a change of filter. */
.sm-roster-list.f-ok .sm-roster-row:not(.is-ok),
.sm-roster-list.f-wn .sm-roster-row:not(.is-wn),
.sm-roster-list.f-bad .sm-roster-row:not(.is-bad) {
    display: none;
}

@media (max-width: 560px) {
    /* The times are the first thing to go — the badge already carries the
       lateness in minutes, and the name matters more than either. */
    .sm-roster-time {
        display: none;
    }

    .sm-roster-row .sm-badge {
        max-width: 150px;
    }
}

/* --------------------------------------------------------------------------
   12. Approval queue (dashboard)
   -------------------------------------------------------------------------- */

.sm-queue-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--sm-bd2);
}

    .sm-queue-item:last-child {
        border-bottom: none;
    }

.sm-queue-body {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sm-queue-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--sm-tx);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sm-queue-detail {
    font-size: 12px;
    color: var(--sm-tx2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sm-queue-when {
    font-size: 11.5px;
    color: var(--sm-tx3);
    white-space: nowrap;
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   12b. List-page toolbar card
   --------------------------------------------------------------------------
   The strip above every table: view toggle, subject picker, scope chip,
   period pickers, filters, search, then the actions pushed right.
   -------------------------------------------------------------------------- */

.sm-toolbar-card {
    background: var(--sm-panel);
    border: 1px solid var(--sm-bd);
    border-radius: 14px;
    padding: 11px 13px;
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    box-shadow: var(--sm-sh);
}

.sm-tb-sep {
    width: 1px;
    height: 22px;
    background: var(--sm-bd);
    flex-shrink: 0;
}

.sm-tb-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

/* search */
.sm-search {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 11px;
    border-radius: 9px;
    border: 1px solid var(--sm-bd);
    background: var(--sm-panel2);
    min-width: 160px;
    flex: 0 1 220px;
}

    .sm-search svg {
        color: var(--sm-tx3);
        flex-shrink: 0;
    }

    .sm-search input {
        border: none;
        background: transparent;
        outline: none;
        font: inherit;
        font-size: 12.5px;
        color: var(--sm-tx);
        width: 100%;
        min-width: 0;
        height: 100%;
        padding: 0;
        box-shadow: none;
    }

    .sm-search:focus-within {
        border-color: var(--sm-acc);
        background: var(--sm-accbg);
    }

/* subject (employee) picker trigger */
.sm-subj-btn {
    height: 34px;
    padding: 0 10px 0 6px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 9px;
    border: 1px solid var(--sm-bd);
    background: var(--sm-panel2);
    color: var(--sm-tx);
    font: inherit;
    font-size: 12.5px;
    cursor: pointer;
    white-space: nowrap;
}

    .sm-subj-btn:hover {
        background: var(--sm-hover);
    }

    .sm-subj-btn img {
        width: 22px;
        height: 22px;
        border-radius: 6px;
        object-fit: cover;
        flex-shrink: 0;
    }

/* calendar header + legend */
.sm-cal-title {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

    .sm-cal-title h2 {
        margin: 0;
        font-size: 16px;
        font-weight: 600;
        color: var(--sm-tx);
    }

.sm-legend {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
    flex-wrap: wrap;
}

.sm-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--sm-tx2);
}

.sm-legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 3px;
    flex-shrink: 0;
    background: var(--sm-dot-mt);
}

    .sm-legend-dot.is-ok {
        background: var(--sm-dot-ok);
    }

    .sm-legend-dot.is-wn {
        background: var(--sm-dot-wn);
    }

    .sm-legend-dot.is-nw {
        background: var(--sm-dot-nw);
    }

    .sm-legend-dot.is-tl {
        background: var(--sm-dot-tl);
    }

    .sm-legend-dot.is-pd {
        background: var(--sm-dot-pd);
    }

    .sm-legend-dot.is-bad {
        background: var(--sm-dot-bad);
    }

/* --------------------------------------------------------------------------
   12c. DataTables skin
   --------------------------------------------------------------------------
   Most list pages render through DataTables, which ships its own markup and
   classes. Rather than restyle each page, the generated chrome is skinned
   once here. Everything is scoped under .sm-app so anything outside the app
   shell is unaffected.

   Specificity note: DataTables' own stylesheet uses `table.dataTable thead th`
   (0,0,3) and Bootstrap uses `.table > thead > tr > th` (0,0,4), so these
   selectors are written to clear both.
   -------------------------------------------------------------------------- */

/* The wrapper is the table's scroll box, at every width. A table with more
   columns than the card is wide is not a phone problem — a narrow window, the
   sidebar expanded, or simply a wide report does it on a desktop too, and
   before this the surplus columns were cut off dead: `overflow: hidden` here
   (it is what makes the 15px radius clip the table's corners) left nothing to
   scroll and no way to reach them. Only 6 of the 25 DataTables pages wrap
   their table in a .table-responsive, so the scroller cannot come from the
   markup.

   The axis matters: overflow-y stays hidden, so the corners still clip and
   nothing gains a vertical scrollbar. When the table fits, auto shows no
   scrollbar and this is inert.

   Making the table itself a block box with its own overflow was the other way
   to do this, and it is the wrong one: the anonymous table inside a block
   shrinks to its content, so a table with few columns would stop filling its
   card. Leaving the table's display alone keeps every table laid out as it
   was. */
.sm-app .dataTables_wrapper {
    background: var(--sm-panel);
    border: 1px solid var(--sm-bd);
    border-radius: 15px;
    box-shadow: var(--sm-sh);
    padding: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    color: var(--sm-tx);
}

/* The length picker, search, info and pagination live inside the wrapper too,
   so scrolling the table would drag them out of view with it. Sticky pins
   them to the left edge — only the rows move. Inert until something
   scrolls. */
.sm-app .dataTables_wrapper > .row,
.sm-app .dataTables_wrapper > .dt-buttons,
.sm-app .dataTables_wrapper > .dataTables_length,
.sm-app .dataTables_wrapper > .dataTables_filter,
.sm-app .dataTables_wrapper > .dataTables_info,
.sm-app .dataTables_wrapper > .dataTables_paginate {
    position: sticky;
    left: 0;
}

/* top row: length picker + search */
.sm-app .dataTables_wrapper .dataTables_length,
.sm-app .dataTables_wrapper .dataTables_filter {
    padding: 12px 16px;
    font-size: 12.5px;
    color: var(--sm-tx2);
}

.sm-app .dataTables_wrapper .dataTables_filter {
    text-align: right;
}

    .sm-app .dataTables_wrapper .dataTables_filter input,
    .sm-app .dataTables_wrapper .dataTables_length select {
        height: 32px;
        border-radius: 8px;
        border: 1px solid var(--sm-bd);
        background: var(--sm-panel2);
        color: var(--sm-tx);
        padding: 0 10px;
        font: inherit;
        font-size: 12.5px;
        margin-left: 8px;
        box-shadow: none;
    }

        .sm-app .dataTables_wrapper .dataTables_filter input:focus,
        .sm-app .dataTables_wrapper .dataTables_length select:focus {
            outline: none;
            border-color: var(--sm-acc);
            background: var(--sm-accbg);
        }

/* the table itself */
.sm-app table.dataTable {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 0 !important;
    background: transparent;
    font-size: 13px;
    border: none;
}

    .sm-app table.dataTable > thead > tr > th,
    .sm-app table.dataTable > thead > tr > td {
        text-align: left;
        padding: var(--sm-th-y) var(--sm-cell-x);
        background: var(--sm-head);
        border-bottom: 1px solid var(--sm-bd);
        border-top: none;
        font-size: 11px;
        font-weight: 600;
        letter-spacing: .05em;
        text-transform: uppercase;
        color: var(--sm-tx3);
        white-space: nowrap;
    }

    /* A header follows the alignment of the column it names. DataTables puts a
       column's `className` on its header cell as well as its body cells (see
       _fnDrawHead), so `dt-body-center` is on the <th> too — without this the
       rule above pinned every label hard left while the values under it were
       centred, and the two sat on different vertical lines. `dt-head-*` is
       DataTables' own header-only class, honoured here because the rule above
       outranks the stylesheet DataTables ships with.

       `text-center` on the <th> is deliberately not in this list. Most views
       carry it on headers whose body cells are left-aligned (HistoryofStatus,
       PaymentRequestHistory, IncidenceStatusHistory …), and no view puts it on
       a <td> at all — honouring it would break the alignment it looks like it
       should fix. */
    .sm-app table.dataTable > thead > tr > th.dt-body-center,
    .sm-app table.dataTable > thead > tr > th.dt-center,
    .sm-app table.dataTable > thead > tr > th.dt-head-center {
        text-align: center;
    }

    /* `align` is the same idea spelled the old way: Site.css/styles.css give
       `td.align` a `text-align-last: end`, which puts the value on the right
       (SalaryIndex's Урьдчилгаа and Суутгал columns). */
    .sm-app table.dataTable > thead > tr > th.dt-body-right,
    .sm-app table.dataTable > thead > tr > th.dt-right,
    .sm-app table.dataTable > thead > tr > th.dt-head-right,
    .sm-app table.dataTable > thead > tr > th.align {
        text-align: right;
    }

    /* a sortable header keeps 26px clear on the right for its caret; mirror it
       on the left so a centred label stays centred over its column */
    .sm-app table.dataTable > thead > tr > th.dt-body-center.sorting,
    .sm-app table.dataTable > thead > tr > th.dt-body-center.sorting_asc,
    .sm-app table.dataTable > thead > tr > th.dt-body-center.sorting_desc,
    .sm-app table.dataTable > thead > tr > th.dt-head-center.sorting,
    .sm-app table.dataTable > thead > tr > th.dt-head-center.sorting_asc,
    .sm-app table.dataTable > thead > tr > th.dt-head-center.sorting_desc {
        padding-left: 26px;
    }

    .sm-app table.dataTable > tbody > tr > td {
        padding: var(--sm-cell-y) var(--sm-cell-x);
        border-bottom: 1px solid var(--sm-bd2);
        border-top: none;
        color: var(--sm-tx);
        vertical-align: middle;
    }

    .sm-app table.dataTable > tbody > tr:last-child > td {
        border-bottom: none;
    }

    .sm-app table.dataTable > tbody > tr:hover > td {
        background: var(--sm-panel2);
    }

    /* DataTables tints the sorted column by default — too heavy here */
    .sm-app table.dataTable > tbody > tr > td.sorting_1 {
        background: transparent;
    }

    .sm-app table.dataTable.no-footer {
        border-bottom: none;
    }

/* sort arrows — the default sprite images are replaced with CSS carets.
   .sorting_asc was missing from this group, so an ascending column kept
   DataTables' own sprite PNG: a stray light-mode arrow on the header of
   whichever column the table is ordered by. */
.sm-app table.dataTable > thead .sorting,
.sm-app table.dataTable > thead .sorting_asc,
.sm-app table.dataTable > thead .sorting_desc {
    background-image: none !important;
    position: relative;
    padding-right: 26px;
    cursor: pointer;
}

    .sm-app table.dataTable > thead .sorting::after,
    .sm-app table.dataTable > thead .sorting_asc::after,
    .sm-app table.dataTable > thead .sorting_desc::after {
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 9px;
        line-height: 1;
    }

    .sm-app table.dataTable > thead .sorting::after {
        content: "\2195";
        opacity: .28;
    }

    .sm-app table.dataTable > thead .sorting_asc::after {
        content: "\2191";
        color: var(--sm-acc);
    }

    .sm-app table.dataTable > thead .sorting_desc::after {
        content: "\2193";
        color: var(--sm-acc);
    }

/* A header that cannot be clicked must not advertise a sort direction. See
   the draw.dt handler in _Layout, which strips the marker; this covers the
   first paint before that runs, and the sprite with it. */
.sm-app table.dataTable > thead .sorting_disabled {
    background-image: none !important;
    padding-right: var(--sm-cell-x);
    cursor: default;
}

    .sm-app table.dataTable > thead .sorting_disabled::after {
        content: none;
    }

/* bottom row: info + pagination */
.sm-app .dataTables_wrapper .dataTables_info {
    padding: 12px 16px;
    font-size: 12px;
    color: var(--sm-tx3);
}

.sm-app .dataTables_wrapper .dataTables_paginate {
    padding: 10px 14px;
}

/* Two shapes reach this point. Plain DataTables puts .paginate_button on an
   <a>; the Bootstrap integration puts it on the <li> and leaves the <a>
   inside carrying Bootstrap's own link chrome. Both are covered: the li
   becomes a bare flex item and the anchor inside takes the button styling,
   which is also why the page-level JS that used to force this with inline
   hex could go. */
.sm-app .dataTables_wrapper .dataTables_paginate .pagination {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
    border-radius: 0;
}

    .sm-app .dataTables_wrapper .dataTables_paginate .pagination > li {
        display: inline-flex;
        margin: 0;
        padding: 0;
        border: none;
        background: none;
    }

        .sm-app .dataTables_wrapper .dataTables_paginate .pagination > li > a,
        .sm-app .dataTables_wrapper .dataTables_paginate .pagination > li > span {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-width: 32px;
            height: 32px;
            padding: 0 9px;
            margin: 0;
            border-radius: 8px;
            border: 1px solid transparent;
            background: transparent;
            color: var(--sm-tx2);
            font-size: 12.5px;
            line-height: 1;
            text-decoration: none;
            box-shadow: none;
        }

            .sm-app .dataTables_wrapper .dataTables_paginate .pagination > li > a:hover,
            .sm-app .dataTables_wrapper .dataTables_paginate .pagination > li > span:hover {
                background: var(--sm-hover);
                border-color: var(--sm-bd);
                color: var(--sm-tx);
            }

    .sm-app .dataTables_wrapper .dataTables_paginate .pagination > li.active > a,
    .sm-app .dataTables_wrapper .dataTables_paginate .pagination > li.active > span {
        background: var(--sm-acc);
        border-color: var(--sm-acc);
        color: #fff;
        font-weight: 600;
    }

    .sm-app .dataTables_wrapper .dataTables_paginate .pagination > li.disabled > a,
    .sm-app .dataTables_wrapper .dataTables_paginate .pagination > li.disabled > span {
        opacity: .38;
        cursor: default;
        background: transparent;
        border-color: transparent;
    }

    .sm-app .dataTables_wrapper .dataTables_paginate .paginate_button {
        min-width: 32px;
        height: 32px;
        padding: 0 9px;
        margin: 0 2px;
        border-radius: 8px;
        border: 1px solid transparent !important;
        background: transparent !important;
        color: var(--sm-tx2) !important;
        font-size: 12.5px;
        line-height: 30px;
        cursor: pointer;
        box-shadow: none !important;
    }

        .sm-app .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
            background: var(--sm-hover) !important;
            color: var(--sm-tx) !important;
            border-color: var(--sm-bd) !important;
        }

        .sm-app .dataTables_wrapper .dataTables_paginate .paginate_button.current {
            background: var(--sm-acc) !important;
            border-color: var(--sm-acc) !important;
            color: #fff !important;
            font-weight: 600;
        }

        .sm-app .dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
            opacity: .38;
            cursor: default;
        }

            .sm-app .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
                background: transparent !important;
                border-color: transparent !important;
            }

/* ── The same pagination, inside a popup ──────────────────────────────────
   A dialog is appended to <body>, so every `.sm-app` rule above misses the
   DataTables that Ээлжийн амралт and the history popups carry: their pager
   fell back to Bootstrap's pale chips, which read as a strip of light mode
   sitting on a dark dialog. Tokens rather than dark-only overrides, so the
   popup pager matches the page pager in BOTH themes.

   `:is()` keeps this to one copy of each rule instead of three (the file
   already relies on `:has()` next door in modern-ui.css).

   The colours carry !important for the same reason §12e's copies do:
   `jquery.dataTables.min.css` writes `.paginate_button { color: #333
   !important }` plus a white→#dcdcdc gradient on `.current`, and modern-ui
   !importants the button background. Specificity alone cannot reach past any
   of that. Layout declarations stay plain. */
:is(.alertify, .ui-dialog, .modal) .dataTables_paginate {
    padding: 10px 14px;
    text-align: right;
}

    :is(.alertify, .ui-dialog, .modal) .dataTables_paginate .pagination {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        margin: 0;
        padding: 0;
        list-style: none;
        border-radius: 0;
    }

        :is(.alertify, .ui-dialog, .modal) .dataTables_paginate .pagination > li {
            display: inline-flex;
            margin: 0;
            padding: 0;
            border: none;
            background: none !important;
        }

            :is(.alertify, .ui-dialog, .modal) .dataTables_paginate .pagination > li > a,
            :is(.alertify, .ui-dialog, .modal) .dataTables_paginate .pagination > li > span {
                display: inline-flex;
                align-items: center;
                justify-content: center;
                min-width: 32px;
                height: 32px;
                padding: 0 9px;
                margin: 0;
                border-radius: 8px;
                border: 1px solid transparent;
                background: transparent !important;
                color: var(--sm-tx2) !important;
                font-size: 12.5px;
                line-height: 1;
                text-decoration: none;
                box-shadow: none;
            }

                :is(.alertify, .ui-dialog, .modal) .dataTables_paginate .pagination > li > a:hover,
                :is(.alertify, .ui-dialog, .modal) .dataTables_paginate .pagination > li > span:hover {
                    background: var(--sm-hover) !important;
                    border-color: var(--sm-bd) !important;
                    color: var(--sm-tx) !important;
                }

            :is(.alertify, .ui-dialog, .modal) .dataTables_paginate .pagination > li.active > a,
            :is(.alertify, .ui-dialog, .modal) .dataTables_paginate .pagination > li.active > span {
                background: var(--sm-acc) !important;
                border-color: var(--sm-acc) !important;
                color: #fff !important;
                font-weight: 600;
            }

            :is(.alertify, .ui-dialog, .modal) .dataTables_paginate .pagination > li.disabled > a,
            :is(.alertify, .ui-dialog, .modal) .dataTables_paginate .pagination > li.disabled > span {
                opacity: .38;
                cursor: default;
                background: transparent !important;
                border-color: transparent !important;
            }

    /* Plain DataTables shape: .paginate_button on the <a> itself. */
    :is(.alertify, .ui-dialog, .modal) .dataTables_paginate .paginate_button {
        min-width: 32px;
        height: 32px;
        padding: 0 9px;
        margin: 0 2px;
        border-radius: 8px;
        border: 1px solid transparent;
        background: transparent !important;
        color: var(--sm-tx2) !important;
        font-size: 12.5px;
        line-height: 30px;
        cursor: pointer;
        box-shadow: none;
    }

        :is(.alertify, .ui-dialog, .modal) .dataTables_paginate .paginate_button:hover {
            background: var(--sm-hover) !important;
            border-color: var(--sm-bd) !important;
            color: var(--sm-tx) !important;
        }

        :is(.alertify, .ui-dialog, .modal) .dataTables_paginate .paginate_button.current {
            background: var(--sm-acc) !important;
            border-color: var(--sm-acc) !important;
            color: #fff !important;
            font-weight: 600;
        }

        :is(.alertify, .ui-dialog, .modal) .dataTables_paginate .paginate_button.disabled {
            opacity: .38;
            cursor: default;
            background: transparent !important;
            border-color: transparent !important;
        }

/* The row count line that sits beside it. */
:is(.alertify, .ui-dialog, .modal) .dataTables_info {
    padding: 10px 14px;
    font-size: 12px;
    color: var(--sm-tx3) !important;
}

.sm-app .dataTables_wrapper .dataTables_scrollHead {
    background: var(--sm-head);
}

.sm-app .dataTables_wrapper .dataTables_empty {
    padding: 44px 16px;
    text-align: center;
    color: var(--sm-tx3);
}

/* processing overlay */
.sm-app .dataTables_wrapper .dataTables_processing {
    background: var(--sm-panel);
    border: 1px solid var(--sm-bd);
    border-radius: 10px;
    box-shadow: var(--sm-sh-pop);
    color: var(--sm-tx2);
    font-size: 12.5px;
    padding: 10px 18px;
}

/* --------------------------------------------------------------------------
   12d. Taking the list chrome back from modern-ui.css
   --------------------------------------------------------------------------
   Content/modern-ui.css is the PREVIOUS redesign's stylesheet. _LoginLayout
   still loads it (ten lines above this file), because the pages this redesign
   has not reached yet are built on it. Two things about it collide here:

     • it has no dark theme at all — no [data-theme], no prefers-color-scheme,
       so every --ui-* token is a light-mode literal; and
     • it writes the DataTables chrome with !important.

   !important beats specificity, so nothing in section 12c above can win, and
   on every list page the pager rendered as light-grey pills, the row rules as
   light hairlines and the row hover as near-white — in dark mode as well as
   light. These rules take those surfaces back. !important is the only answer
   to !important; the values are all tokens, so they still follow the theme.
   Everything stays under .sm-app, so pages still on the old stylesheet are
   untouched.

   Delete this whole section the day modern-ui.css stops being loaded.
   -------------------------------------------------------------------------- */

/* modern-ui forces `border: none` and then its own light hairline on both. */
.sm-app .dt-card table.dataTable > thead > tr > th,
.sm-app table.dataTable > thead > tr > th {
    border-bottom: 1px solid var(--sm-bd) !important;
}

.sm-app .dt-card table.dataTable > tbody > tr > td,
.sm-app table.dataTable > tbody > tr > td {
    border-bottom: 1px solid var(--sm-bd2) !important;
}

.sm-app .dt-card table.dataTable > tbody > tr:last-child > td,
.sm-app table.dataTable > tbody > tr:last-child > td {
    border-bottom: none !important;
}

.sm-app .dt-card table.dataTable > tbody > tr:hover > td,
.sm-app table.dataTable > tbody > tr:hover > td {
    background: var(--sm-panel2) !important;
}

/* pager — the most visible of the three: light pills on a dark card */
.sm-app .dataTables_wrapper .dataTables_paginate .paginate_button,
.sm-app .dataTables_wrapper .dataTables_paginate .pagination > li > a,
.sm-app .dataTables_wrapper .dataTables_paginate .pagination > li > span {
    background: transparent !important;
    border: 1px solid transparent !important;
    color: var(--sm-tx2) !important;
}

.sm-app .dataTables_wrapper .dataTables_paginate .paginate_button:hover,
.sm-app .dataTables_wrapper .dataTables_paginate .pagination > li:not(.active):not(.disabled) > a:hover {
    background: var(--sm-hover) !important;
    border-color: var(--sm-bd) !important;
    color: var(--sm-tx) !important;
}

.sm-app .dataTables_wrapper .dataTables_paginate .paginate_button.current,
.sm-app .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover,
.sm-app .dataTables_wrapper .dataTables_paginate .pagination > li.active > a,
.sm-app .dataTables_wrapper .dataTables_paginate .pagination > li.active > a:hover {
    background: var(--sm-acc) !important;
    border-color: var(--sm-acc) !important;
    color: #fff !important;
}

.sm-app .dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.sm-app .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,
.sm-app .dataTables_wrapper .dataTables_paginate .pagination > li.disabled > a,
.sm-app .dataTables_wrapper .dataTables_paginate .pagination > li.disabled > a:hover {
    background: transparent !important;
    border-color: transparent !important;
    color: var(--sm-tx3) !important;
    cursor: default !important;
}

.sm-app .dataTables_wrapper .dataTables_paginate .ellipsis {
    color: var(--sm-tx3) !important;
    background: none !important;
    border: none !important;
}

/* Select2 controls the layout builds over DataTables' own length select, and
   any that a redesigned page puts in the toolbar. The dropdown panel itself
   is appended to <body>, outside .sm-app, so it is not reachable from here —
   pages that need it style it themselves. */
.sm-app .select2-container .select2-selection--single {
    background: var(--sm-panel2) !important;
    border-color: var(--sm-bd) !important;
}

/* Toolbar <select>/<input> that never got upgraded to Select2.
   modern-ui.css skins .form-control, but every one of its selectors is scoped
   to `.page-content-wrapper` or to a dialog — and this redesign's shell is
   `.sm-app`, which is neither. So a plain `<select class="form-control">` in a
   toolbar fell through to the browser default and painted WHITE on the dark
   sheet (Цагийн хуваарь's employee picker was the one you could see). Every
   other toolbar dropdown escaped it only by being Select2'd.

   Matched to the Select2 skin next to it — 36px, panel2, --ui-radius-ctl — so
   the two read as one control set, and written with tokens so it holds in both
   themes. The chevron is inlined because modern-ui's, like its colours, is out
   of reach from here; its grey is chosen to sit on either sheet. */
.sm-app .toolbar-row select.form-control,
.sm-app .toolbar-row input.form-control,
.sm-app .toolbar-row textarea.form-control {
    background: var(--sm-panel2);
    border: 1px solid var(--sm-bd);
    border-radius: var(--ui-radius-ctl, 9px);
    box-shadow: none;
    color: var(--sm-tx);
    font-size: 12.5px;
    min-height: 36px;
    height: 36px;
    padding: 0 12px;
    transition: border-color .15s, background .15s;
}

.sm-app .toolbar-row select.form-control {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa4b0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    padding-right: 30px;
    cursor: pointer;
}

    .sm-app .toolbar-row select.form-control::-ms-expand {
        display: none;
    }

    .sm-app .toolbar-row select.form-control:hover {
        border-color: var(--sm-tx3);
    }

    .sm-app .toolbar-row select.form-control:focus,
    .sm-app .toolbar-row input.form-control:focus,
    .sm-app .toolbar-row textarea.form-control:focus {
        border-color: var(--sm-acc);
        background-color: var(--sm-panel);
        box-shadow: none;
        outline: none;
    }

/* The <option> list is drawn by the OS, not by CSS: without an explicit pair
   the open menu is white-on-white in dark mode on Windows. (`color-scheme` on
   the dark :root covers Chrome; this covers the rest.) */
:root[data-theme="dark"] .sm-app .toolbar-row select.form-control option {
    background: var(--sm-panel);
    color: var(--sm-tx);
}

/* --------------------------------------------------------------------------
   12e. Dark mode for the table surfaces this redesign has not reached
   --------------------------------------------------------------------------
   Section 12c styles the CELL and leaves it transparent, so whatever sits
   behind it shows through. Three light-mode-only stylesheets paint that
   background, which is why every list page rendered white rows in dark mode
   while the text above them turned light:

     • DataTables' own `jquery.dataTables.min.css` —
       `table.dataTable tbody tr { background-color: #ffffff }`. That is on the
       ROW, which 12c never touches, so a transparent cell lets it straight
       through on EVERY DataTable in the app. Its `.stripe` / `.display`
       variants add #f9f9f9, and Bootstrap's `.table-striped` its own #f9f9f9.
     • `modern-ui.css` — `.dt-card { background: var(--ui-surface) }`, an even-
       row #fcfcfc, a #fafbfc hover and `color: #2a2a2a` on the cell.
     • Bootstrap's contextual row classes (.success / .info / .warning /
       .danger / .active), which are pale tints meant for a white sheet.

   Everything here is scoped to `:root[data-theme="dark"] .sm-app`, so LIGHT
   MODE IS BYTE-IDENTICAL — pages keep their own colours until they are ported.

   Two notes:
     • !important is the only answer to !important. None of the three sources
       above carries an id, so plain specificity plus !important clears them.
       Page <style> blocks that DO write `#id … !important` are not fought from
       here — those few rules were changed at the source to use tokens, which
       is both cheaper and fixes their light theme too. If a page ever renders
       light rows again, grep its <style> block for `!important` first.
     • `.sm-app table` is a bare element selector, which the rest of this file
       avoids. Deliberate here: the point is to reach tables that carry no
       class of ours at all. It is still scoped to the app shell.

   Delete this section once modern-ui.css stops loading and every list page is
   on `.sm-table` / section 12c.
   -------------------------------------------------------------------------- */

/* ── containers ──────────────────────────────────────────────────────────
   The card is what those transparent cells actually reveal. */
:root[data-theme="dark"] .sm-app .dt-card,
:root[data-theme="dark"] .sm-app .table-responsive,
:root[data-theme="dark"] .sm-app .table-scroll,
:root[data-theme="dark"] .sm-app .datatableView {
    background: var(--sm-panel) !important;
    border-color: var(--sm-bd) !important;
}

:root[data-theme="dark"] .sm-app .dt-card table,
:root[data-theme="dark"] .sm-app .table-responsive table {
    background: transparent !important;
}

/* ── header / footer ─────────────────────────────────────────────────────
   `.dataTables_scrollHead` (scrollX/scrollY tables) and `.fixedHeader-*`
   (a sticky header, which DataTables clones into a floating table with
   `background-color: white` hard-coded) are separate elements from the
   <thead> and need painting in their own right. */
:root[data-theme="dark"] .sm-app table > thead > tr > th,
:root[data-theme="dark"] .sm-app table > thead > tr > td,
:root[data-theme="dark"] .sm-app table > tfoot > tr > th,
:root[data-theme="dark"] .sm-app table > tfoot > tr > td,
:root[data-theme="dark"] .sm-app .dataTables_scrollHead,
:root[data-theme="dark"] .sm-app .dataTables_scrollHeadInner,
:root[data-theme="dark"] .sm-app .dataTables_scrollFoot,
:root[data-theme="dark"] .sm-app table.fixedHeader-floating,
:root[data-theme="dark"] .sm-app table.fixedHeader-locked {
    background: var(--sm-head) !important;
    color: var(--sm-tx3) !important;
    border-color: var(--sm-bd) !important;
}

:root[data-theme="dark"] .sm-app .dataTables_scrollBody {
    background: var(--sm-panel) !important;
}

/* ── rows and cells ──────────────────────────────────────────────────────
   The row is cleared as well as the cell: DataTables paints #ffffff on the
   <tr>, and a transparent <td> is no defence against that. Striping is
   dropped rather than re-tinted — the redesigned pages (§9, and Цаг) are flat
   rows separated by a hairline, and the two should not disagree. */
:root[data-theme="dark"] .sm-app table > tbody > tr {
    background: transparent !important;
}

:root[data-theme="dark"] .sm-app table > tbody > tr > td,
:root[data-theme="dark"] .sm-app table > tbody > tr > th {
    background: transparent !important;
    color: var(--sm-tx) !important;
    border-color: var(--sm-bd2) !important;
}

/* Bootstrap's contextual rows, mapped onto the tone tokens so they keep their
   meaning instead of flattening into the sheet. */
:root[data-theme="dark"] .sm-app table > tbody > tr.success > td,
:root[data-theme="dark"] .sm-app table > tbody > tr > td.success {
    background: var(--sm-ok-bg) !important;
}

:root[data-theme="dark"] .sm-app table > tbody > tr.info > td,
:root[data-theme="dark"] .sm-app table > tbody > tr > td.info {
    background: var(--sm-nw-bg) !important;
}

:root[data-theme="dark"] .sm-app table > tbody > tr.warning > td,
:root[data-theme="dark"] .sm-app table > tbody > tr > td.warning {
    background: var(--sm-wn-bg) !important;
}

:root[data-theme="dark"] .sm-app table > tbody > tr.danger > td,
:root[data-theme="dark"] .sm-app table > tbody > tr > td.danger {
    background: var(--sm-bad-bg) !important;
}

:root[data-theme="dark"] .sm-app table > tbody > tr.active > td,
:root[data-theme="dark"] .sm-app table > tbody > tr.selected > td {
    background: var(--sm-accbg) !important;
}

/* KPI edit sheets mark their cells editable / locked with a fill. */
:root[data-theme="dark"] .sm-app table > tbody > tr > td.editable-cell {
    background: var(--sm-inp-td-bg) !important;
}

:root[data-theme="dark"] .sm-app table > tbody > tr > td.non-editable-cell {
    background: var(--sm-mt-bg) !important;
    color: var(--sm-tx3) !important;
}

/* The cell an input sits in is a shade off the row on Цалин. */
:root[data-theme="dark"] .sm-app table > tbody > tr > td.sm-inp-td {
    background: var(--sm-inp-td-bg) !important;
}

/* ── hover ───────────────────────────────────────────────────────────────
   After the tints, so a hovered row still lifts. A tinted row gets the lift
   as a translucent white sheet over its own colour, which keeps the state
   readable without a second token per tone. */
:root[data-theme="dark"] .sm-app table > tbody > tr:hover > td {
    background: var(--sm-hover) !important;
}

:root[data-theme="dark"] .sm-app table > tbody > tr.success:hover > td {
    background: linear-gradient(var(--sm-lift), var(--sm-lift)), var(--sm-ok-bg) !important;
}

:root[data-theme="dark"] .sm-app table > tbody > tr.info:hover > td {
    background: linear-gradient(var(--sm-lift), var(--sm-lift)), var(--sm-nw-bg) !important;
}

:root[data-theme="dark"] .sm-app table > tbody > tr.warning:hover > td {
    background: linear-gradient(var(--sm-lift), var(--sm-lift)), var(--sm-wn-bg) !important;
}

:root[data-theme="dark"] .sm-app table > tbody > tr.danger:hover > td {
    background: linear-gradient(var(--sm-lift), var(--sm-lift)), var(--sm-bad-bg) !important;
}

/* ── controls that live inside a cell ────────────────────────────────────
   Цалин is a grid of number inputs; several pages put a status <select> in
   the last column. */
:root[data-theme="dark"] .sm-app table > tbody > tr > td input,
:root[data-theme="dark"] .sm-app table > tbody > tr > td select,
:root[data-theme="dark"] .sm-app table > tbody > tr > td textarea,
:root[data-theme="dark"] .sm-app table > tbody > tr > td .form-control {
    background-color: var(--sm-inp-bg) !important;
    border-color: var(--sm-bd) !important;
    color: var(--sm-tx) !important;
}

:root[data-theme="dark"] .sm-app table > tbody > tr > td input:focus,
:root[data-theme="dark"] .sm-app table > tbody > tr > td select:focus,
:root[data-theme="dark"] .sm-app table > tbody > tr > td .form-control:focus {
    border-color: var(--sm-acc) !important;
}

/* ── DataTables chrome the pages restyle for themselves ──────────────────
   Section 12c skins these already; the page <style> blocks come later in the
   document and win the tie, so the surfaces are taken back here. */
:root[data-theme="dark"] .sm-app .dataTables_wrapper .dataTables_length select,
:root[data-theme="dark"] .sm-app .dataTables_wrapper .dataTables_filter input,
:root[data-theme="dark"] .sm-app .dataTables_wrapper .dt-buttons .dt-button,
:root[data-theme="dark"] .sm-app .dt-len-btn,
:root[data-theme="dark"] .sm-app .dt-len-menu {
    background-color: var(--sm-panel2) !important;
    border-color: var(--sm-bd) !important;
    color: var(--sm-tx) !important;
}

:root[data-theme="dark"] .sm-app .dataTables_wrapper .dt-buttons .dt-button:hover,
:root[data-theme="dark"] .sm-app .dt-len-btn:hover,
:root[data-theme="dark"] .sm-app .dt-len-item:hover {
    background-color: var(--sm-hover) !important;
    border-color: var(--sm-bd) !important;
}

:root[data-theme="dark"] .sm-app .dt-len-item.active {
    background-color: var(--sm-accbg) !important;
    color: var(--sm-tx) !important;
}

:root[data-theme="dark"] .sm-app .dataTables_wrapper .dataTables_empty,
:root[data-theme="dark"] .sm-app table > tbody > tr > td.dataTables_empty {
    background: transparent !important;
    color: var(--sm-tx3) !important;
}

/* Scroll containers ship a light thumb on several pages, so the theme's own
   thumb has to be forced past the page-local rule. The colour is the same
   --sm-scroll the shell-wide thumb uses (§2), and .dataTables_wrapper is on
   the list because §12e made it the table's scroll box — it is the scrollbar
   most people will actually see. */
:root[data-theme="dark"] .sm-app .table-responsive::-webkit-scrollbar-thumb,
:root[data-theme="dark"] .sm-app .table-scroll::-webkit-scrollbar-thumb,
:root[data-theme="dark"] .sm-app .datatableView::-webkit-scrollbar-thumb,
:root[data-theme="dark"] .sm-app .dataTables_wrapper::-webkit-scrollbar-thumb {
    background: var(--sm-scroll) !important;
}

:root[data-theme="dark"] .sm-app .table-responsive::-webkit-scrollbar-thumb:hover,
:root[data-theme="dark"] .sm-app .table-scroll::-webkit-scrollbar-thumb:hover,
:root[data-theme="dark"] .sm-app .datatableView::-webkit-scrollbar-thumb:hover,
:root[data-theme="dark"] .sm-app .dataTables_wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--sm-scroll-hover) !important;
}

:root[data-theme="dark"] .sm-app .table-responsive::-webkit-scrollbar-track,
:root[data-theme="dark"] .sm-app .table-scroll::-webkit-scrollbar-track,
:root[data-theme="dark"] .sm-app .datatableView::-webkit-scrollbar-track,
:root[data-theme="dark"] .sm-app .dataTables_wrapper::-webkit-scrollbar-track {
    background: transparent !important;
}

/* The ::-webkit-scrollbar rules above cannot do this on their own. Four pages
   — Цалин, Ажилтны мэдээлэл, Цагийн тайлан and Чөлөө — set the standard
   `scrollbar-color: #ddd transparent` on their .table-responsive, and from
   Chrome 121 the standard property WINS OUTRIGHT: a scroller that has
   scrollbar-color set ignores its ::-webkit-scrollbar pseudo-elements
   completely. scrollbar-color also inherits, so that #ddd reaches the
   .dataTables_wrapper nested inside and paints a near-white bar across a dark
   card. Setting the standard property here too is the only way to answer it.

   Dark only, and only on the scrollers: the light-mode #ddd is what those
   pages want on a white card, and forcing scrollbar-width app-wide would
   undo the `scrollbar-width: none` several of them use to hide the scrollbar
   inside dropdown menus. */
:root[data-theme="dark"] .sm-app .table-responsive,
:root[data-theme="dark"] .sm-app .table-scroll,
:root[data-theme="dark"] .sm-app .datatableView,
:root[data-theme="dark"] .sm-app .dataTables_wrapper {
    scrollbar-color: var(--sm-scroll) transparent !important;
    scrollbar-width: thin !important;
}


/* --------------------------------------------------------------------------
   12f. Dark mode for modern-ui.css
   --------------------------------------------------------------------------
   Section 12e took the tables back. Everything AROUND them — the filter
   toolbar above every list page, its dropdowns and buttons, the cards, the
   dialogs — is `modern-ui.css`, the previous redesign's stylesheet, which has
   no dark theme: every `--ui-*` token is a light literal.

   Rather than restate each of its components here, the tokens themselves are
   re-pointed at the sendmn-ui palette. One block covers every component
   modern-ui defines, including the ones this file has never heard of, and it
   keeps working as that stylesheet grows. Its remaining literals were changed
   to read tokens at the same time, so nothing is left behind.

   SCOPED TO body.sm-body, NOT :root. The login page is off limits, and it
   renders through _LoginLayout with modern-ui.css loaded; _Layout is what adds
   the class (ViewBag.BodyClass), so app pages are reached and the login page
   is not, even though the theme attribute is on <html> for both.

   The class sits on <body> rather than on .sm-app because everything that gets
   APPENDED to the body — alertify dialogs, jQuery UI dialogs, bootstrap
   modals, select2 panels, the datepicker — is outside .sm-app and was
   therefore reading the light literals: that is why every popup stayed white
   in dark mode. Tokens inherit, so one definition covers the shell and the
   popup layer alike. §12g finishes the job for the popup chrome that paints
   its own literal colours instead of reading a token.

   Delete this section the day modern-ui.css stops being loaded.
   -------------------------------------------------------------------------- */

:root[data-theme="dark"] body.sm-body {
    --ui-primary: var(--sm-acc);
    /* lighter on hover, not darker: a filled blue lifts against a dark sheet */
    --ui-primary-hover: #2e82e4;
    --ui-primary-soft: var(--sm-accbg);
    --ui-primary-soft-border: var(--sm-nw-bd);
    --ui-primary-soft-hover: #1d3d61;
    --ui-primary-on-soft: var(--sm-nw-fg);
    --ui-danger: var(--sm-bad-fg);
    --ui-danger-soft: var(--sm-bad-bg);
    --ui-danger-soft-border: var(--sm-bad-bd);
    --ui-danger-soft-hover: #4a211c;
    --ui-success: var(--sm-ok-fg);
    --ui-success-soft: var(--sm-ok-bg);
    --ui-success-soft-border: var(--sm-ok-bd);
    --ui-success-soft-hover: var(--sm-punch-done-bg);
    --ui-warning: var(--sm-wn-fg);
    --ui-warning-soft: var(--sm-wn-bg);
    --ui-text: var(--sm-tx);
    --ui-text-2: var(--sm-tx2);
    --ui-text-3: var(--sm-tx3);
    --ui-surface: var(--sm-panel);
    --ui-surface-2: var(--sm-panel2);
    --ui-surface-3: var(--sm-head);
    --ui-border: var(--sm-bd);
    --ui-border-2: var(--sm-bd);
    --ui-border-soft: var(--sm-bd2);
    --ui-hover: var(--sm-hover);
    --ui-border-strong: var(--sm-tx3);
    --ui-scroll-thumb: var(--sm-bd);
    --ui-scroll-thumb-hover: var(--sm-tx3);
    --ui-shadow-pop: var(--sm-sh-pop);
    --ui-shadow-card: var(--sm-sh);
}

/* The three pages modern-ui.css was extracted FROM still carry their own copy
   of the toolbar in a page <style> block, written with literals and sitting
   later in the document than this file. Those copies are tokenised at source
   the same way; these rules are the backstop for the ones that are not, and
   for any page that grows a new one. Class selectors only, so !important is
   all that is needed — no page writes an id here. */
:root[data-theme="dark"] .sm-app .toolbar-row,
:root[data-theme="dark"] .sm-app .ui-card {
    background: var(--sm-panel) !important;
    border-color: var(--sm-bd) !important;
}

:root[data-theme="dark"] .sm-app .tb-dd-btn,
:root[data-theme="dark"] .sm-app .tb-dd-menu,
:root[data-theme="dark"] .sm-app .tb-view-group,
:root[data-theme="dark"] .sm-app .icon-btn,
:root[data-theme="dark"] .sm-app .icon-background1 {
    background: var(--sm-panel2) !important;
    border-color: var(--sm-bd) !important;
    color: var(--sm-tx) !important;
}

:root[data-theme="dark"] .sm-app .tb-dd-btn:hover,
:root[data-theme="dark"] .sm-app .tb-dd-btn.open,
:root[data-theme="dark"] .sm-app .tb-dd-item:hover,
:root[data-theme="dark"] .sm-app .tb-view-btn:hover:not(.active) {
    background: var(--sm-hover) !important;
    color: var(--sm-tx) !important;
}

:root[data-theme="dark"] .sm-app .tb-dd-item--active,
:root[data-theme="dark"] .sm-app .tb-view-btn.active {
    background: var(--sm-accbg) !important;
    color: var(--sm-tx) !important;
}

:root[data-theme="dark"] .sm-app .tb-divider {
    background: var(--sm-bd) !important;
}

/* Outline buttons sit on the toolbar, so they take the panel, not the sheet. */
:root[data-theme="dark"] .sm-app .tb-btn-confirm,
:root[data-theme="dark"] .sm-app .tb-btn-secondary {
    background: var(--sm-panel2) !important;
    border-color: var(--sm-bd) !important;
    color: var(--sm-tx2) !important;
}

/* The tone buttons keep their meaning — dark tint, light label. */
:root[data-theme="dark"] .sm-app .tb-btn-danger {
    background: var(--sm-bad-bg) !important;
    border-color: var(--sm-bad-bd) !important;
    color: var(--sm-bad-fg) !important;
}

:root[data-theme="dark"] .sm-app .tb-btn-success {
    background: var(--sm-ok-bg) !important;
    border-color: var(--sm-ok-bd) !important;
    color: var(--sm-ok-fg) !important;
}

/* Цалин's own .tb-btn-sendall / .tb-btn-import are NOT listed here on
   purpose: that page reads the --ui-* tones now, so both their rest and
   hover states follow the theme. An !important rule here would win over the
   hover and flatten it. */

/* Filled blue stays filled blue in both themes. */
:root[data-theme="dark"] .sm-app .tb-btn-search,
:root[data-theme="dark"] .sm-app .tb-btn-primary {
    background: var(--sm-acc) !important;
    border-color: var(--sm-acc) !important;
    color: #fff !important;
}

/* --------------------------------------------------------------------------
   12g. Dark mode for the popup layer
   --------------------------------------------------------------------------
   Popups are the one part of the app that does not live in .sm-app: alertify
   (both the globalDialog forms and alertify.confirm/alert), jQuery UI dialogs,
   the bootstrap password modal, select2's open panel and the datepicker are
   all appended straight to <body>. That is why they stayed white while the
   page behind them went dark.

   §12f now defines the --ui-* tokens on <body>, which fixes every popup piece
   that READS a token — modern-ui's dialog header and form controls, the
   datepicker (its --dp-* tokens alias --ui-*), the buttons.

   What is left, and what this section is, is the chrome that paints literal
   colours of its own inside the vendor stylesheets: alertify's white dialog
   and black body text, jQuery UI's white .ui-widget-content, bootstrap's white
   .modal-content, select2's white panel. `:root[data-theme="dark"]
   body.sm-body` already outweighs anything those files write with classes, so
   no !important is needed here.
   -------------------------------------------------------------------------- */

/* ── alertify ─────────────────────────────────────────────────────────── */

:root[data-theme="dark"] body.sm-body .alertify .ajs-dialog {
    background-color: var(--sm-panel);
    box-shadow: var(--sm-sh-pop);
}

/* The header is only tokenised for .gd-dialog (modern-ui); alertify's own
   #fafafa is what confirm/alert dialogs show, so both are covered here. */
:root[data-theme="dark"] body.sm-body .alertify .ajs-header {
    background: var(--sm-panel);
    color: var(--sm-tx);
    border-bottom-color: var(--sm-bd2);
}

:root[data-theme="dark"] body.sm-body .alertify .ajs-body,
:root[data-theme="dark"] body.sm-body .alertify .ajs-content {
    color: var(--sm-tx);
}

/* Hidden on the form popups (modern-ui), visible on confirm/alert. */
:root[data-theme="dark"] body.sm-body .alertify .ajs-footer {
    background: var(--sm-panel);
    border-top-color: var(--sm-bd2);
}

:root[data-theme="dark"] body.sm-body .alertify .ajs-footer .ajs-buttons .ajs-button {
    color: var(--sm-tx2);
}

:root[data-theme="dark"] body.sm-body .alertify .ajs-footer .ajs-buttons .ajs-button.ajs-ok {
    color: var(--sm-acc);
}

/* alertify draws its window controls with baked-in near-black PNGs, invisible
   on a dark header. Redrawn as SVG in --sm-tx2 (#a3adbe — the literal is
   unavoidable, a data: URI cannot read a custom property). Inverting the
   button instead would invert its hover chip along with the icon. */
:root[data-theme="dark"] body.sm-body .alertify .ajs-commands button.ajs-close {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10' fill='none' stroke='%23a3adbe' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M1.5 1.5l7 7M8.5 1.5l-7 7'/%3E%3C/svg%3E");
}

:root[data-theme="dark"] body.sm-body .alertify .ajs-commands button.ajs-maximize {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10' fill='none' stroke='%23a3adbe' stroke-width='1.4'%3E%3Crect x='1.2' y='1.2' width='7.6' height='7.6' rx='1.4'/%3E%3C/svg%3E");
}

:root[data-theme="dark"] body.sm-body .alertify.ajs-maximized .ajs-commands button.ajs-maximize,
:root[data-theme="dark"] body.sm-body .alertify .ajs-commands button.ajs-restore {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10' fill='none' stroke='%23a3adbe' stroke-width='1.4'%3E%3Cpath d='M3.2 1.2h5.6v5.6'/%3E%3Crect x='1.2' y='3.2' width='5.6' height='5.6' rx='1.2'/%3E%3C/svg%3E");
}

/* The neutral toast (alertify.message / .notify). The success / error /
   warning ones carry their own colour and are excluded by name — this rule
   would otherwise outrank them and flatten all four into one grey. */
:root[data-theme="dark"] body.sm-body .alertify-notifier .ajs-message:not(.ajs-success):not(.ajs-error):not(.ajs-warning) {
    background: var(--sm-panel2);
    border-color: var(--sm-bd);
    color: var(--sm-tx);
}

/* ── jQuery UI dialogs (and the widgets that share its skin) ──────────── */

:root[data-theme="dark"] body.sm-body .ui-widget-content {
    background: var(--sm-panel);
    border-color: var(--sm-bd);
    color: var(--sm-tx);
}

:root[data-theme="dark"] body.sm-body .ui-widget-header {
    background: var(--sm-head);
    border-color: var(--sm-bd);
    color: var(--sm-tx);
}

:root[data-theme="dark"] body.sm-body .ui-widget.ui-widget-content {
    border-color: var(--sm-bd);
}

/* Titlebar close: jQuery UI's icon is a #444 sprite, so it needs the same
   treatment. A whole sprite sheet cannot be restated as SVG — the icon span
   carries nothing but the image, so inverting it is safe here. */
:root[data-theme="dark"] body.sm-body .ui-dialog .ui-dialog-titlebar-close .ui-icon,
:root[data-theme="dark"] body.sm-body #ui-datepicker-div .ui-icon {
    filter: invert(1) brightness(1.35);
}

/* ── bootstrap modals (password change, and any page that opens one) ──── */

:root[data-theme="dark"] body.sm-body .modal-content {
    background-color: var(--sm-panel);
    border-color: var(--sm-bd);
    box-shadow: var(--sm-sh-pop);
    color: var(--sm-tx);
}

:root[data-theme="dark"] body.sm-body .modal-header,
:root[data-theme="dark"] body.sm-body .modal-footer {
    border-color: var(--sm-bd2);
}

:root[data-theme="dark"] body.sm-body .modal-title {
    color: var(--sm-tx);
}

:root[data-theme="dark"] body.sm-body .modal-header .close {
    color: var(--sm-tx2);
    text-shadow: none;
    opacity: 0.75;
}

/* ── select2's open panel ─────────────────────────────────────────────── */
/* Appended to <body>, so §12c/§12e never reached it: the closed control was
   dark and the list that dropped out of it was white. */

:root[data-theme="dark"] body.sm-body .select2-dropdown {
    background-color: var(--sm-panel2);
    border-color: var(--sm-bd);
}

:root[data-theme="dark"] body.sm-body .select2-results__option {
    color: var(--sm-tx);
}

:root[data-theme="dark"] body.sm-body .select2-container--default .select2-results__option[aria-selected=true] {
    background-color: var(--sm-hover);
}

:root[data-theme="dark"] body.sm-body .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--sm-accbg);
    color: var(--sm-tx);
}

:root[data-theme="dark"] body.sm-body .select2-container--default .select2-search--dropdown .select2-search__field {
    background: var(--sm-panel);
    border-color: var(--sm-bd);
    color: var(--sm-tx);
}

/* ── the other panels that open on top of the page ───────────────────── */
/* Same story as select2: the CLOSED control is themed by §12c/§12f, the panel
   that drops out of it is a vendor stylesheet's white box. The pages style
   these panels' contents themselves (tokenised at source), so only the box
   they sit in is left here.

   `.dropdown-menu` covers bootstrap's own menus AND bootstrap-datetimepicker,
   which renders its widget as one (Зочны мэдээлэл, Асуудал шийдвэрлэлт).
   `.flatpickr-calendar` is the Цагийн тайлан date-range picker, whose CSS
   comes from a CDN this file cannot edit. */

:root[data-theme="dark"] body.sm-body .dropdown-menu,
:root[data-theme="dark"] body.sm-body .flatpickr-calendar,
:root[data-theme="dark"] body.sm-body .flatpickr-months,
:root[data-theme="dark"] body.sm-body .flatpickr-weekdays,
:root[data-theme="dark"] body.sm-body .flatpickr-days,
:root[data-theme="dark"] body.sm-body .dayContainer {
    background: var(--sm-panel);
    border-color: var(--sm-bd);
    color: var(--sm-tx);
}

:root[data-theme="dark"] body.sm-body .dropdown-menu > li > a {
    color: var(--sm-tx2);
}

:root[data-theme="dark"] body.sm-body .dropdown-menu > li > a:hover,
:root[data-theme="dark"] body.sm-body .dropdown-menu > li > a:focus {
    background-color: var(--sm-hover);
    color: var(--sm-tx);
}

:root[data-theme="dark"] body.sm-body .dropdown-menu .divider {
    background-color: var(--sm-bd);
}

/* flatpickr's month/year row and its arrows are drawn with `fill: currentColor`
   over the calendar's own white — without this the arrows vanish. */
:root[data-theme="dark"] body.sm-body .flatpickr-month,
:root[data-theme="dark"] body.sm-body .flatpickr-prev-month,
:root[data-theme="dark"] body.sm-body .flatpickr-next-month,
:root[data-theme="dark"] body.sm-body .flatpickr-current-month input.cur-year,
:root[data-theme="dark"] body.sm-body .flatpickr-monthDropdown-months {
    color: var(--sm-tx);
    fill: var(--sm-tx);
    background: transparent;
}

/* ── tables inside a popup ────────────────────────────────────────────── */
/* §12e takes the app's tables back from bootstrap and DataTables, but it is
   scoped to .sm-app and a popup is not in it. The dialogs that carry a table
   of their own (the анкет's degree/experience rows, the history popups) hit
   exactly the same literals: bootstrap's #ddd cell borders and #f9f9f9
   stripes, DataTables' #ffffff row. */

:root[data-theme="dark"] body.sm-body .alertify table > thead > tr > th,
:root[data-theme="dark"] body.sm-body .alertify table > thead > tr > td,
:root[data-theme="dark"] body.sm-body .alertify table > tbody > tr > th,
:root[data-theme="dark"] body.sm-body .alertify table > tbody > tr > td,
:root[data-theme="dark"] body.sm-body .alertify table > tfoot > tr > td,
:root[data-theme="dark"] body.sm-body .ui-dialog table > thead > tr > th,
:root[data-theme="dark"] body.sm-body .ui-dialog table > tbody > tr > td,
:root[data-theme="dark"] body.sm-body .modal table > thead > tr > th,
:root[data-theme="dark"] body.sm-body .modal table > tbody > tr > td {
    border-color: var(--sm-bd);
}

:root[data-theme="dark"] body.sm-body .alertify table > tbody > tr,
:root[data-theme="dark"] body.sm-body .alertify table.dataTable > tbody > tr,
:root[data-theme="dark"] body.sm-body .ui-dialog table > tbody > tr,
:root[data-theme="dark"] body.sm-body .modal table > tbody > tr {
    background-color: transparent;
}

:root[data-theme="dark"] body.sm-body .alertify .table-striped > tbody > tr:nth-of-type(odd),
:root[data-theme="dark"] body.sm-body .modal .table-striped > tbody > tr:nth-of-type(odd),
:root[data-theme="dark"] body.sm-body .alertify .table-hover > tbody > tr:hover,
:root[data-theme="dark"] body.sm-body .modal .table-hover > tbody > tr:hover {
    background-color: var(--sm-hover);
}

/* The closed control, for the select2s that sit inside a popup rather than on
   the page (the page ones are handled in §12c). */
:root[data-theme="dark"] body.sm-body .select2-container--default .select2-selection--single,
:root[data-theme="dark"] body.sm-body .select2-container--default .select2-selection--multiple {
    background-color: var(--sm-panel2);
    border-color: var(--sm-bd);
}

:root[data-theme="dark"] body.sm-body .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--sm-tx);
}

:root[data-theme="dark"] body.sm-body .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--sm-tx3);
}

/* --------------------------------------------------------------------------
   12h. Sticky table headers
   --------------------------------------------------------------------------
   Wide tables (Цалин is the worst — 24 columns of bare numbers) scroll their
   header out of view after a dozen rows, and from there every figure is an
   unlabelled number. The header row now rides down the page with you.

   `position: sticky` cannot do this here, and the reason is worth writing
   down. Sticky sticks to the nearest SCROLLING ancestor, and on these pages
   that is never the page: §12c gives `.dataTables_wrapper` an `overflow-x` so
   the surplus columns stay reachable, which makes it a scroll box in BOTH
   axes, and a scroll box that is as tall as its content never scrolls
   vertically. A sticky header inside it therefore sits there doing nothing
   while the page scrolls the whole card away.

   Capping the card's height would fix that — and was tried, and is why this
   note exists: it turns the table into a small window with its own scrollbar,
   which the user rightly called claustrophobic. The table stays full height.

   So `smStickyHeads` in Scripts/document.js floats the header instead: as the
   content area scrolls, it translates `<thead>` down by exactly as much as the
   table's top has passed the top of the viewport, and stops when the header
   reaches the last row. One transform on one element moves a two-tier header
   (Цалин's) as a unit, so the rows stay in register.

   This file supplies what the moving header needs: an opaque background, a
   bottom rule that travels with it, and a paint order above the rows.
   The script marks each table `.sm-sticky-head`; a page opts out with
   `class="sm-no-sticky"` on the table or on any ancestor.
   -------------------------------------------------------------------------- */

/* z-index needs a positioned box; §12c already sets `position: relative` on
   sorted headers, so this only extends it to the rest. The transform on
   <thead> is what actually lifts the header above the rows — it creates a
   stacking context that paints after the in-flow tbody — and these keep a
   header cell above a positioned body cell as well. */
.sm-app table.sm-sticky-head > thead > tr > th,
.sm-app table.sm-sticky-head > thead > tr > td {
    position: relative;
    z-index: 3;
    /* With `border-collapse: collapse` the bottom border belongs to the table,
       not to the cell, so it stays behind while the header travels. An inset
       shadow rides along with it. */
    box-shadow: inset 0 -1px 0 var(--sm-bd);
}

/* Opaque background, or the rows show through the header as it passes over
   them. Deliberately kept at (0,2,3) — below §12c's own
   `.sm-app table.dataTable > thead > tr > th` and modern-ui's
   `.dt-card table.dataTable thead tr th` — so this only fills in for the
   tables neither of those paints. */
.sm-app .sm-sticky-head > thead > tr > th,
.sm-app .sm-sticky-head > thead > tr > td {
    background-color: var(--sm-head);
}

/* --------------------------------------------------------------------------
   12i. Soft-deleted rows (Журам)
   --------------------------------------------------------------------------
   Журам are hidden, not deleted. A hidden row keeps its place in the list for
   the roles that manage it and disappears entirely for everyone else — the
   server never sends it — so this only ever paints for a manager.

   Muted per-element rather than with a blanket `opacity` on the row: fading
   the whole <tr> would also dim the Сэргээх button that undoes the hide,
   which is the one control that has to stay obvious.
   -------------------------------------------------------------------------- */

/* The selector and the !important are both load-bearing. §12e resets every
   table cell in dark mode with

     :root[data-theme="dark"] .sm-app table > tbody > tr > td
       { background: transparent !important; color: … !important }

   to take the surface back from modern-ui.css. That is (0,3,4) and marked
   important, so a plain `.sm-table > tbody > tr.is-hidden-row > td` (0,2,3)
   loses on both counts: the hidden row tinted correctly in light mode and was
   invisible in dark. `:root .sm-app table.sm-table …` reaches (0,4,4) and
   wins outright rather than relying on source order. */
:root .sm-app table.sm-table > tbody > tr.is-hidden-row > td {
    background: var(--sm-panel2) !important;
    color: var(--sm-tx3) !important;
}

.sm-table > tbody > tr.is-hidden-row .sm-badge,
.sm-table > tbody > tr.is-hidden-row .sm-file {
    filter: grayscale(1);
    opacity: .75;
}

.sm-table > tbody > tr.is-hidden-row .sm-doc-name {
    text-decoration: line-through;
    text-decoration-color: var(--sm-tx3);
}

/* The list count in the toolbar, next to the filters. */
.sm-doc-count {
    font-size: 12px;
    color: var(--sm-tx3);
    white-space: nowrap;
}

/* Teal rather than the accent blue, which read as "generic UI link" against
   the panel. The алба badges on this page deliberately skip the teal tone so
   this stays the only teal in the table and means one thing: open the file.
   Never --sm-acc — that button blue is 3.5:1 on the dark panel, under AA for
   text; the -fg half of a tone pair is the member sized for text.

   Prefixed with .sm-app and qualified with `a` to out-specify this sheet's
   own `.sm-app a { color: var(--sm-acc) }` (0,1,1) — a bare .sm-open-link
   (0,1,0) loses to it and the link renders blue. */
.sm-app a.sm-open-link {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--sm-tl-fg);
    cursor: pointer;
    white-space: nowrap;
}

    .sm-app a.sm-open-link:hover,
    .sm-app a.sm-open-link:focus {
        color: var(--sm-tl-fg);
        text-decoration: underline;
    }

/* --------------------------------------------------------------------------
   13. Responsive
   --------------------------------------------------------------------------
   Below 900px the sidebar becomes an off-canvas drawer rather than the old
   bottom bar — the nav is far too deep for a 60px strip of icons.
   -------------------------------------------------------------------------- */

@media (max-width: 1200px) {
    .sm-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .sm-side {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1080;
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: 0 0 40px rgba(8, 14, 26, .18);
    }

        .sm-side.is-drawer-open {
            transform: none;
        }

    /* collapsing is a desktop affordance only — in the drawer the full
       labelled nav is the whole point, so the collapsed rules are undone */
    :root[data-side="collapsed"] .sm-side {
        width: var(--sm-side-w);
        flex-basis: var(--sm-side-w);
        padding-left: 12px;
        padding-right: 12px;
        cursor: default;
    }

    :root[data-side="collapsed"] .sm-nav-label,
    :root[data-side="collapsed"] .sm-nav-chev,
    :root[data-side="collapsed"] .sm-nav-badge,
    :root[data-side="collapsed"] .sm-brand-name {
        display: initial;
    }

    :root[data-side="collapsed"] .sm-nav-item {
        justify-content: flex-start;
        gap: 11px;
        padding: 10px 11px;
    }

    :root[data-side="collapsed"] .sm-brand {
        justify-content: flex-start;
    }

    :root[data-side="collapsed"] .sm-side-toggle {
        display: none;
    }

    .sm-side-scrim {
        position: fixed;
        inset: 0;
        background: rgba(8, 14, 26, .45);
        z-index: 1075;
    }

    .sm-topbar {
        padding: 0 14px;
        gap: 10px;
    }

    .sm-content {
        padding: 16px 14px 40px;
    }

    .sm-user-text {
        display: none;
    }

    .sm-cal {
        grid-template-columns: repeat(7, minmax(84px, 1fr));
        gap: 5px;
        min-width: 610px;
    }

    .sm-cal-day {
        min-height: 84px;
        padding: 7px;
    }

    .sm-form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .sm-field-wide {
        grid-column: auto;
    }
}

@media (max-width: 640px) {
    .sm-stats {
        grid-template-columns: minmax(0, 1fr);
    }

    /* Calendar on a phone: the month fits the screen instead of scrolling
       sideways inside a page that already scrolls down. A column is ~44px
       here, so everything that column cannot hold legibly is dropped — the
       clock-in span, the holiday note, the chip labels. What the view is read
       for at a glance survives: the day number, the hours worked, and the cell
       colour. The chips stay on as dots so a request still shows, in its own
       status tone. */
    .sm-cal-scroll {
        overflow-x: visible;
        margin: 0;
        padding: 0;
    }

    .sm-cal {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 3px;
        min-width: 0;
    }

    .sm-cal-dow {
        font-size: 9.5px;
        letter-spacing: 0;
    }

    .sm-cal-day,
    :root[data-density="dense"] .sm-cal-day {
        min-height: 52px;
        padding: 4px 2px;
        gap: 2px;
        border-radius: 7px;
        align-items: center;
    }

    /* number over hours — side by side the two do not fit the column */
    .sm-cal-head {
        flex-direction: column;
        gap: 1px;
    }

    .sm-cal-n {
        font-size: 11px;
    }

    .sm-cal-hrs {
        margin-left: 0;
        font-size: 9.5px;
    }

    /* .sm-cal-ot goes with them: chips collapse to 5px dots at this width, so
       a stray time range would be the only text left in the row. The figure
       top right still carries the overtime in its total. */
    .sm-cal-times,
    .sm-cal-note,
    .sm-cal-ot {
        display: none;
    }

    .sm-cal-chips {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 3px;
    }

    /* The tone class gives a pale background and a strong text colour; at 5px
       the pale wash would vanish against the cell, so the dot takes the text
       colour instead. This rule is declared after the .sm-t-* tones, so the
       background here wins without needing !important. */
    .sm-cal-chip {
        width: 5px;
        height: 5px;
        padding: 0;
        border-radius: 50%;
        font-size: 0;
        overflow: hidden;
        background: currentColor;
    }

    .sm-notif-panel {
        position: fixed;
        top: var(--sm-topbar-h);
        right: 8px;
        left: 8px;
        width: auto;
    }
}

/* the drawer button only exists on small screens */
.sm-drawer-btn {
    display: none;
}

@media (max-width: 900px) {
    .sm-drawer-btn {
        display: inline-flex;
    }
}

/* --------------------------------------------------------------------------
   14. Print — drop chrome, keep the data
   -------------------------------------------------------------------------- */

@media print {
    .sm-side,
    .sm-topbar,
    .sm-toolbar,
    .sm-act-row {
        display: none !important;
    }

    .sm-shell,
    .sm-content {
        height: auto;
        overflow: visible;
        padding: 0;
    }

    .sm-table-wrap {
        border: none;
        box-shadow: none;
        overflow: visible;
    }

    /* §12h leaves the header wherever the reader last scrolled it to. On paper
       it belongs at the top of its table. */
    .sm-app .sm-sticky-head > thead {
        transform: none !important;
    }
}
