/*
 * Scheme Architecture: Admin Panel light theme (Phase 4).
 * Handwritten, no build step. Loaded after the compiled Tailwind/Flux stylesheet and only active under body.admin-ui, so the
 * public website and the printable documents are never touched.
 *
 * Approved palette: Deep Emerald #063D32, Champagne Gold #D6A943, Warm Ivory #F5F1E9, Charcoal #242B27.
 * The neutral, emerald and amber scales below are tints of those four colours, so every existing screen that already uses the
 * zinc / emerald / amber utility classes follows the brand without its markup changing. Red and blue stay as they are
 * (error and information colours). Dark mode is not offered: the Admin Panel has one approved light theme.
 */

body.admin-ui {
    --sa-emerald: #063D32;
    --sa-emerald-soft: #0b5243;
    --sa-gold: #D6A943;
    --sa-gold-dark: #b98d2c;
    --sa-ivory: #F5F1E9;
    --sa-charcoal: #242B27;
    --sa-line: #E4DFD2;
    --sa-stripe: rgba(245, 241, 233, .55);
    --sa-hover: rgba(6, 61, 50, .06);

    /* Neutrals: warm tints of Ivory (light end) and Charcoal (dark end). zinc, gray and neutral share one scale. */
    --color-zinc-50: #FAF8F3;  --color-gray-50: #FAF8F3;  --color-neutral-50: #FAF8F3;
    --color-zinc-100: #F3EFE6; --color-gray-100: #F3EFE6; --color-neutral-100: #F3EFE6;
    --color-zinc-200: #E4DFD2; --color-gray-200: #E4DFD2; --color-neutral-200: #E4DFD2;
    --color-zinc-300: #D2CCBC; --color-gray-300: #D2CCBC; --color-neutral-300: #D2CCBC;
    --color-zinc-400: #8F958F; --color-gray-400: #8F958F; --color-neutral-400: #8F958F;
    --color-zinc-500: #626B65; --color-gray-500: #626B65; --color-neutral-500: #626B65;
    --color-zinc-600: #4A524D; --color-gray-600: #4A524D; --color-neutral-600: #4A524D;
    --color-zinc-700: #39413C; --color-gray-700: #39413C; --color-neutral-700: #39413C;
    --color-zinc-800: #2E3631; --color-gray-800: #2E3631; --color-neutral-800: #2E3631;
    --color-zinc-900: #242B27; --color-gray-900: #242B27; --color-neutral-900: #242B27;
    --color-zinc-950: #161B18; --color-gray-950: #161B18; --color-neutral-950: #161B18;

    /* Emerald: the brand green is 700. */
    --color-emerald-50: #EEF5F2;  --color-emerald-100: #DCEAE4; --color-emerald-200: #B9D5CA;
    --color-emerald-300: #8DB9A9; --color-emerald-400: #4F8F7B; --color-emerald-500: #2A6F5B;
    --color-emerald-600: #0B4A3C; --color-emerald-700: #063D32; --color-emerald-800: #053129;
    --color-emerald-900: #04251F; --color-emerald-950: #021712;

    /* Amber: Champagne Gold (400) and its tints, with dark text shades that stay readable. */
    --color-amber-50: #FBF5E4;  --color-amber-100: #F6E9C4; --color-amber-200: #EDD596;
    --color-amber-300: #E3C168; --color-amber-400: #D6A943; --color-amber-500: #C09431;
    --color-amber-600: #A67C1F; --color-amber-700: #85620F; --color-amber-800: #6B4E0D;
    --color-amber-900: #523C0A; --color-amber-950: #362805;

    /* Flux accent (primary buttons, focus rings, selected controls). */
    --color-accent: #063D32;
    --color-accent-content: #063D32;
    --color-accent-foreground: #F5F1E9;

    background: var(--sa-ivory);
    color: var(--sa-charcoal);
}

.admin-ui :focus-visible { outline: 2px solid var(--sa-gold); outline-offset: 2px; }

