/* ============================================================
   COCKPIT LAYER
   ============================================================
   Design read: data-dense multi-tenant ERP (HR + POS) for operators
   who live in it for a full shift, bilingual EN/AR with RTL.
   Dials: VARIANCE 2 · MOTION 2 · DENSITY 8.

   The app was styled as a consumer marketing page: six corner radii,
   24px pill buttons, five saturated gradient KPI tiles, four fully
   saturated chip colours, decorative bordered pills around plain
   identifiers. That visual language belongs to a landing page. Applied
   to a payroll grid it reads as generated, because the form is
   unrelated to the job the screen does.

   This layer commits to the opposite: lines instead of boxes, one
   accent, two radii, tabular numerals, fixed row rhythm. Nothing here
   is decorative. Every rule earns its place by making data easier to
   scan.

   Loaded after app/dashboard/login so it wins over them, and before
   the scoped component bundle so individual components can still
   override deliberately.
   ============================================================ */

/* ------------------------------------------------------------
   1. TYPE
   All numerals are tabular. In a table, proportional digits make
   columns of figures fail to line up vertically, which is the
   single biggest readability cost in a data grid.
   ------------------------------------------------------------ */
.mud-table-cell,
.mud-table-cell .mud-typography,
.stat-card,
.mud-chip,
input[type="number"],
.tabular {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

/* ------------------------------------------------------------
   2. DATA TABLES
   ------------------------------------------------------------ */

/* Header: was low-contrast light grey at small size, so the column
   names were harder to read than the data beneath them. A header is
   a label, not a whisper. */
.mud-table-head .mud-table-cell {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
    background: var(--mud-palette-background-grey);
    border-bottom: 1px solid var(--line-strong);
    padding-block: 0.5rem;
    white-space: nowrap;
}

/* Rows: one hairline between rows. Never a border on both top and
   bottom of every row, which doubles the visual noise for no gain. */
.mud-table-body .mud-table-row {
    border-top: 0;
}

.mud-table-body .mud-table-row:not(:last-child) .mud-table-cell {
    border-bottom: 1px solid var(--line);
}

/* Fixed rhythm. Row heights previously ranged 60-90px because branch
   and department names wrapped to two and three lines, so the eye
   lost its place scanning down a column. */
.mud-table-body .mud-table-cell {
    padding-block: var(--row-padding-y);
    padding-inline: var(--row-padding-x);
    vertical-align: middle;
}

/* Truncate rather than wrap. Cells carry title="" for the full value.
   min-width:0 is required or the flex/table child refuses to shrink
   and the ellipsis never appears. */
.mud-table-cell > .cell-truncate,
.cell-truncate {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Row hover: a flat tint. No lift, no shadow, no transform. Rows are
   scanned by the hundred; motion on each one is noise. */
.mud-table-body .mud-table-row:hover {
    background: color-mix(in srgb, var(--primary-color) 5%, transparent);
}

/* Zebra is off by default; the hairline does the work. Enable per
   table with .table-zebra when a grid is unusually wide. */
.table-zebra .mud-table-body .mud-table-row:nth-child(even) {
    background: color-mix(in srgb, var(--mud-palette-text-primary) 2.5%, transparent);
}

/* ------------------------------------------------------------
   3. CHIPS AND STATUS
   Employment type rendered as four fully saturated fills (blue,
   green, orange, teal) put four competing accents in every row and
   implied a severity ranking that does not exist. Full Time is not
   "more successful" than Freelance.

   Categorical values get one neutral treatment. Saturated colour is
   reserved for genuine state: overdue, failed, blocked.
   ------------------------------------------------------------ */
.mud-chip {
    border-radius: var(--radius-control) !important;
    height: auto !important;
    min-height: 20px;
    padding: 1px 7px !important;
    font-size: 0.6875rem !important;
    font-weight: 500;
    letter-spacing: 0.01em;
    box-shadow: none !important;
}

/* Categorical: outline, inherits text colour. */
.mud-table-cell .mud-chip.mud-chip-filled {
    background: transparent !important;
    border: 1px solid var(--line-strong) !important;
    color: var(--mud-palette-text-primary) !important;
}

/* True state keeps its colour. Opt in with .chip-state-*.
   Three-class specificity is deliberate: ".mud-chip:not(.has-issues)" further
   down this file (section 17) has equal specificity to a plain two-class
   ".mud-chip.chip-state-*" rule, and being later in the cascade would win and
   silently strip these back to transparent regardless of source order. The
   ".mud-table-cell ..." variants add a fourth class for the same reason
   against section 19's "declutter table chips" rule, which also targets
   ".mud-table-cell .mud-chip.mud-chip-filled" at three-class specificity. */
.mud-chip.mud-chip-filled.chip-state-danger,
.mud-table-cell .mud-chip.mud-chip-filled.chip-state-danger {
    background: color-mix(in srgb, var(--danger-color) 12%, transparent) !important;
    border-color: color-mix(in srgb, var(--danger-color) 40%, transparent) !important;
    color: var(--danger-color) !important;
}

.mud-chip.mud-chip-filled.chip-state-success,
.mud-table-cell .mud-chip.mud-chip-filled.chip-state-success {
    background: color-mix(in srgb, var(--success-color) 12%, transparent) !important;
    border-color: color-mix(in srgb, var(--success-color) 40%, transparent) !important;
    color: var(--success-color) !important;
}

.mud-chip.mud-chip-filled.chip-state-info,
.mud-table-cell .mud-chip.mud-chip-filled.chip-state-info {
    background: color-mix(in srgb, var(--primary-color) 12%, transparent) !important;
    border-color: color-mix(in srgb, var(--primary-color) 40%, transparent) !important;
    color: var(--primary-color) !important;
}

.mud-chip.mud-chip-filled.chip-state-draft,
.mud-table-cell .mud-chip.mud-chip-filled.chip-state-draft {
    background: color-mix(in srgb, var(--warning-color) 12%, transparent) !important;
    border-color: color-mix(in srgb, var(--warning-color) 40%, transparent) !important;
    color: var(--warning-color) !important;
}

/* Identifier codes were wrapped in a bordered pill. A box implies
   interactivity. A code is text; set it in mono and let it be text. */
.code-cell,
.mud-table-cell .code-cell {
    font-family: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace;
    font-size: 0.75rem;
    letter-spacing: -0.01em;
    color: var(--mud-palette-text-secondary);
    background: none;
    border: 0;
    padding: 0;
}

/* ------------------------------------------------------------
   4. LINK RESTRAINT
   Rows carried three blue links each (email, phone, branch). When
   everything is a link nothing reads as one. Only genuine
   destinations stay accented; the rest are text that reveals its
   affordance on hover.
   ------------------------------------------------------------ */
.mud-table-cell a:not(.mud-button-root):not(.link-primary) {
    color: inherit;
    text-decoration: none;
}

.mud-table-cell a:not(.mud-button-root):not(.link-primary):hover {
    color: var(--primary-color);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ------------------------------------------------------------
   5. CONTROLS
   ------------------------------------------------------------ */
.mud-button-root {
    /* Actions tier: pill. Inputs and panels stay on the tight scale. */
    border-radius: var(--radius-action, 999px) !important;
    text-transform: none !important;
    letter-spacing: 0;
    font-weight: 500;
    box-shadow: none !important;
}

/* Tactile press. The only motion in this layer, and it is feedback,
   not decoration. */
.mud-button-root:active:not(:disabled) {
    transform: translateY(1px);
}

/* A visible focus ring is mandatory. MudBlazor's default is easy to
   lose against a tinted row.

   Inputs are deliberately not in this list. .mud-input-control wraps the
   label as well as the field and carries no radius, so :focus-within drew
   a square 2px box around the whole control -- sharp corners against the
   field's own 4px radius -- and it fired on pointer focus, so clicking an
   underline field turned it into a boxed one. Every input already states
   focus in the language of its own variant: the underline goes 2px
   primary, the outlined fieldset goes primary. Scoping to :focus-visible
   would not have fixed it either, because browsers match :focus-visible
   on text inputs for mouse clicks as well as keyboard. */
.mud-button-root:focus-visible,
.mud-icon-button:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Inputs are structural, not actions: they keep the tight radius so a
   text field is never mistaken for a button. */
.mud-input-root,
.mud-input-slot {
    border-radius: var(--radius-control) !important;
}

/* Tabs were uppercase while the rest of the interface is sentence
   case. One register per product. */
.mud-tab {
    text-transform: none !important;
    letter-spacing: 0;
    font-weight: 500;
}

/* ------------------------------------------------------------
   6. SURFACES
   Elevation was applied to nearly every container, so nothing read
   as elevated. Shadows are reserved for things that genuinely float:
   menus, dialogs, popovers.
   ------------------------------------------------------------ */
.mud-paper:not(.mud-popover):not(.mud-dialog):not(.mud-menu-popover) {
    box-shadow: none !important;
    /* No blanket border. Papers nest, so an outline on every one drew a
       rectangle per panel: the tab strip in one box and the grid in a
       second directly beneath, with a seam between them. "Lines not
       boxes" means rules BETWEEN data rows, not an outline around every
       container. Surfaces separate by background and spacing; opt into
       an outline with .surface-outlined where one is genuinely needed. */
    border: 0 !important;
    border-radius: var(--radius-container) !important;
}

.mud-paper.surface-outlined {
    border: 1px solid var(--line) !important;
}

/* Floating surfaces still float. */
.mud-popover,
.mud-menu-popover,
.mud-dialog {
    border: 1px solid var(--line) !important;
    box-shadow: 0 8px 24px rgba(21, 38, 76, 0.12) !important;
}

.mud-popover,
.mud-dialog {
    border-radius: var(--radius-container) !important;
}

/* ------------------------------------------------------------
   7. EMPTY AND ZERO STATES
   A dashboard reading 0 with a red warning triangle looks like a
   failure when it means "nothing recorded yet". Absence is not an
   alarm.
   ------------------------------------------------------------ */
.is-empty,
.stat-card[data-empty="true"] {
    border-inline-start-color: var(--line-strong) !important;
}

.is-empty .stat-value,
.stat-card[data-empty="true"] .stat-value {
    opacity: 0.45;
    font-weight: 500;
}

/* Placeholder for a missing value: an en-rule, not the words
   "Not Assigned" wrapping onto two lines in every row. */
.value-empty::before {
    content: "-";
    opacity: 0.4;
}

/* ------------------------------------------------------------
   8. MOTION
   MOTION_INTENSITY 2. transition:all forces the browser to watch
   every animatable property; name the two that are cheap.
   ------------------------------------------------------------ */
:root {
    --transition-base: background-color 0.15s ease, color 0.15s ease;
    --transition-fast: background-color 0.1s ease, color 0.1s ease;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ------------------------------------------------------------
   9. DARK MODE
   Lines must be defined per theme or they vanish against a dark
   surface.
   ------------------------------------------------------------ */
.mud-theme-dark,
[data-theme="dark"] {
    --line:        rgba(255, 255, 255, 0.10);
    --line-strong: rgba(255, 255, 255, 0.18);
}

/* ------------------------------------------------------------
   10. RTL
   Arabic runs 20-30% longer than English, so nothing may be sized to
   fit an English string. Logical properties above already flip; this
   only corrects glyphs that are directional by meaning.
   ------------------------------------------------------------ */
[dir="rtl"] .code-cell {
    direction: ltr;      /* identifiers stay LTR inside RTL text */
    unicode-bidi: embed;
    display: inline-block;
}

/* ------------------------------------------------------------
   11. GENERIC CELL TRUNCATION
   The opt-in .cell-truncate above only helps markup that adopts it.
   Existing grids stack MudText elements inside a cell, so branch and
   department names wrapped to two and three lines and row heights
   ranged 60-90px. Rows are scanned down a column; a ragged left edge
   costs more than a clipped name, and the full value stays available
   on hover via the title attribute.
   ------------------------------------------------------------ */
.mud-table-body .mud-table-cell {
    max-width: 22ch;
}

/* Columns that must never clip. */
.mud-table-body .mud-table-cell:has(.mud-menu),
.mud-table-body .mud-table-cell:has(.mud-checkbox),
.mud-table-body .mud-table-cell:has(.mud-avatar) {
    max-width: none;
}

.mud-table-body .mud-table-cell > .mud-typography,
.mud-table-body .mud-table-cell > div > .mud-typography {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Secondary line inside a two-line cell (branch under department,
   phone under email) recedes so the primary value leads. */
.mud-table-body .mud-table-cell .mud-typography-caption {
    font-size: 0.6875rem;
    opacity: 0.72;
}

/* "Not Assigned" was set as a caption and wrapped onto two lines in
   every single row, adding height while saying nothing. Absence
   should be quiet. */
.mud-table-body .mud-typography-caption.mud-tertiary-text {
    white-space: nowrap;
    opacity: 0.5;
}

/* ------------------------------------------------------------
   12. TRUNCATION CALIBRATION
   The first pass capped every cell at 22ch, which clipped email
   addresses ("Serena.Carroll94@hotmail.c…"). An address is an
   identifier people read and copy; clipping it mid-domain is worse
   than a slightly wider column. Widen the cap and let the naturally
   long columns breathe.
   ------------------------------------------------------------ */
.mud-table-body .mud-table-cell {
    max-width: 30ch;
}

/* Cells that carry a control alongside text (a status chip, a menu) are
   not plain text columns and must not be capped. */
.mud-table-body .mud-table-cell:has(.mud-chip),
.mud-table-body .mud-table-cell:has(.mud-menu),
.mud-table-body .mud-table-cell:has(.mud-button-root) {
    max-width: none;
}

/* Two-line stacks (email over phone, department over branch) had a
   full line-height of air between them once each child became a
   block. Tighten them into one visual unit. */
.mud-table-body .mud-table-cell > .mud-typography + .mud-typography,
.mud-table-body .mud-table-cell > div > .mud-typography + .mud-typography {
    margin-top: 1px;
    line-height: 1.25;
}

/* ------------------------------------------------------------
   13. FALSE AFFORDANCES
   Branch and phone were set with Color.Secondary / Color.Tertiary,
   which the palette renders blue. They are not links and never
   were, but they read as clickable, so every row appeared to hold
   three destinations. Colour is reserved for things that do
   something; supporting text is grey.
   ------------------------------------------------------------ */
.mud-table-body .mud-table-cell .mud-typography-caption.mud-secondary-text,
.mud-table-body .mud-table-cell .mud-typography-caption.mud-tertiary-text,
.mud-table-body .mud-table-cell .mud-secondary-text,
.mud-table-body .mud-table-cell .mud-tertiary-text {
    color: var(--mud-palette-text-secondary) !important;
}

/* Real links inside a row keep the accent, but only on hover, so a
   dense grid stays monochrome at rest. */
.mud-table-body .mud-table-cell a.mud-link {
    color: var(--mud-palette-text-primary);
    text-decoration: none;
}

.mud-table-body .mud-table-cell a.mud-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ------------------------------------------------------------
   14. DASHBOARD HIERARCHY
   Measured on the HR dashboard: the KPI label rendered
   rgb(63,169,245) (bright blue) while its value rendered
   rgb(25,32,40) at 20px. The label was louder than the number it
   describes, which is backwards. On a metric tile the number is the
   content and everything else is annotation.

   Root cause is Color.Secondary being used to mean "muted". In
   MudBlazor that is a brand palette entry, not a text tone, so
   supporting copy came out saturated. Supporting text is grey.
   ------------------------------------------------------------ */
.mud-typography-caption.mud-secondary-text,
.mud-typography-body2.mud-secondary-text,
.mud-typography-caption.mud-tertiary-text {
    color: var(--mud-palette-text-secondary) !important;
}

/* The metric leads: larger, tighter, tabular. */
.mud-paper .mud-typography-h4 {
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

/* Decorative tile icons came in four hues (navy, green, amber, red),
   putting four accents in one row of four tiles. They label the tile,
   they do not report status, so they recede to one weight. Genuine
   status still comes through with .icon-status. */
.mud-paper > div > .mud-icon-root:not(.icon-status):not(.mud-button-root *),
.mud-paper .mud-typography + .mud-icon-root:not(.icon-status):not(.mud-button-root *) {
    color: var(--mud-palette-text-secondary) !important;
    opacity: 0.45;
}

/* ------------------------------------------------------------
   15. PROGRESS TRACKS
   Ten filled-track bars sat under "Attendance %" values that were
   all 0%. A full-width grey track with nothing in it reads as a
   broken control. Drop the track; the bar draws only what exists.
   ------------------------------------------------------------ */
.mud-progress-linear.mud-progress-linear-background .mud-progress-linear-bar--background,
.mud-progress-linear .mud-progress-linear-bar--background {
    background: transparent !important;
}

.mud-progress-linear {
    border-radius: 0 !important;
    height: 2px !important;
    background: var(--line) !important;
}

/* ------------------------------------------------------------
   16. ZERO IS NOT AN ERROR
   "Compliance Score 0" carried a red warning triangle, and the
   Compliance list rendered four counts of 0 as amber and red
   badges. Zero outstanding issues is the best possible reading of
   that panel; it should not look like a failure. Colour is applied
   only when a count is actually non-zero, via .has-issues on the
   badge.
   ------------------------------------------------------------ */
.mud-chip:not(.has-issues),
.badge-count:not(.has-issues) {
    background: transparent !important;
    border: 1px solid var(--line-strong) !important;
    color: var(--mud-palette-text-secondary) !important;
}

.badge-count.has-issues {
    background: color-mix(in srgb, var(--danger-color) 12%, transparent) !important;
    border-color: color-mix(in srgb, var(--danger-color) 40%, transparent) !important;
    color: var(--danger-color) !important;
}

/* ------------------------------------------------------------
   17. REMAINING DECORATION
   Three leftovers from the same habit: colour and boxes applied to
   things that are neither interactive nor alarming.
   ------------------------------------------------------------ */

/* List-row icons (Compliance, Today's Summary) still arrived in
   amber / red / blue / green per row. They mark the row's subject,
   not its state, so they take one weight like the tile icons. */
.mud-list-item .mud-icon-root:not(.icon-status):not(.mud-button-root *),
.mud-paper .mud-list .mud-icon-root:not(.icon-status):not(.mud-button-root *),
.mud-paper .d-flex > .mud-icon-root:not(.icon-status):not(.mud-button-root *) {
    color: var(--mud-palette-text-secondary) !important;
    opacity: 0.5;
}

/* Icons inside a control belong to that control and must inherit its
   colour. The sweep above initially caught them too, which turned the
   white "+" on the navy Add button into grey at 50% opacity: still
   rendered, still correctly positioned, but effectively invisible
   against the fill. It read as a clipped glyph. */
html body .mud-button-root .mud-icon-root,
html body .mud-button-root svg,
html body .mud-icon-button .mud-icon-root,
html body .mud-icon-button svg,
html body .mud-chip .mud-icon-root,
html body .mud-input-control .mud-icon-root,
html body .side-nav .mud-icon-root,
html body .breadcrumb-bar .mud-icon-root {
    color: inherit !important;
    fill: currentColor !important;
    opacity: 1 !important;
}

/* Filled buttons and the selected segment paint white on the accent,
   so their glyphs must be white too. Measured at #374655 on #0F4C99
   before this rule, which is unreadable. */
html body .mud-button-filled .mud-icon-root,
html body .mud-button-filled svg,
html body .view-toggle-btn--active .mud-icon-root,
html body .view-toggle-btn--active svg {
    color: #FFFFFF !important;
    fill: currentColor !important;
}

/* Percentages were set in palette-secondary blue. A percentage is a
   value; it belongs in the same ink as every other value. */
.mud-paper .mud-typography.mud-secondary-text,
.mud-paper .mud-typography.mud-primary-text {
    color: var(--mud-palette-text-primary) !important;
}

/* Counts inside the Department Breakdown were each wrapped in an
   outlined box. Eighteen boxes around eighteen single digits is the
   Code-pill problem repeated: a box implies a control. Numbers are
   numbers, right-aligned and tabular so columns line up. */
.mud-table-cell .mud-chip.mud-chip-outlined,
.mud-table-cell .mud-chip.mud-chip-text {
    background: none !important;
    border: 0 !important;
    padding: 0 !important;
    min-height: 0;
    color: var(--mud-palette-text-primary) !important;
    font-size: 0.8125rem !important;
}

/* Numeric columns right-align. Comparing magnitudes down a column
   only works when the digits share an edge. */
.mud-table-cell.numeric,
.mud-table-cell[align="right"],
.mud-table-cell:has(> .mud-chip.mud-chip-outlined) {
    text-align: end;
}

/* ------------------------------------------------------------
   18. FINAL DECORATION SWEEP
   Validated by live injection before being written here.
   ------------------------------------------------------------ */

/* Status icons in Today's Summary (green check, red X, amber clock)
   and Compliance still arrived coloured. They caption the row, they
   do not report a live condition, so they take one weight. */
/* Same over-broad sweep as section 17, duplicated in this pass and
   appended later, so it outranked the control-icon exception and kept
   glyphs on filled buttons at #374655 over a blue fill. Excluded here
   too. */
.mud-paper .mud-icon-root:not(.icon-status):not(.mud-avatar .mud-icon-root):not(.mud-button-root *):not(.mud-chip *) {
    color: var(--mud-palette-text-secondary) !important;
    opacity: 0.5;
}

/* Panel heading icons stay slightly stronger so section titles still
   anchor. */
.mud-paper .mud-typography-h6 .mud-icon-root,
.mud-paper > .d-flex:first-child > .mud-icon-root {
    opacity: 0.75 !important;
}

/* Department Breakdown counts were each boxed. Strip to plain
   right-aligned tabular figures. */
.mud-table-cell .mud-chip {
    background: none !important;
    border: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
    box-shadow: none !important;
    color: var(--mud-palette-text-primary) !important;
    font-size: 0.8125rem !important;
    font-weight: 500;
}

/* Type column keeps a visible boundary so it still reads as a
   category, not a number. */
.mud-table-cell .mud-chip.type-chip,
.mud-table-cell td:nth-child(5) .mud-chip {
    border: 1px solid var(--line-strong) !important;
    padding: 1px 7px !important;
}

/* Percentages and summary figures: one ink. */
.mud-paper .mud-typography.mud-primary-text,
.mud-paper .mud-typography.mud-secondary-text,
.mud-paper .mud-typography.mud-success-text,
.mud-paper .mud-typography.mud-warning-text {
    color: var(--mud-palette-text-primary) !important;
}

/* ------------------------------------------------------------
   19. CHIPS, CORRECTED
   The outlined treatment in section 3 was wrong. A 1px rectangle
   hugging two words reads as a disabled input, not a tag; the grid
   looked like a form full of dead fields. Validated in the browser
   before landing here: a low-tint fill with no border and real
   padding reads as a label on the data.
   ------------------------------------------------------------ */
.mud-table-cell .mud-chip,
.mud-table-cell .mud-chip.mud-chip-filled,
.mud-table-cell .mud-chip.mud-chip-outlined,
.mud-table-cell .mud-chip.mud-chip-text {
    background: color-mix(in srgb, var(--mud-palette-text-primary) 6%, transparent) !important;
    border: 0 !important;
    color: var(--mud-palette-text-secondary) !important;
    border-radius: 3px !important;
    padding: 2px 8px !important;
    min-height: 0 !important;
    font-size: 0.6875rem !important;
    font-weight: 500 !important;
    letter-spacing: 0.01em;
    line-height: 1.5;
    box-shadow: none !important;
}

/* Genuine state still reads as state. */
.mud-table-cell .mud-chip.chip-state-danger {
    background: color-mix(in srgb, var(--danger-color) 12%, transparent) !important;
    color: var(--danger-color) !important;
}

.mud-table-cell .mud-chip.chip-state-success {
    background: color-mix(in srgb, var(--success-color) 12%, transparent) !important;
    color: var(--success-color) !important;
}

/* ------------------------------------------------------------
   20. ACTIONS TIER: PILL
   Chosen deliberately over the tight scale. The rule, applied
   everywhere so it reads as a system rather than an exception:

     ACTIONS      pill      buttons, segmented controls, tab indicator
     STRUCTURE    4px       inputs, chips, cells
     SURFACES     6px       cards, dialogs, panels

   A pill says "press me" and separates the few elements that act from
   the many that only hold data. That distinction is worth more on a
   dense screen than uniform corners.
   ------------------------------------------------------------ */
.mud-button-root,
.mud-icon-button,
.view-toggle-group,
.toolbar-action-btn,
.toolbar-filter-btn,
.toolbar-add-btn {
    border-radius: var(--radius-action, 999px) !important;
}

/* The segments themselves stay square so they meet flush; the group's
   overflow clips them into the pill. */
.view-toggle-group .mud-icon-button {
    border-radius: 0 !important;
}

/* Tab indicator picks up the same language: a rounded bar, not a
   hard-edged rule. */
.mud-tab-slider {
    height: 3px !important;
    border-radius: var(--radius-action, 999px) !important;
}

/* Structure stays tight so a field is never mistaken for a button. */
.mud-input-root,
.mud-input-slot,
fieldset.mud-input-outlined-border,
.mud-table-cell .mud-chip {
    border-radius: var(--radius-control) !important;
}

/* ------------------------------------------------------------
   21. PILL TABS
   The previous pass only rounded the 3px underline, which was not
   what "pill tabs" means: the tabs themselves stayed flat 0px
   underline tabs. Converted properly.

   The tab strip is now a segmented pill group, matching the view
   toggle and the buttons beside it. That is the whole point of the
   actions tier: the tab bar switches views, so it should look like
   the other control that switches views, not like a heading rule.
   ------------------------------------------------------------ */

/* The strip becomes a track, not a ruled edge. */
.mud-tabs .mud-tabs-toolbar,
.mud-tabs-toolbar {
    border-bottom: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    min-height: 0 !important;
    padding: 4px 0;
}

.mud-tabs-toolbar-content,
.mud-tabs-toolbar-inner {
    gap: 4px;
}

/* Each tab is a pill. Height drops from 48px, which was heading-sized
   for a control. */
.mud-tab {
    border-radius: var(--radius-action, 999px) !important;
    min-height: 32px !important;
    height: 32px !important;
    padding: 0 14px !important;
    margin: 0 !important;
    min-width: 0 !important;
    text-transform: none !important;
    letter-spacing: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--mud-palette-text-secondary) !important;
    opacity: 1 !important;
}

.mud-tab:hover {
    background: color-mix(in srgb, var(--mud-palette-text-primary) 5%, transparent) !important;
}

/* Selected tab carries the fill; the underline is redundant once the
   pill exists, so it is removed rather than left to draw a second
   marker under the first. */
.mud-tab.mud-tab-active,
.mud-tab-active {
    background: var(--mud-palette-primary) !important;
    color: #FFFFFF !important;
    font-weight: 600;
}

.mud-tab.mud-tab-active .mud-icon-root,
.mud-tab-active .mud-icon-root {
    color: #FFFFFF !important;
}

.mud-tab-slider {
    display: none !important;
}

/* The panel below no longer needs a rule to attach to, since the tabs
   are self-contained pills rather than a strip fused to a surface. */
.mud-tabs-panels {
    padding-top: 4px;
}

/* ------------------------------------------------------------
   22. TAB STRIP CONTAINER
   .mud-tabs-tabbar was a 1122x48 white rectangle at 0px radius
   sitting behind the pills: a hard-edged slab holding rounded
   controls, which is the shape conflict the two-tier system exists
   to prevent.

   The pills are the control. They do not need a surface behind
   them, so the bar becomes transparent and the tabs sit directly on
   the page. One less box.
   ------------------------------------------------------------ */
.mud-tabs-tabbar,
.mud-tabs-tabbar-inner,
.mud-tabs-tabbar-content {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    min-height: 0 !important;
}

.mud-tabs-tabbar {
    height: auto !important;
    padding: 6px 0 !important;
}

/* Its wrapper paper should not paint a card either. */
.mud-tabs > .mud-paper,
.mud-tabs.mud-paper {
    background: transparent !important;
}

/* ------------------------------------------------------------
   23. INLINE STAT STRIP
   Replaces rows of filled count chips. ManagerDashboard carried five
   in Success / Warning / Info / Secondary / Error, which put five
   accents in a single row and implied a severity ranking that plain
   counts do not have.

   A count is a number with a caption. The number leads, tabular so a
   row of them aligns, and hairlines separate rather than boxes.
   ------------------------------------------------------------ */
.stat-strip {
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0;
}

.stat-strip__item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    padding: 2px 14px;
    border-inline-start: 1px solid var(--line);
}

.stat-strip__item:first-child {
    border-inline-start: 0;
}

.stat-strip__value {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    color: var(--mud-palette-text-primary);
}

.stat-strip__label {
    font-size: 0.6875rem;
    letter-spacing: 0.02em;
    color: var(--mud-palette-text-secondary);
}

/* Identifier shown with its label outside a table (detail headers). */
.identity-code {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}

.identity-code__label {
    font-size: 0.6875rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
}

/* Emphasis variant: used when one figure in the strip is genuinely bad
   (a failed import). Zero never takes it, per section 16. */
.stat-strip__value--alert {
    color: var(--danger-color) !important;
}

/* A count in a grid cell: a number, not a badge. */
.count-cell {
    display: block;
    text-align: end;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    font-size: 0.8125rem;
}

/* Inline quantity on a card: value leads, unit-style caption after it. */
.asset-availability {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
}

.asset-availability__value {
    font-size: 0.9375rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    color: var(--mud-palette-text-primary);
}

.asset-availability__label {
    font-size: 0.6875rem;
    letter-spacing: 0.02em;
    color: var(--mud-palette-text-secondary);
}

/* ------------------------------------------------------------
   24. TAB SWITCHING
   Measured on the Employees page: .mud-tabs-panels carried
   "transition: 0.3s cubic-bezier(0.25,0.8,0.5,1)" with no property
   named, which resolves to transition-property: all. Swapping panels
   therefore animated height and layout, not just appearance, so the
   page visibly stretched and settled on every tab change. .mud-tabs
   and .mud-tabs-tabbar were "transition: all" for the same reason.

   Two panels of a data grid are not a scene change. Switching tabs is
   navigation: it should feel instant. Content is swapped with a short
   opacity fade only, and nothing animates geometry.
   ------------------------------------------------------------ */
.mud-tabs,
.mud-tabs-tabbar,
.mud-tabs-panels {
    transition: none !important;
}

/* A brief fade so the swap does not read as a flicker, on opacity
   only: it is compositor-friendly and cannot move the layout. */
.mud-tabs-panels .mud-tab-panel {
    animation: tab-panel-in 120ms ease-out;
}

@keyframes tab-panel-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* The tab buttons keep a colour transition for hover feedback, but
   named rather than "all". */
.mud-tab {
    transition: background-color 0.12s ease, color 0.12s ease !important;
}

/* Height must not animate: the two panels have very different content
   heights, and transitioning between them is what produced the slide. */
.mud-tabs-panels,
.mud-tabs-tabbar-wrapper,
.mud-tabs-tabbar-content {
    will-change: auto;
}

@media (prefers-reduced-motion: reduce) {
    .mud-tabs-panels .mud-tab-panel { animation: none; }
}

/* ------------------------------------------------------------
   25. GRID DENSITY, SECOND PASS
   Rows measured ~74px, so barely ten fit a 950px viewport on a screen
   whose whole job is scanning lists.
   ------------------------------------------------------------ */

/* The header shared its background and weight with the rows below it, so
   it read as one more row rather than as a different kind of thing. */
.mud-table-head .mud-table-cell {
    background: color-mix(in srgb, var(--mud-palette-text-primary) 3.5%, transparent) !important;
    border-bottom: 1px solid var(--line-strong) !important;
    padding-block: 7px !important;
    letter-spacing: 0.07em !important;
}

.mud-table-body .mud-table-cell {
    padding-block: 6px !important;
}

/* Stacked pairs (email over phone, department over branch) are one field
   shown on two lines, not two fields, so they close up. */
.mud-table-body .mud-table-cell .mud-typography + .mud-typography,
.mud-table-body .mud-table-cell > div > .mud-typography + .mud-typography,
.mud-table-body .mud-table-cell .mud-stack > .mud-typography + .mud-typography {
    margin-top: 0 !important;
    line-height: 1.3 !important;
}

.mud-table-body .mud-table-cell .mud-stack {
    gap: 0 !important;
}

/* Those pairs are separated by a literal <br> in the markup. Once the
   truncation rule above made the surrounding .mud-typography
   display:block, the <br> stopped joining two inline runs and began
   generating its own empty line box: 21px of dead space in every row,
   which is most of the height problem. The block children already stack,
   so the break has nothing left to do. */
.mud-table-body .mud-table-cell br {
    display: none !important;
}

/* 40px of chrome around a single letter. */
.mud-table-body .mud-table-cell .mud-avatar {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.75rem !important;
}

/* No width constraint on the avatar column.
   Two attempts failed here and both were the same mistake: inferring a
   column's purpose from something other than its purpose. Keying on
   :first-child assumed every grid opens with a photo, and crushed the
   Employee name column on Team Status to 52px. Keying on :has(.mud-avatar)
   then matched any cell that merely CONTAINS an avatar, including that same
   cell, which pairs an avatar with a name and a role.

   Sizing the avatar is sufficient: at 28px the column is naturally narrow
   where the avatar is the whole content, and stays wide where it is not.
   A dedicated photo column being a few pixels wider than strictly needed
   costs nothing; a crushed name column costs the row. */

/* Left-aligned variant: the strip defaults to flex-end for dashboard
   headers, but in page content it should start at the text margin. */
.stat-strip--start {
    justify-content: flex-start;
}

.balance-heading {
    display: block;
    margin-bottom: 2px;
    color: var(--mud-palette-text-secondary);
}

.balance-strip {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--line);
}
