/**
 * Monjez ERP — Premium theme layer (loaded after sb-admin-2.min.css)
 * Design tokens + SB Admin 2 / Bootstrap 4 overrides + RTL scaffold
 */

/* -------------------------------------------------------------------------- */
/* Design tokens                                                               */
/* -------------------------------------------------------------------------- */
:root {
    --erp-brand-slate: #0f172a;
    --erp-brand-slate-mid: #1e293b;
    --erp-brand-slate-soft: #334155;
    --erp-primary: #2563eb;
    --erp-primary-hover: #1d4ed8;
    --erp-primary-soft: rgba(37, 99, 235, 0.12);
    --erp-accent: #f59e0b;
    --erp-success: #059669;
    --erp-success-soft: rgba(5, 150, 105, 0.12);
    --erp-warning: #d97706;
    --erp-warning-soft: rgba(217, 119, 6, 0.12);
    --erp-danger: #dc2626;
    --erp-danger-soft: rgba(220, 38, 38, 0.12);
    --erp-info: #0891b2;
    --erp-info-soft: rgba(8, 145, 178, 0.12);

    --erp-neutral-50: #f8fafc;
    --erp-neutral-100: #f1f5f9;
    --erp-neutral-200: #e2e8f0;
    --erp-neutral-300: #cbd5e1;
    --erp-neutral-400: #94a3b8;
    --erp-neutral-500: #64748b;
    --erp-neutral-600: #475569;
    --erp-neutral-700: #334155;
    --erp-neutral-800: #1e293b;
    --erp-neutral-900: #0f172a;

    --erp-surface: #ffffff;
    --erp-surface-muted: var(--erp-neutral-50);
    --erp-border: var(--erp-neutral-200);
    --erp-text: var(--erp-neutral-800);
    --erp-text-muted: var(--erp-neutral-500);

    --erp-font-sans: "Cairo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --erp-font-mono: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;

    --erp-radius-sm: 6px;
    --erp-radius-md: 10px;
    --erp-radius-lg: 14px;
    --erp-radius-xl: 20px;
    --erp-radius-pill: 999px;

    --erp-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
    --erp-shadow-sm: 0 4px 14px rgba(15, 23, 42, 0.07);
    --erp-shadow-md: 0 10px 30px rgba(15, 23, 42, 0.1);
    --erp-shadow-lg: 0 18px 45px rgba(15, 23, 42, 0.12);

    --erp-transition-fast: 0.15s ease;
    --erp-transition-base: 0.22s ease;

    --erp-topbar-height: 4.25rem;
    --erp-sidebar-width: 14rem;
}

/* Typography: Cairo for UI; preserve Font Awesome & monospace */
body {
    font-family: var(--erp-font-sans);
    color: var(--erp-text);
    background: linear-gradient(180deg, var(--erp-neutral-50) 0%, #eef2f7 55%, var(--erp-neutral-100) 100%);
    -webkit-font-smoothing: antialiased;
}

body,
.form-control,
.custom-select,
.btn,
.dropdown-menu,
.modal-content,
.nav-link {
    font-family: var(--erp-font-sans);
}

/* Icon fonts must not inherit Cairo */
.fa,
.fas,
.far,
.fal,
.fab,
[class^="fa-"],
.fontawesome-i2svg-active,
.fontawesome-i2svg-complete {
    font-family: "Font Awesome 5 Free" !important;
}

code,
kbd,
pre,
samp {
    font-family: var(--erp-font-mono);
}

a {
    color: var(--erp-primary);
    transition: color var(--erp-transition-fast);
}

a:hover {
    color: var(--erp-primary-hover);
}

/* Primary / utilities mapped to tokens */
.text-primary {
    color: var(--erp-primary) !important;
}

.bg-primary {
    background-color: var(--erp-primary) !important;
    border-color: var(--erp-primary) !important;
}

.bg-gradient-primary {
    background: linear-gradient(165deg, var(--erp-primary) 0%, #1e40af 100%) !important;
}

.border-left-primary {
    border-left-color: var(--erp-primary) !important;
}

.btn {
    border-radius: var(--erp-radius-md);
    font-weight: 600;
    transition: background-color var(--erp-transition-fast), border-color var(--erp-transition-fast),
        box-shadow var(--erp-transition-fast), transform var(--erp-transition-fast);
}

.btn:focus,
.form-control:focus,
.custom-select:focus {
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.18);
}

.btn-primary {
    background-color: var(--erp-primary);
    border-color: var(--erp-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--erp-primary-hover);
    border-color: var(--erp-primary-hover);
}

.btn-sm {
    border-radius: var(--erp-radius-sm);
}

/* -------------------------------------------------------------------------- */
/* Shell: sidebar (slate premium)                                              */
/* -------------------------------------------------------------------------- */
.sidebar.erp-sidebar,
ul.navbar-nav.sidebar.erp-sidebar {
    background: linear-gradient(185deg, var(--erp-brand-slate) 0%, var(--erp-brand-slate-mid) 48%, #0b1220 100%);
    box-shadow: 6px 0 24px rgba(0, 0, 0, 0.18);
}

.sidebar.erp-sidebar .sidebar-brand {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
    padding-top: 1.35rem;
    padding-bottom: 1.35rem;
}

.sidebar.erp-sidebar .sidebar-brand-icon {
    font-size: 1.75rem;
    opacity: 0.95;
}

.sidebar.erp-sidebar .sidebar-heading {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding-left: 1rem;
    padding-right: 1rem;
}

.sidebar.erp-sidebar .nav-item .nav-link {
    color: rgba(255, 255, 255, 0.82);
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: var(--erp-radius-md);
    margin: 0.18rem 0.55rem;
    padding: 0.62rem 0.85rem;
    transition: background var(--erp-transition-fast), color var(--erp-transition-fast), box-shadow var(--erp-transition-fast);
}

.sidebar.erp-sidebar .nav-item .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar.erp-sidebar .nav-item.active > .nav-link:first-child,
.sidebar.erp-sidebar .nav-item .nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, var(--erp-primary) 0%, #1d4ed8 100%);
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.35);
}

.sidebar.erp-sidebar .collapse-inner {
    background: rgba(15, 23, 42, 0.55) !important;
    border-radius: var(--erp-radius-md) !important;
    margin: 0.35rem 0.5rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar.erp-sidebar .collapse-item {
    color: rgba(255, 255, 255, 0.78) !important;
    border-radius: var(--erp-radius-sm);
    padding: 0.45rem 0.65rem;
    font-size: 0.84rem;
}

.sidebar.erp-sidebar .collapse-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff !important;
}

.sidebar.erp-sidebar .collapse-header {
    color: rgba(255, 255, 255, 0.45) !important;
    font-size: 0.65rem;
    letter-spacing: 0.06em;
}

.sidebar.erp-sidebar hr.sidebar-divider {
    border-top-color: rgba(255, 255, 255, 0.08);
}

.erp-sidebar-brand-sub {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 0.15rem;
}

.erp-role-chip {
    display: inline-block;
    margin-top: 0.35rem;
    padding: 0.12rem 0.45rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--erp-radius-pill);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

/* -------------------------------------------------------------------------- */
/* Shell: topbar (glass)                                                       */
/* -------------------------------------------------------------------------- */
.topbar.erp-topbar {
    position: relative;
    z-index: 1035;
    background: rgba(255, 255, 255, 0.82) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--erp-border);
    box-shadow: var(--erp-shadow-sm);
    min-height: var(--erp-topbar-height);
    margin-bottom: 1.25rem !important;
}

.topbar.erp-topbar .navbar-search .form-control {
    border-radius: var(--erp-radius-pill);
    border: 1px solid var(--erp-border);
    background: var(--erp-surface);
    min-width: 220px;
}

.topbar.erp-topbar .navbar-search .btn {
    border-radius: var(--erp-radius-pill);
}

.erp-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    font-size: 0.875rem;
    color: var(--erp-text-muted);
    margin: 0;
    padding: 0;
    list-style: none;
}

.erp-breadcrumb li {
    display: inline-flex;
    align-items: center;
}

.erp-breadcrumb li + li::before {
    content: "/";
    margin: 0 0.5rem;
    color: var(--erp-neutral-300);
    font-weight: 400;
}

.erp-breadcrumb a {
    color: var(--erp-text-muted);
    text-decoration: none;
}

.erp-breadcrumb a:hover {
    color: var(--erp-primary);
}

.erp-breadcrumb .active {
    color: var(--erp-text);
    font-weight: 600;
}

.erp-page-title-block h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--erp-neutral-900);
    letter-spacing: -0.02em;
    margin: 0;
}

.erp-page-title-block .text-muted {
    font-size: 0.8rem;
}

.erp-search-hint {
    font-size: 0.65rem;
    color: var(--erp-neutral-400);
    margin-left: 0.35rem;
}

.erp-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--erp-radius-pill);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(145deg, var(--erp-primary), #1e40af);
    border: 2px solid rgba(255, 255, 255, 0.85);
    box-shadow: var(--erp-shadow-xs);
}

.erp-topbar .img-profile {
    border: 2px solid var(--erp-neutral-200);
}

.topbar-divider {
    border-left-color: var(--erp-border) !important;
}

.erp-topbar .dropdown-menu {
    z-index: 1040;
}

/* Notification bell */
.erp-nav-icon-btn .fa-fw {
    font-size: 1.05rem;
    color: var(--erp-neutral-600);
}

.erp-nav-icon-btn .nav-link.position-relative {
    padding-right: 0.75rem;
}

.erp-notif-badge {
    position: absolute;
    top: 0;
    right: 0;
    transform: translate(35%, -25%);
    font-size: 0.65rem;
    padding: 0.2em 0.45em;
}

/* -------------------------------------------------------------------------- */
/* Cards, surfaces                                                             */
/* -------------------------------------------------------------------------- */
.card,
.modal-content,
.dropdown-menu,
.swal2-popup {
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-lg);
    box-shadow: var(--erp-shadow-sm);
}

.card-header {
    background: var(--erp-surface-muted);
    border-bottom-color: var(--erp-border);
    font-weight: 700;
    color: var(--erp-neutral-700);
    border-radius: var(--erp-radius-lg) var(--erp-radius-lg) 0 0 !important;
}

.form-control,
.custom-select {
    border-radius: var(--erp-radius-md);
    border-color: var(--erp-neutral-300);
    color: var(--erp-text);
}

.table {
    background: var(--erp-surface);
}

.table thead th {
    border-bottom: 2px solid var(--erp-border);
    color: var(--erp-neutral-700);
    background: var(--erp-neutral-50);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.table td,
.table th {
    vertical-align: middle;
}

.badge {
    border-radius: var(--erp-radius-pill);
    font-weight: 700;
    padding: 0.35em 0.65em;
}

.page-item .page-link {
    border-radius: var(--erp-radius-sm);
    margin: 0 0.1rem;
    color: var(--erp-neutral-700);
}

.page-item.active .page-link {
    background-color: var(--erp-primary);
    border-color: var(--erp-primary);
}

.content-wrapper,
#content-wrapper {
    background-color: transparent;
}

