/**
 * Wiko ERP - Compact Professional Green Theme
 * A-Z Zero Inline Custom Framework
 */

:root {
    --erp-green-50: #ecfdf5;
    --erp-green-100: #d1fae5;
    --erp-green-400: #34d399;
    --erp-green-500: #10b981;
    --erp-green-600: #059669;
    --erp-green-700: #047857;
    --erp-gray-50: #f8fafc;
    --erp-gray-100: #f1f5f9;
    --erp-gray-200: #e2e8f0;
    --erp-gray-300: #cbd5e1;
    --erp-gray-600: #475569;
    --erp-gray-800: #1e293b;
    --erp-gray-900: #0f172a;

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);

    --sidebar-w: 240px;
    --sidebar-mini-w: 72px;
    --header-h: 56px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ========================================================
   GLOBAL X-AXIS OVERFLOW PREVENTION
   Prevents horizontal scrollbar on ALL pages / breakpoints
   ======================================================== */
html {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    font-family: 'Inter', 'Plus Jakarta Sans', sans-serif;
    background: var(--erp-gray-50);
    color: var(--erp-gray-800);
    font-size: 14px;
    /* Professional Compact */
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    max-width: 100%;
}

/* Global Premium Green Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #059669;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #036d4d;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #059669 transparent;
}

a {
    text-decoration: none;
    color: var(--erp-green-600);
    transition: 0.15s;
    font-weight: 500;
}

a:hover {
    color: var(--erp-green-700);
}

/* Typography */
h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--erp-gray-900);
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--erp-gray-900);
    margin-bottom: 0.5rem;
}

h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--erp-gray-900);
}

p {
    color: var(--erp-gray-600);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: 0.15s;
    font-family: inherit;
}

.btn-primary {
    background: var(--erp-green-600);
    color: #fff !important;
}

.btn-primary:hover {
    background: var(--erp-green-700);
    color: #fff !important;
    box-shadow: var(--shadow-sm);
}

.btn-outline {
    border-color: var(--erp-green-600);
    color: var(--erp-green-600);
    background: transparent;
}

.btn-outline:hover {
    background: var(--erp-green-50);
    color: var(--erp-green-700);
}

.btn-full {
    width: 100%;
}

.btn-icon-only {
    background: none;
    border: none;
    color: var(--erp-gray-600);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    transition: 0.1s;
}

.btn-icon-only:hover {
    background: var(--erp-green-50);
    color: var(--erp-green-700);
}

/* Inputs */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--erp-gray-800);
    margin-bottom: 0.35rem;
}

.form-control {
    width: 100%;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--erp-gray-300);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: #fff;
    color: var(--erp-gray-900);
    transition: 0.15s;
    font-family: inherit;
    height: 34px;
}

.form-control:focus {
    outline: none;
    border-color: var(--erp-green-500);
    box-shadow: 0 0 0 3px var(--erp-green-100);
}

.form-error {
    display: block;
    color: #dc2626;
    font-size: 12px;
    margin-top: 0.35rem;
    font-weight: 500;
}

/* Input Icons */
.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-wrapper i {
    position: absolute;
    left: 0.75rem;
    color: var(--erp-gray-600);
    font-size: 14px;
}

.input-icon-wrapper .form-control {
    padding-left: 2.25rem;
}

.input-icon-wrapper select.form-control {
    appearance: none;
    -webkit-appearance: none;
    padding-left: 2.25rem;
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23475569' d='M6 8.825a.5.5 0 01-.354-.146l-3.5-3.5a.5.5 0 01.708-.708L6 7.618l3.146-3.147a.5.5 0 01.708.708l-3.5 3.5A.5.5 0 016 8.825z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    cursor: pointer;
}

/* Custom File Upload Design */
.custom-file-wrapper {
    margin-bottom: 0.5rem;
}

.custom-file-upload {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: #fff;
    border: 1px dashed var(--erp-green-500);
    border-radius: var(--radius-sm);
    color: var(--erp-green-600);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: 0.15s;
}

.custom-file-upload:hover {
    background: var(--erp-green-50);
}

.custom-file-upload i {
    font-size: 16px;
}

.hidden-file-input {
    display: none;
}

.file-name-display {
    font-size: 12px;
    color: var(--erp-gray-600);
    font-weight: 500;
    font-style: italic;
    margin-left: 0.5rem;
}

/* Cards & Badges */
.card {
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--erp-gray-200);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
    overflow: hidden;
    min-width: 0;
    /* Critical for grid track shrinking */
}

/* Premium Glow Cards */
.card-glow-green {
    border: none;
    border-top: 3px solid var(--erp-green-400);
    box-shadow: 0 4px 20px -5px rgba(16, 185, 129, 0.15);
}

.card-glow-amber {
    border: none;
    border-top: 3px solid #fbbf24;
    box-shadow: 0 4px 20px -5px rgba(217, 119, 6, 0.15);
}

.card-glow-indigo {
    border: none;
    border-top: 3px solid #818cf8;
    box-shadow: 0 4px 20px -5px rgba(79, 70, 229, 0.15);
}

.card-body {
    padding: 1.25rem;
}

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

.card-title {
    font-size: 14px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.badge-green {
    background: var(--erp-green-100);
    color: var(--erp-green-700);
}

.badge-gray {
    background: var(--erp-gray-100);
    color: var(--erp-gray-600);
}

.badge-indigo {
    background: #e0e7ff;
    color: #4338ca;
}

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

.badge-purple {
    background: #f3e8ff;
    color: #7e22ce;
}

/* Tables (High Density) */
.card .table-responsive {
    margin: 0;
    border: none;
}

.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    border-radius: var(--radius-md);
}

/* Stable Scrollbar for table responsiveness */
.table-responsive::-webkit-scrollbar {
    height: 8px;
    width: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--erp-green-600);
    border-radius: 10px;
    border: 2px solid #fff;
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.1);
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.05);
}

