:root {
    --erp-bg0: #e8f1fb;
    --erp-bg1: #f7fbff;
    --erp-surface: rgba(255, 255, 255, 0.92);
    --erp-surface-strong: rgba(255, 255, 255, 0.97);
    --erp-border: rgba(43, 108, 176, 0.16);
    --erp-border-strong: rgba(43, 108, 176, 0.28);
    --erp-text: #0f2744;
    --erp-muted: #3f5470;
    --erp-accent: #0e8f9b;
    --erp-accent-2: #2b6cb0;
    --erp-accent-soft: rgba(14, 143, 155, 0.14);
    --erp-sidebar: rgba(11, 31, 58, 0.94);
    --erp-sidebar-text: #e7f0fb;
    --erp-sidebar-muted: #a9bfdc;
    --erp-ok: #047857;
    --erp-ok-bg: rgba(16, 185, 129, 0.14);
    --erp-warn: #b45309;
    --erp-warn-bg: rgba(245, 158, 11, 0.16);
    --erp-danger: #be123c;
    --erp-danger-bg: rgba(244, 63, 94, 0.12);
    --erp-radius: 1rem;
    --erp-radius-sm: 0.75rem;
    --erp-blur: 18px;
    --erp-shadow: 0 10px 40px rgba(15, 39, 68, 0.08);
    --erp-ring: 0 0 0 3px rgba(14, 143, 155, 0.22);
    --erp-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Naskh Arabic", sans-serif;
}

html.dark {
    --erp-bg0: #070d18;
    --erp-bg1: #0b1730;
    --erp-surface: rgba(15, 27, 48, 0.92);
    --erp-surface-strong: rgba(18, 32, 56, 0.96);
    --erp-border: rgba(148, 163, 184, 0.16);
    --erp-border-strong: rgba(148, 163, 184, 0.28);
    --erp-text: #e8eef8;
    --erp-muted: #a8b8d2;
    --erp-accent: #2dd4bf;
    --erp-accent-2: #60a5fa;
    --erp-accent-soft: rgba(45, 212, 191, 0.14);
    --erp-sidebar: rgba(6, 16, 31, 0.96);
    --erp-sidebar-text: #e8eef8;
    --erp-sidebar-muted: #9db2d0;
    --erp-ok: #6ee7b7;
    --erp-ok-bg: rgba(16, 185, 129, 0.16);
    --erp-warn: #fbbf24;
    --erp-warn-bg: rgba(245, 158, 11, 0.16);
    --erp-danger: #fb7185;
    --erp-danger-bg: rgba(244, 63, 94, 0.16);
    --erp-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    --erp-ring: 0 0 0 3px rgba(45, 212, 191, 0.25);
}

html, body {
    font-family: var(--erp-font);
    color: var(--erp-text);
    background: radial-gradient(1200px 600px at 10% -10%, rgba(14, 143, 155, 0.16), transparent 55%),
                radial-gradient(900px 500px at 110% 0%, rgba(43, 108, 176, 0.18), transparent 50%),
                linear-gradient(180deg, var(--erp-bg0), var(--erp-bg1));
    min-height: 100%;
}

.erp-shell {
    display: flex;
    min-height: 100vh;
}

.erp-sidebar {
    width: 16.5rem;
    flex-shrink: 0;
    background: var(--erp-sidebar);
    color: var(--erp-sidebar-text);
    backdrop-filter: blur(var(--erp-blur));
    -webkit-backdrop-filter: blur(var(--erp-blur));
    border-inline-end: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
}

.erp-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.35rem 1.15rem 1rem;
}

.erp-mark {
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 0.7rem;
    background: linear-gradient(135deg, #2dd4bf, #2b6cb0);
    box-shadow: 0 6px 18px rgba(45, 212, 191, 0.28);
    position: relative;
    flex-shrink: 0;
}

.erp-mark::after {
    content: "";
    position: absolute;
    inset: 7px;
    border-radius: 0.35rem;
    border: 2px solid rgba(255, 255, 255, 0.85);
    border-bottom-color: transparent;
    transform: rotate(-20deg);
}

.erp-brand-name {
    font-weight: 650;
    letter-spacing: 0.02em;
    font-size: 1rem;
    line-height: 1.2;
}

.erp-brand-phase {
    font-size: 0.75rem;
    color: var(--erp-sidebar-muted);
    margin-top: 0.1rem;
}

.erp-nav {
    padding: 0.25rem 0.7rem 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.erp-nav-group {
    margin-bottom: 0.85rem;
}

.erp-nav-label {
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--erp-sidebar-muted);
    padding: 0.35rem 0.7rem 0.4rem;
}

.erp-nav-details {
    margin-bottom: 0.35rem;
}

.erp-nav-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border-radius: 0.7rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 650;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--erp-sidebar-muted);
    user-select: none;
}

