/* =========================================================
   PG 7 ERP — SHARED general stylesheet
   ---------------------------------------------------------
   Loaded by BOTH systems (payroll + production), AFTER Bootstrap
   and BEFORE each system's own stylesheet.

   Put ONLY genuinely-general rules here (buttons, shared tokens,
   generic utilities). System-specific styling stays in each
   system's own CSS:
     - payroll/css/payroll.css, login.css
     - production/css/production.css, sidebar.css
   ========================================================= */

/* ---------------------------------------------------------
   Global button identity — typography/shape ONLY.
   Colour and width are intentionally left to each Bootstrap
   variant (btn-danger stays red, btn-white white, ...) and to
   the button's own layout, so nothing is clobbered.
   --------------------------------------------------------- */
.btn {
    font-family: "Fira Code", monospace;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-radius: 5px;
}

/* Tooltips — system-wide (Payroll / Production / Launchpad). Fira Code to match
   the app font, 25% smaller than Bootstrap's 0.875rem default (→ 0.65625rem),
   with 1px tighter tracking. Wins over Bootstrap's sans-serif .tooltip by load
   order (app.css is loaded after bootstrap on every page). */
.tooltip { --bs-tooltip-font-size: 0.65625rem; font-family: "Fira Code", monospace; }
.tooltip-inner { letter-spacing: -1px; }

/* =========================================================
   ERP SHELL — design tokens + dark sidebar (from Payroll)  2026-08-06
   Shared by both systems. System-specific sidebar extras
   (collapsible submenus, collapsed state, user profile) live
   in each system's own CSS, restyled for this dark theme.
   ========================================================= */
:root {
    --sidebar-width:        220px;
    --sidebar-bg:           #1a2535;
    --sidebar-hover:        rgba(255, 255, 255, 0.07);
    --sidebar-active:       rgba(255, 255, 255, 0.13);
    --sidebar-text:         rgba(255, 255, 255, 0.70);
    --sidebar-text-active:  #ffffff;
    --sidebar-group:        rgba(255, 255, 255, 0.30);
    --sidebar-accent:       #3b82f6;
    --sidebar-border:       rgba(255, 255, 255, 0.08);

    --surface-page:         #eef1f5;
    --surface-card:         #ffffff;
    --surface-topbar:       #ffffff;
    --topbar-h:             52px;

    --tab-text:             #64748b;
    --tab-hover:            #1e293b;
    --tab-active:           #2563eb;
    --tab-bar-border:       #e2e6ed;

    --card-hdr-bg:          #f8f9fa;
    --card-hdr-text:        #374151;
    --card-hdr-border:      #e5e7eb;

    --border:               #e2e6ed;
    --border-lt:            #eef1f5;
    --text:                 #1e293b;
    --text-secondary:       #64748b;
    --text-muted:           #94a3b8;
}

/* ---- Sidebar (dark) ---- */
#sidebar {
    width: var(--sidebar-width, 220px);
    flex-shrink: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--sidebar-bg, #1a2535);
    border-right: none;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.18);
    transition: width 0.25s ease-in-out;
    overflow: hidden;
    z-index: 100;
}
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 12px 12px;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}
.sidebar-logo { width: 30px; height: 30px; object-fit: contain; flex-shrink: 0; border-radius: 4px; }
.sidebar-app-name {
    font-size: 0.75rem; font-weight: 700; color: var(--sidebar-text-active);
    text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap; overflow: hidden;
}
.sidebar-content { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 6px 6px; scrollbar-width: none; }
.sidebar-content::-webkit-scrollbar { display: none; }
.sidebar-group-label {
    font-size: 0.6rem; font-weight: 700; color: var(--sidebar-group);
    text-transform: uppercase; letter-spacing: 0.14em; padding: 14px 10px 4px;
    pointer-events: none; user-select: none; list-style: none;
}
.sidebar-item { list-style: none; }
a.sidebar-link {
    display: flex; align-items: center; gap: 9px; padding: 7px 10px;
    color: var(--sidebar-text); font-size: 0.72rem; font-weight: 500; white-space: nowrap;
    text-transform: uppercase; letter-spacing: 0.04em; position: relative; border-radius: 5px;
    border-left: 2px solid transparent;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease; margin-bottom: 1px;
}
a.sidebar-link:hover { background: var(--sidebar-hover); color: var(--sidebar-text-active); }
.sidebar-item.active > a.sidebar-link {
    background: var(--sidebar-active); color: var(--sidebar-text-active);
    border-left-color: var(--sidebar-accent); font-weight: 600; padding-left: 8px;
}
.sidebar-link .bi {
    font-size: 1.1rem; line-height: 1; flex: 0 0 1.4rem; width: 1.4rem;
    display: inline-flex; align-items: center; justify-content: center; opacity: 0.75;
}
.sidebar-item.active > a.sidebar-link .bi { opacity: 1; }
.sidebar-link label { margin: 0; display: block; line-height: 1.2; cursor: pointer; }