/* Force horizontal scroll on small devices by preventing column crushing */
.erp-table {
    min-width: 1100px;
    /* Base minimum width to ensure complex data has room */
    width: 100%;
}

@media (max-width: 1200px) {
    .erp-table {
        min-width: 1250px;
        /* Force more scrolling on smaller screens for readability */
    }
}

/* Ensure tables inside cards look perfect on mobile */
.card .table-responsive {
    margin: 0;
    border: none;
}

.erp-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

/* Force horizontal scroll instead of text wrapping to ensure clean 1-line rows */
.erp-table th,
.erp-table td {
    white-space: nowrap;
}

.erp-table th {
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--erp-gray-200);
    color: var(--erp-gray-600);
    font-weight: 600;
    font-size: 12px;
    user-select: none;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.erp-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--erp-gray-100);
    color: var(--erp-gray-800);
}

.erp-table tr:hover td {
    background: var(--erp-gray-100);
}

.sticky-col {
    position: sticky;
    left: 0;
    z-index: 5;
    background: #fff !important;
    width: 240px;
    min-width: 240px;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
}

th.sticky-col {
    z-index: 6;
    background: var(--erp-gray-50) !important;
}

/* Separation border-shadow for sticky column during scroll */
.sticky-col::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 1px;
    background: var(--erp-gray-200);
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.03);
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--erp-gray-600);
    font-size: 13px;
}

/* Custom Pagination Styling */
.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    justify-content: center;
    gap: 0.5rem;
    margin: 0;
    align-items: center;
    flex-wrap: wrap;
}

.page-item {
    margin: 0;
}

.page-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 0.75rem;
    font-size: 14px;
    font-weight: 700;
    color: var(--erp-gray-800);
    background-color: #fff;
    border: 1px solid var(--erp-gray-300);
    border-radius: var(--radius-md);
    transition: all 0.2s;
    text-decoration: none;
}

.page-link:hover {
    z-index: 2;
    color: var(--erp-green-700);
    background-color: var(--erp-green-100);
    border-color: var(--erp-green-400);
}

.page-item.active .page-link {
    background: var(--erp-green-500) !important;
    color: white !important;
    /* Adding !important to ensure color overrides any default bootstrap */
    border-color: var(--erp-green-500) !important;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25) !important;
}

.page-item.disabled .page-link {
    color: var(--erp-gray-400);
    pointer-events: none;
    background-color: var(--erp-gray-100);
    border-color: var(--erp-gray-200);
}

.page-link svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* Guest Layout */
.guest-wrapper {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    background: #fff;
}

.guest-nav {
    height: 60px;
    background: #fff;
    border-bottom: 1px solid var(--erp-gray-200);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    justify-content: space-between;
}

.guest-nav .brand {
    font-size: 18px;
    font-weight: 900;
    color: var(--erp-gray-900);
    letter-spacing: -0.02em;
}

.guest-nav .brand span {
    color: var(--erp-green-600);
}

.guest-nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.guest-nav-links a.active {
    color: var(--erp-green-600);
    font-weight: 600;
}

.guest-content {
    flex: 1;
}

/* Welcome Page Specifics */
.hero-section {
    padding: 6rem 1.5rem;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero-p {
    font-size: 16px;
    margin: 1rem 0 2rem;
    color: var(--erp-gray-600);
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    max-width: 900px;
    margin: 4rem auto;
    padding: 0 1.5rem;
    border-top: 1px solid var(--erp-gray-200);
    padding-top: 3rem;
}

.feature-item {
    text-align: center;
}

.feature-icon {
    font-size: 24px;
    color: var(--erp-green-600);
    margin-bottom: 0.75rem;
}

/* Split-Screen Auth Layout */
.auth-split {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.auth-split-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 60px 20px;
    background: #fff;
    overflow-y: auto;
}

.auth-split-right {
    flex: 1;
    background: linear-gradient(135deg, var(--erp-green-700), var(--erp-green-600));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: white;
    height: 100vh;
}

/* Mobile Responsiveness for Split Auth */
@media (max-width: 991px) {
    .auth-split {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .auth-split-left {
        height: auto;
        overflow: visible;
        padding: 40px 20px;
    }

    .auth-split-right {
        display: none;
    }
}

.auth-right-content {
    max-width: 400px;
}

.auth-right-content h2 {
    color: white;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.auth-right-content p {
    color: var(--erp-green-50);
    font-size: 15px;
    line-height: 1.6;
}

.auth-form-container {
    width: 100%;
    max-width: 600px;
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    font-size: 14px;
    margin-bottom: 2rem;
    color: var(--erp-gray-600);
}

.auth-footer {
    margin-top: 1.5rem;
    font-size: 13px;
    text-align: center;
}

/* Form Layout Grids */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 0.5rem;
}

@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* Form Radio Grids */
.radio-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.radio-card {
    border: 1px solid var(--erp-gray-200);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: 0.15s;
    font-size: 13px;
    font-weight: 500;
    background: #fff;
}

.radio-card:hover {
    border-color: var(--erp-green-500);
    background: var(--erp-green-50);
}

.radio-card input {
    accent-color: var(--erp-green-600);
    margin: 0;
}

/* App Sidebar Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: var(--sidebar-w);
    background: #fff;
    border-right: 1px solid var(--erp-gray-200);
    display: flex;
    flex-direction: column;
    z-index: 40;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-mini-w);
}

.sidebar-header {
    height: var(--header-h);
    border-bottom: 1px solid var(--erp-gray-200);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    font-weight: 800;
    font-size: 16px;
    color: var(--erp-gray-900);
    letter-spacing: -0.02em;
    gap: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.sidebar.collapsed .sidebar-header {
    padding: 0;
    justify-content: center;
    gap: 0;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed .sidebar-header .logo-text {
    opacity: 0;
    visibility: hidden;
    max-width: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-header span {
    color: var(--erp-green-600);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.25rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed .sidebar-nav {
    padding: 1.25rem 0.5rem;
    align-items: center;
    overflow-y: auto;
}

.sidebar-close {
    display: none;
    background: var(--erp-gray-100);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: var(--erp-gray-600);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: 0.2s;
}

.sidebar-close:hover {
    background: var(--erp-gray-200);
    color: var(--erp-gray-900);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 35;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-md);
    color: var(--erp-gray-600);
    font-size: 13.5px;
    font-weight: 500;
    border: none;
    background: transparent;
    width: 100%;
    cursor: pointer;
    transition: 0.15s;
}

.sidebar-item i {
    font-size: 14px;
    width: 16px;
    text-align: center;
}

.sidebar-item:hover,
.sidebar-item.active {
    background: var(--erp-green-50);
    color: var(--erp-green-700);
}

.sidebar-item span,
.sidebar-label {
    transition: opacity 0.3s ease, visibility 0.3s ease, max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin 0.3s ease;
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-label {
    opacity: 0;
    visibility: hidden;
    max-width: 0;
    margin: 0;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-item span {
    opacity: 0;
    visibility: hidden;
    max-width: 0;
    margin: 0;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-item {
    justify-content: center;
    padding: 0.75rem;
    width: 44px;
    height: 44px;
    margin: 0.25rem auto;
    gap: 0;
}

.sidebar-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed .sidebar-item i {
    font-size: 18px;
    width: auto;
    margin: 0;
}

/* App Workspace */
.app-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--erp-gray-50);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-header {
    height: var(--header-h);
    background: #fff;
    border-bottom: 1px solid var(--erp-gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    z-index: 30;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 18px;
    color: var(--erp-gray-600);
    cursor: pointer;
    margin-right: 1rem;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    transition: 0.2s;
}

.sidebar-toggle:hover {
    background: var(--erp-gray-50);
    color: var(--erp-green-600);
}

.header-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--erp-gray-900);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 13px;
    font-weight: 600;
    color: var(--erp-gray-800);
}