.sticky-footer {
    border-top: 1px solid var(--erp-border);
    color: var(--erp-text-muted);
    font-size: 0.875rem;
}

/* -------------------------------------------------------------------------- */
/* DataTables                                                                  */
/* -------------------------------------------------------------------------- */
div.dataTables_wrapper div.dataTables_filter input {
    border-radius: var(--erp-radius-pill);
    border: 1px solid var(--erp-border);
    padding: 0.35rem 0.85rem;
}

table.dataTable {
    border-collapse: collapse !important;
}

table.dataTable thead th,
table.dataTable thead td {
    border-bottom: 2px solid var(--erp-border);
}

.erp-table-card table.dataTable tbody th,
.erp-table-card table.dataTable tbody td {
    padding: 0.65rem 0.85rem;
    vertical-align: middle;
}

table.dataTable.dtf-compact tbody th,
table.dataTable.dtf-compact tbody td {
    padding: 0.5rem 0.65rem;
}

/* -------------------------------------------------------------------------- */
/* SweetAlert2                                                                 */
/* -------------------------------------------------------------------------- */
.swal2-popup {
    font-family: var(--erp-font-sans) !important;
    border-radius: var(--erp-radius-xl) !important;
}

.swal2-styled.swal2-confirm {
    border-radius: var(--erp-radius-md) !important;
    font-weight: 600 !important;
}

/* -------------------------------------------------------------------------- */
/* jQuery UI (datepicker)                                                      */
/* -------------------------------------------------------------------------- */
.ui-datepicker {
    font-family: var(--erp-font-sans) !important;
    border-radius: var(--erp-radius-md) !important;
    box-shadow: var(--erp-shadow-md) !important;
}

/* -------------------------------------------------------------------------- */
/* ERP components — KPI, hero, pills                                         */
/* -------------------------------------------------------------------------- */
.erp-hero {
    background: linear-gradient(125deg, var(--erp-brand-slate) 0%, #1e3a5f 55%, var(--erp-primary) 160%);
    color: #fff;
    border-radius: var(--erp-radius-xl);
    padding: 1.75rem 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--erp-shadow-md);
    position: relative;
    overflow: hidden;
}

.erp-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 90% 20%, rgba(255, 255, 255, 0.12), transparent 45%);
    pointer-events: none;
}

.erp-hero .erp-hero-inner {
    position: relative;
    z-index: 1;
}

.erp-hero h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.35rem;
}

.erp-hero p {
    margin: 0;
    opacity: 0.88;
    font-size: 0.95rem;
}

.erp-quick-actions .btn {
    border-radius: var(--erp-radius-pill);
    font-weight: 600;
}

.erp-kpi-card {
    border-radius: var(--erp-radius-lg);
    border: 1px solid var(--erp-border);
    background: var(--erp-surface);
    box-shadow: var(--erp-shadow-sm);
    padding: 1.15rem 1.25rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    transition: box-shadow var(--erp-transition-base), transform var(--erp-transition-fast);
}

.erp-kpi-card:hover {
    box-shadow: var(--erp-shadow-md);
    transform: translateY(-2px);
}

.erp-kpi-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--erp-text-muted);
}

.erp-kpi-value {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--erp-neutral-900);
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.erp-kpi-meta {
    font-size: 0.8rem;
    color: var(--erp-success);
    font-weight: 600;
}

.erp-kpi-meta.erp-kpi-meta--muted {
    color: var(--erp-text-muted);
    font-weight: 500;
}

.erp-kpi-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--erp-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #fff;
}

.erp-kpi-icon--primary {
    background: linear-gradient(145deg, var(--erp-primary), #1d4ed8);
}
.erp-kpi-icon--success {
    background: linear-gradient(145deg, #10b981, #059669);
}
.erp-kpi-icon--warning {
    background: linear-gradient(145deg, #f59e0b, #d97706);
}
.erp-kpi-icon--info {
    background: linear-gradient(145deg, #06b6d4, #0891b2);
}
.erp-kpi-icon--danger {
    background: linear-gradient(145deg, #f87171, #dc2626);
}

.erp-sparkline {
    width: 100%;
    height: 36px;
    opacity: 0.85;
}

.erp-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.65rem;
    border-radius: var(--erp-radius-pill);
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.erp-status-pill .erp-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.erp-status-pill--pending {
    background: var(--erp-warning-soft);
    color: #92400e;
    border-color: rgba(217, 119, 6, 0.25);
}
.erp-status-pill--pending .erp-dot {
    background: #d97706;
}

.erp-status-pill--progress {
    background: var(--erp-info-soft);
    color: #155e75;
    border-color: rgba(8, 145, 178, 0.25);
}
.erp-status-pill--progress .erp-dot {
    background: var(--erp-info);
}

.erp-status-pill--partial {
    background: var(--erp-primary-soft);
    color: #1e40af;
    border-color: rgba(37, 99, 235, 0.22);
}
.erp-status-pill--partial .erp-dot {
    background: var(--erp-primary);
}

.erp-status-pill--ready {
    background: var(--erp-success-soft);
    color: #065f46;
    border-color: rgba(5, 150, 105, 0.22);
}
.erp-status-pill--ready .erp-dot {
    background: var(--erp-success);
}

.erp-status-pill--hold {
    background: rgba(100, 116, 139, 0.15);
    color: var(--erp-neutral-700);
    border-color: rgba(100, 116, 139, 0.25);
}
.erp-status-pill--hold .erp-dot {
    background: var(--erp-neutral-500);
}

.erp-status-pill--default {
    background: var(--erp-neutral-100);
    color: var(--erp-neutral-700);
    border-color: var(--erp-border);
}
.erp-status-pill--default .erp-dot {
    background: var(--erp-neutral-400);
}

.erp-user-cell {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.erp-user-avatar-sm {
    width: 2rem;
    height: 2rem;
    border-radius: var(--erp-radius-pill);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--erp-neutral-600), var(--erp-neutral-800));
}

/* Ops page — segmented strip */
.erp-stat-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.erp-stat-segment {
    flex: 1 1 120px;
    min-width: 100px;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-lg);
    padding: 0.85rem 1rem;
    box-shadow: var(--erp-shadow-xs);
}

.erp-stat-segment .label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    color: var(--erp-text-muted);
    display: block;
    margin-bottom: 0.25rem;
}

.erp-stat-segment .value {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--erp-neutral-900);
}

.erp-page-header-sticky {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.97) 70%, rgba(248, 250, 252, 0));
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.erp-filter-card.sticky-top {
    top: 4.5rem;
    z-index: 1018;
}

.erp-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.75rem;
}

.erp-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: var(--erp-radius-pill);
    background: var(--erp-primary-soft);
    color: var(--erp-primary-hover);
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.erp-table-card tbody tr:hover {
    background: rgba(37, 99, 235, 0.03);
}

/* Visit browse — filtered cards (view_visits.php) */
.erp-visit-filter-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.erp-visit-filter-nav .nav-link {
    border-radius: var(--erp-radius-pill);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.45rem 0.95rem;
    color: var(--erp-neutral-600);
    border: 1px solid transparent;
    transition:
        background-color var(--erp-transition-fast),
        color var(--erp-transition-fast),
        border-color var(--erp-transition-fast),
        box-shadow var(--erp-transition-fast);
}

.erp-visit-filter-nav .nav-link:hover {
    background: var(--erp-neutral-100);
    color: var(--erp-neutral-800);
}

.erp-visit-filter-nav .nav-link.active {
    background: var(--erp-primary);
    color: #fff !important;
    border-color: var(--erp-primary);
    box-shadow: var(--erp-shadow-xs);
}

.erp-visit-browse-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    margin-bottom: 1rem;
    border-radius: var(--erp-radius-md);
    border: 1px solid var(--erp-border);
    background: var(--erp-surface);
    box-shadow: var(--erp-shadow-xs);
}

.erp-visit-browse-toolbar__meta {
    font-size: 0.875rem;
    color: var(--erp-text-muted);
}

.erp-visit-browse-toolbar__meta strong {
    color: var(--erp-text);
    font-weight: 700;
}

.erp-visit-browse-empty {
    text-align: center;
    padding: 2.75rem 1.25rem;
    border-radius: var(--erp-radius-lg);
    border: 1px dashed var(--erp-border);
    background: var(--erp-surface);
}

.erp-visit-browse-empty__icon {
    font-size: 2.25rem;
    color: var(--erp-neutral-400);
    margin-bottom: 0.75rem;
}

.erp-visit-browse-card {
    position: relative;
    border-radius: var(--erp-radius-md);
    border: 1px solid var(--erp-border);
    background: var(--erp-surface);
    transition:
        box-shadow var(--erp-transition-fast),
        border-color var(--erp-transition-fast);
}

.erp-visit-browse-card:hover {
    box-shadow: var(--erp-shadow-md);
    border-color: var(--erp-neutral-300);
}

.erp-visit-browse-card--stripe-info {
    border-left: 4px solid var(--erp-info);
}

.erp-visit-browse-card--stripe-warning {
    border-left: 4px solid var(--erp-warning);
}

.erp-visit-browse-card--stripe-danger {
    border-left: 4px solid var(--erp-danger);
}

.erp-visit-browse-card--stripe-success {
    border-left: 4px solid var(--erp-success);
}

.erp-visit-browse-card--stripe-neutral {
    border-left: 4px solid var(--erp-neutral-400);
}

.erp-visit-browse-card__toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1rem;
    text-align: inherit;
    background: transparent;
    border: 0;
    cursor: pointer;
    color: inherit;
    border-radius: var(--erp-radius-md) var(--erp-radius-md) 0 0;
}

.erp-visit-browse-card__toggle:focus {
    outline: 2px solid var(--erp-primary);
    outline-offset: 2px;
}

.erp-visit-browse-card__toggle:hover {
    background: var(--erp-surface-muted);
}

.erp-visit-browse-card__main {
    flex: 1 1 auto;
    min-width: 0;
    text-align: start;
}

.erp-visit-browse-card__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--erp-neutral-900);
    margin: 0 0 0.25rem;
    line-height: 1.35;
}

.erp-visit-browse-card__subtitle {
    font-size: 0.82rem;
    color: var(--erp-text-muted);
    margin: 0;
    line-height: 1.4;
}

.erp-visit-browse-card__aside {
    flex-shrink: 0;
    text-align: right;
}

.erp-visit-browse-card__date {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--erp-neutral-700);
    margin-top: 0.35rem;
}

.erp-visit-browse-card__chevron {
    align-self: center;
    color: var(--erp-neutral-400);
    font-size: 0.85rem;
    transition: transform var(--erp-transition-fast);
}

.erp-visit-browse-card__toggle:not(.collapsed) .erp-visit-browse-card__chevron {
    transform: rotate(180deg);
}

.erp-visit-browse-card__body {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.erp-visit-browse-card__section-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--erp-text-muted);
    margin-bottom: 0.3rem;
}

.erp-visit-browse-card__section-value {
    font-size: 0.875rem;
    color: var(--erp-text);
    line-height: 1.45;
    margin-bottom: 1rem;
}

