/* ERP Design System v1 - Bootstrap 5 compatible */
:root {
    --erp-font-sans: "Segoe UI", "Noto Sans", "Liberation Sans", sans-serif;
    --erp-color-primary: #1d4ed8;
    --erp-color-secondary: #0f766e;
    --erp-color-success: #15803d;
    --erp-color-danger: #b91c1c;
    --erp-color-warning: #b45309;
    --erp-color-info: #0369a1;
    --erp-color-bg: #f6f8fb;
    --erp-color-surface: #ffffff;
    --erp-color-border: #dce3ef;
    --erp-color-text: #0f172a;
    --erp-color-text-muted: #5b6475;
    --erp-radius-sm: 10px;
    --erp-radius-md: 14px;
    --erp-shadow-sm: 0 6px 16px rgba(15, 23, 42, 0.05);
    --erp-shadow-md: 0 10px 26px rgba(15, 23, 42, 0.08);
    --erp-sidebar-width: 250px;
}

body#cloudonex_body {
    font-family: var(--erp-font-sans);
    color: var(--erp-color-text);
    background: var(--erp-color-bg);
}

.page-content {
    background: var(--erp-color-bg);
}

.erp-sidebar {
    border-right: 1px solid var(--erp-color-border);
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.erp-topbar {
    border-bottom: 1px solid var(--erp-color-border);
    background: var(--erp-color-surface);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
}

.erp-content {
    padding-top: 1.2rem;
}

.erp-shell {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.erp-page-title {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--erp-color-text);
}

.erp-page-subtitle {
    margin: 0;
    color: var(--erp-color-text-muted);
    font-size: 0.93rem;
}

.erp-section {
    margin-bottom: 1rem;
}

.erp-card,
.panel.erp-card {
    border: 1px solid var(--erp-color-border);
    border-radius: var(--erp-radius-md);
    background: var(--erp-color-surface);
    box-shadow: var(--erp-shadow-sm);
    overflow: hidden;
}

.erp-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--erp-color-border);
}

.erp-card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--erp-color-text);
}

.erp-card-body {
    padding: 1rem;
}

.erp-kpi-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0.75rem;
}

.erp-kpi-col {
    grid-column: span 12;
}

.erp-kpi-card {
    position: relative;
    border: 1px solid var(--erp-color-border);
    border-radius: var(--erp-radius-sm);
    background: var(--erp-color-surface);
    box-shadow: var(--erp-shadow-sm);
    padding: 0.9rem 1rem;
    min-height: 108px;
}

.erp-kpi-label {
    margin: 0 0 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--erp-color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.erp-kpi-value {
    margin: 0;
    font-size: 1.4rem;
    line-height: 1.15;
    font-weight: 800;
    color: var(--erp-color-text);
}

.erp-kpi-meta {
    margin-top: 0.4rem;
    font-size: 0.8rem;
    color: var(--erp-color-text-muted);
}

.erp-kpi-accent-primary {
    border-left: 4px solid var(--erp-color-primary);
}

.erp-kpi-accent-success {
    border-left: 4px solid var(--erp-color-success);
}

.erp-kpi-accent-danger {
    border-left: 4px solid var(--erp-color-danger);
}

.erp-kpi-accent-warning {
    border-left: 4px solid var(--erp-color-warning);
}

.erp-kpi-accent-info {
    border-left: 4px solid var(--erp-color-info);
}

.erp-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: flex-end;
    padding: 0.8rem;
    border: 1px solid var(--erp-color-border);
    border-radius: var(--erp-radius-sm);
    background: #fbfcfe;
}

.erp-filter-item {
    min-width: 170px;
    flex: 1 1 170px;
}

.erp-filter-item label {
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    color: var(--erp-color-text-muted);
    text-transform: uppercase;
}

.erp-input,
.erp-select {
    width: 100%;
    border: 1px solid var(--erp-color-border);
    border-radius: 10px;
    min-height: 40px;
    padding: 0.45rem 0.7rem;
    background: #fff;
    color: var(--erp-color-text);
}