.header-notifications {
    position: relative;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--erp-gray-50);
    color: var(--erp-gray-600);
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 0.75rem;
}

.header-notifications:hover {
    background: var(--erp-green-50);
    color: var(--erp-green-600);
}

.notification-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #dc2626;
    color: white;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 50px;
    line-height: 1;
    border: 2px solid white;
}

.header-avatar {
    width: 30px;
    height: 30px;
    background: var(--erp-green-100);
    color: var(--erp-green-700);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.app-main {
    flex: 1;
    padding: 1.25rem;
    transition: padding 0.3s ease;
    min-width: 0;
    overflow-y: auto;
    /* Restoring vertical scrolling */
}

@media (max-width: 768px) {
    .app-main {
        padding: 0.75rem;
    }
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1.5rem;
    align-items: start;
}

/* Dashboard Info List */
.info-box {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--erp-gray-100);
    font-size: 13px;
}

.info-box:last-child {
    border-bottom: none;
}

.info-lbl {
    color: var(--erp-gray-600);
    font-weight: 500;
}

.info-val {
    font-weight: 600;
    color: var(--erp-gray-900);
}

/* Service Chips & Forms inline */
.chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.chip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border: 1px solid var(--erp-gray-200);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.6rem;
    font-size: 12px;
    font-weight: 500;
    gap: 0.5rem;
}

.service-form-inline {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

/* Global Loader */
.global-page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: 0.2s ease;
}

.global-page-loader.active {
    opacity: 1;
    visibility: visible;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--erp-green-100);
    border-top: 3px solid var(--erp-green-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Alerts / States */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-success {
    background: var(--erp-green-50);
    border: 1px solid var(--erp-green-100);
    color: var(--erp-green-700);
}

.auth-success-box {
    text-align: center;
}

.auth-success-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--erp-green-100);
    color: var(--erp-green-600);
    font-size: 24px;
    margin: 0 auto 1.5rem;
}

/* Responsiveness */
.erp-filter-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
    gap: 1rem;
    align-items: flex-end;
}

@media (max-width: 1400px) {
    .erp-filter-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    }
}

@media (max-width: 1200px) {
    .erp-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
    }
}

@media (max-width: 1024px) {
    .erp-filter-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .auth-split-right {
        display: none;
    }

    .auth-split-left {
        padding-top: 10vh;
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
        height: 100vh;
        background: #fff;
        z-index: 999;
    }

    .sidebar.open {
        transform: translateX(0);
        width: 260px;
        /* Professional mobile width */
    }

    /* Restore sidebar-nav structure on mobile open */
    .sidebar.open .sidebar-nav {
        align-items: stretch !important;
        overflow-y: auto !important;
        padding: 1.25rem 0.75rem !important;
    }

    /* Force visibility on mobile even if sidebar has 'collapsed' class */
    .sidebar.open .sidebar-item span,
    .sidebar.open .sidebar-label,
    .sidebar.open .logo-text {
        opacity: 1 !important;
        visibility: visible !important;
        max-width: 200px !important;
        margin: inherit !important;
        padding: inherit !important;
        overflow: visible !important;
        width: auto !important;
        margin-left: 6px !important;
    }

    .sidebar.open .sidebar-item {
        justify-content: flex-start !important;
        width: 100% !important;
        height: auto !important;
        padding: 0.65rem 1rem !important;
        margin: 0 !important;
        gap: 0.75rem !important;
    }

    .sidebar.open .sidebar-item i {
        font-size: 14px !important;
        width: 16px !important;
    }

    .sidebar-close {
        display: flex;
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
    }

    .sidebar-header {
        justify-content: flex-start;
        padding: 0 1.25rem;
        position: relative;
    }

    .app-main {
        padding: 0.75rem;
    }

    .mobile-toggle {
        display: block;
    }

    /* Stable Flex Containers */
    .flex-wrap-mobile {
        flex-wrap: wrap !important;
        gap: 0.75rem !important;
    }

    /* Force full width on inputs in standard grids */
    .form-group {
        width: 100% !important;
    }

    /* Form Responsiveness */
    form[action*="dashboard"],
    .erp-filter-form,
    .erp-filter-grid {
        grid-template-columns: 1fr !important;
        height: auto !important;
        gap: 0.75rem !important;
    }

    form[action*="dashboard"] .btn-primary,
    .btn-mobile-full {
        width: 100% !important;
    }

    /* General Grid Stacking */
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }

    .metrics-row-grid {
        grid-template-columns: 1fr !important;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .radio-grid {
        grid-template-columns: 1fr;
    }

    .service-form-inline {
        flex-direction: column;
    }

    .app-header {
        padding: 0 1rem;
    }

    .app-main {
        padding: 1rem;
    }

    .activity-feed-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Tablet refinements (769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: var(--sidebar-mini-w);
        transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar-is-expanded .sidebar {
        width: 250px;
        /* Slimmer for tablets */
    }

    .sidebar-is-expanded .sidebar .sidebar-item {
        padding: 0.6rem 0.85rem;
        gap: 0.65rem;
    }

    .sidebar-is-expanded .sidebar .sidebar-item span {
        font-size: 13px;
    }
}

/* Task Manager Specific Components */
.task-manager-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
}

