/* =====================================================================
   Medical Devices ERP – design system
   Teal/blue medical palette · light & dark · RTL/LTR · responsive
   ===================================================================== */
:root {
    --erp-primary: #0e7c86;
    --erp-primary-rgb: 14, 124, 134;
    --erp-primary-600: #0b6770;
    --erp-accent: #2563eb;
    --erp-success: #16a34a;
    --erp-warning: #d97706;
    --erp-danger: #dc2626;
    --erp-info: #0891b2;
    --erp-violet: #7c3aed;
    --erp-bg: #f3f6f9;
    --erp-surface: #ffffff;
    --erp-surface-2: #f8fafc;
    --erp-border: #e3e9ef;
    --erp-text: #0f2230;
    --erp-muted: #64748b;
    --erp-sidebar: #0b2a3c;
    --erp-sidebar-2: #0f3549;
    --erp-sidebar-text: #b9cbd8;
    --erp-sidebar-active: #14b8a6;
    --erp-radius: 14px;
    --erp-shadow: 0 1px 2px rgba(15, 34, 48, .04), 0 4px 16px rgba(15, 34, 48, .06);
    --erp-sidebar-w: 272px;
    --erp-topbar-h: 64px;
    --bs-primary: var(--erp-primary);
    --bs-primary-rgb: var(--erp-primary-rgb);
    --bs-link-color: var(--erp-primary);
    --bs-link-color-rgb: var(--erp-primary-rgb);
    --bs-link-hover-color: var(--erp-primary-600);
    --bs-body-font-family: "Inter", "Cairo", system-ui, -apple-system, "Segoe UI", sans-serif;
}

[dir="rtl"] { --bs-body-font-family: "Cairo", "Inter", system-ui, "Segoe UI", sans-serif; }

[data-bs-theme="dark"] {
    --erp-bg: #0b1520;
    --erp-surface: #111f2c;
    --erp-surface-2: #0f1b27;
    --erp-border: #1f3344;
    --erp-text: #e2e8f0;
    --erp-muted: #94a3b8;
    --erp-sidebar: #07121b;
    --erp-sidebar-2: #0c1d2a;
    --erp-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --bs-body-bg: var(--erp-bg);
    --bs-body-color: var(--erp-text);
    --bs-border-color: var(--erp-border);
    --bs-secondary-bg: #16283a;
    --bs-tertiary-bg: #13212f;
}