.erp-pager {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-top: .8rem;
}

.erp-audit-meta span {
    display: inline-block;
    margin-inline-end: .65rem;
    font-size: .85rem;
}

/* Standalone top-level link (Dashboard) — big-menu look without a chevron */
a.erp-nav-standalone {
    display: flex;
    align-items: center;
    border-radius: 0.7rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.82rem;
    font-weight: 650;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--erp-sidebar-muted);
    text-decoration: none;
}

a.erp-nav-standalone:hover,
a.erp-nav-standalone.is-active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--erp-sidebar-text);
}

.erp-nav-summary::-webkit-details-marker {
    display: none;
}

.erp-nav-summary::after {
    content: "";
    width: 0.38rem;
    height: 0.38rem;
    border-inline-end: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 150ms ease;
    flex-shrink: 0;
    opacity: 0.8;
}

.erp-nav-details[open] > .erp-nav-summary {
    color: var(--erp-sidebar-text);
    background: rgba(255, 255, 255, 0.06);
}

.erp-nav-details[open] > .erp-nav-summary::after {
    transform: rotate(225deg);
}

.erp-nav-summary:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--erp-sidebar-text);
}

.erp-nav-sub {
    padding-inline-start: 0.35rem;
    margin: 0.15rem 0 0.35rem 0.55rem;
    border-inline-start: 1px solid rgba(255, 255, 255, 0.1);
}

.erp-nav-link {
    display: block;
    position: relative;
    border-radius: 0.7rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    color: var(--erp-sidebar-text);
    text-decoration: none;
    margin-bottom: 0.15rem;
    transition: background 150ms ease, color 150ms ease;
}

.erp-nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
}

.erp-nav-link.is-active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.erp-nav-link.is-active::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 99px;
    background: var(--erp-accent);
}

.erp-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.erp-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.5rem;
    background: color-mix(in srgb, var(--erp-surface-strong) 88%, transparent);
    backdrop-filter: blur(var(--erp-blur));
    -webkit-backdrop-filter: blur(var(--erp-blur));
    border-bottom: 1px solid var(--erp-border);
}

.erp-title {
    font-size: 1.2rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    margin: 0;
}

.erp-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.erp-content {
    padding: 1.4rem 1.5rem 2rem;
    flex: 1;
}

.erp-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 1rem;
    padding: 0.3rem;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-sm);
    box-shadow: var(--erp-shadow);
    backdrop-filter: blur(var(--erp-blur));
    -webkit-backdrop-filter: blur(var(--erp-blur));
}

.erp-tab {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.85rem;
    border-radius: 0.6rem;
    font-size: 0.95rem;
    color: var(--erp-muted);
    text-decoration: none;
    transition: background 150ms ease, color 150ms ease;
}

.erp-tab:hover {
    background: var(--erp-accent-soft);
    color: var(--erp-text);
}

.erp-tab.is-active {
    background: var(--erp-accent-soft);
    color: var(--erp-text);
    font-weight: 650;
    box-shadow: inset 0 0 0 1px var(--erp-border-strong);
}

.erp-card {
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    box-shadow: var(--erp-shadow);
    backdrop-filter: blur(var(--erp-blur));
    -webkit-backdrop-filter: blur(var(--erp-blur));
    padding: 1.15rem 1.2rem;
    transition: transform 150ms ease, box-shadow 150ms ease;
}

.erp-card + .erp-card {
    margin-top: 1rem;
}

.erp-card-title {
    font-size: 0.92rem;
    font-weight: 650;
    margin: 0 0 0.9rem;
}

.erp-stat {
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    box-shadow: var(--erp-shadow);
    backdrop-filter: blur(var(--erp-blur));
    -webkit-backdrop-filter: blur(var(--erp-blur));
    padding: 1.15rem 1.2rem;
}

.erp-stat-label {
    font-size: 0.8rem;
    color: var(--erp-muted);
}