@media (max-width: 1200px) {
    .task-manager-grid {
        grid-template-columns: 1fr;
    }
}

.task-card {
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--erp-gray-200);
    border-radius: 12px;
    overflow: hidden;
}

.task-header-premium {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-bottom: 1px solid var(--erp-gray-100);
    padding: 1.25rem 1.5rem;
}

.task-header-flex {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.task-header-title {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: var(--erp-gray-900);
}

.task-header-subtitle {
    font-size: 11px;
    color: var(--erp-gray-500);
    margin: 2px 0 0 0;
}

.task-count-badge {
    padding: 0.6rem 1.25rem;
    border-radius: 50px;
    font-weight: 800;
    font-size: 11px;
}

.task-count-badge i {
    margin-right: 6px;
    opacity: 0.7;
}

.task-table-card-body {
    padding: 0 !important;
}

.table-no-margin {
    margin: 0 !important;
}

.task-header-icon {
    width: 42px;
    height: 42px;
    background: var(--erp-green-50);
    color: var(--erp-green-600);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: inset 0 0 0 1px rgba(13, 148, 136, 0.1);
}

.task-row {
    transition: all 0.2s ease;
}

.task-row:hover {
    background: var(--erp-gray-50);
    box-shadow: inset 4px 0 0 0 var(--erp-green-500);
}

.task-row td {
    vertical-align: middle;
    border-bottom: 1px solid var(--erp-gray-100);
}

.task-row:last-child td {
    border-bottom: none;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    position: relative;
}

.status-dot.pending {
    background: #ea580c;
    box-shadow: 0 0 0 4px rgba(234, 88, 12, 0.1);
}

.status-dot.completed {
    background: var(--erp-green-600);
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.1);
}

.priority-pill {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 800;
    text-transform: uppercase;
    border: 1px solid transparent;
}

.priority-pill.urgent {
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.2);
}

.priority-pill.high {
    background: rgba(234, 88, 12, 0.1);
    color: #ea580c;
    border-color: rgba(234, 88, 12, 0.2);
}

.priority-pill.normal {
    background: rgba(13, 148, 136, 0.1);
    color: #0d9488;
    border-color: rgba(13, 148, 136, 0.2);
}

.priority-pill.low {
    background: rgba(100, 116, 139, 0.1);
    color: #64748b;
    border-color: rgba(100, 116, 139, 0.2);
}

.type-indicator {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.type-indicator.task {
    background: var(--erp-green-100);
    color: var(--erp-green-700);
}

.type-indicator.note {
    background: var(--erp-gray-100);
    color: var(--erp-gray-600);
}

.action-btn-circle {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.action-btn-circle.success {
    color: var(--erp-green-600);
    border-color: var(--erp-green-100);
}

.action-btn-circle.success:hover {
    background: var(--erp-green-600);
    color: #fff;
    transform: translateY(-3px) rotate(8deg);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.2);
}

.action-btn-circle.danger {
    color: var(--erp-gray-400);
    border-color: var(--erp-gray-200);
}

.action-btn-circle.danger:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fecaca;
    transform: translateY(-3px) rotate(-8deg);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
}

.action-btn-circle.info {
    color: var(--erp-gray-600);
    border-color: var(--erp-gray-200);
}

.action-btn-circle.info:hover {
    background: var(--erp-gray-100);
    color: var(--erp-gray-900);
    border-color: var(--erp-gray-300);
    transform: translateY(-3px);
}

.activity-type-selector {
    position: relative;
    cursor: pointer;
    display: block;
}

.activity-type-selector input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.activity-type-selector span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0.6rem 0.5rem;
    background: #fff;
    border: 1px solid var(--erp-gray-200);
    border-radius: 8px;
    font-size: 10px;
    font-weight: 800;
    color: var(--erp-gray-500);
    transition: all 0.2s ease;
    letter-spacing: 0.02em;
}

.activity-type-selector input:checked~span {
    background: var(--erp-green-50);
    border-color: var(--erp-green-600);
    color: var(--erp-green-700);
    box-shadow: 0 2px 4px rgba(13, 148, 136, 0.05);
}

.activity-type-selector:hover span {
    border-color: var(--erp-green-200);
    color: var(--erp-green-600);
}

/* Layout Utilities (Single Class) */
.flex-column-gap {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.activity-feed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: 1.5rem;
    align-items: start;
    margin-bottom: 2rem;
}