.erp-visit-browse-card__section-value:last-child {
    margin-bottom: 0;
}

.erp-visit-browse-card__muted-hint {
    font-size: 0.875rem;
    color: var(--erp-text-muted);
    font-style: italic;
}

.erp-visit-browse-photo-row {
    display: flex;
    flex-wrap: wrap;
    margin: -0.2rem;
}

.erp-visit-browse-photo-row a {
    display: block;
    padding: 0.2rem;
}

.erp-visit-browse-photo-row img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: var(--erp-radius-sm);
    border: 1px solid var(--erp-border);
    vertical-align: middle;
}

.erp-visit-browse-card__footer {
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--erp-border);
    background: var(--erp-surface-muted);
}

.erp-visit-browse-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.18rem 0.45rem;
    border-radius: var(--erp-radius-pill);
    vertical-align: middle;
}

.erp-visit-browse-badge--overdue {
    background: var(--erp-danger-soft);
    color: var(--erp-danger);
    border: 1px solid rgba(220, 38, 38, 0.22);
}

.erp-visit-browse-badge--today {
    background: var(--erp-warning-soft);
    color: #92400e;
    border: 1px solid rgba(217, 119, 6, 0.28);
}

body[dir="rtl"] .erp-visit-browse-card__aside {
    text-align: left;
}

body[dir="rtl"] .erp-visit-browse-card--stripe-info,
body[dir="rtl"] .erp-visit-browse-card--stripe-warning,
body[dir="rtl"] .erp-visit-browse-card--stripe-danger,
body[dir="rtl"] .erp-visit-browse-card--stripe-success,
body[dir="rtl"] .erp-visit-browse-card--stripe-neutral {
    border-left: 1px solid var(--erp-border);
    border-right-width: 4px;
    border-right-style: solid;
}

body[dir="rtl"] .erp-visit-browse-card--stripe-info {
    border-right-color: var(--erp-info);
}

body[dir="rtl"] .erp-visit-browse-card--stripe-warning {
    border-right-color: var(--erp-warning);
}

body[dir="rtl"] .erp-visit-browse-card--stripe-danger {
    border-right-color: var(--erp-danger);
}

body[dir="rtl"] .erp-visit-browse-card--stripe-success {
    border-right-color: var(--erp-success);
}

body[dir="rtl"] .erp-visit-browse-card--stripe-neutral {
    border-right-color: var(--erp-neutral-400);
}

/* Visit request detail — legacy VisitRequests photo grid */
.erp-visit-photo-grid .erp-visit-photo-thumb {
    max-height: 180px;
    width: 100%;
    object-fit: cover;
}

/* Activity list */
.erp-activity-item {
    display: flex;
    gap: 0.85rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--erp-border);
}
.erp-activity-item:last-child {
    border-bottom: 0;
}

.erp-activity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 0.35rem;
    flex-shrink: 0;
    background: var(--erp-primary);
}

/* Dashboard calendar skin (replaces inline Tailwind dependency where possible) */
.erp-dashboard-calendar .bg-white.rounded-lg {
    border-radius: var(--erp-radius-xl) !important;
    border: 1px solid var(--erp-border);
    box-shadow: var(--erp-shadow-sm) !important;
}

.erp-dashboard-calendar .fc-event {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: var(--erp-radius-sm);
}

.erp-dashboard-calendar .event-factory-visits {
    background-color: var(--erp-success) !important;
    border-color: #047857 !important;
}

.erp-dashboard-calendar .event-nameplate-iwo {
    background-color: var(--erp-primary) !important;
    border-color: #1d4ed8 !important;
}

.erp-dashboard-calendar .event-visit-requests {
    background-color: var(--erp-warning) !important;
    border-color: #b45309 !important;
}

.erp-dashboard-calendar .event-factory-work-orders {
    background-color: #7c3aed !important;
    border-color: #6d28d9 !important;
}

.erp-dashboard-calendar .legend-item {
    display: inline-flex;
    align-items: center;
    margin-right: 15px;
    font-size: 14px;
}

.erp-dashboard-calendar .legend-color {
    width: 15px;
    height: 15px;
    margin-right: 5px;
    border-radius: 3px;
}

.erp-dashboard-calendar #bookEventBtn {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.erp-dashboard-calendar #bookEventBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

/* -------------------------------------------------------------------------- */
/* Login page                                                                  */
/* -------------------------------------------------------------------------- */
.erp-login-page {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    background: var(--erp-brand-slate);
}

.erp-login-brand {
    flex: 1.1;
    background: linear-gradient(160deg, var(--erp-brand-slate) 0%, #1e3a5f 45%, var(--erp-primary) 180%);
    color: #fff;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.erp-login-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 80%, rgba(37, 99, 235, 0.35), transparent 50%);
    pointer-events: none;
}

.erp-login-brand-inner {
    position: relative;
    z-index: 1;
    max-width: 420px;
}

.erp-login-brand h1 {
    font-size: 2rem;
    font-weight: 800;
    margin: 0 0 0.75rem;
    letter-spacing: -0.03em;
}

.erp-login-brand p {
    opacity: 0.88;
    line-height: 1.6;
    margin: 0;
}

.erp-login-panel {
    flex: 0.95;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--erp-neutral-50);
}

.erp-login-card {
    width: 100%;
    max-width: 420px;
    background: var(--erp-surface);
    border-radius: var(--erp-radius-xl);
    border: 1px solid var(--erp-border);
    box-shadow: var(--erp-shadow-lg);
    padding: 2.75rem;
}

.erp-login-card h2 {
    font-size: 1.35rem;
    font-weight: 800;
    margin: 0 0 0.25rem;
    color: var(--erp-neutral-900);
}

.erp-login-card .erp-login-sub {
    color: var(--erp-text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.erp-login-field {
    margin-bottom: 1.5rem;
}

.erp-login-field label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--erp-neutral-700);
    margin-bottom: 0.5rem;
    display: block;
}

.erp-login-field input[type="text"],
.erp-login-field input[type="password"] {
    width: 100%;
    padding: 0.85rem 1.125rem;
    border-radius: var(--erp-radius-md);
    border: 1px solid var(--erp-border);
    font-family: var(--erp-font-sans);
    transition: border-color var(--erp-transition-fast), box-shadow var(--erp-transition-fast);
    font-size: 0.95rem;
}

.erp-login-field input:focus {
    outline: none;
    border-color: var(--erp-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.erp-login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 0.85rem 1rem;
    border-radius: var(--erp-radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
}

.erp-login-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.erp-login-submit {
    width: 100%;
    padding: 0.85rem 1rem;
    border: none;
    border-radius: var(--erp-radius-md);
    font-weight: 700;
    font-family: var(--erp-font-sans);
    color: #fff;
    background: linear-gradient(135deg, var(--erp-primary), #1e40af);
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
    transition: transform var(--erp-transition-fast), box-shadow var(--erp-transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.erp-login-kicker {
    opacity: 0.75;
    letter-spacing: 0.18em;
    font-size: 0.72rem;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.erp-login-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.4);
}

.erp-login-hint {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.8rem;
    color: var(--erp-text-muted);
}

@media (max-width: 991px) {
    .erp-login-page {
        flex-direction: column;
    }
    .erp-login-brand {
        min-height: 220px;
        padding: 2rem;
    }
}

.erp-login-spinner {
    display: none;
    margin-left: 0.5rem;
}

.erp-login-spinner.show {
    display: inline-block;
    animation: erp-spin 0.9s linear infinite;
}

@keyframes erp-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.erp-login-support {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--erp-border);
    font-size: 0.85rem;
}

.erp-login-support a {
    color: var(--erp-text-muted);
    margin: 0 0.65rem;
    text-decoration: none;
    font-weight: 600;
}

.erp-login-support a:hover {
    color: var(--erp-primary);
}

/* -------------------------------------------------------------------------- */
/* RTL scaffold (toggle with <html lang="ar" dir="rtl">)                       */
/* -------------------------------------------------------------------------- */
[dir="rtl"] .sidebar {
    box-shadow: -6px 0 24px rgba(0, 0, 0, 0.18);
}

[dir="rtl"] .erp-breadcrumb li + li::before {
    content: "›";
    margin: 0 0.5rem;
}

[dir="rtl"] .navbar-nav.ml-auto {
    margin-left: 0 !important;
    margin-right: auto !important;
}

[dir="rtl"] .dropdown-menu-right {
    right: auto !important;
    left: 0 !important;
}

[dir="rtl"] .sidebar.toggled {
    margin-right: 0;
}

@media (min-width: 768px) {
    [dir="rtl"] body.sidebar-toggled .sidebar {
        margin-right: calc(-1 * var(--erp-sidebar-width));
        margin-left: 0;
    }
}

/* -------------------------------------------------------------------------- */
/* HR module                                                                   */
/* -------------------------------------------------------------------------- */
.hr-profile-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-lg);
    box-shadow: var(--erp-shadow-sm);
    margin-bottom: 1.25rem;
}

.hr-profile-avatar {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--erp-primary), #1d4ed8);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    flex-shrink: 0;
}

.hr-profile-name {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 0.2rem;
    color: var(--erp-neutral-900);
}

.hr-profile-meta {
    color: var(--erp-text-muted);
    font-size: 0.9rem;
}

.hr-profile-meta i {
    color: var(--erp-primary);
    margin-right: 0.35rem;
}

.hr-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem 1.5rem;
}

.hr-info-item .label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    color: var(--erp-text-muted);
    display: block;
    margin-bottom: 0.15rem;
}

.hr-info-item .value {
    font-size: 0.95rem;
    color: var(--erp-neutral-800);
    word-break: break-word;
}

.hr-doc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.hr-doc-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-md);
    background: var(--erp-surface);
    transition: box-shadow var(--erp-transition-base);
}

.hr-doc-item:hover {
    box-shadow: var(--erp-shadow-sm);
}

.hr-doc-item.is-expired {
    border-left: 3px solid var(--erp-danger);
}

.hr-doc-item.is-soon {
    border-left: 3px solid var(--erp-warning);
}

.hr-doc-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--erp-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--erp-primary-soft);
    color: var(--erp-primary);
    flex-shrink: 0;
}

.hr-doc-meta {
    flex-grow: 1;
    min-width: 0;
}

.hr-doc-meta .name {
    font-weight: 600;
    color: var(--erp-neutral-800);
    word-break: break-word;
}

.hr-doc-meta .sub {
    font-size: 0.8rem;
    color: var(--erp-text-muted);
}

.hr-form-section {
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--erp-shadow-xs);
}

.hr-form-section .section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--erp-neutral-900);
    margin: 0 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hr-form-section .section-title i {
    color: var(--erp-primary);
}

.hr-leave-progress {
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--erp-neutral-100);
    margin-top: 0.45rem;
}

.hr-leave-progress > span {
    display: block;
    height: 100%;
    background: var(--erp-primary);
}