.erp-stat-value {
    margin-top: 0.4rem;
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--erp-accent), var(--erp-accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.erp-muted {
    color: var(--erp-muted);
}

.erp-table-wrap {
    overflow: auto;
    border-radius: calc(var(--erp-radius) - 4px);
}

.erp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.erp-table th {
    position: sticky;
    top: 0;
    text-align: start;
    font-weight: 600;
    color: var(--erp-muted);
    background: var(--erp-surface-strong);
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--erp-border);
    white-space: nowrap;
}

.erp-table td {
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--erp-border);
    vertical-align: middle;
}

.erp-table tbody tr:nth-child(even) {
    background: rgba(43, 108, 176, 0.035);
}

html.dark .erp-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.025);
}

.erp-table tbody tr:hover {
    background: var(--erp-accent-soft);
}

.erp-table tfoot td {
    font-weight: 650;
    background: var(--erp-surface-strong);
    border-top: 1px solid var(--erp-border-strong);
}

.erp-num {
    font-variant-numeric: tabular-nums;
    text-align: end;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.erp-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.erp-label {
    display: block;
    font-size: 0.75rem;
    color: var(--erp-muted);
    margin-bottom: 0.3rem;
}

.erp-input,
.erp-select {
    width: 100%;
    border: 1px solid var(--erp-border-strong);
    background: var(--erp-surface-strong);
    color: var(--erp-text);
    border-radius: var(--erp-radius-sm);
    padding: 0.5rem 0.7rem;
    font-size: 0.95rem;
    outline: none;
}

.erp-input:focus,
.erp-select:focus {
    box-shadow: var(--erp-ring);
    border-color: var(--erp-accent);
}

.erp-btn,
.erp-btn-primary,
.erp-btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--erp-radius-sm);
    padding: 0.5rem 0.9rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    background: transparent;
    color: inherit;
    transition: background 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.erp-btn {
    border-color: var(--erp-border-strong);
    background: var(--erp-surface-strong);
    color: var(--erp-text);
}

.erp-btn:hover {
    background: var(--erp-accent-soft);
}

.erp-btn-primary {
    background: linear-gradient(135deg, var(--erp-accent), var(--erp-accent-2));
    color: #fff;
    box-shadow: 0 6px 16px rgba(14, 143, 155, 0.25);
}

.erp-btn-primary:hover {
    filter: brightness(1.05);
}

.erp-btn-danger {
    border-color: rgba(190, 18, 60, 0.28);
    color: var(--erp-danger);
    background: var(--erp-danger-bg);
}

.erp-btn-danger:hover {
    filter: brightness(1.05);
}

.erp-flash-ok,
.erp-flash-err {
    border-radius: var(--erp-radius-sm);
    padding: 0.65rem 0.85rem;
    font-size: 0.95rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.erp-flash-ok {
    background: var(--erp-ok-bg);
    color: var(--erp-ok);
    border-color: rgba(16, 185, 129, 0.25);
}

.erp-flash-err {
    background: var(--erp-danger-bg);
    color: var(--erp-danger);
    border-color: rgba(244, 63, 94, 0.25);
}

.erp-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    font-size: 0.78rem;
    font-weight: 650;
    background: var(--erp-accent-soft);
    color: var(--erp-accent-2);
}

.erp-chip-ok {
    background: var(--erp-ok-bg);
    color: var(--erp-ok);
}

.erp-chip-warn {
    background: var(--erp-warn-bg);
    color: var(--erp-warn);
}

.erp-filterbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.9rem;
    align-items: end;
}

.erp-filterbar .erp-input,
.erp-filterbar .erp-select {
    width: auto;
    min-width: 9.5rem;
}

.erp-empty {
    text-align: center;
    color: var(--erp-muted);
    padding: 1.5rem 0.75rem !important;
}

.erp-grid-3 {
    display: grid;
    gap: 1rem;
}

.erp-grid-2 {
    display: grid;
    gap: 1rem;
}

.erp-form-grid {
    display: grid;
    gap: 0.75rem;
}

.erp-user {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-inline-start: 0.35rem;
    padding: 0.2rem 0.55rem 0.2rem 0.2rem;
    border-radius: 999px;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    font-size: 0.8rem;
}

.erp-avatar {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--erp-accent), var(--erp-accent-2));
}

.erp-login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: radial-gradient(900px 500px at 20% 10%, rgba(14, 143, 155, 0.22), transparent 55%),
                radial-gradient(700px 420px at 90% 90%, rgba(43, 108, 176, 0.22), transparent 50%),
                linear-gradient(180deg, var(--erp-bg0), var(--erp-bg1));
}