html, body { height: 100%; }
body { background: var(--erp-bg); color: var(--erp-text); font-size: .9rem; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
.num, td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.text-muted { color: var(--erp-muted) !important; }

/* ---------------------------------------------------------- buttons */
.btn-primary { --bs-btn-bg: var(--erp-primary); --bs-btn-border-color: var(--erp-primary); --bs-btn-hover-bg: var(--erp-primary-600); --bs-btn-hover-border-color: var(--erp-primary-600); --bs-btn-active-bg: var(--erp-primary-600); --bs-btn-disabled-bg: var(--erp-primary); --bs-btn-disabled-border-color: var(--erp-primary); }
.btn-outline-primary { --bs-btn-color: var(--erp-primary); --bs-btn-border-color: var(--erp-primary); --bs-btn-hover-bg: var(--erp-primary); --bs-btn-hover-border-color: var(--erp-primary); --bs-btn-active-bg: var(--erp-primary); }
.btn { border-radius: 10px; font-weight: 500; }
.btn-sm { border-radius: 8px; }
.btn-icon { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; color: var(--erp-muted); border: 0; font-size: 1.15rem; }
.btn-icon:hover { background: var(--erp-surface-2); color: var(--erp-text); }
.form-control, .form-select { border-radius: 10px; border-color: var(--erp-border); }
.form-control:focus, .form-select:focus { border-color: var(--erp-primary); box-shadow: 0 0 0 .2rem rgba(var(--erp-primary-rgb), .15); }
.form-label { font-weight: 600; font-size: .82rem; color: var(--erp-muted); margin-bottom: .3rem; }
.form-check-input:checked { background-color: var(--erp-primary); border-color: var(--erp-primary); }

/* ---------------------------------------------------------- sidebar */
.sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--erp-sidebar-w); z-index: 1040;
    background: linear-gradient(180deg, var(--erp-sidebar) 0%, var(--erp-sidebar-2) 100%);
    color: var(--erp-sidebar-text); display: flex; flex-direction: column; transition: transform .25s ease, width .25s ease;
}
.brand { display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1.1rem .9rem; color: #fff; }
.brand-logo { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; color: #fff;
    background: linear-gradient(135deg, #14b8a6, #2563eb); box-shadow: 0 6px 18px rgba(20, 184, 166, .35); flex-shrink: 0; }
.brand-logo.lg { width: 64px; height: 64px; font-size: 2rem; border-radius: 18px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; overflow: hidden; white-space: nowrap; }
.brand-text strong { font-size: 1.05rem; letter-spacing: .2px; }
.brand-text small { color: #7fa3b8; font-size: .72rem; }
.menu-search { margin: .25rem 1rem .75rem; position: relative; }
.menu-search i { position: absolute; inset-inline-start: .75rem; top: 50%; transform: translateY(-50%); color: #6c8ea3; font-size: .85rem; }
.menu-search input { width: 100%; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08); color: #fff; border-radius: 10px; padding: .45rem .75rem .45rem 2.1rem; font-size: .82rem; outline: none; }
[dir="rtl"] .menu-search input { padding: .45rem 2.1rem .45rem .75rem; }
.menu-search input::placeholder { color: #6c8ea3; }
.menu { flex: 1; overflow-y: auto; padding: 0 .65rem 1rem; scrollbar-width: thin; scrollbar-color: #24465b transparent; }
.menu-link { display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border-radius: 10px; color: var(--erp-sidebar-text); font-weight: 500; margin-bottom: 2px; white-space: nowrap; }
.menu-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; }
.menu-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.menu-link.active { background: rgba(20, 184, 166, .16); color: #fff; box-shadow: inset 3px 0 0 var(--erp-sidebar-active); }
[dir="rtl"] .menu-link.active { box-shadow: inset -3px 0 0 var(--erp-sidebar-active); }
.menu-link.sub { padding: .42rem .75rem .42rem 2.35rem; font-size: .84rem; font-weight: 400; }
[dir="rtl"] .menu-link.sub { padding: .42rem 2.35rem .42rem .75rem; }
.menu-link.sub i { font-size: .9rem; opacity: .8; }
.menu-section-toggle { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: .7rem; width: 100%; padding: .55rem .75rem; border-radius: 10px; font-weight: 600; color: #dbe7ef; margin-top: 2px; white-space: nowrap; }
.menu-section-toggle:hover { background: rgba(255, 255, 255, .05); }
.menu-section-toggle i:first-child { font-size: 1.05rem; width: 1.2rem; text-align: center; color: #5eead4; }
.menu-section-toggle .caret { margin-inline-start: auto; font-size: .7rem; transition: transform .2s; opacity: .6; }
.menu-section.open .caret { transform: rotate(180deg); }
.menu-items { display: none; padding: 2px 0 6px; }
.menu-section.open .menu-items { display: block; }
.sidebar-footer { padding: .75rem 1.1rem; font-size: .72rem; color: #6c8ea3; border-top: 1px solid rgba(255, 255, 255, .06); white-space: nowrap; }
.dot-online { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; margin-inline-end: 4px; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }

/* ------------------------------------------------------- main + topbar */
.main { margin-inline-start: var(--erp-sidebar-w); min-height: 100vh; display: flex; flex-direction: column; transition: margin .25s ease; }
.topbar { position: sticky; top: 0; z-index: 1030; height: var(--erp-topbar-h); display: flex; align-items: center; gap: .75rem; padding: 0 1.25rem;
    background: color-mix(in srgb, var(--erp-surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--erp-border); }
.topbar-title h1 { font-size: 1.05rem; margin: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; }
.global-search { position: relative; margin-inline-start: auto; width: 340px; }
.global-search i { position: absolute; inset-inline-start: .8rem; top: 50%; transform: translateY(-50%); color: var(--erp-muted); }
.global-search input { width: 100%; border: 1px solid var(--erp-border); background: var(--erp-surface-2); border-radius: 12px; padding: .5rem .8rem .5rem 2.3rem; outline: none; color: var(--erp-text); }
[dir="rtl"] .global-search input { padding: .5rem 2.3rem .5rem .8rem; }
.global-search input:focus { border-color: var(--erp-primary); }
.topbar-actions { display: flex; align-items: center; gap: .25rem; margin-inline-start: auto; }
.global-search + .topbar-actions { margin-inline-start: .75rem; }
.lang-chip { font-size: .78rem; font-weight: 700; border: 1.5px solid currentColor; border-radius: 6px; padding: 0 5px; line-height: 1.4; }
.notif-count { position: absolute; top: 4px; inset-inline-end: 4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--erp-danger); color: #fff; font-size: .65rem; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--erp-surface); }
.notif-menu { width: 360px; max-width: 92vw; padding: 0; border-radius: 14px; overflow: hidden; }
.notif-list { max-height: 400px; overflow-y: auto; }
.notif-item { display: flex; gap: .7rem; padding: .7rem 1rem; border-bottom: 1px solid var(--erp-border); color: var(--erp-text); }
.notif-item:hover { background: var(--erp-surface-2); }
.notif-item.unread { background: rgba(var(--erp-primary-rgb), .05); }
.notif-item .ni { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.notif-item small { color: var(--erp-muted); display: block; }
.user-chip { display: flex; align-items: center; gap: .55rem; padding: .25rem .5rem; border: 0; border-radius: 12px; }
.user-chip:hover { background: var(--erp-surface-2); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--erp-primary), var(--erp-accent)); color: #fff; font-weight: 700; font-size: .82rem; text-transform: uppercase; flex-shrink: 0; }
.avatar.sm { width: 28px; height: 28px; font-size: .7rem; }
.content { padding: 1.5rem; flex: 1; }
.app-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; padding: 1rem 1.5rem; font-size: .78rem; color: var(--erp-muted); border-top: 1px solid var(--erp-border); }

/* collapsed sidebar (desktop) */
html.sidebar-collapsed { --erp-sidebar-w: 76px; }
html.sidebar-collapsed .brand-text, html.sidebar-collapsed .menu-search, html.sidebar-collapsed .menu-link span,
html.sidebar-collapsed .menu-section-toggle span, html.sidebar-collapsed .menu-section-toggle .caret, html.sidebar-collapsed .sidebar-footer { display: none; }
html.sidebar-collapsed .menu-items { display: none !important; }
html.sidebar-collapsed .menu-link, html.sidebar-collapsed .menu-section-toggle { justify-content: center; padding: .6rem; }
html.sidebar-collapsed .brand { justify-content: center; }

.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); width: 280px; }
    [dir="rtl"] .sidebar { transform: translateX(100%); }
    .main { margin-inline-start: 0; }
    html.sidebar-open .sidebar { transform: none; }
    html.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(2, 12, 20, .5); z-index: 1035; }
    html.sidebar-collapsed { --erp-sidebar-w: 272px; }
    html.sidebar-collapsed .brand-text, html.sidebar-collapsed .menu-search, html.sidebar-collapsed .menu-link span, html.sidebar-collapsed .menu-section-toggle span { display: initial; }
    .content { padding: 1rem; }
    .topbar { padding: 0 .75rem; }
}

/* ------------------------------------------------------------ cards */
.card { background: var(--erp-surface); border: 1px solid var(--erp-border); border-radius: var(--erp-radius); box-shadow: var(--erp-shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--erp-border); padding: .9rem 1.15rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.card-header .card-actions { margin-inline-start: auto; display: flex; gap: .4rem; }
.card-body { padding: 1.15rem; }
.page-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head .ph-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.4rem; color: var(--erp-primary); background: rgba(var(--erp-primary-rgb), .1); }
.page-head h2 { font-size: 1.35rem; font-weight: 700; margin: 0; }
.page-head .sub { color: var(--erp-muted); font-size: .85rem; }
.page-head .actions { margin-inline-start: auto; display: flex; gap: .5rem; flex-wrap: wrap; }

/* KPI tiles */
.kpi { position: relative; padding: 1.1rem 1.15rem; height: 100%; overflow: hidden; }
.kpi .kpi-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 1.3rem; }
.kpi .kpi-label { color: var(--erp-muted); font-size: .8rem; font-weight: 600; margin-top: .75rem; }
.kpi .kpi-value { font-size: 1.55rem; font-weight: 800; letter-spacing: -.5px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi .kpi-foot { font-size: .75rem; margin-top: .2rem; color: var(--erp-muted); }
.kpi a.stretched-link:hover ~ * { opacity: .9; }
.tone-teal { background: rgba(14, 124, 134, .12); color: #0e7c86; }
.tone-blue { background: rgba(37, 99, 235, .12); color: #2563eb; }
.tone-green { background: rgba(22, 163, 74, .12); color: #16a34a; }
.tone-amber { background: rgba(217, 119, 6, .12); color: #d97706; }
.tone-red { background: rgba(220, 38, 38, .12); color: #dc2626; }
.tone-violet { background: rgba(124, 58, 237, .12); color: #7c3aed; }
.tone-cyan { background: rgba(8, 145, 178, .12); color: #0891b2; }
.tone-slate { background: rgba(100, 116, 139, .14); color: #475569; }
[data-bs-theme="dark"] .tone-slate { color: #cbd5e1; }
.trend-up { color: var(--erp-success); font-weight: 600; }
.trend-down { color: var(--erp-danger); font-weight: 600; }
.hero-banner { border-radius: var(--erp-radius); padding: 1.35rem 1.5rem; color: #fff; background: radial-gradient(1200px 300px at 0% 0%, rgba(20, 184, 166, .55), transparent), linear-gradient(120deg, #0b2a3c, #0e4d6b 55%, #1d4ed8); box-shadow: var(--erp-shadow); }
.hero-banner h2 { font-weight: 800; font-size: 1.4rem; margin: 0; }
.hero-banner p { margin: .25rem 0 0; opacity: .85; }
.hero-banner .btn-light { color: #0b2a3c; }
.chart-box { position: relative; height: 300px; }
.chart-box.sm { height: 230px; }

/* lists inside cards */
.list-row { display: flex; align-items: center; gap: .75rem; padding: .65rem 0; border-bottom: 1px dashed var(--erp-border); }
.list-row:last-child { border-bottom: 0; }
.list-row .lr-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.list-row .lr-main { flex: 1; min-width: 0; }
.list-row .lr-main strong, .list-row .lr-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .lr-main small { color: var(--erp-muted); }
.progress { height: 8px; border-radius: 8px; background: var(--erp-surface-2); }
.progress-bar { background: linear-gradient(90deg, var(--erp-primary), #14b8a6); border-radius: 8px; }

/* ----------------------------------------------------------- tables */
.table { --bs-table-bg: transparent; --bs-table-color: var(--erp-text); margin-bottom: 0; vertical-align: middle; }
.table > thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .4px; color: var(--erp-muted); font-weight: 700; background: var(--erp-surface-2); border-bottom: 1px solid var(--erp-border); white-space: nowrap; }
[dir="rtl"] .table > thead th { letter-spacing: 0; font-size: .8rem; }
.table > tbody td { border-color: var(--erp-border); }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: rgba(var(--erp-primary-rgb), .04); }
.row-actions { display: flex; gap: .25rem; justify-content: flex-end; flex-wrap: nowrap; }
.row-actions .btn { padding: .2rem .45rem; }
div.dt-container .dt-search input { border-radius: 10px; min-width: 240px; }
div.dt-container .dt-length select { border-radius: 10px; }
div.dt-container .dt-paging .page-link { border-radius: 8px; margin: 0 2px; }
div.dt-container .dt-paging .page-item.active .page-link { background: var(--erp-primary); border-color: var(--erp-primary); }
div.dt-container div.dt-layout-row { margin: .5rem 0; }
div.dt-processing > div:last-child > div { background: var(--erp-primary) !important; }
table.dataTable th.dt-type-numeric, table.dataTable td.dt-type-numeric { text-align: start; }

/* status badges */
.status-badge { font-weight: 600; font-size: .72rem; padding: .35em .65em; border-radius: 999px; background: rgba(100, 116, 139, .14); color: #475569; }
[data-bs-theme="dark"] .status-badge { color: #cbd5e1; }
.status-draft, .status-new, .status-notstarted, .status-planning, .status-prospecting, .status-scheduled, .status-ordered, .status-low, .status-due { background: rgba(100, 116, 139, .15); color: #475569; }
.status-submitted, .status-sent, .status-assigned, .status-pendingapproval, .status-pending, .status-contacted, .status-qualification, .status-needsanalysis, .status-intransit, .status-medium, .status-mitigating, .status-reserved { background: rgba(37, 99, 235, .13); color: #1d4ed8; }
.status-approved, .status-accepted, .status-active, .status-completed, .status-paid, .status-closedwon, .status-resolved, .status-present, .status-installed, .status-delivered, .status-cleared, .status-qualified, .status-converted, .status-create, .status-instock, .status-closed { background: rgba(22, 163, 74, .13); color: #15803d; }
.status-posted, .status-proposal, .status-negotiation, .status-inprogress, .status-update, .status-atcustoms, .status-remote, .status-sold { background: rgba(8, 145, 178, .14); color: #0e7490; }
.status-partiallypaid, .status-waitingparts, .status-waitingcustomer, .status-onhold, .status-late, .status-high, .status-expired, .status-renewed, .status-undermaintenance, .status-overdue, .status-onleave { background: rgba(217, 119, 6, .15); color: #b45309; }
.status-rejected, .status-cancelled, .status-closedlost, .status-blocked, .status-critical, .status-terminated, .status-delete, .status-absent, .status-unqualified, .status-scrapped, .status-returned { background: rgba(220, 38, 38, .13); color: #b91c1c; }
.status-archived { background: rgba(124, 58, 237, .13); color: #6d28d9; }
[data-bs-theme="dark"] [class*="status-"] { filter: brightness(1.35); }

/* ------------------------------------------------------------ forms */
.form-section { border: 1px solid var(--erp-border); border-radius: var(--erp-radius); padding: 1.1rem; background: var(--erp-surface); }
.required-mark { color: var(--erp-danger); margin-inline-start: 2px; }
.ts-wrapper.form-select, .ts-wrapper.form-control { padding: 0; border: 0; }
.ts-control { border-radius: 10px !important; border-color: var(--erp-border) !important; min-height: 38px; background: var(--bs-body-bg) !important; color: var(--erp-text); }
.ts-dropdown { border-radius: 10px; background: var(--erp-surface); color: var(--erp-text); border-color: var(--erp-border); }
.ts-dropdown .active { background: rgba(var(--erp-primary-rgb), .12); color: var(--erp-text); }
[dir="rtl"] .ts-wrapper.single .ts-control:after { right: auto; left: 15px; }
.field-validation-error, .text-danger.small { font-size: .78rem; }

/* line-item editor */
.lines-table td { padding: .35rem; }
.lines-table .form-control, .lines-table .form-select { font-size: .85rem; padding: .35rem .5rem; }
.lines-table input[type=number] { min-width: 80px; }
.totals-box { background: var(--erp-surface-2); border-radius: 12px; padding: 1rem; }
.totals-box .t-row { display: flex; justify-content: space-between; padding: .25rem 0; }
.totals-box .t-row.grand { font-size: 1.15rem; font-weight: 800; border-top: 1px solid var(--erp-border); margin-top: .35rem; padding-top: .6rem; color: var(--erp-primary); }

/* printable document */
.doc-sheet { background: var(--erp-surface); border: 1px solid var(--erp-border); border-radius: var(--erp-radius); padding: 2rem; box-shadow: var(--erp-shadow); }
.doc-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-bottom: 3px solid var(--erp-primary); padding-bottom: 1rem; margin-bottom: 1.25rem; }
.doc-title { font-size: 1.6rem; font-weight: 800; color: var(--erp-primary); text-transform: uppercase; letter-spacing: 1px; }
.doc-meta dt { color: var(--erp-muted); font-weight: 600; font-size: .78rem; }
.doc-meta dd { font-weight: 600; margin-bottom: .5rem; }

/* details */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9rem 1.5rem; }
.detail-grid .dl-item small { display: block; color: var(--erp-muted); font-weight: 600; font-size: .75rem; margin-bottom: .1rem; }
.detail-grid .dl-item div { font-weight: 500; word-break: break-word; }
.nav-tabs.erp-tabs { border-bottom: 1px solid var(--erp-border); gap: .25rem; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
.nav-tabs.erp-tabs .nav-link { border: 0; color: var(--erp-muted); font-weight: 600; padding: .7rem 1rem; border-bottom: 2px solid transparent; white-space: nowrap; }
.nav-tabs.erp-tabs .nav-link.active { color: var(--erp-primary); background: transparent; border-bottom-color: var(--erp-primary); }
.timeline { position: relative; padding-inline-start: 1.5rem; }
.timeline::before { content: ""; position: absolute; inset-inline-start: .45rem; top: .3rem; bottom: .3rem; width: 2px; background: var(--erp-border); }
.timeline .tl-item { position: relative; padding-bottom: 1rem; }
.timeline .tl-item::before { content: ""; position: absolute; inset-inline-start: -1.3rem; top: .3rem; width: 12px; height: 12px; border-radius: 50%; background: var(--erp-surface); border: 3px solid var(--erp-primary); }
.timeline .tl-item small { color: var(--erp-muted); }

/* kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 1rem; overflow-x: auto; padding-bottom: .5rem; }
.kanban-col { background: var(--erp-surface-2); border: 1px solid var(--erp-border); border-radius: var(--erp-radius); padding: .75rem; min-height: 300px; }
.kanban-col h6 { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: .75rem; }
.kanban-card { background: var(--erp-surface); border: 1px solid var(--erp-border); border-radius: 12px; padding: .75rem; margin-bottom: .6rem; cursor: grab; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.kanban-card:active { cursor: grabbing; }
.kanban-col.drag-over { outline: 2px dashed var(--erp-primary); }

/* gantt */
.gantt-wrap { overflow-x: auto; direction: ltr; }
.gantt .bar-wrapper.bar-done .bar { fill: #16a34a; }
.gantt .bar-wrapper.bar-late .bar { fill: #dc2626; }
.gantt .bar-wrapper.bar-blocked .bar { fill: #d97706; }
.gantt .bar-wrapper.bar-milestone .bar { fill: #7c3aed; }
.gantt .bar-progress { fill: rgba(0, 0, 0, .25) !important; }
[data-bs-theme="dark"] .gantt .grid-background, [data-bs-theme="dark"] .gantt .grid-header { fill: var(--erp-surface); }
[data-bs-theme="dark"] .gantt .grid-row { fill: var(--erp-surface); }
[data-bs-theme="dark"] .gantt .grid-row:nth-child(even) { fill: var(--erp-surface-2); }
[data-bs-theme="dark"] .gantt .lower-text, [data-bs-theme="dark"] .gantt .upper-text { fill: var(--erp-muted); }
[data-bs-theme="dark"] .gantt .row-line, [data-bs-theme="dark"] .gantt .tick { stroke: var(--erp-border); }

/* permission matrix */
.perm-table th, .perm-table td { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: start; }

/* auth */
.auth-body { background: var(--erp-bg); }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { color: #fff; padding: 4rem; align-items: center; background: radial-gradient(800px 400px at 10% 10%, rgba(20, 184, 166, .45), transparent), linear-gradient(135deg, #0b2a3c, #0e4d6b 55%, #1d4ed8); }
.auth-hero h1 { font-weight: 800; font-size: 2.1rem; line-height: 1.3; }
.auth-hero .lead { opacity: .85; max-width: 520px; }
.auth-points { list-style: none; padding: 0; margin-top: 2rem; }
.auth-points li { display: flex; gap: .75rem; align-items: center; margin-bottom: .9rem; font-size: 1rem; }
.auth-points i { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .12); }
.auth-panel { padding: 2.5rem; display: flex; flex-direction: column; justify-content: center; max-width: 520px; width: 100%; margin: 0 auto; }
.auth-card h2 { font-weight: 800; }
.demo-accounts { font-size: .78rem; }
.demo-accounts code { cursor: pointer; }
@media (max-width: 991.98px) { .auth-shell { grid-template-columns: 1fr; } }

/* misc */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--erp-muted); }
.empty-state i { font-size: 2.2rem; display: block; margin-bottom: .5rem; opacity: .6; }
.qr-box { background: #fff; padding: 12px; border-radius: 12px; display: inline-block; }
.risk-matrix td { width: 20%; height: 44px; text-align: center; font-weight: 700; border: 2px solid var(--erp-surface) !important; border-radius: 6px; }
.dropdown-menu { border-color: var(--erp-border); border-radius: 12px; }
.alert { border-radius: 12px; }
.toast { border-radius: 12px; }
#scanReader video { border-radius: 12px; }

@media print {
    .sidebar, .topbar, .app-footer, .no-print, .alert, .toast-container { display: none !important; }
    .main { margin: 0 !important; }
    .content { padding: 0 !important; }
    .card, .doc-sheet { box-shadow: none !important; border: 0 !important; }
    body { background: #fff !important; color: #000 !important; font-size: 11pt; }
    [data-bs-theme="dark"] body { background: #fff; }
}
.validation-summary-valid { display: none; }

/* FullCalendar hides the list view's table header at left:-10000px. In RTL pages that off-screen box widens the
   document by 10,000px, so phones zoom the whole page out and the calendar looks blank. Hide it in place instead
   ("html body" outranks the stylesheet FullCalendar injects at runtime). */
html body .fc .fc-list-table thead { position: absolute; left: auto; right: auto; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