.hr-leave-progress > span.bg-danger {
    background: var(--erp-danger);
}
.hr-leave-progress > span.bg-warning {
    background: var(--erp-warning);
}
.hr-leave-progress > span.bg-success {
    background: var(--erp-success);
}

/* HR employee Awesomplete: align with Bootstrap full-width controls */
.hr-emp-autocomplete-wrap .awesomplete {
    display: block;
    width: 100%;
}

.hr-emp-autocomplete-wrap .awesomplete > ul {
    z-index: 2000;
}

/* -------------------------------------------------------------------------- */
/* Compliance / certificates module (certificates_manager)                     */
/* -------------------------------------------------------------------------- */
.compliance-page-title,
.compliance-hero-wrap {
    margin-left: 1.5rem;
    margin-right: 1.5rem;
}

.compliance-hero-wrap {
    width: calc(100% - 3rem);
}

.compliance-hero {
    background: linear-gradient(135deg, var(--erp-neutral-900) 0%, var(--erp-primary) 100%);
    border-radius: var(--erp-radius-lg);
    color: var(--erp-surface);
    overflow: hidden;
    position: relative;
}

.compliance-hero::after {
    background: rgba(255, 255, 255, 0.12);
    border-radius: var(--erp-radius-pill);
    content: "";
    height: 180px;
    position: absolute;
    right: -70px;
    top: -75px;
    width: 180px;
}

.compliance-hero > * {
    position: relative;
    z-index: 1;
}

.compliance-hero h2.h4 {
    font-size: 1.15rem;
    line-height: 1.35;
}

@media (max-width: 575.98px) {
    .compliance-page-title,
    .compliance-hero-wrap {
        margin-left: 1rem;
        margin-right: 1rem;
    }

    .compliance-hero-wrap {
        width: calc(100% - 2rem);
    }
}

.compliance-page-title .h3 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.compliance-filter-card .card-body {
    padding: 1.25rem 1.5rem;
}

.compliance-table-card .card-body,
.compliance-table-card .card-body.p-0 {
    padding: 1rem 1.25rem !important;
}

.compliance-table-card .dataTables_wrapper {
    width: 100%;
}

.compliance-table-card .table {
    margin-bottom: 0;
}

.compliance-table-card .table thead th {
    background: var(--erp-surface-muted);
    border-bottom: 2px solid var(--erp-border);
    color: var(--erp-neutral-700);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.compliance-table-card .table td {
    vertical-align: middle;
}

.compliance-table-card .table tbody tr:hover {
    background: var(--erp-neutral-50);
}

.field-label {
    color: var(--erp-neutral-500);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    margin-bottom: 0.35rem;
    text-transform: uppercase;
}

.compliance-form-card .form-control,
.compliance-form-card .custom-select,
.compliance-filter-card .form-control,
.compliance-filter-card .custom-select {
    border-radius: var(--erp-radius-sm);
    border-color: var(--erp-neutral-200);
}

.compliance-form-card .form-control:focus,
.compliance-filter-card .form-control:focus {
    border-color: var(--erp-success);
    box-shadow: 0 0 0 0.15rem var(--erp-success-soft);
}

.compliance-location-field {
    background: var(--erp-surface);
    min-height: 44px;
}

.compliance-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    min-height: 2rem;
}

.compliance-chip {
    align-items: center;
    background: var(--erp-primary-soft);
    border: 1px solid rgba(37, 99, 235, 0.22);
    border-radius: var(--erp-radius-pill);
    color: var(--erp-primary);
    display: inline-flex;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.3rem 0.65rem;
}

.compliance-chip button {
    background: transparent;
    border: 0;
    color: inherit;
    font-size: 1rem;
    line-height: 1;
    margin-left: 0.35rem;
    padding: 0;
}

.compliance-selected-product,
.compliance-file-tile {
    align-items: center;
    background: var(--erp-neutral-50);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-md);
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
}

.compliance-selected-product img,
.compliance-file-tile img,
.compliance-file-icon {
    border-radius: var(--erp-radius-sm);
    flex: 0 0 auto;
    height: 64px;
    object-fit: cover;
    width: 64px;
}

.compliance-file-tile video {
    background: var(--erp-neutral-900);
    border-radius: var(--erp-radius-sm);
    flex: 0 0 auto;
    max-height: 72px;
    max-width: 140px;
    width: 100%;
}

.compliance-profile-preview {
    border-radius: var(--erp-radius-md);
    height: 96px;
    object-fit: cover;
    width: 96px;
}

.compliance-file-icon {
    align-items: center;
    background: var(--erp-surface);
    color: var(--erp-neutral-500);
    display: flex;
    justify-content: center;
}

.compliance-upload-panel {
    background: var(--erp-surface-muted);
    border: 1px dashed var(--erp-neutral-300);
    border-radius: var(--erp-radius-md);
    padding: 1rem;
}

.compliance-empty-state {
    border: 1px dashed var(--erp-neutral-300);
    border-radius: var(--erp-radius-lg);
    color: var(--erp-neutral-500);
    padding: 2.5rem 1.5rem;
    text-align: center;
}

.compliance-empty-state i {
    color: var(--erp-neutral-400);
    margin-bottom: 0.75rem;
}

.compliance-section-divider {
    border-bottom: 1px solid var(--erp-border);
    color: var(--erp-primary);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin: 1.5rem 0 1rem;
    padding-bottom: 0.35rem;
}

.compliance-danger-zone {
    border: 1px solid rgba(220, 38, 38, 0.35);
    border-radius: var(--erp-radius-lg);
}

.btn-compliance-primary {
    border-radius: var(--erp-radius-sm);
    font-weight: 600;
}

.badge-status-lg {
    font-size: 0.85rem;
    padding: 0.45em 0.65em;
}

/* -------------------------------------------------------------------------- */
/* Document master drive                                                      */
/* -------------------------------------------------------------------------- */
.document-drive-page {
    padding-bottom: 2rem;
}

.document-drive-hero {
    background:
        radial-gradient(circle at 85% 20%, rgba(255, 255, 255, 0.2), transparent 28%),
        linear-gradient(130deg, var(--erp-neutral-900) 0%, #164e63 58%, var(--erp-primary) 135%);
}

.document-drive-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.65rem;
    padding: 0.28rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: var(--erp-radius-pill);
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.document-drive-hero-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.document-drive-hero-actions .btn {
    border-radius: var(--erp-radius-pill);
}

.document-drive-hero-actions .btn-outline-light.active,
.document-drive-hero-actions .btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.document-drive-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(130px, 1fr));
    gap: 0.85rem;
    margin-top: 1.5rem;
}

.document-drive-stat {
    padding: 0.95rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--erp-radius-lg);
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
}

.document-drive-stat .label {
    display: block;
    margin-bottom: 0.2rem;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.document-drive-stat .value {
    display: block;
    color: #fff;
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1.15;
}

.document-drive-stat .value-sm {
    font-size: 1rem;
}

.document-drive-shell {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.document-drive-sidebar,
.document-drive-toolbar,
.document-drive-list,
.document-drive-empty {
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-xl);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--erp-shadow-sm);
}

.document-drive-sidebar {
    position: sticky;
    top: 5.25rem;
    padding: 1rem;
}

.document-drive-sidebar-title {
    margin-bottom: 0.75rem;
    color: var(--erp-neutral-700);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.document-drive-space {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.75rem 0.85rem;
    border-radius: var(--erp-radius-md);
    color: var(--erp-neutral-700);
    font-weight: 700;
}

.document-drive-space:hover,
.document-drive-space.active {
    background: var(--erp-primary-soft);
    color: var(--erp-primary-hover);
    text-decoration: none;
}

.document-drive-space i {
    width: 1.1rem;
    text-align: center;
}

.document-drive-storage {
    margin-top: 1rem;
    padding: 0.9rem;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-lg);
    background: var(--erp-surface-muted);
    color: var(--erp-text-muted);
    font-size: 0.78rem;
}

.document-drive-storage-bar {
    height: 0.48rem;
    margin-bottom: 0.55rem;
    border-radius: var(--erp-radius-pill);
    background: var(--erp-neutral-200);
    overflow: hidden;
}

.document-drive-storage-bar span {
    display: block;
    width: 64%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--erp-primary), var(--erp-info));
}

.document-drive-content {
    min-width: 0;
}

.document-drive-toolbar {
    padding: 1rem;
    margin-bottom: 1.2rem;
}

.document-drive-filter-form {
    display: grid;
    gap: 0.9rem;
}

.document-drive-search {
    position: relative;
}

.document-drive-search i {
    position: absolute;
    top: 50%;
    left: 1rem;
    color: var(--erp-text-muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.document-drive-search .form-control {
    height: 3rem;
    padding-left: 2.75rem;
    border-radius: var(--erp-radius-pill);
    background: var(--erp-surface-muted);
}

.document-drive-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: 0.75rem;
}

.document-drive-filter-grid label {
    margin-bottom: 0.3rem;
    color: var(--erp-text-muted);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.document-drive-filter-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.document-drive-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.document-drive-section-header h3 {
    margin: 0;
    color: var(--erp-neutral-900);
    font-size: 1.1rem;
    font-weight: 800;
}

.document-drive-section-header p {
    margin: 0.2rem 0 0;
    color: var(--erp-text-muted);
    font-size: 0.86rem;
}

.document-drive-view-toggle {
    display: inline-flex;
    padding: 0.25rem;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-pill);
    background: var(--erp-surface);
    box-shadow: var(--erp-shadow-xs);
}

.document-drive-view-toggle a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.15rem;
    height: 2.15rem;
    border-radius: var(--erp-radius-pill);
    color: var(--erp-text-muted);
}

.document-drive-view-toggle a.active,
.document-drive-view-toggle a:hover {
    background: var(--erp-primary);
    color: #fff;
    text-decoration: none;
}

.document-drive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
    gap: 1rem;
}

.document-drive-card {
    position: relative;
    min-height: 238px;
    padding: 1.1rem;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-xl);
    background: var(--erp-surface);
    box-shadow: var(--erp-shadow-xs);
    cursor: pointer;
    transition: border-color var(--erp-transition-fast), box-shadow var(--erp-transition-base),
        transform var(--erp-transition-fast);
}

.document-drive-card:hover,
.document-drive-card:focus {
    border-color: rgba(37, 99, 235, 0.42);
    box-shadow: var(--erp-shadow-md);
    outline: none;
    transform: translateY(-3px);
}

.document-drive-card-actions {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    gap: 0.35rem;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity var(--erp-transition-fast), transform var(--erp-transition-fast);
}

.document-drive-card:hover .document-drive-card-actions,
.document-drive-card:focus .document-drive-card-actions,
.document-drive-card-actions:focus-within {
    opacity: 1;
    transform: translateY(0);
}

.document-drive-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-pill);
    background: var(--erp-surface);
    box-shadow: var(--erp-shadow-xs);
}

.document-drive-icon-btn:hover {
    background: var(--erp-surface-muted);
    text-decoration: none;
}