/* =========================================================
   ERP SHELL — layout wrapper + topbar + profile + hamburger
   (from Payroll). Shared by both systems.  2026-08-07
   ========================================================= */
.main-wrapper { display: flex; height: 100vh; overflow: hidden; }
.inner-wrapper { flex: 1; display: flex; flex-direction: column; background-color: var(--surface-page); overflow: hidden; }

.topbar {
    height: var(--topbar-h, 52px);
    background: var(--surface-topbar);
    border-bottom: 1px solid var(--border);
    padding: 0 1.25rem;
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0; gap: 1rem;
}
.topbar-title {
    font-size: 0.8125rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.07em; color: var(--text);
    display: flex; align-items: baseline; gap: .6rem;
}
.topbar-title .topbar-date { font-size: .65rem; font-weight: 500; color: var(--text-muted); letter-spacing: .03em; text-transform: none; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 1rem; }

.topbar-profile { display: flex; align-items: center; gap: 8px; }
.topbar-avatar { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; object-fit: cover; border: 1px solid var(--border); }
.topbar-profile-info { display: flex; flex-direction: column; align-items: flex-start; text-align: left; line-height: 1.15; overflow: hidden; }
.topbar-user-name { font-size: .72rem; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-user-role { font-size: .6rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .05em; }
.topbar-profile-toggle { display: flex; align-items: center; gap: 8px; background: transparent; border: 0; padding: 4px 8px; border-radius: 8px; cursor: pointer; transition: background .12s ease; }
.topbar-profile-toggle:hover,
.topbar-profile-toggle[aria-expanded="true"] { background: var(--surface-page); }
.topbar-profile-caret { font-size: .65rem; color: var(--text-secondary); transition: transform .12s ease; }
.topbar-profile-toggle[aria-expanded="true"] .topbar-profile-caret { transform: rotate(180deg); }
.topbar-profile .dropdown-menu { font-size: .8rem; min-width: 180px; }
.topbar-profile .dropdown-header { line-height: 1.25; }

/* Hamburger + mobile drawer backdrop */
#sidebarBackdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1040; }
#sidebarBackdrop.active { display: block; }
#sidebarHamburger { display: none !important; background: none; border: none; padding: 4px 6px; color: var(--text); font-size: 1.25rem; line-height: 1; cursor: pointer; flex-shrink: 0; }

@media (max-width: 767.98px) {
    #sidebarHamburger { display: inline-flex !important; align-items: center; }
    .main-wrapper { display: block; height: auto; overflow: visible; }
    .inner-wrapper { height: auto; overflow: visible; }
    body { height: auto; overflow-y: auto; overflow-x: hidden; }
    .topbar { padding: 0 0.75rem; gap: 0.5rem; }
    .topbar-title { font-size: 0.75rem; }
    .topbar-profile-info { display: none; }
    #sidebar {
        position: fixed; top: 0; left: 0; height: 100%;
        width: var(--sidebar-width, 220px) !important;
        transform: translateX(-100%); transition: transform 0.25s ease-in-out; z-index: 1050;
    }
    #sidebar.mobile-open { transform: translateX(0); }
}

/* =========================================================
   ERP CARD SYSTEM (from Payroll). Shared by both systems.  2026-08-07
   Subtle bordered card + light uppercase header.
   ========================================================= */
.card {
    border: 0.5px solid var(--border) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    overflow: hidden;
}
.card-header {
    background-color: var(--card-hdr-bg) !important;
    border-bottom: 1px solid var(--card-hdr-border) !important;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--card-hdr-text);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* =========================================================
   ERP TYPOGRAPHY + MODAL + sidebar footer (from Payroll)  2026-08-07
   ========================================================= */
:root { --tbl-row-height: 28px; --tbl-cell-padding-x: .5rem; --tbl-font-size: 0.78rem; --modal-font-size: 0.72rem; }

/* Form labels */
.form-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); margin-bottom: 0.25rem; }
.form-check-label { font-size: 0.8rem; font-weight: 500; }

/* =========================================================
   ERP filter bar + teleported DataTables search — shared
   alignment. Moved here from payroll.css (2026-08-12) so every
   app AND the central ERP console (admin.php) render the filter
   label + search box identically, regardless of the placeholder id.
   ========================================================= */
.erp-filter-bar {
    padding: 0.5rem 1rem;
    background: var(--surface-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
    flex-shrink: 0;
    overflow: hidden;
}
.erp-filter-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-secondary);
    white-space: nowrap;
}
.erp-filter-bar .dt-search,
.erp-filter-bar .dataTables_filter { display: flex; align-items: center; padding: 0 !important; margin: 0 !important; }
.erp-filter-bar input[type="search"] {
    height: 31px !important;
    font-size: 0.875rem !important;
    border-color: var(--border) !important;
    border-radius: 4px !important;
    padding: 0 1.75rem 0 0.65rem !important;
    min-width: 0;
    width: 100%;
    flex: 1;
}
/* Filter-bar selects/inputs match the search box + the page form controls
   (0.875rem text, 31px height) so nothing in a filter bar looks undersized.
   2026-09-06 (was 0.75rem / 30px). */