.erp-input:focus,
.erp-select:focus {
    outline: none;
    border-color: #7aa2ff;
    box-shadow: 0 0 0 0.2rem rgba(29, 78, 216, 0.12);
}

.erp-btn {
    border-radius: 10px;
    font-weight: 600;
    border: 1px solid transparent;
    padding: 0.45rem 0.85rem;
}

.erp-btn-primary {
    background: var(--erp-color-primary);
    border-color: var(--erp-color-primary);
    color: #fff;
}

.erp-btn-primary:hover,
.erp-btn-primary:focus {
    background: #1843bc;
    border-color: #1843bc;
    color: #fff;
}

.erp-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    padding: 0.28rem 0.52rem;
}

.erp-badge-success {
    color: #166534;
    background: #dcfce7;
}

.erp-badge-warning {
    color: #92400e;
    background: #fef3c7;
}

.erp-badge-danger {
    color: #991b1b;
    background: #fee2e2;
}

.erp-badge-info {
    color: #075985;
    background: #e0f2fe;
}

.erp-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--erp-color-border);
    border-radius: var(--erp-radius-sm);
    background: #fff;
}

.erp-table-wrap table {
    margin-bottom: 0;
    min-width: 760px;
}

.erp-table-wrap thead th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    z-index: 1;
}

/* Products & Services table polish */
.erp-products-panel {
    --erp-brand-blue: #3aa7d9;
    --erp-brand-blue-dark: #1f6f9e;
    --erp-brand-blue-ink: #184e74;
    --erp-brand-blue-soft: #e8f5fc;
    --erp-brand-black: #0d1420;
    border: 1px solid var(--erp-color-border);
    border-radius: 16px;
    overflow: hidden;
    background: var(--erp-color-surface);
    box-shadow: 0 10px 24px rgba(13, 20, 32, 0.11);
}

.erp-products-panel .panel-hdr {
    min-height: auto;
    border-bottom: 1px solid #24344d;
    padding: 0.95rem 1rem;
    background: linear-gradient(120deg, var(--erp-brand-black) 0%, var(--erp-brand-blue-dark) 60%, var(--erp-brand-blue) 100%);
}

.erp-products-panel .panel-hdr h2 {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 700;
    color: #f5fbff;
    letter-spacing: 0.02em;
}