/* Row & Column Specifics */
.task-row-title-container {
    font-weight: 800;
    color: var(--erp-gray-900);
    font-size: 14px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.task-row-desc-text {
    font-size: 12px;
    color: var(--erp-gray-500);
    line-height: 1.4;
    max-width: 320px;
}

.task-date-group {
    display: flex;
    flex-direction: column;
}

.task-date-main {
    font-size: 13px;
    font-weight: 700;
    color: var(--erp-gray-800);
}

.task-date-sub {
    font-size: 10px;
    color: var(--erp-gray-400);
    font-weight: 700;
}

.task-status-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task-status-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.task-status-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.task-action-wrapper {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    align-items: center;
}

/* Indicators */
.type-indicator.plan {
    background: #f5f3ff;
    color: #7c3aed;
}

.priority-pill.overdue-badge {
    font-size: 8px;
    padding: 1px 4px;
}

/* Creation Form */
.form-section-label {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.type-selection-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 0.75rem;
}

/* Vault Info Card */
.privacy-vault-card {
    background: var(--erp-green-50);
    border: 1px dashed var(--erp-green-300);
    border-radius: 16px;
}

.privacy-vault-body {
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.privacy-vault-icon {
    color: var(--erp-green-600);
    font-size: 20px;
}

.privacy-vault-title {
    font-size: 13px;
    font-weight: 900;
    color: var(--erp-green-800);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.privacy-vault-text {
    font-size: 11px;
    color: var(--erp-green-700);
    line-height: 1.7;
    margin: 0;
    font-weight: 600;
}

/* Empty State */
.task-empty-state {
    text-align: center;
    padding: 6rem 2rem;
    color: var(--erp-gray-400);
}

.task-empty-icon {
    font-size: 56px;
    margin-bottom: 2rem;
    color: var(--erp-gray-200);
    opacity: 0.5;
}

.task-empty-title {
    font-weight: 900;
    color: var(--erp-gray-800);
    margin-bottom: 0.75rem;
    font-size: 18px;
}

.task-empty-desc {
    font-size: 14px;
    color: var(--erp-gray-500);
}

/* Modals (Premium Glassmorphic) */
.erp-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.erp-modal-overlay.active {
    display: flex;
}

.erp-modal {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 550px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.erp-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--erp-gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.erp-modal-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--erp-gray-900);
}

.erp-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--erp-gray-400);
    cursor: pointer;
    transition: 0.15s;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.erp-modal-close:hover {
    background: var(--erp-gray-100);
    color: var(--erp-gray-900);
}

.erp-modal-body {
    padding: 1.25rem 1.5rem;
    max-height: 80vh;
    overflow-y: auto;
}

.erp-modal-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--erp-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.erp-modal-desc {
    font-size: 14px;
    color: var(--erp-gray-800);
    line-height: 1.7;
    white-space: pre-wrap;
    background: var(--erp-gray-50);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--erp-gray-100);
}

.erp-modal-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.erp-modal-footer {
    padding: 0.75rem 1.5rem;
    background: var(--erp-gray-50);
    border-top: 1px solid var(--erp-gray-100);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* --- Provision Console Specifics (PVC) --- */
.pvc-container {
    width: 100%;
    padding: 1rem 0;
}

.pvc-card {
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--erp-gray-200);
}

.pvc-header {
    background: var(--erp-gray-50);
    border-bottom: 1px solid var(--erp-gray-200);
    padding: 1.5rem 2.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pvc-title {
    font-size: 1.5rem;
    color: var(--erp-gray-900);
    font-weight: 800;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.pvc-title i {
    color: var(--erp-green-600);
}

.pvc-body {
    padding: 2.5rem 3rem;
}

.pvc-intro-text {
    color: var(--erp-gray-600);
    font-size: 14px;
    margin-bottom: 2rem;
    line-height: 1.6;
    max-width: 850px;
}

.pvc-form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 0.5rem;
}

.pvc-service-box {
    margin-bottom: 0.75rem;
    background: var(--erp-gray-50);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px dashed var(--erp-gray-300);
}

.pvc-section-label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 800;
    color: var(--erp-gray-900);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.05em;
}

.pvc-multi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.pvc-check-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    border-radius: 6px;
    background: white;
    border: 1px solid var(--erp-gray-200);
    transition: 0.2s;
}

.pvc-check-item:hover {
    border-color: var(--erp-green-500);
}

.pvc-check-item input {
    width: 16px;
    height: 16px;
    accent-color: var(--erp-green-600);
}

.pvc-check-item span {
    font-size: 13px;
    color: var(--erp-gray-800);
    font-weight: 700;
}

.pvc-file-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--erp-gray-100);
}

.pvc-security-block {
    background: var(--erp-gray-50);
    color: var(--erp-gray-700);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border: 1px solid var(--erp-gray-200);
}