.erp-filter-input {
    font-size: 0.875rem !important;
    height: 31px !important;
    border-color: var(--border) !important;
    border-radius: 4px !important; /* match the filter-bar search input (also 4px) */
}

/* Modal — icon + uppercase title, light header/footer, unified body font */
.modal-header { padding: 0.65rem 1rem; border-bottom: 1px solid var(--border); background: var(--card-hdr-bg); align-items: center; }
.modal-title { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; color: var(--card-hdr-text); text-transform: uppercase; display: flex; align-items: center; gap: 0.45rem; line-height: 1.4; }
.modal-title .bi { font-size: 0.95rem; color: var(--text-secondary); flex-shrink: 0; }
.modal-footer { padding: 0.55rem 1rem; border-top: 1px solid var(--border); background: var(--card-hdr-bg); gap: 0.4rem; }
.modal-footer > * { margin: 0; }
.modal-body label,
.modal-body small,
.modal-body .form-text,
.modal-body .input-group-text,
.modal-body :is(input.form-control, select.form-select, textarea.form-control),
.modal-body .btn,
.modal-footer .btn { font-size: var(--modal-font-size, 0.72rem); }

/* ---------------------------------------------------------
   Modal font-family — suite-wide (Point 3, 2026-09-06).
   Bootstrap appends modals to the DOM where they inherit body font, but
   some contexts left modal content on a non–Fira Code fallback. Pin the
   whole modal to Fira Code from one place; form controls pick it up via
   Bootstrap Reboot's `font-family: inherit` on input/select/textarea, so
   this single rule covers every modal in Payroll + Production.
   --------------------------------------------------------- */
.modal-content { font-family: "Fira Code", monospace; }

/* ---------------------------------------------------------
   <select> / <input> uniformity — suite-wide (Point 2, revised 2026-09-06).
   Selects share the app font (Fira Code) AND match text inputs in
   font-size + height, so a <select> and a <input> sitting side by side
   line up. Values per request: 0.875rem text, Bootstrap's compact control
   height. Modals keep their own smaller scale via the .modal-body rule.
   --------------------------------------------------------- */
.form-select { font-family: "Fira Code", monospace; }
.form-select,
.form-control {
	font-size: 0.875rem;
	min-height: calc(1.5em + 0.5rem + calc(var(--bs-border-width) * 2));
	/* Balanced vertical padding so the (single-line) text sits centered at the
	   shared height — without this, non-sm selects forced to a fixed height
	   overflow their line box and read as top-aligned. 2026-09-06 */
	padding-top: 0.25rem;
	padding-bottom: 0.25rem;
}

/* ---------------------------------------------------------
   Payroll Processing — mobile action dropdown (Point 6, 2026-09-06).
   The same btn-* buttons are re-used inside a dropdown on small screens;
   stack them full-width so they read as a proper menu. A button hidden by
   state logic (d-none) stays hidden here too.
   --------------------------------------------------------- */
.pp-actions-menu { min-width: 14rem; padding: 0.3rem; }
/* Reused .btn action buttons, restyled to read as dropdown-menu rows
   (icon on the left, label after, neutral colours, hover highlight) —
   matching the launchpad profile menu. State colours (btn-success etc.)
   are intentionally flattened here; the desktop row keeps them. */
.pp-actions-menu .btn {
	display: flex !important;
	width: 100%;
	align-items: center;
	justify-content: flex-start;
	gap: 0.55rem;
	margin: 0;
	padding: 0.45rem 0.7rem;
	background: transparent !important;
	border: 0 !important;
	box-shadow: none !important;
	color: var(--text) !important;
	text-transform: none;
	letter-spacing: normal;
	font-weight: 600;
	border-radius: 6px;
}
.pp-actions-menu .btn:hover,
.pp-actions-menu .btn:focus {
	background: var(--bs-tertiary-bg, rgba(0, 0, 0, 0.06)) !important;
	color: var(--text) !important;
}
.pp-actions-menu .btn[disabled] { opacity: 0.45; pointer-events: none; }
.pp-actions-menu .btn .vr { display: none; }                 /* drop the label/icon divider */
.pp-actions-menu .btn .btn-label { order: 2; }               /* text after… */
.pp-actions-menu .btn .btn-icon-slot { order: 1; }           /* …the icon */
.pp-actions-menu .btn .btn-icon { color: var(--text-secondary); }
.pp-actions-menu .btn.d-none { display: none !important; }   /* keep state-hidden actions hidden */