.document-drive-file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4.8rem;
    height: 4.8rem;
    margin-bottom: 1rem;
    border-radius: 1.4rem;
    background: linear-gradient(145deg, var(--erp-primary-soft), rgba(8, 145, 178, 0.12));
    color: var(--erp-primary);
    font-size: 2.1rem;
}

.document-drive-file-icon i {
    filter: drop-shadow(0 8px 12px rgba(37, 99, 235, 0.14));
}

.document-drive-file-name {
    display: -webkit-box;
    min-height: 2.8rem;
    margin-bottom: 0.45rem;
    overflow: hidden;
    color: var(--erp-neutral-900);
    font-size: 0.96rem;
    font-weight: 800;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.document-drive-file-number {
    margin-bottom: 0.8rem;
    color: var(--erp-text-muted);
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-drive-card-meta {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    color: var(--erp-text-muted);
    font-size: 0.78rem;
}

.document-drive-card-footer {
    position: absolute;
    left: 1.1rem;
    right: 1.1rem;
    bottom: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--erp-border);
    color: var(--erp-text-muted);
    font-size: 0.78rem;
}

.document-drive-list {
    overflow: hidden;
}

.document-drive-table {
    margin-bottom: 0;
}

.document-drive-table thead th {
    border-top: 0;
    border-bottom: 1px solid var(--erp-border);
    background: var(--erp-surface-muted);
    color: var(--erp-neutral-600);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.document-drive-table td {
    vertical-align: middle;
}

.document-drive-table-file {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 220px;
    color: var(--erp-neutral-900);
    font-weight: 700;
}

.document-drive-row-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--erp-radius-md);
    background: var(--erp-primary-soft);
    color: var(--erp-primary);
    flex-shrink: 0;
}

.document-drive-table-actions {
    white-space: nowrap;
}

.document-drive-empty {
    padding: 3rem 1.5rem;
    text-align: center;
}

.document-drive-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 5rem;
    height: 5rem;
    margin-bottom: 1rem;
    border-radius: 1.5rem;
    background: var(--erp-primary-soft);
    color: var(--erp-primary);
    font-size: 2.2rem;
}

.document-drive-empty h4 {
    color: var(--erp-neutral-900);
    font-weight: 800;
}

.document-drive-empty p {
    max-width: 420px;
    margin: 0 auto 1.2rem;
    color: var(--erp-text-muted);
}

/* Document detail drive view */
.document-detail-layout {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.document-detail-sidebar,
.document-detail-toolbar,
.document-detail-file-card {
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-xl);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--erp-shadow-sm);
}

.document-detail-sidebar {
    position: sticky;
    top: 5.25rem;
    padding: 1.25rem;
}

.document-detail-preview-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 5.5rem;
    height: 5.5rem;
    margin-bottom: 1rem;
    border-radius: 1.55rem;
    background: linear-gradient(145deg, var(--erp-primary-soft), rgba(8, 145, 178, 0.12));
    color: var(--erp-primary);
    font-size: 2.4rem;
}

.document-detail-sidebar h3 {
    margin: 0 0 0.7rem;
    color: var(--erp-neutral-900);
    font-size: 1.05rem;
    font-weight: 800;
    word-break: break-word;
}

.document-detail-info-list {
    display: grid;
    gap: 0.85rem;
    margin-top: 1.25rem;
}

.document-detail-info-list div {
    padding-top: 0.85rem;
    border-top: 1px solid var(--erp-border);
}

.document-detail-info-list span {
    display: block;
    margin-bottom: 0.2rem;
    color: var(--erp-text-muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.document-detail-info-list strong {
    color: var(--erp-neutral-800);
    font-size: 0.9rem;
    word-break: break-word;
}

.document-detail-main {
    min-width: 0;
}

.document-detail-toolbar {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
}

.document-detail-toolbar h3 {
    margin: 0;
    color: var(--erp-neutral-900);
    font-size: 1.08rem;
    font-weight: 800;
}

.document-detail-toolbar p {
    margin: 0.2rem 0 0;
    color: var(--erp-text-muted);
    font-size: 0.86rem;
}

.document-detail-filter-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 150px 150px 150px auto;
    gap: 0.65rem;
    align-items: center;
}

.document-detail-file-stack {
    display: grid;
    gap: 1rem;
}

.document-detail-file-card {
    overflow: hidden;
    transition: border-color var(--erp-transition-fast), box-shadow var(--erp-transition-base);
}

.document-detail-file-card:hover {
    border-color: rgba(37, 99, 235, 0.22);
    box-shadow: var(--erp-shadow-md);
}

.document-detail-file-card--filtered-out {
    opacity: 0.62;
}

.document-detail-file-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1rem 0.85rem;
}

.document-detail-file-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.document-detail-file-title .document-drive-file-icon {
    width: 4rem;
    height: 4rem;
    margin-bottom: 0;
    border-radius: 1.15rem;
    font-size: 1.8rem;
    flex-shrink: 0;
}

.document-detail-file-title h4 {
    margin: 0;
    color: var(--erp-neutral-900);
    font-size: 1rem;
    font-weight: 800;
    word-break: break-word;
}

.document-detail-file-title p {
    margin: 0.25rem 0 0;
    color: var(--erp-text-muted);
    font-size: 0.82rem;
}

.document-detail-file-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.document-detail-file-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0 1rem 1rem;
    color: var(--erp-text-muted);
    font-size: 0.8rem;
}

.document-detail-visible-count {
    margin-left: auto;
    color: var(--erp-text-muted);
    font-size: 0.78rem;
}

.document-detail-revision-table-wrap {
    border-top: 1px solid var(--erp-border);
}

.document-detail-revision-table {
    margin-bottom: 0;
}

.document-detail-revision-table thead th {
    border-top: 0;
    border-bottom: 1px solid var(--erp-border);
    background: var(--erp-surface-muted);
    color: var(--erp-neutral-600);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.document-detail-revision-table td {
    vertical-align: middle;
}

.document-detail-notes {
    min-width: 220px;
    max-width: 360px;
    color: var(--erp-neutral-700);
}

.document-detail-revision-tools {
    white-space: nowrap;
}

.document-detail-empty-inline {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0 1rem 1rem;
    padding: 0.85rem 1rem;
    border: 1px dashed var(--erp-neutral-300);
    border-radius: var(--erp-radius-lg);
    background: var(--erp-surface-muted);
    color: var(--erp-text-muted);
    font-size: 0.88rem;
}

.document-detail-empty-inline i {
    color: var(--erp-primary);
}

/* -------------------------------------------------------------------------- */
/* Responsive                                                                  */
/* -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .erp-hero {
        padding: 1.35rem 1.25rem;
    }

    .card,
    .modal-content {
        border-radius: var(--erp-radius-md);
    }

    .hr-profile-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .document-drive-hero-actions {
        justify-content: flex-start;
    }

    .document-drive-stats,
    .document-drive-shell,
    .document-drive-filter-grid,
    .document-detail-layout,
    .document-detail-filter-grid {
        grid-template-columns: 1fr;
    }

    .document-drive-sidebar,
    .document-detail-sidebar {
        position: static;
    }

    .document-drive-section-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .document-detail-file-header {
        flex-direction: column;
    }

    .document-detail-file-actions {
        justify-content: flex-start;
    }

    .document-detail-visible-count {
        margin-left: 0;
        width: 100%;
    }
}

/* -------------------------------------------------------------------------- */
/* Shared AJAX uploader (modal + queue + progress)                             */
/* -------------------------------------------------------------------------- */
.erp-uploader-modal .modal-content {
    border: 0;
    border-radius: var(--erp-radius-lg);
    overflow: hidden;
    box-shadow: var(--erp-shadow-lg);
}

.erp-uploader-modal .modal-header {
    background: linear-gradient(120deg, var(--erp-brand-slate), var(--erp-brand-slate-mid));
    color: #fff;
    padding: 1rem 1.25rem;
}

.erp-uploader-modal .modal-header .modal-title {
    color: #fff;
    font-weight: 600;
    font-size: 1.05rem;
}

.erp-uploader-modal .modal-header .close {
    color: #fff;
    text-shadow: none;
    opacity: 0.85;
}

.erp-uploader-modal .modal-body {
    padding: 1.25rem;
}

.erp-uploader-dropzone {
    position: relative;
    border: 2px dashed var(--erp-neutral-300);
    border-radius: var(--erp-radius-lg);
    padding: 1.75rem 1rem;
    text-align: center;
    background: var(--erp-neutral-50);
    cursor: pointer;
    transition: border-color var(--erp-transition-base), background-color var(--erp-transition-base);
}

.erp-uploader-dropzone:focus,
.erp-uploader-dropzone:hover,
.erp-uploader-dropzone--hover {
    outline: none;
    border-color: var(--erp-primary);
    background: var(--erp-primary-soft);
}

.erp-uploader-dropzone-icon {
    font-size: 1.85rem;
    color: var(--erp-primary);
    margin-bottom: 0.4rem;
}

.erp-uploader-dropzone-title {
    font-weight: 600;
    color: var(--erp-text);
    font-size: 1rem;
    margin-bottom: 0.15rem;
}

.erp-uploader-dropzone-hint {
    color: var(--erp-text-muted);
    font-size: 0.88rem;
}

.erp-uploader-dropzone-meta {
    margin-top: 0.4rem;
    font-size: 0.78rem;
    color: var(--erp-text-muted);
}

.erp-uploader-options {
    background: var(--erp-surface-muted);
    border-radius: var(--erp-radius-md);
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--erp-border);
}

.erp-uploader-queue {
    margin-top: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 320px;
    overflow-y: auto;
}

.erp-uploader-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-md);
    padding: 0.55rem 0.65rem;
    transition: border-color var(--erp-transition-base), background-color var(--erp-transition-base);
}

.erp-uploader-row--ok {
    border-color: var(--erp-success);
    background: var(--erp-success-soft);
}

.erp-uploader-row--err {
    border-color: var(--erp-danger);
    background: var(--erp-danger-soft);
}

.erp-uploader-row-icon {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: var(--erp-radius-sm);
    background: var(--erp-neutral-100);
    color: var(--erp-neutral-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.erp-uploader-row-body {
    flex: 1 1 auto;
    min-width: 0;
}

.erp-uploader-row-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--erp-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.erp-uploader-row-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--erp-text-muted);
    margin-top: 0.1rem;
}

.erp-uploader-row-status--prog {
    color: var(--erp-primary);
}

.erp-uploader-row-status--ok {
    color: var(--erp-success);
}

.erp-uploader-row-status--err {
    color: var(--erp-danger);
}

.erp-uploader-progress {
    height: 6px;
    background: var(--erp-neutral-100);
    border-radius: var(--erp-radius-pill);
    margin-top: 0.4rem;
    overflow: hidden;
}

.erp-uploader-progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--erp-primary), var(--erp-info));
    transition: width 0.18s ease;
}

.erp-uploader-progress-bar--ok {
    background: var(--erp-success);
}

.erp-uploader-progress-bar--err {
    background: var(--erp-danger);
}

.erp-uploader-row-remove {
    flex: 0 0 auto;
}

