@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --sidebar-bg: #0f172a;
    --sidebar-active: #1e40af;
    --sidebar-hover: rgba(255, 255, 255, 0.08);
    --content-bg: #f1f5f9;
    --card-radius: 12px;
    --primary-blue: #2563eb;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
}

body.procure-app {
    font-family: 'Inter', 'Source Sans Pro', sans-serif;
    background: var(--content-bg);
}

/* Sidebar */
.procure-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1030;
    overflow-y: auto;
}

.procure-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 24px;
    color: #fff;
    text-decoration: none;
}

.procure-brand:hover {
    color: #fff;
    text-decoration: none;
}

.procure-brand-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-blue);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.procure-brand-text {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.procure-nav {
    list-style: none;
    padding: 0 12px;
    margin: 0;
    flex: 1;
}

.procure-nav .nav-item {
    margin-bottom: 2px;
}

.procure-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: #94a3b8;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
}

.procure-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: #e2e8f0;
}

.procure-nav .nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
}

.procure-nav .nav-link i {
    width: 18px;
    text-align: center;
    font-size: 15px;
}

.procure-user-panel {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.procure-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.procure-user-info {
    flex: 1;
    min-width: 0;
}

.procure-user-name {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.procure-user-role {
    color: #64748b;
    font-size: 12px;
    margin: 0;
}

.procure-user-panel .fa-chevron-down {
    color: #64748b;
    font-size: 12px;
}

/* Main Content */
.procure-content {
    margin-left: 240px;
    min-height: 100vh;
    padding: 24px 28px;
}

.procure-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.procure-header-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 4px;
}

.procure-header-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0;
}

.procure-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.procure-search {
    position: relative;
}

.procure-search input {
    width: 280px;
    padding: 8px 14px 8px 38px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
    outline: none;
}

.procure-search input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.procure-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
}

.procure-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    color: var(--text-dark);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.procure-btn:hover {
    background: #f8fafc;
}

.procure-btn i {
    font-size: 12px;
    color: var(--text-muted);
}

/* KPI Cards */
.kpi-card {
    background: #fff;
    border-radius: var(--card-radius);
    padding: 18px 20px 12px;
    border: 1px solid var(--border-color);
    height: 100%;
}