.pvc-security-icon {
    width: 24px;
    height: 24px;
    color: var(--erp-green-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.pvc-security-info {
    font-size: 11px;
}

.pvc-security-info strong {
    font-weight: 700;
    color: var(--erp-gray-900);
    display: block;
    margin-bottom: 1px;
}

.pvc-submit-wrap {
    text-align: right;
}

.pvc-submit-btn {
    padding: 0.75rem 2.5rem;
    font-size: 14px;
    border-radius: var(--radius-sm);
    font-weight: 700;
}

/* --- Utility Classes --- */
.text-center {
    text-align: center;
}

.d-block {
    display: block;
}

.mt-1 {
    margin-top: 0.25rem;
}

.m-l-10 {
    margin-left: 10px;
}

.btn-full {
    width: 100%;
}

/* Custom Select Component (Premium with Icons) */
.erp-select-custom {
    position: relative;
    width: 100%;
    min-width: 0;
}

.erp-select-trigger {
    width: 100%;
    padding: 0.5rem 0.25rem 0.5rem 0.25rem;
    padding-left: 0.75rem;
    border: 1px solid var(--erp-gray-300);
    border-radius: var(--radius-sm);
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: 0.15s;
    gap: 8px;
    min-height: 27px;
    height: 34px;
}

.erp-select-trigger:focus-within,
.erp-select-custom.active .erp-select-trigger {
    border-color: var(--erp-green-500);
    box-shadow: 0 0 0 3px var(--erp-green-100);
    outline: none;
}

.erp-select-trigger .trigger-icon {
    position: initial;
    color: var(--erp-gray-500);
    font-size: 13px;
}

.erp-select-trigger .trigger-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.erp-select-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    min-width: 160px;
    background: #fff;
    border: 1px solid var(--erp-gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.erp-select-custom.active .erp-select-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.erp-select-option {
    padding: 0.6rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 13.5px;
    color: var(--erp-gray-800);
    transition: 0.1s;
}

.erp-select-option:hover {
    background: var(--erp-green-50);
    color: var(--erp-green-700);
}

.erp-select-option i {
    color: var(--erp-green-600);
    font-size: 14px;
    width: 18px;
    text-align: center;
}

.erp-select-option.selected {
    background: var(--erp-green-100);
    font-weight: 600;
}

.erp-select-trigger .arrow {
    font-size: 10px;
    color: var(--erp-gray-600);
    transition: 0.2s;
}

.erp-select-custom.active .arrow {
    transform: rotate(180deg);
}

/* Modal Specific Compact Layouts */
.erp-modal .form-group {
    margin-bottom: 0.85rem;
}

.erp-modal .type-selection-grid {
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.erp-modal .form-section-label {
    font-size: 10px;
}

/* ============================================
   SEARCHABLE DROPDOWN COMPONENT
   ============================================ */
.searchable-select-wrapper {
    position: relative;
    width: 100%;
    margin-top: 0.5rem;
}

.searchable-select-display {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1px solid var(--erp-gray-300);
    border-radius: 10px;
    font-size: 13px;
    background: #fff;
    color: var(--erp-gray-900);
    cursor: pointer;
    transition: 0.15s;
    font-family: inherit;
    min-height: 40px;
    user-select: none;
}

.searchable-select-wrapper.open .searchable-select-display {
    border-color: var(--erp-green-500);
    box-shadow: 0 0 0 3px var(--erp-green-100);
    border-radius: 10px 10px 0 0;
}

.searchable-select-display .ss-placeholder {
    color: var(--erp-gray-600);
    flex: 1;
    font-size: 12px;
    font-style: italic;
}

.searchable-select-display .ss-selected-text {
    flex: 1;
    font-weight: 700;
    font-size: 13px;
    color: var(--erp-gray-900);
}

.searchable-select-display .ss-chevron {
    color: var(--erp-gray-600);
    font-size: 11px;
    transition: transform 0.2s ease;
    margin-left: auto;
    padding-left: 8px;
}

.searchable-select-wrapper.open .ss-chevron {
    transform: rotate(180deg);
}

.searchable-select-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--erp-green-500);
    border-top: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 8px 25px -5px rgba(5, 150, 105, 0.15);
    z-index: 9999;
    flex-direction: column;
    overflow: hidden;
}

.searchable-select-wrapper.open .searchable-select-panel {
    display: flex;
}

.ss-search-bar {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--erp-gray-100);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--erp-gray-50);
}

.ss-search-bar i {
    color: var(--erp-gray-600);
    font-size: 12px;
}

.ss-search-input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    width: 100%;
    font-family: inherit;
    color: var(--erp-gray-900);
}

.ss-options-list {
    overflow-y: auto;
    max-height: 175px;
}

.ss-option {
    padding: 0.55rem 1rem;
    font-size: 13px;
    cursor: pointer;
    color: var(--erp-gray-800);
    transition: background 0.1s;
    border-bottom: 1px solid var(--erp-gray-50);
}

.ss-option:last-child {
    border-bottom: none;
}

.ss-option:hover,
.ss-option.focused {
    background: var(--erp-green-50);
    color: var(--erp-green-700);
}

.ss-option.selected {
    background: var(--erp-green-100);
    color: var(--erp-green-700);
}

.ss-opt-name {
    font-weight: 700;
    display: block;
    font-size: 13px;
}

.ss-opt-company {
    font-size: 11px;
    color: var(--erp-gray-500);
    font-weight: 500;
}

.ss-option.selected .ss-opt-company {
    color: var(--erp-green-600);
}

.ss-no-results {
    padding: 1.25rem;
    text-align: center;
    font-size: 12px;
    color: var(--erp-gray-500);
    font-style: italic;
}

.ss-icon-wrapper {
    position: absolute;
    left: 0.75rem;
    top: 10px;
    color: var(--erp-gray-600);
    font-size: 14px;
    pointer-events: none;
}

/* ============================================
   CLIENT SEARCH FIELD (always-visible input)
   ============================================ */
.client-search-field {
    position: relative;
    width: 100%;
    margin-top: 0.5rem;
}

.client-results-panel {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--erp-green-500);
    border-radius: 0 0 10px 10px;
    box-shadow: 0 8px 25px -5px rgba(5, 150, 105, 0.15);
    z-index: 9999;
    max-height: 200px;
    overflow-y: auto;
}

.client-result-item {
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    border-bottom: 1px solid var(--erp-gray-50);
    transition: background 0.1s;
}

.client-result-item:last-child {
    border-bottom: none;
}

.client-result-item:hover {
    background: var(--erp-green-50);
}

.client-result-item.is-selected {
    background: var(--erp-green-50);
}

.client-result-info .cr-name {
    font-weight: 700;
    font-size: 13px;
    color: var(--erp-gray-900);
    display: block;
}

.client-result-info .cr-company {
    font-size: 11px;
    color: var(--erp-gray-500);
}

.client-result-check {
    font-size: 15px;
    color: var(--erp-green-600);
    opacity: 0;
    transition: opacity 0.15s;
}

.client-result-item.is-selected .client-result-check {
    opacity: 1;
}

.client-selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 7px;
    padding: 4px 10px 4px 8px;
    background: var(--erp-green-50);
    border: 1px solid var(--erp-green-200);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: var(--erp-green-700);
}

.client-selected-tag i {
    font-size: 12px;
    color: var(--erp-green-600);
}

.client-tag-remove {
    background: none;
    border: none;
    color: var(--erp-green-600);
    cursor: pointer;
    font-size: 13px;
    padding: 0;
    line-height: 1;
    margin-left: 2px;
    opacity: 0.7;
    transition: opacity 0.1s;
}