.erp-uploader-busy .erp-uploader-row-remove,
.erp-uploader-busy [data-uploader-clear],
.erp-uploader-busy [data-uploader-file-input] {
    pointer-events: none;
    opacity: 0.6;
}

/* -------------------------------------------------------------------------- */
/* Shared file tile + actions (used outside the uploader, for file lists)      */
/* -------------------------------------------------------------------------- */
.erp-file-tile {
    display: flex;
    gap: 0.85rem;
    align-items: stretch;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-md);
    padding: 0.75rem;
    transition: border-color var(--erp-transition-base), box-shadow var(--erp-transition-base);
}

.erp-file-tile:hover {
    border-color: var(--erp-primary);
    box-shadow: var(--erp-shadow-sm);
}

.erp-file-tile--new {
    animation: erpFileTileFadeIn 0.4s ease;
}

@keyframes erpFileTileFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.erp-file-tile-thumb {
    flex: 0 0 auto;
    width: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.erp-file-tile-thumb img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--erp-radius-sm);
}

.erp-file-tile-thumb video {
    width: 100%;
    max-width: 100px;
    max-height: 64px;
    background: var(--erp-neutral-900);
    border-radius: var(--erp-radius-sm);
}

.erp-file-tile-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--erp-radius-sm);
    background: var(--erp-neutral-100);
    color: var(--erp-neutral-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

.erp-file-tile-icon.text-danger { background: var(--erp-danger-soft); color: var(--erp-danger); }
.erp-file-tile-icon.text-primary { background: var(--erp-primary-soft); color: var(--erp-primary); }
.erp-file-tile-icon.text-success { background: var(--erp-success-soft); color: var(--erp-success); }
.erp-file-tile-icon.text-warning { background: var(--erp-warning-soft); color: var(--erp-warning); }
.erp-file-tile-icon.text-info { background: var(--erp-info-soft); color: var(--erp-info); }

.erp-file-tile-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.erp-file-tile-badge {
    display: inline-block;
    align-self: flex-start;
    background: var(--erp-primary-soft);
    color: var(--erp-primary);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: var(--erp-radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.erp-file-tile-name {
    font-weight: 600;
    color: var(--erp-text);
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.erp-file-tile-meta {
    font-size: 0.78rem;
    color: var(--erp-text-muted);
}

.erp-file-actions {
    margin-top: 0.45rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.erp-file-actions--sm .erp-file-action {
    font-size: 0.78rem;
    padding: 0.2rem 0.55rem;
    line-height: 1.1;
}

.erp-file-action {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.erp-file-action i { font-size: 0.85em; }

body[dir="rtl"] .erp-uploader-modal .modal-header .modal-title i { margin-right: 0; margin-left: 0.5rem; }
body[dir="rtl"] .erp-uploader-row-meta { flex-direction: row-reverse; }
body[dir="rtl"] .erp-file-tile { flex-direction: row-reverse; }

/* -------------------------------------------------------------------------- */
/* Shared signature pad modal                                                   */
/* -------------------------------------------------------------------------- */

.erp-signature-modal .modal-content { border-radius: var(--erp-radius-lg); }

.erp-signature-modes { gap: 0.25rem; }
.erp-signature-modes .nav-link {
    background: transparent;
    border: 1px solid transparent;
    color: var(--erp-text-muted);
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    border-radius: var(--erp-radius-pill);
}
.erp-signature-modes .nav-link.active {
    color: var(--erp-primary);
    background: var(--erp-primary-soft);
    border-color: transparent;
}

.erp-signature-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.65rem;
    background: var(--erp-surface-muted);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-md);
}

.erp-signature-toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.erp-signature-toolbar-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--erp-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.erp-signature-swatches {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.erp-signature-swatch {
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    border: 2px solid var(--erp-border);
    padding: 0;
    cursor: pointer;
    transition: transform var(--erp-transition-fast), box-shadow var(--erp-transition-fast),
        border-color var(--erp-transition-fast);
}
.erp-signature-swatch:hover { transform: translateY(-1px); }
.erp-signature-swatch.is-active {
    border-color: var(--erp-primary);
    box-shadow: 0 0 0 2px var(--erp-primary-soft);
}
.erp-signature-swatch:focus-visible {
    outline: 2px solid var(--erp-primary);
    outline-offset: 2px;
}

.erp-signature-swatch-picker {
    width: 1.6rem;
    height: 1.6rem;
    padding: 0;
    border: 1px dashed var(--erp-neutral-300);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.erp-signature-thickness {
    width: 7rem;
    max-width: 100%;
}

.erp-signature-pad-wrap {
    position: relative;
    width: 100%;
    min-height: 15rem;
    height: 15rem;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-md);
    background: var(--erp-surface);
    box-shadow: var(--erp-shadow-xs);
    overflow: hidden;
    touch-action: none;
}

.erp-signature-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    vertical-align: middle;
}

.erp-signature-canvas:focus {
    outline: 2px solid var(--erp-primary);
    outline-offset: 2px;
}

.erp-signature-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--erp-neutral-400);
    font-size: 0.95rem;
    font-style: italic;
    pointer-events: none;
    user-select: none;
}

.erp-signature-meta-row .form-control { max-width: 32rem; }

.erp-signature-type-input {
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-md);
}

.erp-signature-type-preview {
    margin-top: 0.6rem;
    padding: 1.5rem 1rem;
    min-height: 7rem;
    border: 1px dashed var(--erp-neutral-300);
    border-radius: var(--erp-radius-md);
    background: var(--erp-surface);
    text-align: center;
    overflow: hidden;
}

.erp-signature-type-preview > span {
    font-family: "Great Vibes", "Snell Roundhand", "Apple Chancery", cursive;
    font-size: 3rem;
    line-height: 1.1;
    color: var(--erp-neutral-800);
    word-break: break-word;
}

.erp-signature-upload-preview-wrap {
    border: 1px dashed var(--erp-neutral-300);
    border-radius: var(--erp-radius-md);
    background: var(--erp-surface);
    padding: 0.75rem;
    text-align: center;
    min-height: 7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.erp-signature-upload-preview {
    max-height: 9rem;
    max-width: 100%;
}

.erp-signature-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.25rem;
    padding-top: 0.25rem;
    border-top: 1px dashed var(--erp-neutral-200);
}

.erp-signature-modal .modal-footer .btn[disabled] { opacity: 0.6; }

body[dir="rtl"] .erp-signature-modal .modal-header .modal-title i {
    margin-right: 0;
    margin-left: 0.5rem;
}
body[dir="rtl"] .erp-signature-toolbar { flex-direction: row-reverse; }
body[dir="rtl"] .erp-signature-modes { flex-direction: row-reverse; }

.erp-signature-demo-preview {
    min-height: 4rem;
    background: var(--erp-surface-muted);
}

/* -------------------------------------------------------------------------- */
/* FWO add — spreadsheet-style line items grid                                 */
/* -------------------------------------------------------------------------- */
.erp-fwo-lines-sheet-outer {
    position: relative;
}

.erp-fwo-sheet-toolbar {
    gap: 0.35rem;
}

.erp-fwo-sheet-toolbar .btn {
    border-radius: var(--erp-radius-sm);
}

.erp-fwo-lines-table .fwo-line-type-badge-btn:focus {
    outline: 2px solid var(--erp-primary);
    outline-offset: 2px;
    box-shadow: none;
}

.fwo-product-ac-dropdown {
    background: var(--erp-surface);
    border-color: var(--erp-border) !important;
}

.erp-fwo-sheet-card {
    border-radius: var(--erp-radius-lg);
    border-color: var(--erp-border);
}

.erp-fwo-grid-placeholder-msg {
    max-width: 35rem;
}

.erp-fwo-lines-table tbody tr.fwo-grid-placeholder td.erp-fwo-grid-placeholder-cell {
    background: var(--erp-surface-muted);
    border-bottom: none;
}

.erp-fwo-lines-table tbody tr.fwo-sheet-row-active:not(.fwo-grid-placeholder) {
    background: var(--erp-primary-soft);
    outline: 1px solid var(--erp-primary);
    outline-offset: -1px;
}

.erp-sheet-extra-slot .form-control-sm {
    min-width: 4.25rem;
    max-width: 8.25rem;
}

.erp-fwo-sheet-scroll-shell {
    background: var(--erp-surface);
    box-shadow: var(--erp-shadow-xs);
}

.erp-fwo-sheet-scroll {
    max-height: min(70vh, 560px);
    overflow: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}

/* FWO add/edit: taller grid so typical line counts fit without inner vertical scroll */
.add-fwo-page .erp-fwo-sheet-scroll {
    max-height: min(96vh, 1800px);
}

.erp-fwo-lines-table {
    border-collapse: separate;
    border-spacing: 0;
    min-width: max(1040px, 100%);
    font-size: 0.8125rem;
    table-layout: auto;
}

.erp-fwo-lines-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: linear-gradient(180deg, var(--erp-neutral-100) 0%, var(--erp-neutral-200) 100%);
    color: var(--erp-neutral-700);
    font-weight: 600;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--erp-neutral-300) !important;
    white-space: nowrap;
    padding: 0.35rem 0.45rem !important;
    padding-inline-end: 0.85rem !important;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
}

.erp-fwo-lines-table td,
.erp-fwo-lines-table th {
    border-color: var(--erp-border) !important;
    vertical-align: middle;
    padding: 0.25rem 0.35rem !important;
}

.erp-fwo-lines-table tbody tr:nth-child(even) {
    background: var(--erp-surface-muted);
}

.erp-fwo-lines-table tbody tr.product-item:focus-within {
    background: var(--erp-primary-soft);
}

.erp-fwo-lines-table .form-control,
.erp-fwo-lines-table .custom-select {
    min-height: 30px;
    padding: 0.2rem 0.35rem;
    font-size: 0.8125rem;
    border-radius: var(--erp-radius-sm);
}

.erp-fwo-lines-table .form-control:focus,
.erp-fwo-lines-table .custom-select:focus {
    border-color: var(--erp-primary);
    box-shadow: 0 0 0 0.12rem var(--erp-primary-soft);
}

.erp-sheet-col-num {
    width: 2rem;
    min-width: 2rem;
}

.erp-sheet-col-img {
    width: 3.25rem;
    min-width: 3.25rem;
}

.erp-sheet-col-qty {
    width: 4.25rem;
    min-width: 4.25rem;
}

.erp-sheet-col-uom {
    width: 5.5rem;
    min-width: 5rem;
}

.erp-sheet-col-status {
    width: 6.5rem;
    min-width: 6rem;
}

.erp-sheet-col-date {
    width: 7rem;
    min-width: 7rem;
}

.erp-sheet-col-pr {
    width: 2.75rem;
    min-width: 2.75rem;
}

.erp-sheet-col-actions {
    width: 2.75rem;
    min-width: 2.75rem;
}

/* Shared with factory FWO / work order line sheets (thead uses these for width hints) */
.erp-sheet-col-part {
    min-width: 8.5rem;
    width: 10rem;
}

.erp-sheet-col-desc {
    min-width: 12rem;
    width: 16rem;
}