/* =========================================================
   Validation icon overlap fix (Bootstrap 5.3).  .was-validated pins a
   valid/invalid icon as a right-edge background-image. On native-control
   inputs (date/time/etc.) it collides with the browser's own picker glyph,
   and on <select> it crowds the dropdown caret. Keep the validation BORDER
   colour, but drop the redundant icon for these controls.  2026-09-03
   ========================================================= */
.was-validated input[type="date"].form-control:valid,
.was-validated input[type="date"].form-control:invalid,
.was-validated input[type="datetime-local"].form-control:valid,
.was-validated input[type="datetime-local"].form-control:invalid,
.was-validated input[type="time"].form-control:valid,
.was-validated input[type="time"].form-control:invalid,
.was-validated input[type="month"].form-control:valid,
.was-validated input[type="month"].form-control:invalid,
.was-validated input[type="week"].form-control:valid,
.was-validated input[type="week"].form-control:invalid,
input[type="date"].form-control.is-valid,
input[type="date"].form-control.is-invalid,
input[type="datetime-local"].form-control.is-valid,
input[type="datetime-local"].form-control.is-invalid,
input[type="time"].form-control.is-valid,
input[type="time"].form-control.is-invalid,
input[type="month"].form-control.is-valid,
input[type="month"].form-control.is-invalid,
input[type="week"].form-control.is-valid,
input[type="week"].form-control.is-invalid {
    background-image: none;
    padding-right: 0.5rem;
}
/* Selects: keep the caret (--bs-form-select-bg-img), drop only the validation
   icon (--bs-form-select-bg-icon) and revert the padding/position it added.
   Bootstrap nests its select validation rule under :not([multiple]):not([size])
   — specificity (0,4,0). This override MUST mirror those qualifiers or it loses
   the cascade (a flat .form-select.is-invalid is only (0,2,0)). */
.was-validated .form-select:valid:not([multiple]):not([size]),
.was-validated .form-select:valid:not([multiple])[size="1"],
.was-validated .form-select:invalid:not([multiple]):not([size]),
.was-validated .form-select:invalid:not([multiple])[size="1"],
.form-select.is-valid:not([multiple]):not([size]),
.form-select.is-valid:not([multiple])[size="1"],
.form-select.is-invalid:not([multiple]):not([size]),
.form-select.is-invalid:not([multiple])[size="1"] {
    --bs-form-select-bg-icon: none;
    padding-right: 2.25rem;
    background-position: right 0.75rem center;
}

/* =========================================================
   PDF paper/orientation settings table — used by the per-page gear modals
   and the System Config → Print/Export page in BOTH apps. Moved here from
   production.css (2026-09-03) so Production and Payroll share one style.
   ========================================================= */
.pdf-settings-table th,
.pdf-settings-table td:first-child { font-size: 0.72rem; }
/* Sub-group header rows (e.g. Default / Documents / Reports / Input Production). */
.pdf-settings-table .pdf-group td { font-weight: 700; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); background: var(--card-hdr-bg); border-bottom: 1px solid var(--card-hdr-border); }

/* =========================================================
   "Who's online" presence stack (bottom-right) — shared by Payroll,
   Production, and the Launchpad. Populated by shared/js/presence.js;
   hidden until it has content. All colours use var(…, fallback) so it
   renders correctly even where an app hasn't defined the token.  2026-09-03
   ========================================================= */