.erp-products-panel .panel-toolbar .btn {
    border-radius: 10px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.erp-products-panel .panel-toolbar .btn-primary {
    background: var(--erp-brand-blue);
    border-color: var(--erp-brand-blue);
    color: #062238;
}

.erp-products-panel .panel-toolbar .btn-primary:hover,
.erp-products-panel .panel-toolbar .btn-primary:focus {
    background: #2c9ad0;
    border-color: #2c9ad0;
}

.erp-products-panel .panel-toolbar .btn-success {
    background: #111c2c;
    border-color: #2a3a53;
    color: #e9f5ff;
}

.erp-products-panel .panel-toolbar .btn-success:hover,
.erp-products-panel .panel-toolbar .btn-success:focus {
    background: #1a2a43;
    border-color: #33445f;
}

.erp-products-content {
    padding: 1rem;
    background: linear-gradient(180deg, #f7fbff 0%, #f1f8ff 100%);
}

.erp-products-table-wrap {
    border: 1px solid #cfdfee;
    border-radius: 12px;
    background: #ffffff;
    overflow: auto;
}

.erp-products-table {
    min-width: 980px;
    margin-bottom: 0;
}

.erp-products-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: 1px solid #c6daec;
    background: linear-gradient(180deg, #eff8fd 0%, #e3f3fb 100%);
    color: #25567a;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    padding: 0.78rem 0.8rem;
}

.erp-products-table tbody td {
    border-top: 1px solid #e3edf7;
    color: #15283e;
    vertical-align: middle;
    padding: 0.72rem 0.8rem;
}

.erp-products-table.table-striped tbody tr:nth-of-type(odd) td {
    background: #f9fcff;
}

.erp-products-table tbody tr:hover td {
    background: var(--erp-brand-blue-soft);
}

.erp-products-thumb {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    object-fit: cover;
    object-position: center;
    border: 1px solid #cde0f1;
    background: #ffffff;
    box-shadow: 0 4px 11px rgba(17, 40, 66, 0.1);
}

.erp-products-table .erp-col-qty {
    text-align: right;
    white-space: nowrap;
}

.erp-products-table .erp-qty-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    border-radius: 999px;
    padding: 0.18rem 0.55rem;
    border: 1px solid #b7d8eb;
    background: #e3f2fb;
    color: var(--erp-brand-blue-ink);
    font-weight: 700;
    font-size: 0.78rem;
    line-height: 1.2;
}

.erp-products-table .erp-col-toggle,
.erp-products-table .erp-col-actions {
    white-space: nowrap;
}

.erp-products-table .erp-col-toggle {
    text-align: center;
}

.erp-products-table .erp-col-actions {
    text-align: right;
}

.erp-products-table .erp-row-actions {
    display: inline-flex;
    justify-content: flex-end;
    gap: 0.35rem;
    float: none !important;
}

.erp-products-table .erp-row-actions .btn {
    border-radius: 9px;
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cbddef;
}

.erp-products-table .erp-row-actions .btn-primary {
    background: var(--erp-brand-blue);
    border-color: var(--erp-brand-blue);
    color: #062238;
}

.erp-products-table .erp-row-actions .btn-dark {
    background: #182538;
    border-color: #182538;
}

.erp-products-panel .dataTables_wrapper .dataTables_filter input,
.erp-products-panel .dataTables_wrapper .dataTables_length select {
    border: 1px solid #c4d9ea;
    border-radius: 10px;
    background: #fff;
    color: #15324f;
}

.erp-products-panel .dataTables_wrapper .dataTables_filter input:focus,
.erp-products-panel .dataTables_wrapper .dataTables_length select:focus {
    border-color: var(--erp-brand-blue);
    box-shadow: 0 0 0 0.18rem rgba(58, 167, 217, 0.2);
}

.erp-products-panel .dataTables_wrapper .pagination .page-link {
    border-color: #c8dbed;
    color: #1d4f74;
}

.erp-products-panel .dataTables_wrapper .pagination .page-item.active .page-link {
    background: var(--erp-brand-blue-dark);
    border-color: var(--erp-brand-blue-dark);
    color: #fff;
}

.erp-products-panel .dataTables_wrapper .pagination .page-link:hover {
    background: #e6f4fc;
    color: #0f3857;
}

.erp-empty-state {
    text-align: center;
    border: 1px dashed var(--erp-color-border);
    border-radius: var(--erp-radius-sm);
    background: #fff;
    color: var(--erp-color-text-muted);
    padding: 1.2rem;
}

.erp-empty-title {
    margin: 0;
    font-weight: 700;
    color: var(--erp-color-text);
}

.erp-empty-subtitle {
    margin: 0.4rem 0 0;
    font-size: 0.9rem;
}

.erp-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

/* DataTables compatibility */
div.dataTables_wrapper div.dataTables_filter input,
div.dataTables_wrapper div.dataTables_length select {
    border: 1px solid var(--erp-color-border);
    border-radius: 10px;
}

/* Responsive breakpoints */
@media (min-width: 576px) {
    .erp-kpi-col {
        grid-column: span 6;
    }
}

@media (min-width: 992px) {
    .erp-kpi-col {
        grid-column: span 4;
    }

    .erp-kpi-col-xl {
        grid-column: span 2;
    }
}

@media (max-width: 991.98px) {
    .page-content {
        padding: 0.9rem;
    }

    .erp-topbar .page-logo-text {
        font-size: 0.9rem;
    }

    .erp-products-panel .panel-toolbar .btn-group {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        gap: 0.45rem;
    }

    .erp-products-panel .panel-toolbar .btn-group .btn {
        flex: 1 1 auto;
    }

    .erp-products-table {
        min-width: 760px;
    }

    .erp-products-table thead th,
    .erp-products-table tbody td {
        padding: 0.64rem 0.68rem;
    }
}