.erp-sheet-col-supplier {
    min-width: 6.5rem;
    width: 8rem;
}

.erp-sheet-col-est {
    min-width: 5.25rem;
    width: 5.5rem;
}

.erp-sheet-col-extras {
    min-width: 11rem;
    width: 13rem;
}

.erp-sheet-col-recv-loc {
    min-width: 7rem;
    width: 8.5rem;
}

.erp-sheet-col-line-total {
    min-width: 5rem;
    width: 5.5rem;
}

/* Drag column borders in thead (spreadsheet-like) */
.erp-sheet-resize-handle {
    position: absolute;
    inset-inline-end: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    margin-inline-end: -4px;
    cursor: col-resize;
    z-index: 5;
}

.erp-sheet-resize-handle:hover {
    background: var(--erp-primary-soft);
}

body.erp-sheet-col-resizing {
    user-select: none !important;
    cursor: col-resize !important;
}

.erp-sheet-col-type {
    width: 3.25rem;
}

.erp-sheet-cell-notes {
    min-height: 32px;
    max-height: 88px;
    resize: vertical;
}

.erp-sheet-input-qty {
    font-variant-numeric: tabular-nums;
}

.erp-fwo-thumb {
    object-fit: cover;
    border-radius: var(--erp-radius-sm);
    border: 1px solid var(--erp-border);
    vertical-align: middle;
}

.erp-fwo-row--catalog {
    box-shadow: inset 3px 0 0 0 var(--erp-success);
}

.erp-fwo-row--custom {
    box-shadow: inset 3px 0 0 0 var(--erp-primary);
}

.erp-fwo-row--local {
    box-shadow: inset 3px 0 0 0 var(--erp-info);
}

.erp-fwo-spec-grid-wrap {
    max-height: min(65vh, 540px);
    overflow: auto;
    background: var(--erp-surface);
}

.erp-fwo-spec-grid-table .fwo-spec-h,
.erp-fwo-spec-grid-table .fwo-spec-c {
    min-width: 6.5rem;
}

.erp-fwo-spec-grid-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--erp-surface);
    box-shadow: 0 1px 0 var(--erp-border);
}

.erp-fwo-extra-pair {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 0.25rem;
    align-items: center;
    margin-bottom: 0.25rem;
}

.erp-fwo-spec-modal-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 0.25rem;
    align-items: center;
}

.erp-fwo-spec-preview-wrap {
    max-height: 11rem;
    overflow: auto;
    border-radius: var(--erp-radius-sm, 4px);
}

.erp-fwo-spec-preview {
    margin-bottom: 0;
    font-size: 0.75rem;
}

.erp-fwo-spec-inline-input-wrap {
    margin-bottom: 0.25rem;
}

.erp-fwo-spec-inline-input-wrap:last-child {
    margin-bottom: 0;
}

/* Work order lines: spec sheet columns expanded into the main grid */
.erp-sheet-col-spec-cell {
    min-width: 4.5rem;
    max-width: 9.5rem;
    white-space: normal;
    vertical-align: top;
}

.erp-fwo-spec-inline-col {
    min-width: 3.75rem;
    max-width: 10rem;
    white-space: normal;
    vertical-align: top;
    font-size: 0.8125rem;
    word-break: break-word;
}

.erp-fwo-spec-cell {
    vertical-align: top;
}

.erp-fwo-extras-wrap {
    min-width: 0;
}

.erp-fwo-cell-desc {
    max-height: 4.5rem;
    overflow: auto;
    word-break: break-word;
}

.erp-fwo-na-cell {
    font-size: 0.75rem;
}

body[dir="rtl"] .erp-fwo-row--catalog {
    box-shadow: inset -3px 0 0 0 var(--erp-success);
}

body[dir="rtl"] .erp-fwo-row--custom {
    box-shadow: inset -3px 0 0 0 var(--erp-primary);
}

body[dir="rtl"] .erp-fwo-row--local {
    box-shadow: inset -3px 0 0 0 var(--erp-info);
}

/* -------------------------------------------------------------------------- */
/* Employee private messages (Modernized WhatsApp/Telegram style)               */
/* -------------------------------------------------------------------------- */
.erp-emp-messages-page .erp-chat-card {
    border: none;
    border-radius: var(--erp-radius-xl);
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    background: var(--erp-surface);
}

.erp-chat-layout {
    height: calc(100vh - 12rem);
    min-height: 500px;
}

.erp-chat-sidebar {
    background: var(--erp-surface);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--erp-border);
    height: 100%;
}

.erp-chat-sidebar .border-bottom {
    border-color: var(--erp-border) !important;
}

.erp-chat-search-wrap {
    padding: 1rem;
    background: var(--erp-surface);
    border-bottom: 1px solid var(--erp-border);
}

.erp-chat-search-wrap .form-control {
    border-radius: var(--erp-radius-pill);
    background: var(--erp-neutral-100);
    border: none;
    padding-left: 2.5rem;
    height: 2.5rem;
}

.erp-chat-search-wrap .input-group-text {
    background: transparent;
    border: none;
    position: absolute;
    left: 0.5rem;
    top: 0.4rem;
    z-index: 10;
    color: var(--erp-neutral-400);
}

.erp-chat-tabs {
    background: var(--erp-surface);
    padding: 0 1rem;
    border-bottom: 1px solid var(--erp-border) !important;
}

.erp-chat-tabs .nav-link {
    border: none;
    color: var(--erp-text-muted);
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid transparent;
    transition: all var(--erp-transition-fast);
}

.erp-chat-tabs .nav-link:hover {
    color: var(--erp-primary);
}

.erp-chat-tabs .nav-link.active {
    color: var(--erp-primary);
    border-bottom-color: var(--erp-primary);
    background: transparent;
}

.erp-chat-list-wrap {
    flex: 1;
    overflow-y: auto;
    background: var(--erp-surface);
}

.erp-chat-list-item,
.erp-chat-people-item {
    border: none;
    border-bottom: 1px solid var(--erp-neutral-100);
    padding: 1rem;
    transition: background var(--erp-transition-fast);
    cursor: pointer;
    background: transparent;
}

.erp-chat-list-item:hover,
.erp-chat-people-item:hover {
    background: var(--erp-neutral-50);
}

.erp-chat-list-item.active {
    background: var(--erp-primary-soft);
}

.erp-chat-list-item-unread .font-weight-bold {
    color: var(--erp-neutral-900);
    font-weight: 800 !important;
}

.erp-chat-list-item-unread .text-muted {
    color: var(--erp-neutral-700) !important;
    font-weight: 600;
}

.erp-chat-unread-pill {
    background: var(--erp-primary);
    color: white;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
}

/* Chat Main Area */
.erp-chat-main {
    height: 100%;
    background: #eef2f5;
    position: relative;
}

.erp-chat-thread-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--erp-border);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    height: 4.5rem;
    z-index: 10;
}

.erp-chat-thread-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background-color: #e5ddd5;
    background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23d1d5db' fill-opacity='0.4' fill-rule='evenodd'%3E%3Cpath d='M0 40L40 0H20L0 20M40 40V20L20 40'/%3E%3C/g%3E%3C/svg%3E");
}

.erp-chat-row {
    display: flex;
    margin-bottom: 1rem;
    width: 100%;
}

.erp-chat-row-mine {
    justify-content: flex-end;
}

.erp-chat-row-theirs {
    justify-content: flex-start;
}

.erp-chat-bubble {
    max-width: 75%;
    padding: 0.5rem 1rem 0.5rem 0.75rem;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.4;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    word-break: break-word;
    display: flex;
    flex-direction: column;
}

.erp-chat-row-mine .erp-chat-bubble {
    background: #dcf8c6;
    color: #111b21;
    border-top-right-radius: 4px;
}

.erp-chat-row-theirs .erp-chat-bubble {
    background: #ffffff;
    color: #111b21;
    border-top-left-radius: 4px;
}

.erp-chat-bubble .erp-chat-time {
    font-size: 0.65rem;
    color: rgba(17, 27, 33, 0.5);
    align-self: flex-end;
    margin-top: 2px;
    margin-bottom: -4px;
    margin-right: -4px;
    margin-left: 12px;
}

.erp-chat-compose {
    background: #f0f2f5;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--erp-border);
    display: flex;
    align-items: flex-end;
}

.erp-chat-upload-progress {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-md);
    padding: 0.45rem 0.6rem;
    margin-bottom: 0.55rem;
}

.erp-chat-upload-progress-bar-wrap {
    height: 0.45rem;
    background: var(--erp-neutral-100);
}

.erp-chat-upload-progress-bar {
    background: var(--erp-primary);
}

.erp-chat-compose .input-group {
    background: #ffffff;
    border-radius: 24px;
    padding: 0.25rem 0.5rem;
    display: flex;
    align-items: flex-end;
}

#erpMsgInput {
    border: none;
    box-shadow: none;
    resize: none;
    max-height: 120px;
    min-height: 38px;
    background: transparent;
    padding: 0.5rem 0.75rem;
}

#erpMsgInput:focus {
    outline: none;
}

#erpMsgSendBtn {
    border-radius: 50% !important;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.5rem;
    margin-bottom: 2px;
    background: var(--erp-primary);
    border: none;
    transition: transform 0.2s;
}

#erpMsgSendBtn:hover {
    transform: scale(1.05);
}

.erp-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--erp-primary), #1e40af);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#erpMsgThreadAvatar {
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
}

.badge-sm {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
}

.erp-chat-people-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.erp-chat-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--erp-neutral-500);
}

.erp-chat-empty-state i {
    color: rgba(0,0,0,0.1);
    font-size: 5rem;
    margin-bottom: 1rem;
}

body[dir="rtl"] .erp-chat-row-mine {
    justify-content: flex-start;
}

body[dir="rtl"] .erp-chat-row-mine .erp-chat-bubble {
    border-top-right-radius: 12px;
    border-top-left-radius: 4px;
}

body[dir="rtl"] .erp-chat-row-theirs {
    justify-content: flex-end;
}

body[dir="rtl"] .erp-chat-row-theirs .erp-chat-bubble {
    border-top-left-radius: 12px;
    border-top-right-radius: 4px;
}

body[dir="rtl"] .erp-chat-sidebar {
    border-right: none;
    border-left: 1px solid var(--erp-border);
}

body[dir="rtl"] .erp-chat-search-wrap .form-control {
    padding-left: 1rem;
    padding-right: 2.5rem;
}

body[dir="rtl"] .erp-chat-search-wrap .input-group-text {
    left: auto;
    right: 0.5rem;
}

/* Topbar message dropdown */
.erp-msg-dropdown {
    min-width: 20rem;
    max-width: 24rem;
    z-index: 1050;
}

.erp-msg-list {
    max-height: 20rem;
    overflow-y: auto;
}

.erp-topbar .dropdown-list.erp-msg-dropdown .dropdown-item:focus {
    outline: 2px solid var(--erp-primary);
    outline-offset: -2px;
}

.erp-chat-launch-modal .modal-dialog {
    max-width: min(1200px, 96vw);
}