/* ------------------------------------------------------------------ Sidebar (emerald, ivory text, gold active marker) */
.admin-ui [data-flux-sidebar] { background: var(--sa-emerald); border-color: rgba(214, 169, 67, .35); }
.admin-ui [data-flux-sidebar] a.mr-5 { color: var(--sa-ivory); }
.admin-ui [data-flux-sidebar] [data-flux-sidebar-toggle] { color: var(--sa-ivory); }
.admin-ui [data-flux-sidebar] div.text-zinc-400 {
    color: var(--sa-gold); font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; line-height: 1;
}
.admin-ui [data-flux-sidebar] [data-flux-navlist-item] {
    color: rgba(245, 241, 233, .86); border: 1px solid transparent; border-radius: 8px; font-size: .9rem;
}
.admin-ui [data-flux-sidebar] [data-flux-navlist-item]:hover { background: rgba(245, 241, 233, .09); color: #fff; }
.admin-ui [data-flux-sidebar] [data-flux-navlist-item][data-current] {
    background: rgba(214, 169, 67, .18); color: #fff; font-weight: 600; border-color: rgba(214, 169, 67, .5); box-shadow: inset 3px 0 0 var(--sa-gold);
}
.admin-ui [data-flux-sidebar] [data-flux-navlist-item][data-current]:hover { color: #fff; }
.admin-ui [data-flux-sidebar] [data-flux-profile] { color: var(--sa-ivory); }
.admin-ui [data-flux-sidebar] [data-flux-profile]:hover { background: rgba(245, 241, 233, .1); }
.admin-ui [data-flux-sidebar] [data-flux-profile] > span { color: var(--sa-ivory); }
.admin-ui [data-flux-sidebar] [data-flux-profile] svg { color: rgba(245, 241, 233, .75); }

/* Mobile top bar: light, with a gold hairline */
.admin-ui [data-flux-header] { background: #fff; border-bottom: 2px solid var(--sa-gold); }

/* ------------------------------------------------------------------ Workspace */
.admin-ui [data-flux-main] h1 { color: var(--sa-emerald); letter-spacing: -.01em; }

/* Dashboard welcome area and section headings */
.admin-ui .admin-welcome { background: #fff; border: 1px solid var(--sa-line); border-left: 4px solid var(--sa-gold); border-radius: 12px; padding: 1.1rem 1.4rem; }
.admin-ui .admin-welcome h1 { margin: 0; }
.admin-ui [data-testid="dashboard-overview"] section > div:first-child h3,
.admin-ui [data-testid="dashboard-overview"] > div:first-child h2 {
    color: var(--sa-emerald); font-weight: 650; font-size: 1.05rem; padding-left: .65rem; border-left: 3px solid var(--sa-gold); line-height: 1.3;
}
.admin-ui [data-testid="dashboard-extras"] h2 { color: var(--sa-emerald); font-weight: 650; }

/* Cards and tiles */
.admin-ui [data-flux-main] a.rounded-xl.border { transition: border-color .15s, box-shadow .15s; }
.admin-ui [data-flux-main] a.rounded-xl.border:hover { border-color: var(--sa-gold); box-shadow: 0 6px 18px rgba(6, 61, 50, .08); }
.admin-ui [data-flux-main] [data-stat-value] { font-variant-numeric: tabular-nums; color: var(--sa-charcoal); }
.admin-ui [data-flux-main] section.rounded-xl.border,
.admin-ui [data-flux-main] div.rounded-xl.border { border-color: var(--sa-line); }

/* ------------------------------------------------------------------ Tables: one design for every list (not the printable documents) */
@media screen {
    .admin-ui [data-flux-main] table:not(.doc-frame):not(.doc-article table) { border-collapse: collapse; }

    .admin-ui [data-flux-main] table:not(.doc-frame):not(.doc-article table) thead { background: var(--sa-emerald); }
    .admin-ui [data-flux-main] table:not(.doc-frame):not(.doc-article table) thead th,
    .admin-ui [data-flux-main] table:not(.doc-frame):not(.doc-article table) thead td {
        color: var(--sa-ivory); font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; vertical-align: middle; white-space: nowrap;
    }
    .admin-ui [data-flux-main] table:not(.doc-frame):not(.doc-article table) thead th a,
    .admin-ui [data-flux-main] table:not(.doc-frame):not(.doc-article table) thead th button { color: inherit; }

    .admin-ui [data-flux-main] table:not(.doc-frame):not(.doc-article table) tbody { background: #fff; }
        .admin-ui [data-flux-main] table:not(.doc-frame):not(.doc-article table) tbody tr:nth-child(even) { background: var(--sa-stripe); }
    .admin-ui [data-flux-main] table:not(.doc-frame):not(.doc-article table) tbody tr:hover { background: var(--sa-hover); }
    .admin-ui [data-flux-main] table:not(.doc-frame):not(.doc-article table) tbody td { vertical-align: middle; }
    .admin-ui [data-flux-main] table:not(.doc-frame):not(.doc-article table) tbody td.text-right { font-variant-numeric: tabular-nums; }
    .admin-ui [data-flux-main] table:not(.doc-frame):not(.doc-article table) tfoot td,
    .admin-ui [data-flux-main] table:not(.doc-frame):not(.doc-article table) tfoot th { background: var(--sa-ivory); font-weight: 600; }

    /* The one border standard of the Admin Panel: 0.5px solid #063D32 on every table cell and on the table itself, always visible (collapsed, so adjacent cells share one line and nothing doubles). Header cells sit on the emerald header, so their border is the same colour as it. A browser draws 0.5px as one device pixel: crisp half a CSS pixel on high-density screens, one pixel on a standard screen. */
    .admin-ui [data-flux-main] table:not(.doc-frame):not(.doc-article table) th,
    .admin-ui [data-flux-main] table:not(.doc-frame):not(.doc-article table) td { border: 0.5px solid #063D32; }
    .admin-ui [data-flux-main] table:not(.doc-frame):not(.doc-article table) { border: 0.5px solid #063D32; }

.admin-ui [data-flux-main] table:not(.doc-frame):not(.doc-article table) thead th { box-shadow: inset 0 0 0 1px rgba(245, 241, 233, .22); }

    /* Table links read as links without shouting */
    .admin-ui [data-flux-main] table:not(.doc-frame) tbody a.font-medium:hover { color: var(--sa-emerald); text-decoration: underline; }

    /* Status badges: one shape, one size; the colours come from the existing emerald / amber / red / zinc classes */
    .admin-ui [data-flux-main] td span.rounded-full {
        display: inline-flex; align-items: center; white-space: nowrap; line-height: 1.25; padding: .2rem .65rem; font-size: .75rem; font-weight: 600;
        box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 26%, transparent);
    }

    /* Action columns: compact buttons that never wrap */
    .admin-ui [data-flux-main] td [data-flux-button] { white-space: nowrap; }
    .admin-ui [data-flux-main] td .justify-end { flex-wrap: wrap; align-items: center; }
}

/* A wide table scrolls inside its own container, never the page */
.admin-ui [data-flux-main] .overflow-x-auto { max-width: 100%; -webkit-overflow-scrolling: touch; }

/* ------------------------------------------------------------------ Forms, filters, buttons */
.admin-ui [data-flux-control],
.admin-ui [data-flux-main] select,
.admin-ui [data-flux-main] textarea,
.admin-ui [data-flux-main] input[type="text"],
.admin-ui [data-flux-main] input[type="search"],
.admin-ui [data-flux-main] input[type="date"],
.admin-ui [data-flux-main] input[type="email"],
.admin-ui [data-flux-main] input[type="number"],
.admin-ui [data-flux-main] input[type="tel"] { border-radius: 8px; background-color: #fff; color: var(--sa-charcoal); }
.admin-ui [data-flux-main] input[type="checkbox"], .admin-ui [data-flux-main] input[type="radio"] { accent-color: var(--sa-emerald); }
.admin-ui [data-flux-label] { color: var(--sa-charcoal); font-weight: 600; font-size: .85rem; }

/* Buttons: primary = emerald with ivory text; secondary = white with a warm border; the focus ring is gold */
.admin-ui [data-flux-button] { border-radius: 8px; }
.admin-ui [data-flux-button]:focus-visible { outline: 2px solid var(--sa-gold); outline-offset: 2px; }

/* Pagination (Laravel and Livewire links) */
.admin-ui nav[aria-label="Pagination Navigation"] [aria-current="page"] > span { background: var(--sa-emerald); color: var(--sa-ivory); border-color: var(--sa-emerald); }
.admin-ui nav[aria-label="Pagination Navigation"] a:hover { background: var(--sa-ivory); color: var(--sa-emerald); }

/* Dialogs: white panel on a dark scrim, thin warm border */
.admin-ui [role="dialog"] > div { border: 1px solid var(--sa-line); }

/* Empty states */
.admin-ui [data-flux-main] td .rounded-full.bg-zinc-100 { background: var(--color-emerald-50); color: var(--sa-emerald); }

/* ------------------------------------------------------------------ Responsive */
@media (max-width: 640px) {
    .admin-ui .admin-welcome { padding: .95rem 1rem; }
    .admin-ui [data-flux-main] h1 { font-size: 1.5rem; }
    .admin-ui [data-flux-main] table:not(.doc-frame):not(.doc-article table) thead th { font-size: .68rem; }
}
/* Nothing in the workspace may widen the page; wide tables scroll inside .overflow-x-auto */
.admin-ui [data-flux-main] { min-width: 0; }
@media (prefers-reduced-motion: reduce) {
    .admin-ui * { transition: none !important; }
}

/* ------------------------------------------------------------------ Sidebar identity: the full name and the designation, nothing else */
.admin-ui .sidebar-identity {
    display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; width: 100%; padding: .55rem .75rem; border: 0; border-radius: 8px;
    background: transparent; color: var(--sa-ivory); text-align: left; cursor: pointer; font: inherit;
}
.admin-ui .sidebar-identity:hover { background: rgba(245, 241, 233, .1); }
.admin-ui .sidebar-identity-name { display: block; max-width: 100%; font-size: .95rem; font-weight: 600; line-height: 1.3; color: #fff; white-space: normal; overflow-wrap: anywhere; }
.admin-ui .sidebar-identity-role { display: block; max-width: 100%; font-size: .8rem; line-height: 1.3; color: var(--sa-gold); white-space: normal; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ Modal forms: fields may shrink inside their grid, never overflow or overlap */
.admin-ui [role="dialog"] form .grid > * { min-width: 0; }
.admin-ui [role="dialog"] [data-flux-field], .admin-ui [role="dialog"] [data-flux-input] { min-width: 0; max-width: 100%; }
.admin-ui [role="dialog"] [data-flux-control]:not([type="checkbox"]):not([type="radio"]) { min-width: 0; max-width: 100%; width: 100%; }
.admin-ui [role="dialog"] input[type="date"], .admin-ui [role="dialog"] input[type="number"] { min-width: 0; }

/* Quotation and invoice line items: Description | Quantity | Unit price (BDT) | Line amount (BDT) | Remove.
   The unit price column is wide enough for its placeholder and amount; below 1024 px the existing one- and two-column stack is kept. */
@media (min-width: 1024px) {
    .admin-ui .doc-line-item { grid-template-columns: minmax(0, 2.2fr) minmax(8.5rem, 1fr) minmax(9.5rem, 1.2fr) minmax(8.5rem, 1fr) 2.75rem; column-gap: .9rem; }
    .admin-ui .doc-line-item > * { grid-column: auto; min-width: 0; }
}

/* ------------------------------------------------------------------ Sidebar brand area: about twice the previous height (logo tile 2rem -> 4rem) */
.admin-ui [data-flux-sidebar] a.sidebar-brand { display: flex; align-items: center; gap: .85rem; min-height: 4.5rem; margin-right: 0; padding: .15rem 0 .35rem; }
.admin-ui .sidebar-brand-logo, .admin-ui .sidebar-brand-mark {
    display: flex; flex: none; align-items: center; justify-content: center; width: 4rem; height: 4rem; padding: .3rem; border-radius: 10px;
}
.admin-ui .sidebar-brand-logo { background: transparent; padding: 0; border: 0; box-shadow: none; }
.admin-ui .sidebar-brand-mark { background: var(--sa-emerald-soft); }
.admin-ui .sidebar-brand-logo img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.admin-ui .sidebar-brand-name { flex: 1; min-width: 0; margin: 0; font-size: 1.05rem; line-height: 1.2; }
.admin-ui .sidebar-brand-name span { margin: 0; line-height: 1.2; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; color: var(--sa-ivory); }

/* ------------------------------------------------------------------ Create-draft-transaction form: explicit grid, one column on phones, two from 640 px */
.admin-ui .tx-form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem 1.25rem; }
.admin-ui .tx-form-grid > * { min-width: 0; }
.admin-ui .tx-form-grid > .tx-span-2 { grid-column: 1 / -1; }
@media (min-width: 640px) {
    .admin-ui .tx-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ------------------------------------------------------------------ Form fields: the same 0.5px solid #063D32 border on every input, select and textarea (Flux fields, plain fields, search boxes, date pickers, file inputs, modal fields) */
.admin-ui input:where(:not([type="checkbox"], [type="radio"], [type="range"], [type="hidden"], [type="submit"], [type="button"], [type="reset"], [type="image"], [type="color"])),
.admin-ui select,
.admin-ui textarea { border: 0.5px solid #063D32; }
/* An invalid field keeps its red border (Flux marks it with data-invalid) */
.admin-ui input[data-invalid], .admin-ui select[data-invalid], .admin-ui textarea[data-invalid] { border-color: var(--color-red-500, #ef4444); }
/* Quotation / invoice line items: the row and its read-only amount box use the same border */
.admin-ui .doc-line-item, .admin-ui .doc-line-item .rounded-lg.border { border: 0.5px solid #063D32; }

/* ------------------------------------------------------------------ Create-draft-transaction fields: one wrapper, one label, one control each */
.admin-ui .tx-field { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.admin-ui .tx-label { font-size: .85rem; font-weight: 600; line-height: 1.25; color: var(--sa-charcoal); }
.admin-ui .tx-control {
    display: block; width: 100%; max-width: 100%; min-width: 0; min-height: 2.5rem; padding: .5rem .75rem; border-radius: 8px; background: #fff; color: var(--sa-charcoal);
    font: inherit; font-size: .9rem; line-height: 1.4; box-sizing: border-box;
}
.admin-ui textarea.tx-control { min-height: 5.5rem; resize: vertical; }
.admin-ui .tx-control[readonly], .admin-ui .tx-control:disabled { background: var(--color-zinc-100); color: var(--color-zinc-600); }
.admin-ui .tx-control:focus { outline: none; box-shadow: 0 0 0 2px var(--sa-ivory), 0 0 0 4px var(--sa-gold); }

/* ------------------------------------------------------------------ Employee form: profile picture frame and Upload Photo button only
   The frame grows from 5 rem (80 px) to 5.5 rem (88 px); its negative block margin keeps the space it takes in the row unchanged, so nothing around it moves. */
.admin-ui [data-testid="profile-photo-frame"] { width: 5.5rem; height: 5.5rem; margin-block: -4px; border: 0.5px solid #063D32; border-radius: 50%; top: -4px; }
.admin-ui [data-testid="profile-photo-button"] { border: 0.5px solid #063D32; }

/* ------------------------------------------------------------------ Phase 5: phones and tablets (Admin Panel) */
/* Grid items may shrink: a long name or figure can never push a dashboard or filter grid wider than the screen. */
.admin-ui [data-flux-main] .grid > * { min-width: 0; }
/* Recent business activity: the date drops under the text when the card is narrow, and stays on the same line when there is room. */
.admin-ui [data-testid="dashboard-extras"] li { flex-wrap: wrap; row-gap: .15rem; }
.admin-ui [data-testid="dashboard-extras"] li > div { flex: 1 1 14rem; }
.admin-ui [data-testid="dashboard-extras"] li > a, .admin-ui [data-testid="dashboard-extras"] li > span { overflow-wrap: anywhere; }
/* Scroll containers around wide tables: smooth horizontal scrolling that does not drag the page along */
.admin-ui [data-flux-main] .overflow-x-auto { overscroll-behavior-x: contain; }
/* Dialogs on phones: a little less padding so the form uses the width */
@media (max-width: 480px) {
    .admin-ui [role="dialog"] { padding: .5rem; }
    .admin-ui [role="dialog"] > div { padding: 1rem; margin-block: .5rem; }
    .admin-ui [role="dialog"] .justify-end { flex-wrap: wrap; }
}
/* Long headings and values wrap instead of overflowing */
.admin-ui [data-flux-main] h1, .admin-ui [data-flux-main] h2, .admin-ui [data-flux-main] h3 { overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ Mobile drawer open: the top bar's user control must not stay in front of the overlay
   Flux marks the sidebar with data-flux-sidebar-on-mobile, and with data-flux-sidebar-collapsed-mobile while it is closed. While the drawer is open the
   top bar's user dropdown is hidden (and cannot be tapped); when the drawer closes the attribute goes away and the control is back, unchanged. */
.admin-ui:has([data-flux-sidebar][data-flux-sidebar-on-mobile]:not([data-flux-sidebar-collapsed-mobile])) [data-flux-header] ui-dropdown { visibility: hidden; pointer-events: none; }

/* ------------------------------------------------------------------ Mobile top bar: the user's name and designation (right-aligned, wraps instead of being cut) */
.admin-ui [data-flux-header] ui-dropdown { min-width: 0; max-width: calc(100% - 4.5rem); }
.admin-ui .topbar-identity { display: flex; flex-direction: column; align-items: flex-end; gap: .1rem; max-width: 100%; padding: .3rem .5rem; border: 0; border-radius: 8px; background: transparent; text-align: right; cursor: pointer; font: inherit; }
.admin-ui .topbar-identity:hover { background: var(--sa-hover); }
.admin-ui .topbar-identity-name { display: block; max-width: 100%; font-size: .9rem; font-weight: 600; line-height: 1.25; color: var(--sa-charcoal); white-space: normal; overflow-wrap: anywhere; }
.admin-ui .topbar-identity-role { display: block; max-width: 100%; font-size: .78rem; line-height: 1.25; color: var(--sa-emerald); white-space: normal; overflow-wrap: anywhere; }
/* ==================================================================== PAYROLL UI (Step 6) — begin
   One isolated block, appended after every existing rule. Everything is scoped under body.admin-ui and uses the "pr-" prefix; it uses
   only the palette variables above (Deep Emerald, Champagne Gold, Warm Ivory, Charcoal) and the approved 0.5px solid emerald border.
   It changes no existing rule. The compiled Tailwind stylesheet is not rebuilt, so anything Payroll needs that it lacks lives here. */

/* ---- status badge: one pill shape, four statuses */
body.admin-ui .pr-badge { display: inline-block; padding: .15rem .7rem; border: 0.5px solid var(--sa-emerald); border-radius: 9999px; font-size: .75rem; font-weight: 600; line-height: 1.4; white-space: nowrap; color: var(--sa-charcoal); background: #fff; }
body.admin-ui .pr-badge-draft { background: rgba(214, 169, 67, .22); }
body.admin-ui .pr-badge-submitted { background: var(--sa-ivory); }
body.admin-ui .pr-badge-approved { background: var(--sa-emerald); color: var(--sa-ivory); }
body.admin-ui .pr-badge-cancelled { background: rgba(36, 43, 39, .08); color: rgba(36, 43, 39, .7); text-decoration: line-through; }

/* ---- the run list */
body.admin-ui .pr-filters { display: grid; gap: .75rem; padding: 1rem; border-bottom: 0.5px solid var(--sa-emerald); grid-template-columns: 1fr; }
body.admin-ui .pr-restricted { color: rgba(36, 43, 39, .65); font-style: italic; white-space: nowrap; }
body.admin-ui .pr-figure { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
body.admin-ui .pr-muted { color: rgba(36, 43, 39, .65); font-size: .8rem; display: block; }
body.admin-ui .pr-empty { padding: 3rem 1rem; text-align: center; }
body.admin-ui .pr-empty strong { display: block; color: var(--sa-charcoal); }

/* ---- the Generate dialog and every later Payroll dialog */
body.admin-ui .pr-dialog-backdrop { position: fixed; inset: 0; z-index: 50; overflow-y: auto; padding: 1rem; background: rgba(36, 43, 39, .55); }
body.admin-ui .pr-dialog { width: 100%; max-width: 34rem; margin: 1.5rem auto; padding: 1.5rem; background: #fff; border: 0.5px solid var(--sa-emerald); border-radius: 12px; box-shadow: 0 18px 40px rgba(36, 43, 39, .28); color: var(--sa-charcoal); }
body.admin-ui .pr-dialog-title { margin: 0 0 .5rem; font-size: 1.125rem; font-weight: 600; color: var(--sa-emerald); }
body.admin-ui .pr-dialog-body { font-size: .9rem; line-height: 1.5; }
body.admin-ui .pr-dialog-reason { margin-top: 1rem; }
body.admin-ui .pr-hint { margin: .25rem 0 0; font-size: .75rem; color: rgba(36, 43, 39, .65); }
body.admin-ui .pr-dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; padding-top: 1rem; border-top: 0.5px solid var(--sa-line); }

/* ---- the month list inside the Generate dialog */
body.admin-ui .pr-months { margin: 1rem 0 0; padding: 0; border: 0.5px solid var(--sa-emerald); border-radius: 8px; max-height: 18rem; overflow-y: auto; }
body.admin-ui .pr-months legend { padding: 0 .4rem; font-size: .75rem; font-weight: 600; color: var(--sa-emerald); }
body.admin-ui .pr-month-group { margin: 0; padding: .4rem .75rem; background: var(--sa-ivory); border-bottom: 0.5px solid var(--sa-line); font-size: .7rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--sa-emerald); }
body.admin-ui .pr-month { display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem; border-bottom: 0.5px solid var(--sa-line); cursor: pointer; }
body.admin-ui .pr-month:hover { background: var(--sa-hover); }
body.admin-ui .pr-month[data-disabled] { cursor: not-allowed; opacity: .55; background: transparent; }
body.admin-ui .pr-month-name { font-weight: 600; }
body.admin-ui .pr-month-note { margin-left: auto; font-size: .75rem; color: rgba(36, 43, 39, .75); text-align: right; }

/* ---- small screens: the run table becomes one card per run, and dialogs fill the width */
body.admin-ui .pr-runs { min-width: 960px; }

@media (max-width: 640px) {
    body.admin-ui .pr-runs { min-width: 0; }
    body.admin-ui .pr-runs thead { display: none; }
    body.admin-ui .pr-runs tbody, body.admin-ui .pr-runs tr, body.admin-ui .pr-runs td { display: block; width: 100%; }
    body.admin-ui .pr-runs tr { margin-bottom: .75rem; }
    body.admin-ui .pr-runs td { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; text-align: right; }
    body.admin-ui .pr-runs td::before { content: attr(data-label); flex: none; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; text-align: left; color: var(--sa-emerald); }
    body.admin-ui .pr-dialog { margin: .5rem auto; padding: 1rem; }
    body.admin-ui .pr-dialog-actions { flex-direction: column-reverse; }
    body.admin-ui .pr-dialog-actions > * { width: 100%; min-height: 2.5rem; }
    body.admin-ui .pr-month { min-height: 2.75rem; }
}

@media (min-width: 640px) {
    body.admin-ui .pr-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---- Run details page (Step 6C) ---- */
body.admin-ui .pr-back { font-size: .8rem; font-weight: 600; color: var(--sa-emerald); text-decoration: none; }
body.admin-ui .pr-back:hover, body.admin-ui .pr-link:hover { text-decoration: underline; }
body.admin-ui .pr-link { font-weight: 600; color: var(--sa-emerald); text-decoration: none; white-space: nowrap; }
body.admin-ui .pr-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
body.admin-ui .pr-summary { display: grid; gap: 0; margin: 0; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
body.admin-ui .pr-summary-item { padding: .9rem 1.25rem; border-bottom: 0.5px solid var(--sa-line); }
body.admin-ui .pr-summary-item dt { font-size: .7rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--sa-emerald); }
body.admin-ui .pr-summary-item dd { margin: .2rem 0 0; font-size: .9rem; color: var(--sa-charcoal); overflow-wrap: anywhere; }
body.admin-ui .pr-section-title { margin: 0; padding: 1rem 1.25rem .25rem; font-size: 1rem; font-weight: 600; color: var(--sa-emerald); }
body.admin-ui .pr-section-note { margin: 0; padding: 0 1.25rem .75rem; font-size: .8rem; color: rgba(36, 43, 39, .75); }
body.admin-ui .pr-warnings { list-style: none; margin: 0; padding: 0; }
body.admin-ui .pr-warning { display: grid; gap: .5rem 1rem; padding: .85rem 1.25rem; border-top: 0.5px solid var(--sa-line); background: rgba(214, 169, 67, .1); grid-template-columns: minmax(0, 14rem) minmax(0, 1fr) auto; align-items: start; }
body.admin-ui .pr-warning-who { display: flex; flex-direction: column; gap: .1rem; }
body.admin-ui .pr-warning-text { display: flex; flex-direction: column; gap: .2rem; font-size: .875rem; overflow-wrap: anywhere; }
body.admin-ui .pr-items { min-width: 1000px; }
body.admin-ui .pr-excluded td { color: rgba(36, 43, 39, .65); }
body.admin-ui .pr-flag { display: inline-block; padding: .1rem .55rem; border: 0.5px solid var(--sa-emerald); border-radius: 9999px; font-size: .7rem; font-weight: 600; background: rgba(36, 43, 39, .08); color: var(--sa-charcoal); }
body.admin-ui .pr-segment { display: block; font-size: .75rem; line-height: 1.5; white-space: nowrap; }

@media (max-width: 640px) {
    body.admin-ui .pr-summary { grid-template-columns: 1fr 1fr; }
    body.admin-ui .pr-warning { grid-template-columns: 1fr; }
    body.admin-ui .pr-link { display: inline-flex; align-items: center; min-height: 2.5rem; }
    body.admin-ui .pr-items { min-width: 0; }
    body.admin-ui .pr-items thead { display: none; }
    body.admin-ui .pr-items tbody, body.admin-ui .pr-items tr, body.admin-ui .pr-items td { display: block; width: 100%; }
    body.admin-ui .pr-items tr { margin-bottom: .75rem; }
    body.admin-ui .pr-items td { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; text-align: right; overflow-wrap: anywhere; }
    body.admin-ui .pr-items td::before { content: attr(data-label); flex: none; max-width: 45%; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; text-align: left; color: var(--sa-emerald); }
    body.admin-ui .pr-items .pr-segment { white-space: normal; }
}

/* ---- Draft actions (Step 6D) ---- */
body.admin-ui .pr-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
body.admin-ui .pr-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 2.5rem; padding: .4rem 1rem; border: 0.5px solid var(--sa-emerald); border-radius: 8px; font-size: .85rem; font-weight: 600; line-height: 1.2; cursor: pointer; color: var(--sa-charcoal); background: #fff; }
body.admin-ui .pr-btn:hover { background: var(--sa-hover); }
body.admin-ui .pr-btn:disabled { cursor: not-allowed; opacity: .55; }
body.admin-ui .pr-btn-neutral { background: var(--sa-ivory); color: var(--sa-emerald); }
body.admin-ui .pr-btn-warn { background: rgba(214, 169, 67, .22); color: var(--sa-charcoal); }
body.admin-ui .pr-btn-warn:hover { background: rgba(214, 169, 67, .4); }
body.admin-ui .pr-btn-positive { background: var(--sa-emerald); color: var(--sa-ivory); }
body.admin-ui .pr-btn-positive:hover { background: var(--sa-emerald); opacity: .9; }
body.admin-ui .pr-notice { padding: .75rem 1rem; border: 0.5px solid var(--sa-emerald); border-radius: 8px; font-size: .875rem; color: var(--sa-emerald); background: rgba(6, 61, 50, .07); }
body.admin-ui .pr-alert { padding: .75rem 1rem; border: 0.5px solid var(--sa-emerald); border-radius: 8px; font-size: .875rem; color: var(--sa-charcoal); background: rgba(214, 169, 67, .22); }
body.admin-ui .pr-dialog-who { margin: 0 0 .6rem; padding: .5rem .75rem; border: 0.5px solid var(--sa-line); border-radius: 8px; background: var(--sa-ivory); }

@media (max-width: 640px) {
    body.admin-ui .pr-actions > .pr-btn, body.admin-ui .pr-items td .pr-btn { width: 100%; min-height: 2.75rem; }
}

/* ---- Run workflow actions (Step 6E) ---- */
body.admin-ui .pr-btn-danger { background: var(--sa-charcoal); color: var(--sa-ivory); }
body.admin-ui .pr-btn-danger:hover { background: var(--sa-charcoal); opacity: .9; }
body.admin-ui .pr-self-warning { margin: .75rem 0 0; padding: .75rem 1rem; border: 0.5px solid var(--sa-emerald); border-radius: 8px; font-size: .875rem; line-height: 1.45; color: var(--sa-charcoal); background: rgba(214, 169, 67, .3); }
body.admin-ui .pr-check { display: flex; align-items: flex-start; gap: .6rem; margin-top: .75rem; padding: .65rem .75rem; border: 0.5px solid var(--sa-emerald); border-radius: 8px; font-size: .875rem; line-height: 1.4; cursor: pointer; background: #fff; }
body.admin-ui .pr-check input { flex: none; width: 1.25rem; height: 1.25rem; margin-top: .1rem; accent-color: var(--sa-emerald); }

@media (max-width: 640px) {
    body.admin-ui .pr-check { min-height: 2.75rem; }
    body.admin-ui .pr-dialog .pr-btn { width: 100%; }
}

/* ---- Audit history and responsive refinements (Step 6F) ---- */
body.admin-ui .pr-header-links { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
body.admin-ui .pr-timeline { list-style: none; margin: 0; padding: 0; }
body.admin-ui .pr-event { display: grid; gap: .25rem 1.25rem; padding: .9rem 1.25rem; border-top: 0.5px solid var(--sa-line); grid-template-columns: 11rem minmax(0, 1fr); align-items: start; }
body.admin-ui .pr-event:nth-child(even) { background: var(--sa-stripe); }
body.admin-ui .pr-event-when { display: flex; flex-direction: column; font-size: .85rem; font-weight: 600; color: var(--sa-charcoal); }
body.admin-ui .pr-event-body { min-width: 0; overflow-wrap: anywhere; }
body.admin-ui .pr-event-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
body.admin-ui .pr-event-who { margin: .35rem 0 0; font-size: .875rem; }
body.admin-ui .pr-event-line { margin: .25rem 0 0; font-size: .85rem; line-height: 1.45; }
body.admin-ui .pr-dialog-body, body.admin-ui .pr-dialog-who { overflow-wrap: anywhere; }
body.admin-ui .pr-filters > * { min-width: 0; }

@media (max-width: 640px) {
    body.admin-ui .pr-event { grid-template-columns: minmax(0, 1fr); padding: .85rem 1rem; }
    body.admin-ui .pr-event-when { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: .5rem; }
    body.admin-ui .pr-runs td { overflow-wrap: anywhere; }
    body.admin-ui .pr-dialog { max-width: 100%; }
    body.admin-ui .pr-month-note { margin-left: 0; text-align: left; }
    body.admin-ui .pr-month { flex-wrap: wrap; }
    body.admin-ui .pr-header-links { gap: .25rem 1rem; }
}
/* ==================================================================== PAYROLL UI (Step 6) — end */