.client-tag-remove:hover {
    opacity: 1;
}

.client-no-results {
    padding: 1rem;
    text-align: center;
    font-size: 12px;
    color: var(--erp-gray-500);
    font-style: italic;
}

/* ============================================
   PAGINATION STYLING (Zero-Inline Custom Bootstrap 5 API Override)
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.page-item {
    margin: 0;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 0.5rem;
    font-size: 13px;
    font-weight: 600;
    color: var(--erp-gray-600);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s;
}

.page-link:hover {
    background: var(--erp-gray-100);
    color: var(--erp-gray-900);
}

.page-item.active .page-link {
    background: var(--erp-green-500);
    color: white;
    border-color: var(--erp-green-500);
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}

.page-item.disabled .page-link {
    color: var(--erp-gray-400);
    pointer-events: none;
    background: transparent;
}

/* ============================================
   DASHBOARD METRICS ROW
   ============================================ */
.metrics-row-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 1024px) {
    .metrics-row-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .metrics-row-grid {
        grid-template-columns: 1fr;
    }
}

.metrics-row-grid .card {
    height: 200px;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}

/* ============================================
   DASHBOARD GRID SYMMETRY ENFORCEMENT
   ============================================ */
.activity-feed-grid .card {
    height: 400px;
    /* Lock perfect professional height */
    display: flex;
    flex-direction: column;
}

.activity-feed-grid .card-header {
    flex-shrink: 0;
}

.activity-feed-grid .card-body {
    flex: 1 1 auto;
    overflow-y: auto;
    /* Beautiful inner scrolling for long tables */
    /* Custom Scrollbar for inner card */
    scrollbar-width: thin;
    scrollbar-color: #059669 transparent;
}

.activity-feed-grid .card-body::-webkit-scrollbar {
    width: 6px;
}

.activity-feed-grid .card-body::-webkit-scrollbar-thumb {
    background-color: #059669;
    border-radius: 10px;
}

.activity-feed-grid .card-footer {
    flex-shrink: 0;
    margin-top: auto;
}

/* ============================================
 IMAGE VIEWER MODAL
 ============================================ */
.image-viewer-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: 0.3s;
}

.image-viewer-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 85vh;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation-name: zoom;
    animation-duration: 0.4s;
    cursor: default;
}

@keyframes zoom {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.image-viewer-close {
    position: absolute;
    top: 25px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 10001;
    background: rgba(255, 255, 255, 0.1);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    line-height: 1;
}

.image-viewer-close:hover,
.image-viewer-close:focus {
    color: #fff;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Pagination Premium Styles */
.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 6px;
    align-items: center;
}

.pagination .page-item {
    display: inline-block;
}

.pagination .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--erp-gray-600);
    background: white;
    border: 1px solid var(--erp-gray-200);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.pagination .page-item.active .page-link {
    background: var(--erp-primary);
    color: white;
    border-color: var(--erp-primary);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
}

.pagination .page-link:hover:not(.active) {
    background: var(--erp-gray-50);
    border-color: var(--erp-gray-300);
    color: var(--erp-primary);
    transform: translateY(-1px);
}

.pagination .page-item.disabled .page-link {
    color: var(--erp-gray-300);
    background: var(--erp-gray-50);
    cursor: not-allowed;
    transform: none;
}

.pagination .page-item:first-child .page-link,
.pagination .page-item:last-child .page-link {
    font-size: 14px;
}

.pagination svg {
    width: 16px;
    height: 16px;
}

/* Standardized Circular Avatars */
.avatar-circle {
    border-radius: 50% !important;
    object-fit: cover !important;
}