.erp-chat-launch-modal .modal-content {
    border: none;
    border-radius: var(--erp-radius-xl);
    overflow: hidden;
    box-shadow: 0 22px 65px rgba(15, 23, 42, 0.2);
}

.erp-chat-modal-frame {
    display: block;
    width: 100%;
    height: min(78vh, 860px);
    border: 0;
    background: var(--erp-surface);
}

/* Compose: emoji / recording / attach */
.erp-chat-compose .dropdown-toggle-no-caret::after {
    display: none;
}

.erp-chat-emoji-cell {
    font-size: 1.25rem;
    line-height: 1;
    min-width: 2.25rem;
    padding: 0.2rem 0.35rem;
}

.erp-chat-emoji-cell:focus {
    outline: 2px solid var(--erp-primary);
    outline-offset: 1px;
}

.erp-chat-tool-active {
    background: var(--erp-primary-soft) !important;
    color: var(--erp-primary) !important;
    border-color: rgba(37, 99, 235, 0.35) !important;
}

.erp-chat-annotate-wrap {
    overflow: auto;
    max-height: 60vh;
}

.erp-chat-annotate-canvas {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
    cursor: crosshair;
    touch-action: none;
}

.pulse-rec {
    animation: erp-chat-pulse 1.2s ease-in-out infinite;
}

@keyframes erp-chat-pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.35;
    }
}

.erp-chat-bubble-media {
    display: block;
    max-width: 260px;
    max-height: 280px;
    width: auto;
    height: auto;
    border-radius: var(--erp-radius-md);
}

.erp-chat-bubble-audio {
    width: 220px;
    max-width: 100%;
    min-height: 36px;
}

.erp-chat-doc-tile {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    max-width: 260px;
}

.erp-chat-doc-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--erp-radius-md);
    background: var(--erp-primary-soft);
    color: var(--erp-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.erp-chat-doc-meta {
    flex: 1 1 120px;
    min-width: 0;
}

.erp-chat-doc-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--erp-text);
}

.erp-chat-row-mine .erp-chat-bubble-text {
    color: #111b21;
}

.erp-chat-row-theirs .erp-chat-bubble-text {
    color: var(--erp-text);
}

.erp-chat-bubble .erp-chat-time {
    color: rgba(17, 27, 33, 0.55);
    font-size: 0.65rem;
    align-self: flex-end;
}

.erp-chat-media-link {
    display: inline-block;
    line-height: 0;
}

.erp-chat-media-link:focus {
    outline: 2px solid var(--erp-primary);
    outline-offset: 2px;
    border-radius: var(--erp-radius-md);
}

body.erp-chat-embedded .sidebar,
body.erp-chat-embedded .erp-topbar,
body.erp-chat-embedded .sticky-footer,
body.erp-chat-embedded .scroll-to-top,
body.erp-chat-embedded .erp-chat-launch-modal {
    display: none !important;
}

body.erp-chat-embedded #content-wrapper {
    margin: 0;
    width: 100%;
}

body.erp-chat-embedded #content {
    padding: 0;
}

body.erp-chat-embedded .erp-emp-messages-page {
    margin: 0;
    padding: 0 !important;
    max-width: none;
}

body.erp-chat-embedded .erp-emp-messages-page > .d-sm-flex {
    display: none !important;
}

body.erp-chat-embedded .erp-chat-card {
    border-radius: 0;
    box-shadow: none;
    border: 0;
}

body.erp-chat-embedded .erp-chat-layout {
    min-height: 100vh;
    height: 100vh;
}

@media (max-width: 767.98px) {
    .erp-chat-launch-modal .modal-dialog {
        max-width: 100vw;
        margin: 0;
        min-height: 100vh;
    }

    .erp-chat-launch-modal .modal-content {
        min-height: 100vh;
        border-radius: 0;
    }

    .erp-chat-modal-frame {
        height: calc(100vh - 56px);
    }

    .erp-emp-messages-page .erp-chat-card {
        border-radius: 0;
        box-shadow: none;
    }

    .erp-chat-layout {
        height: calc(100vh - 9.5rem);
        min-height: 520px;
    }

    .erp-chat-thread-body {
        padding: 0.9rem;
    }

    .erp-chat-bubble {
        max-width: 88%;
    }

    .erp-chat-thread-header {
        padding: 0.6rem 0.9rem;
    }
}

/* --- Template designer: template list (view_templates) --- */
.erp-td-view-templates .erp-td-page-lead {
    font-size: 0.9rem;
    color: var(--erp-text-muted);
    max-width: 42rem;
}

.erp-td-view-templates .erp-td-create-card .card-body,
.erp-td-view-templates .erp-td-list-card .card-body {
    padding: 1.25rem;
}

.erp-td-view-templates .erp-td-card-heading {
    background: var(--erp-surface-muted);
    border-bottom: 1px solid var(--erp-border);
}

.erp-td-view-templates .erp-td-list-card .table thead th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: var(--erp-text-muted);
    border-top: 0;
    vertical-align: middle;
}

.erp-td-view-templates .erp-td-list-card .table tbody td {
    vertical-align: middle;
}

.erp-td-view-templates .erp-td-name-link {
    font-weight: 600;
    color: var(--erp-text);
}

.erp-td-view-templates .erp-td-name-link:hover {
    color: var(--erp-primary-hover);
}

.erp-td-view-templates .erp-td-preview-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: var(--erp-radius-sm);
    border: 1px dashed var(--erp-neutral-300);
    background: var(--erp-surface-muted);
    color: var(--erp-text-muted);
    font-size: 0.75rem;
}

.erp-td-preview-zoom {
    position: relative;
    display: inline-block;
    outline: none;
}

.erp-td-preview-zoom__thumb {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-sm);
    background: var(--erp-surface-muted);
    display: block;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.erp-td-preview-zoom:hover .erp-td-preview-zoom__thumb,
.erp-td-preview-zoom:focus-visible .erp-td-preview-zoom__thumb {
    border-color: var(--erp-primary);
    box-shadow: var(--erp-shadow-sm);
}

.erp-td-preview-zoom__flyout {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-50%);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.16s ease, visibility 0.16s ease;
    pointer-events: none;
    padding: 6px;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-md);
    box-shadow: var(--erp-shadow-md);
}

.erp-td-preview-zoom__flyout.is-visible {
    opacity: 1;
    visibility: visible;
}

.erp-td-preview-zoom__flyout img {
    display: block;
    max-width: min(424px, calc(100vw - 32px));
    max-height: min(72vh, 560px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--erp-radius-sm);
    background: var(--erp-surface-muted);
}

.erp-td-view-templates .erp-td-empty-state {
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--erp-text-muted);
}

.erp-td-view-templates .erp-td-empty-state .fa {
    opacity: 0.45;
}

/* Product categories tree (products_category/view_product_categories.php) */
.erp-cat-tree {
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-md);
    overflow: hidden;
    background: var(--erp-surface);
}

.erp-cat-main-block + .erp-cat-main-block {
    border-top: 1px solid var(--erp-border);
}

.erp-cat-main-head {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    background: var(--erp-surface-muted);
}

.erp-cat-main-head .erp-cat-main-text {
    flex: 1;
    min-width: 0;
}

.erp-cat-main-head .erp-cat-main-actions {
    flex-shrink: 0;
}

.erp-cat-toggle {
    padding: 0.25rem 0.45rem;
    color: var(--erp-text-muted);
}

.erp-cat-toggle:focus {
    outline: 2px solid var(--erp-primary);
    outline-offset: 2px;
}

.erp-cat-subs {
    margin: 0;
    padding: 0.35rem 1rem 0.85rem 2.75rem;
    border-left: 3px solid var(--erp-primary-soft);
    margin-left: 1.25rem;
    background: var(--erp-surface);
}

body[dir="rtl"] .erp-cat-subs {
    border-left: none;
    border-right: 3px solid var(--erp-primary-soft);
    margin-left: 0;
    margin-right: 1.25rem;
    padding-right: 2.75rem;
    padding-left: 1rem;
}

.erp-cat-sub-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 0;
    border-bottom: 1px dashed var(--erp-neutral-200);
}

.erp-cat-sub-row:last-child {
    border-bottom: 0;
}

.erp-cat-sub-row .erp-cat-sub-name {
    min-width: 0;
    word-break: break-word;
}

.erp-cat-main-block.is-filter-hidden,
.erp-cat-sub-row.is-filter-hidden {
    display: none !important;
}

.erp-cat-empty-msg {
    padding: 2rem 1.25rem;
    text-align: center;
    color: var(--erp-text-muted);
}

.erp-cat-toolbar-filter {
    min-width: 220px;
    gap: 0.5rem;
}

.erp-cat-filter-input {
    max-width: 320px;
}

.erp-cat-toolbar-actions .btn {
    margin-right: 0.35rem;
    margin-bottom: 0.25rem;
}

.erp-cat-toolbar-actions .btn:last-child {
    margin-right: 0;
}

/* Fleet module — Leaflet map panel */
.erp-fleet-map {
    min-height: 420px;
    width: 100%;
    border-radius: var(--erp-radius-md, 0.5rem);
    border: 1px solid var(--erp-border);
    background: var(--erp-surface-muted);
}

/* ICT — delivery note print (used by ict/delivery_note_print.php) */
.dn-wrap {
    max-width: 800px;
    margin: 24px auto;
    padding: 24px;
    font-family: var(--erp-font-sans);
}

.dn-header {
    border-bottom: 2px solid var(--erp-primary);
    padding-bottom: 16px;
    margin-bottom: 24px;
}

.dn-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.dn-meta {
    margin-top: 16px;
    font-size: 0.95rem;
}

.dn-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

.dn-table th,
.dn-table td {
    border: 1px solid var(--erp-border);
    padding: 8px;
    text-align: left;
}

.dn-sign {
    margin-top: 48px;
    display: flex;
    justify-content: space-between;
}

.dn-sign-box {
    width: 45%;
    border-top: 1px solid var(--erp-neutral-700);
    padding-top: 8px;
    text-align: center;
    font-size: 0.9rem;
}

@media print {
    .dn-no-print {
        display: none !important;
    }

    body {
        margin: 0;
    }

    .dn-wrap {
        margin: 0;
        max-width: none;
    }
}

/* ICT hardware form: keep file control on its own line (label + “No file chosen” don’t run together) */
.ict-hw-photos-group .form-control-file {
    display: block;
    max-width: 100%;
}

/* ICT hardware assignment form (add / edit) */
.ict-hw-form-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--erp-primary, #4e73df);
    margin-bottom: 1rem;
    padding-bottom: 0.35rem;
    border-bottom: 2px solid var(--erp-border, var(--erp-neutral-200));
}

.ict-hw-specs-panel {
    background: var(--erp-surface-muted, var(--erp-neutral-50));
    border-color: var(--erp-border, var(--erp-neutral-200)) !important;
}

.ict-hw-pc-serials {
    border-color: var(--erp-border, var(--erp-neutral-200)) !important;
}

body[dir="rtl"] .ict-hw-form-section-title {
    text-align: right;
}

