/* ERP UI Styles */
:root {
    --primary-color: #0d6efd;
    --primary-hover: #0b5ed7;
    --sidebar-width: 260px;
    --header-height: 64px;
    --bg-color: #f8fafc;
    --text-color: #334155;
    --border-color: #e2e8f0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: subpixel-antialiased;
}

.tabular-nums {
    font-variant-numeric: tabular-nums;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    background-color: #ffffff;
    border-right: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px 20px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
}

.sidebar-brand i {
    font-size: 1.8rem;
    margin-right: 12px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.sidebar-nav-item {
    padding: 12px 24px;
    display: flex;
    align-items: center;
    color: #475569;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: background 0.15s, color 0.15s;
    border-right: 3px solid transparent;
}

.sidebar-nav-item:hover,
.sidebar-nav-item.active {
    background-color: #f1f5f9;
    color: var(--primary-color);
    border-right-color: var(--primary-color);
}

.sidebar-nav-item i {
    width: 24px;
    font-size: 1.1rem;
    margin-right: 12px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-header {
    height: var(--header-height);
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.search-bar {
    width: 320px;
}

/* Custom Cards */
.card {
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
}

/* Grid & Tables */
.table th {
    background-color: #f8fafc;
    font-weight: 600;
    font-size: 0.85rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-color);
}

.table td {
    font-size: 0.9rem;
    vertical-align: middle;
    color: #334155;
    font-weight: 500;
}

/* Sticky Bottom Footer for Forms */
.sticky-footer {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 1px solid var(--border-color);
    padding: 16px 32px;
    z-index: 100;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
}

.kpi-card {
    transition: transform 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 1.5rem;
}

/* ERP Slide-Over Drawer */
.erp-drawer {
    border-left: 1px solid var(--border-color);
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.05);
    background-color: var(--bg-color);
}

.erp-drawer .offcanvas-header {
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

.erp-drawer .offcanvas-body {
    padding: 0;
    overflow-y: auto;
}

.erp-drawer-content {
    padding: 1.5rem;
}

.erp-drawer .sticky-footer {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    z-index: 10;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.03);
}

.erp-drawer-wide {
    width: 85vw !important;
    max-width: 1200px !important;
}

.erp-drawer-md {
    width: 50vw !important;
    min-width: 500px !important;
}

.erp-drawer-sm {
    width: 400px !important;
}

/* Premium form-select Custom Styling and Reset */
select.form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23475569' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px 10px;
    padding-right: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: #ffffff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

select.form-select:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 0.18rem rgba(13, 110, 253, 0.15) !important;
    outline: 0 !important;
}

span.input-group-text.bg-white.fw-bold.text-muted.border-secondary {
    margin-right: 4px;
}