.erp-login-card {
    width: 100%;
    max-width: 28rem;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: 1.25rem;
    box-shadow: var(--erp-shadow);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    padding: 1.75rem 1.6rem 1.4rem;
}

.erp-login-kicker {
    font-size: 0.8rem;
    font-weight: 650;
    color: var(--erp-accent);
}

.erp-login h1 {
    margin: 0.2rem 0 1.1rem;
    font-size: 1.55rem;
    letter-spacing: -0.03em;
}

.erp-stack {
    display: grid;
    gap: 0.85rem;
}

.erp-inline {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
}

.erp-link {
    color: var(--erp-accent-2);
    text-decoration: none;
}

.erp-link:hover {
    text-decoration: underline;
}

.erp-hint {
    margin-top: 0.85rem;
    font-size: 0.82rem;
    color: var(--erp-muted);
}

@media (min-width: 768px) {
    .erp-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .erp-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .erp-form-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .erp-form-grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .erp-form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .erp-form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* ==========================================================================
   Branding: sidebar company-logo slot, vendor footer, printable doc headers
   ========================================================================== */

.erp-brand-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* White chip so any logo (light or dark) stays visible on the dark sidebar */
.erp-brand-logo img {
    height: 2.35rem;
    max-width: 8.75rem;
    object-fit: contain;
    border-radius: 0.45rem;
    background: rgba(255, 255, 255, 0.94);
    padding: 0.16rem 0.32rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}

.erp-sidebar-footer {
    margin-top: auto;
    padding: 0.85rem 1.15rem 1.05rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.erp-sidebar-footer-label {
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--erp-sidebar-muted);
}

.erp-sidebar-footer img {
    height: 1.55rem;
    max-width: 6.5rem;
    object-fit: contain;
    opacity: 0.94;
}

/* ---------- printable document header (invoices, reports, slips) ---------- */

.erp-doc-header {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.35rem 0 1rem;
    border-bottom: 2px solid var(--erp-accent, #2dd4bf);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.erp-doc-logo {
    height: 3.1rem;
    max-width: 11rem;
    object-fit: contain;
}

.erp-doc-company-name {
    font-weight: 700;
    font-size: 1.02rem;
    line-height: 1.25;
}

.erp-doc-company-meta {
    font-size: 0.76rem;
    color: var(--erp-muted, #64748b);
    margin-top: 0.1rem;
}

.erp-doc-title {
    margin-inline-start: auto;
    text-align: end;
    font-weight: 700;
    font-size: 0.95rem;
}

.erp-doc-title .erp-doc-meta {
    display: block;
    font-weight: 500;
    font-size: 0.78rem;
    color: var(--erp-muted, #64748b);
    font-family: var(--erp-mono, ui-monospace, monospace);
}

.erp-doc-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

/* ---------- print: clean document with the company logo ---------- */

@media print {
    .erp-sidebar,
    .erp-topbar,
    .erp-tabs,
    .erp-no-print {
        display: none !important;
    }

    .erp-shell,
    .erp-main {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        max-width: none !important;
        background: #fff !important;
    }

    .erp-content {
        padding: 0 !important;
        overflow: visible !important;
    }

    body {
        background: #fff !important;
        color: #0f172a !important;
    }

    .erp-card {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        background: #fff !important;
    }

    .erp-doc-header {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

/* transfer / movement slip signature blocks */
.erp-slip-signatures { margin-top: 3.2rem; }
.erp-slip-signatures > div { text-align: center; font-size: 0.8rem; color: var(--erp-muted, #64748b); }
.erp-slip-line { border-bottom: 1px solid var(--erp-border, #94a3b8); margin-bottom: .35rem; height: 2.2rem; }


/* v1.4.2 — shared list pagination */
.erp-pagination{display:flex;justify-content:space-between;align-items:center;gap:.75rem;flex-wrap:wrap;margin:.8rem 0 .2rem}
.erp-pagination-info{font-size:.8rem;color:var(--erp-muted,#64748b)}
.erp-pagination-links{display:flex;gap:.3rem;align-items:center;flex-wrap:wrap}
.erp-pagination-links .erp-btn{padding:.15rem .55rem;font-size:.8rem;min-width:2rem;text-align:center;text-decoration:none}
.erp-pagination-current{pointer-events:none}
.erp-pagination-gap{padding:0 .15rem;color:var(--erp-muted,#64748b)}
@media print{.erp-pagination{display:none}}