.presence-stack {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1030; /* above content, below Bootstrap modals (1055) */
    display: none;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 10px;
    background: var(--surface-card, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 999px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.12);
}
.presence-stack.is-visible { display: inline-flex; }
.presence-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    white-space: nowrap;
}
.presence-label .bi { color: var(--role-po, #059669); font-size: .8rem; }
.presence-avatars { display: inline-flex; align-items: center; }
.presence-avatar {
    position: relative;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid var(--surface-card, #fff);
    box-shadow: 0 0 0 1px var(--border, #e2e8f0);
    margin-left: -8px;
    overflow: hidden;
    transition: transform .12s ease;
    cursor: default;
}
.presence-avatars .presence-avatar:first-child { margin-left: 0; }
.presence-avatar:hover,
.presence-avatar:focus-visible { transform: translateY(-2px); z-index: 2; outline: none; }
/* Profile photo overlays the initials badge, filling the circle; if it fails to
   load the JS removes it and the role-coloured initials underneath show through. */
.presence-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.presence-avatar-badge {
    background: var(--sidebar-accent, #3b82f6);
    color: #fff;
    font-size: .55rem;
    font-weight: 700;
    letter-spacing: .04em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
/* Per-role fallbacks; the inline colour from roles.badge_color still wins. */
.presence-avatar-badge--adm { background: var(--role-adm); }
.presence-avatar-badge--po  { background: var(--role-po);  }
.presence-avatar-badge--tk  { background: var(--role-tk);  }
.presence-avatar-badge--sv  { background: var(--role-sv);  }
.presence-avatar-badge--emp { background: var(--role-emp); }
.presence-avatar-badge--dev { background: #475569; } /* dev/support — matches topbar-avatar-badge--dev */
.presence-avatar--self { box-shadow: 0 0 0 2px var(--role-po, #059669); }
.presence-avatar-more {
    background: var(--surface-page, #eef1f5);
    color: var(--text-muted, #64748b);
    font-size: .62rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
@media (max-width: 767px) {
    .presence-stack { right: 10px; bottom: 10px; padding: 5px 10px 5px 8px; }
    .presence-label { font-size: 0; gap: 0; }   /* collapse the "N online" text… */
    .presence-label .bi { font-size: .9rem; }   /* …leaving just the broadcast icon */
}

/* =========================================================
   Modal open behaviour + loading state + spinner + entity badge.
   Moved here from payroll.css (2026-08-12) so the ERP console and
   every app share the same modal look/feel: the dialog scales up
   (0.95 → 1) and fades in on open, with a soft backdrop.
   ========================================================= */
.modal .modal-content { transition: filter 0.5s ease; }
.modal.loading .modal-content { position: relative; filter: brightness(0.8); pointer-events: none; }
.modal.loading .modal-content::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, 0.3); backdrop-filter: blur(1px); z-index: 1000; }
.modal.fade .modal-dialog { transform: scale(0.95); opacity: 0; transition: transform 0.3s ease, opacity 0.3s ease; }
.modal.fade.show .modal-dialog { transform: scale(1); opacity: 1; }
.modal-backdrop.fade { opacity: 0; transition: opacity 0.3s ease; }
.modal-backdrop.fade.show { opacity: 0.5; }

/* Spinner overlay inside .modal-dialog (outside .modal-content) — shown by
   toggling display:flex (or adding .loading on the .modal). */
.modal-spinner { position: absolute; inset: 0; background: rgba(255, 255, 255, 0.72); display: none; flex-direction: column; align-items: center; justify-content: center; z-index: 1060; border-radius: inherit; pointer-events: all; }
.modal-spinner .spinner-border { width: 2rem; height: 2rem; border-width: 3px; color: var(--bs-secondary); }

/* ERP entity badge — the small bordered chip used in modal titles
   ("Set Password — <username>") and inline references. */
.erp-emp-id-badge { font-size: 0.65rem; font-weight: 700; color: var(--text-secondary); background: var(--surface-page); border: 1px solid var(--border); border-radius: 3px; padding: 1px 6px; letter-spacing: 0.04em; text-transform: uppercase; }

/* ERP version badge — the dark navy version chip on Patch Notes / Platform
   Updates. Pair with Bootstrap's .badge. Shared by all patch-note surfaces. */
.erp-version-badge { background: var(--sidebar-bg); color: #fff; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; }

/* ERP inner tab bar — secondary tabs inside a card (Payroll UM, Production UM).
   Shared so both surfaces get the same compact uppercase tabs. */
.erp-inner-tabbar { padding: 0 1rem; background: var(--surface-card); border-bottom: 1px solid var(--border); }
.erp-inner-tabbar .nav-tabs { border-bottom: none; gap: 0; }
.erp-inner-tabbar .nav-tabs .nav-link { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--tab-text); border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 0.6rem 0.9rem; margin-bottom: -1px; transition: color 0.12s ease, border-color 0.12s ease; }
.erp-inner-tabbar .nav-tabs .nav-link:hover { color: var(--tab-hover); background: transparent; border-bottom-color: var(--border); }
.erp-inner-tabbar .nav-tabs .nav-link.active { color: var(--tab-active); background: transparent; border-bottom-color: var(--tab-active); font-weight: 700; }

/* ERP config-table styling (Payroll parity) — opt-in via an .erp-tables ancestor
   so admin/config tables get flat borderless cell inputs, compact uppercase
   headers, and small cell text WITHOUT touching an app's operational tables. */
.erp-tables .table { margin-bottom: 0; }
.erp-tables .table :is(th, td) { height: var(--tbl-row-height, 28px); padding: 0; vertical-align: middle !important; white-space: nowrap; }
.erp-tables .table td:not(:has(:is(input, select, button))),
.erp-tables .table th { padding-inline: var(--tbl-cell-padding-x, .5rem); }
.erp-tables .table thead th { background: var(--card-hdr-bg) !important; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--card-hdr-text); box-shadow: inset 0 -1px 0 var(--card-hdr-border); }
.erp-tables .table.table-sm,
.erp-tables .table.table-sm :is(input, select, button),
.erp-tables .table tbody td { font-size: var(--tbl-font-size, 0.78rem); }
.erp-tables .table tbody :is(input.form-control, select.form-select, button.btn) { height: calc(var(--tbl-row-height, 28px) - 2px); min-height: unset; padding: 0 var(--tbl-cell-padding-x, .5rem); border: 0; border-radius: 0; box-shadow: none !important; }

/* =========================================================
   ERP inline notices (info / warning / danger / success).
   Icon + text callout box. Moved here from payroll.css
   (2026-08-13) so the ERP console and every app share them.
   ========================================================= */
.erp-info-notice,
.erp-warning-notice,
.erp-danger-notice,
.erp-success-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.65rem 0.9rem;
    border: 1px solid;
    border-radius: 5px;
    font-size: 0.72rem;
    line-height: 1.5;
}
.erp-info-notice .bi,
.erp-warning-notice .bi,
.erp-danger-notice .bi,
.erp-success-notice .bi {
    font-size: 0.9rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}
.erp-info-notice code,
.erp-warning-notice code,
.erp-danger-notice code,
.erp-success-notice code {
    border-radius: 3px;
    padding: 0 0.3em;
    font-size: 0.9em;
}
/* Variant colours */
.erp-info-notice    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.erp-warning-notice { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.erp-danger-notice  { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.erp-success-notice { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.erp-info-notice code    { background: rgba(30,  64, 175, 0.10); }
.erp-warning-notice code { background: rgba(146, 64,  14, 0.10); }
.erp-danger-notice code  { background: rgba(153, 27,  27, 0.10); }
.erp-success-notice code { background: rgba(22,  101, 52, 0.10); }
/* Inline action link inside a notice — inherits the notice's own colour so it
   stays on-palette (not default link-blue); underlined + bold to read as a link. */
.erp-notice-link { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.erp-notice-link:hover,
.erp-notice-link:focus { color: inherit; opacity: 0.75; }

.btn-dark { background: var(--sidebar-bg) !important; border-color: var(--sidebar-bg) !important; color: #fff !important; }
.btn-dark:hover { filter: brightness(1.15); }

/* Sidebar footer / app-version (Payroll structure) */
.sidebar-footer { padding: 10px 12px; border-top: 1px solid var(--sidebar-border); flex-shrink: 0; }
.sidebar-app-version { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; }
.sidebar-app-version-name { font-size: 0.62rem; font-weight: 700; color: var(--sidebar-text); text-transform: uppercase; letter-spacing: 0.08em; }
.sidebar-app-version-num { font-size: 0.58rem; color: var(--sidebar-group); }

/* =========================================================
   ERP DASHBOARD — hero banner + KPI cards (from Payroll)  2026-08-07
   ========================================================= */
.db-hero {
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, #243650 55%, var(--tab-active) 130%);
    color: #fff;
    border-radius: var(--bs-border-radius, .5rem);
    padding: 1.25rem 1.5rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    box-shadow: 0 6px 18px rgba(26, 37, 53, .18);
}
.db-hero-greeting { font-size: 1.15rem; font-weight: 600; line-height: 1.25; }
.db-hero-sub { font-size: .8rem; color: rgba(255,255,255,.72); margin-top: .15rem; }
.db-hero-date {
    display: inline-flex; align-items: center; gap: .45rem;
    background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18);
    border-radius: 999px; padding: .4rem .85rem; font-size: .82rem; font-weight: 500; white-space: nowrap;
}
.db-kpi {
    border: 1px solid var(--border); border-radius: var(--bs-border-radius, .5rem);
    background: var(--surface-card); padding: 1rem 1.1rem; height: 100%;
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    position: relative; overflow: hidden; transition: transform .15s ease, box-shadow .15s ease;
}
.db-kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--db-accent, var(--tab-active)); }
.db-kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(30,41,59,.08); }
.db-kpi-label { font-size: .68rem; letter-spacing: .04em; text-transform: uppercase; color: var(--text-secondary); font-weight: 600; }
.db-kpi-value { font-size: 1.75rem; font-weight: 700; color: var(--text); line-height: 1.1; margin-top: .15rem; }
.db-kpi-icon { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.4rem; color: var(--db-accent, var(--tab-active)); background: var(--db-accent-soft, rgba(37,99,235,.1)); }
.db-kpi--amber  { --db-accent: #d97706; --db-accent-soft: rgba(217,119,6,.12); }
.db-kpi--violet { --db-accent: #7c3aed; --db-accent-soft: rgba(124,58,237,.12); }
.db-kpi--teal   { --db-accent: #0d9488; --db-accent-soft: rgba(13,148,136,.12); }
.db-kpi--blue   { --db-accent: var(--tab-active); --db-accent-soft: rgba(37,99,235,.1); }

/* Dashboard chart container (canonical) — Payroll attendance charts + Production
   egg charts both use this. Canvas fills it; the card provides border/bg/radius. */
.db-chart-box { position: relative; width: 100%; height: 260px; }

/* =========================================================
   ERP ACTION BUTTONS — btn-icon-mode (from Payroll)  2026-08-07
   Icon → spinner (processing) → checkmark (success), + label
   typography + subtle vertical divider. Shared by both systems.
   ========================================================= */
.btn-icon-mode .btn-spinner,
.btn-icon-mode .btn-checkmark { display: none; }
.btn-icon-mode.is-processing .btn-icon { display: none; }
.btn-icon-mode.is-processing .btn-spinner { display: inline-block; }
.btn-icon-mode.is-success .btn-icon { display: none; }
.btn-icon-mode.is-success .btn-checkmark { display: inline-block; }
/* Fixed-size slot: the icon (line box 1.5em), spinner (1rem) and checkmark all
   occupy the same box, so swapping states on click doesn't reflow the button.
   Height matters as much as width — the Bootstrap icon's 1.5em line box is
   taller than the 1rem spinner, so without a fixed height the button shrinks
   ~4px vertically (and re-centers) during the processing state. */
button.btn-icon-mode .btn-icon-slot { display: inline-flex; align-items: center; justify-content: center; width: 1rem; height: 1.5em; flex: 0 0 auto; }
.btn-icon-mode .btn-spinner { width: 1rem; height: 1rem; }
.btn.btn-icon-mode .btn-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.btn.btn-icon-mode .vr { opacity: 0.25; margin-inline: 0.1rem; }

/* Topbar profile avatar badge — role-abbreviation chip shared by every ERP
   surface (Payroll, Production, launchpad) so the profile "icon" is identical
   everywhere. Color is set per-user via an inline background. */
.topbar-avatar-badge {
	width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
	background: var(--sidebar-accent, #3b82f6); color: #fff;
	font-size: .55rem; font-weight: 700; letter-spacing: .04em;
	display: inline-flex; align-items: center; justify-content: center;
}
/* Dev/support accounts — one shared slate badge across Payroll, Production and
   the Launchpad. Applied via the "topbar-avatar-badge--dev" modifier class.
   Compound selector (0,2,0 specificity) so it wins even where an app's own CSS
   redefines the base .topbar-avatar-badge background after this file loads
   (e.g. payroll.css). */
.topbar-avatar-badge.topbar-avatar-badge--dev { background: #475569; }

/* =========================================================
   ERP Button — Override btn-secondary with flat light style
   (from Payroll). Uses Bootstrap 5.3 CSS variable API so no
   !important needed. Shared by both systems.  2026-08-07
   ========================================================= */
.btn-secondary {
    --bs-btn-bg:                  #f1f5f9;
    --bs-btn-color:               #1e293b;
    --bs-btn-border-color:        #dde2e8;
    --bs-btn-hover-bg:            #e2e8f0;
    --bs-btn-hover-color:         #1e293b;
    --bs-btn-hover-border-color:  #c8d3de;
    --bs-btn-focus-shadow-rgb:    203, 213, 225;
    --bs-btn-active-bg:           #d5e0ec;
    --bs-btn-active-color:        #1e293b;
    --bs-btn-active-border-color: #c8d3de;
    --bs-btn-disabled-bg:         #f1f5f9;
    --bs-btn-disabled-color:      #94a3b8;
    --bs-btn-disabled-border-color: #dde2e8;
}

/* =========================================================
   ERP Button — btn-white (minimal text+icon button used in table
   OPT columns, the launchpad Settings button, etc.). Bootstrap has
   NO .btn-white variant, so without these tokens its :active/:focus
   border-color falls back to currentColor (dark) — that was the
   black outline on click. Keep the border transparent in every
   state; only a soft tinted background on hover/active.  2026-08-13
   ========================================================= */
.btn-white {
    --bs-btn-bg:                    transparent;
    --bs-btn-color:                 #1e293b;
    --bs-btn-border-color:          transparent;
    --bs-btn-hover-bg:              #f1f5f9;
    --bs-btn-hover-color:           #1e293b;
    --bs-btn-hover-border-color:    transparent;
    --bs-btn-focus-shadow-rgb:      203, 213, 225;
    --bs-btn-active-bg:             #e2e8f0;
    --bs-btn-active-color:          #1e293b;
    --bs-btn-active-border-color:   transparent;
    --bs-btn-disabled-bg:           transparent;
    --bs-btn-disabled-color:        #94a3b8;
    --bs-btn-disabled-border-color: transparent;
}

/* =========================================================
   ERP TABLES — DataTables active-page color (from Payroll).
   Generic (not scoped to .table-container) so it applies to
   BOTH systems' DT 2.x pagination.  2026-08-07
   ========================================================= */
.dt-paging .pagination .page-item.active .page-link,
.dt-paging .pagination .page-item.current .page-link,
.dt-paging .pagination .dt-paging-button.current .page-link,
.dt-paging .pagination .dt-paging-button.current button.page-link {
    background-color: var(--tab-active) !important;
    border-color:     var(--tab-active) !important;
    color: #fff !important;
    font-weight: 700;
    box-shadow: none !important;
}
.dt-paging .pagination .page-item:not(.disabled):not(.active):not(.current) .page-link:hover {
    background-color: var(--surface-page) !important;
    color:            var(--text) !important;
}

/* =========================================================
   MODULE TAB BAR — per-page sub-navigation (from Payroll).
   Sits below the topbar; renderNavButton() produces the tabs.
   Shared by both systems.  2026-08-07
   ========================================================= */
.content-button-group {
    padding: 0 1.25rem;
    background: var(--surface-topbar);
    border-bottom: 1px solid var(--tab-bar-border);
    flex-shrink: 0;
    display: flex;
    justify-content: flex-start;   /* tabs always left-aligned */
    align-items: stretch;
}
.content-button-group .btn-group {
    display: flex;
    gap: 0;
    border: none;
    border-radius: 0;
    margin-top: 0;
    width: auto;
}
.content-button-group .mt-3 { margin-top: 0; }
.content-button-group .btn-group > .btn.btn-outline-dark {
    border: none !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 0 !important;
    margin-bottom: -1px;
    padding: 0.75rem 1.1rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--tab-text);
    background: transparent;
    box-shadow: none !important;
    white-space: nowrap;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.content-button-group .btn-group > .btn.btn-outline-dark:hover {
    color: var(--tab-hover);
    background: transparent;
    border-bottom-color: var(--border) !important;
}
.content-button-group .btn-group > .btn.btn-outline-dark.active {
    color: var(--tab-active);
    border-bottom-color: var(--tab-active) !important;
    background: transparent;
    font-weight: 700;
}

/* =========================================================
   Carbon-style DataTables pager footer — shared by Production + Payroll.
   Opt-in: add the class to the DataTables container in initComplete
     $( api.table().container() ).addClass( "erp-dt-carbon" );
   and pair with a Carbon layout
     layout: { bottomStart: ["pageLength","info"], bottomEnd: "paging" }.
   DataTables 2 (bootstrap5) builds controls in Bootstrap .row/.col wrappers
   (NOT .dt-layout-row). In a p-0 card body the column gutter (--bs-gutter-x)
   insets the table and the .mt-2 row margins add stray gaps — neutralize both
   so the table sits flush, then turn the pager row into a footer that continues
   the table (shares its L/R/B border; the table's own bottom border divides).
   Footer: white bar, borderless "ITEMS PER PAGE" select + item count grouped
   left, arrow buttons right, full-height dividers. Verified vs DataTables 2.3.4.
   ========================================================= */
.erp-dt-carbon > .row { margin: 0 !important; --bs-gutter-x: 0; }
.erp-dt-carbon table.dataTable { margin: 0; width: 100%; }

.erp-dt-carbon > .row:has(.dt-paging) {
    padding: 0 !important;
    background: var(--surface-card, #fff);
    align-items: stretch;
    border: 1px solid var(--border);
    border-top: 0; /* the table's own bottom border is the divider */
    flex-wrap: nowrap; /* keep the footer on ONE line even below the md breakpoint
                          (narrow sidebars like the Payroll employee list) */
}
.erp-dt-carbon > .row:has(.dt-paging) > * { flex: 0 0 auto; width: auto; }
.erp-dt-carbon .dt-length,
.erp-dt-carbon .dt-info,
.erp-dt-carbon .dt-paging { margin: 0; }
/* Match the "FILTER" label typography (0.68rem / 700 / uppercase). */
.erp-dt-carbon .dt-length,
.erp-dt-carbon .dt-length label,
.erp-dt-carbon .dt-length select.form-select,
.erp-dt-carbon .dt-info {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-secondary);
}
.erp-dt-carbon .dt-length {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0 0.9rem;
    white-space: nowrap;
}
.erp-dt-carbon .dt-length label { margin: 0; }
.erp-dt-carbon .dt-length select.form-select {
    border: 0;
    background-color: transparent;
    box-shadow: none !important;
    width: auto;
    padding: 0.15rem 1.5rem 0.15rem 0.35rem;
}
.erp-dt-carbon .dt-info {
    display: flex;
    align-items: center;
    padding: 0 1rem;
    color: var(--text-secondary);
    border-left: 1px solid var(--border);
}
/* Pager — clean square arrow buttons with a left divider each. */
.erp-dt-carbon .dt-paging { display: flex; align-items: stretch; }
.erp-dt-carbon .dt-paging .pagination { margin: 0; }
.erp-dt-carbon .dt-paging .page-item { display: flex; }
.erp-dt-carbon .dt-paging .page-link {
    border: 0;
    border-left: 1px solid var(--border);
    border-radius: 0 !important;
    background: transparent;
    color: var(--text);
    width: 2.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    padding: 0;
}
.erp-dt-carbon .dt-paging .page-link:hover { background: var(--surface-page, #eef1f5); }
.erp-dt-carbon .dt-paging .page-item.disabled .page-link { color: var(--text-muted); background: transparent; }