.kpi-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.kpi-icon.blue { background: #dbeafe; color: #2563eb; }
.kpi-icon.green { background: #dcfce7; color: #16a34a; }
.kpi-icon.purple { background: #f3e8ff; color: #9333ea; }
.kpi-icon.teal { background: #ccfbf1; color: #0d9488; }
.kpi-icon.cyan { background: #e0f2fe; color: #0284c7; }

.kpi-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 4px;
    line-height: 1.2;
}

.kpi-change {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 8px;
}

.kpi-change.up { color: #16a34a; }
.kpi-change.down { color: #dc2626; }

.kpi-sparkline {
    height: 40px;
    margin-top: 4px;
}

/* Chart Cards */
.chart-card {
    background: #fff;
    border-radius: var(--card-radius);
    border: 1px solid var(--border-color);
    height: 100%;
}

.chart-card.chart-card-auto {
    height: auto;
}

.chart-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 0;
}

.chart-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chart-card-title .info-icon {
    color: var(--text-muted);
    font-size: 13px;
    cursor: help;
}

.chart-card-body {
    padding: 12px 20px 20px;
}

.chart-select {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 28px 4px 10px;
    font-size: 12px;
    color: var(--text-dark);
    background: #fff;
    appearance: auto;
}

.chart-container {
    position: relative;
    height: 260px;
}

.chart-container-sm {
    position: relative;
    height: 200px;
}

/* Donut legend */
.donut-legend {
    list-style: none;
    padding: 0;
    margin: 0;
}

.donut-legend li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
}

.donut-legend .legend-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.donut-legend .legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.donut-legend .legend-label {
    color: var(--text-dark);
    font-weight: 500;
}

.donut-legend .legend-value {
    color: var(--text-muted);
    font-size: 12px;
    text-align: right;
}

.donut-legend .legend-pct {
    color: var(--text-muted);
    font-size: 12px;
    min-width: 36px;
    text-align: right;
}

/* PO Status layout */
.po-status-layout {
    display: flex;
    align-items: center;
    gap: 20px;
}

.po-status-chart {
    flex: 0 0 180px;
    position: relative;
    height: 180px;
}

/* Table */
.procure-table {
    width: 100%;
    border-collapse: collapse;
}

.procure-table thead th {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.procure-table tbody td {
    padding: 12px;
    font-size: 13px;
    color: var(--text-dark);
    border-bottom: 1px solid #f1f5f9;
}

.procure-table tbody tr:last-child td {
    border-bottom: none;
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.approved { background: #dcfce7; color: #15803d; }
.status-badge.issued { background: #dbeafe; color: #1d4ed8; }
.status-badge.pending { background: #fef3c7; color: #b45309; }
.status-badge.draft { background: #f1f5f9; color: #64748b; }
.status-badge.cancelled { background: #fee2e2; color: #b91c1c; }

.view-all-link {
    font-size: 13px;
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 500;
}

.view-all-link:hover {
    text-decoration: underline;
    color: #1d4ed8;
}

/* Contracts list */
.contract-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid #f1f5f9;
}

.contract-item:last-child {
    border-bottom: none;
}

.contract-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 2px;
}

.contract-supplier {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

.contract-date {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.days-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: #fef3c7;
    color: #b45309;
    white-space: nowrap;
}

.days-badge.urgent {
    background: #fee2e2;
    color: #b91c1c;
}

/* Savings insight */
.savings-insight {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-radius: var(--card-radius);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    border: 1px solid #a7f3d0;
}

.savings-icon {
    width: 44px;
    height: 44px;
    background: #10b981;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    flex-shrink: 0;
}

.savings-text h5 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 4px;
}

.savings-text p {
    font-size: 13px;
    color: #16a34a;
    margin: 0 0 8px;
    font-weight: 500;
}

.savings-link {
    font-size: 13px;
    color: var(--primary-blue);
    font-weight: 500;
    text-decoration: none;
}

.savings-link:hover {
    text-decoration: underline;
}

/* Auth pages */
.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-dark);
}

.auth-brand:hover {
    text-decoration: none;
    color: var(--text-dark);
}

.auth-brand-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-blue);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
}

.auth-brand-text {
    font-size: 24px;
    font-weight: 700;
}

.login-page, .register-page {
    background: var(--content-bg);
}

.login-box .card, .register-box .card {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.login-box .btn-primary, .register-box .btn-primary {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    border-radius: 8px;
}

.login-box .btn-primary:hover, .register-box .btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.login-box .card-outline-primary {
    border-top: 3px solid var(--primary-blue);
}

/* Mobile toggle button */
.procure-mobile-toggle {
    position: fixed;
    top: 12px;
    left: 12px;
    width: 40px;
    height: 40px;
    background: var(--sidebar-bg);
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    z-index: 1040;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Sidebar overlay for mobile */
.procure-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1025;
    display: none;
}

.procure-sidebar-overlay.show {
    display: block;
}

@media (max-width: 991.98px) {
    .procure-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .procure-sidebar.show {
        transform: translateX(0);
    }

    .procure-content {
        margin-left: 0;
        padding: 16px;
        padding-top: 56px;
    }

    .procure-search input {
        width: 100%;
    }

    .procure-header-actions {
        width: 100%;
    }

    .procure-header {
        flex-direction: column;
    }

    .kpi-card {
        margin-bottom: 12px;
    }

    .po-status-layout {
        flex-direction: column;
    }

    .po-status-chart {
        flex: unset;
        width: 100%;
    }
}

@media (min-width: 992px) {
    .procure-mobile-toggle {
        display: none !important;
    }
}

/* Form cards & filters */
.procure-form-card {
    background: #fff;
    border-radius: var(--card-radius);
    border: 1px solid var(--border-color);
    padding: 24px;
}

.procure-filters {
    background: #fff;
    border-radius: var(--card-radius);
    border: 1px solid var(--border-color);
    padding: 16px 20px;
    margin-bottom: 16px;
}

.procure-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: var(--primary-blue);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
}

.procure-btn-primary:hover {
    background: #1d4ed8;
    color: #fff;
    text-decoration: none;
}

.procure-detail-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 2px;
}

.procure-detail-value {
    font-size: 14px;
    color: var(--text-dark);
    font-weight: 500;
    margin-bottom: 14px;
}

.expiry-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.expiry-badge.red { background: #fee2e2; color: #b91c1c; }
.expiry-badge.orange { background: #ffedd5; color: #c2410c; }
.expiry-badge.yellow { background: #fef3c7; color: #b45309; }
.expiry-badge.green { background: #dcfce7; color: #15803d; }

.approval-timeline {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
}

.approval-timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--border-color);
}

.approval-timeline li {
    position: relative;
    padding-left: 44px;
    padding-bottom: 20px;
}

.approval-timeline .tl-dot {
    position: absolute;
    left: 8px;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--primary-blue);
}

.mapping-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}

.progress-ring-label {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
}