.clickable-avatar {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.clickable-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Image Preview Modal */
.image-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-preview-overlay.active {
    display: flex;
    opacity: 1;
}

.image-preview-content {
    max-width: 90%;
    max-height: 90%;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.image-preview-overlay.active .image-preview-content {
    transform: scale(1);
}

.image-preview-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.image-preview-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* ============================================================
   COMPLETE RESPONSIVE NO-X-SCROLL SYSTEM
   Targets every component that can bleed past the viewport
   ============================================================ */

/* --- Images & Media --- */
img,
video,
iframe,
embed,
object {
    max-width: 100%;
    height: auto;
}

/* --- Global container clamp --- */
.app-container {
    max-width: 100%;
}

.app-workspace {
    min-width: 0;
    width: 100%;
}

.app-main {
    max-width: 100%;
    min-width: 0;
}

.app-header {
    max-width: 100%;
}

/* --- Provision Console (PVC) responsive --- */
@media (max-width: 1024px) {
    .pvc-body {
        padding: 1.5rem 1.5rem;
    }

    .pvc-header {
        padding: 1rem 1.5rem;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .pvc-form-grid-2 {
        grid-template-columns: 1fr;
    }

    .pvc-file-section {
        grid-template-columns: 1fr;
    }

    .pvc-multi-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .pvc-submit-wrap {
        text-align: left;
    }

    .pvc-submit-btn {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .pvc-body {
        padding: 1rem;
    }

    .pvc-header {
        padding: 0.75rem 1rem;
    }

    .pvc-title {
        font-size: 1.1rem;
    }

    .pvc-multi-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .pvc-multi-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Modals responsive --- */
.erp-modal-overlay {
    padding: 0.75rem;
}

@media (max-width: 640px) {
    .erp-modal {
        max-width: 100%;
        border-radius: 12px;
    }

    .erp-modal-body {
        padding: 1rem;
        max-height: 75vh;
    }

    .erp-modal-header {
        padding: 1rem;
    }

    .erp-modal-footer {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
    }

    .erp-modal-meta-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .erp-modal-footer .btn {
        width: 100%;
    }
}

/* --- App Header responsive --- */
@media (max-width: 480px) {
    .app-header {
        padding: 0 0.75rem;
        flex-wrap: nowrap;
        gap: 0.25rem;
    }

    .header-user {
        gap: 0.35rem;
        font-size: 12px;
        min-width: 0;
        overflow: hidden;
    }

    .header-user>span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 90px;
    }

    .header-title {
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }
}

/* --- Filter / Search grids --- */
@media (max-width: 640px) {
    .erp-filter-grid {
        grid-template-columns: 1fr !important;
    }

    .erp-filter-grid>div,
    .erp-filter-grid>button,
    .erp-filter-grid>a {
        width: 100% !important;
    }
}

/* --- Metrics row --- */
@media (max-width: 640px) {
    .metrics-row-grid {
        grid-template-columns: 1fr !important;
    }
}

/* --- Activity feed grid --- */
@media (max-width: 640px) {
    .activity-feed-grid {
        grid-template-columns: 1fr !important;
    }

    .activity-feed-grid .card {
        height: auto !important;
        max-height: 500px;
    }
}

/* --- Type selection grid --- */
@media (max-width: 480px) {
    .type-selection-grid {
        grid-template-columns: 1fr !important;
    }
}

/* --- Card header wrapping --- */
@media (max-width: 640px) {
    .card-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

/* --- Table responsive: prevent page overflow, only scroll table container --- */
.table-responsive {
    width: 100%;
    max-width: 100%;
}

/* --- Auth split responsive coverage --- */
@media (max-width: 640px) {
    .auth-split-left {
        padding: 24px 16px;
        min-width: 0;
        width: 100%;
    }

    .auth-form-container {
        max-width: 100%;
        width: 100%;
    }

    .radio-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Guest layout responsive --- */
@media (max-width: 640px) {
    .guest-nav {
        padding: 0 1rem;
    }

    .hero-section {
        padding: 3rem 1rem;
    }

    .hero-actions {
        flex-direction: column;
        align-items: center;
    }

    .features-grid {
        grid-template-columns: 1fr;
        padding: 0 1rem;
    }
}

/* --- Task manager responsive --- */
@media (max-width: 768px) {
    .task-header-premium {
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 1rem;
    }

    .task-header-flex {
        flex-wrap: wrap;
    }

    .task-action-wrapper {
        flex-wrap: wrap;
        justify-content: flex-start;
    }
}

/* --- Service form inline --- */
@media (max-width: 640px) {
    .service-form-inline {
        flex-direction: column;
    }

    .service-form-inline>* {
        width: 100% !important;
    }
}

/* --- Chip grid overflow prevention --- */
.chip-grid {
    overflow: hidden;
    max-width: 100%;
}

/* --- Sidebar responsive: prevent it from overflowing page width --- */
@media (max-width: 768px) {
    .sidebar {
        max-width: 90vw;
    }

    .sidebar.open {
        width: min(280px, 90vw);
    }
}

/* --- Inline dashboard stats grid (auto-fit, prevents overflow) --- */
@media (max-width: 640px) {
    [style*='grid-template-columns: repeat(auto-fit'] {
        grid-template-columns: 1fr !important;
    }
}

/* --- Prevent any fixed/absolute elements from breaking x layout --- */
.erp-select-options,
.searchable-select-panel,
.client-results-panel {
    max-width: 100%;
    left: 0;
    right: 0;
    width: 100%;
}

/* --- Confirmation modal responsive --- */
@media (max-width: 480px) {
    #confirmModal>div {
        margin: 0.75rem;
        width: calc(100% - 1.5rem) !important;
        max-width: 100% !important;
    }
}

/* --- PVC body large-padding safeguard --- */
@media (max-width: 600px) {
    .pvc-body {
        padding: 0.85rem 0.85rem;
    }

    .pvc-security-block {
        flex-wrap: wrap;
    }
}

/* --- Overflow-safe utility --- */
.overflow-safe {
    overflow-x: hidden;
    max-width: 100%;
    width: 100%;
}

/* --- Fluid Table utility (Prevents X-Scroll on simple tables) --- */
.table-fluid {
    min-width: 0 !important;
    width: 100% !important;
}

.table-fluid td {
    white-space: normal !important;
}

/* --- Settings & Profile Overhaul --- */
.settings-page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--erp-gray-200);
}

.settings-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

@media (max-width: 640px) {
    .settings-header-flex {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1.25rem;
    }
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

.settings-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid var(--erp-gray-200);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
    height: 100%;
}

.settings-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

.settings-card-header {
    padding: 1.25rem 1.5rem;
    background: var(--erp-gray-50);
    border-bottom: 1px solid var(--erp-gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-card-body {
    padding: 1.5rem;
}

.settings-logo-container {
    width: 90px;
    height: 90px;
    background: #fff;
    border-radius: 20px;
    border: 2px solid var(--erp-green-50);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    position: relative;
    transition: all 0.3s;
}

.settings-logo-container:hover {
    border-color: var(--erp-green-400);
    transform: scale(1.05);
}

.info-section {
    margin-bottom: 1.5rem;
}

.info-section:last-child {
    margin-bottom: 0;
}

.info-section-title {
    font-size: 11px;
    font-weight: 800;
    color: var(--erp-gray-400);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed var(--erp-gray-100);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--erp-gray-50);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 13px;
    color: var(--erp-gray-600);
    font-weight: 500;
}

.info-value {
    font-size: 13px;
    color: var(--erp-gray-900);
    font-weight: 700;
    text-align: right;
}

.security-badge {
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 10px;
    font-weight: 800;
}

.security-badge-on {
    background: var(--erp-green-50);
    color: var(--erp-green-700);
    border: 1px solid var(--erp-green-200);
}

.security-badge-off {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.glass-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    border: 1px solid var(--erp-gray-200);
    color: var(--erp-gray-700);
    font-size: 12px;
    padding: 0.4rem 1rem;
    border-radius: 8px;
    font-weight: 700;
    transition: all 0.2s;
    text-decoration: none;
}

.glass-action-btn:hover {
    background: #fff;
    border-color: var(--erp-green-500);
    color: var(--erp-green-600);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}