:root {
    --sidebar-width: 260px;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #3b82f6;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --body-bg: #f1f5f9;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--body-bg);
    color: #334155;
    font-size: 0.9rem;
    overflow-x: hidden;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #cbd5e1;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h4 {
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
}

.sidebar-header small {
    color: #94a3b8 !important;
    font-size: 0.75rem;
}

.sidebar-nav {
    padding: 0.5rem 0;
}

.nav-section {
    padding: 0.5rem 0;
}

.nav-section-title {
    display: block;
    padding: 0.5rem 1.5rem 0.25rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.6rem 1.5rem;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.85rem;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    color: #fff;
    background: var(--sidebar-hover);
}

.nav-item.active {
    color: #fff;
    background: rgba(59, 130, 246, 0.15);
    border-left-color: var(--sidebar-active);
}

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

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    overflow-x: hidden;
}

.content-area {
    max-width: 1400px;
    overflow-x: hidden;
}

.navbar {
    height: 60px;
}

.card {
    border: none;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
}

.stat-card {
    border: none;
    border-radius: 12px;
    padding: 1.25rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 100px;
    height: 200%;
    background: rgba(255,255,255,0.08);
    transform: rotate(15deg);
}

.stat-card .stat-icon {
    font-size: 2rem;
    opacity: 0.3;
    position: absolute;
    right: 15px;
    top: 15px;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    opacity: 0.85;
    margin-top: 0.25rem;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.bg-gradient-success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.bg-gradient-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.bg-gradient-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.bg-gradient-info {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
}

.bg-gradient-purple {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.table {
    font-size: 0.85rem;
}

.table thead th {
    background: #f8fafc;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: #64748b;
    border-bottom: 2px solid #e2e8f0;
    padding: 0.75rem;
}

.table tbody td {
    padding: 0.75rem;
    vertical-align: middle;
}

.form-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: #475569;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #d1d5db;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.btn {
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
    border-radius: 6px;
}

.pipeline-container {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 10px 0;
}

.pipeline-column {
    min-width: 250px;
    max-width: 280px;
    background: #f8fafc;
    border-radius: 10px;
    padding: 12px;
    flex-shrink: 0;
}

.pipeline-column-header {
    font-weight: 600;
    font-size: 0.85rem;
    padding: 8px;
    margin-bottom: 8px;
    border-radius: 6px;
    text-align: center;
}

.pipeline-card {
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border-left: 3px solid var(--primary);
    cursor: pointer;
    transition: transform 0.15s;
}

.pipeline-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

.pipeline-card h6 {
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.pipeline-card small {
    color: #94a3b8;
    font-size: 0.75rem;
}

.progress-stages {
    display: flex;
    gap: 4px;
    margin: 10px 0;
}

.progress-stage {
    flex: 1;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
}

.progress-stage.completed {
    background: var(--success);
}

.progress-stage.current {
    background: var(--primary);
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.login-card {
    background: #fff;
    border-radius: 14px;
    padding: 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    margin: 1rem;
}

.login-card h2 {
    font-weight: 700;
    color: #1e293b;
    font-size: 1.3rem;
}

.login-card .brand-icon {
    font-size: 2rem;
    color: var(--primary);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .sidebar-overlay.show {
        display: block;
    }
    .main-content {
        margin-left: 0;
    }
}

/* ── Mobile-specific fixes ── */
@media (max-width: 575.98px) {
    .login-container {
        padding: 0.5rem;
        align-items: flex-start;
        padding-top: 2rem;
    }
    .login-card {
        padding: 1.5rem;
        margin: 0.5rem;
        border-radius: 12px;
    }
    .login-card h2 {
        font-size: 1.4rem;
    }
    .login-card .brand-icon {
        font-size: 2rem;
    }
    .stat-card {
        padding: 0.85rem;
    }
    .stat-card .stat-value {
        font-size: 1.3rem !important;
    }
    .stat-card .stat-label {
        font-size: 0.7rem;
    }
    .stat-card .stat-icon {
        font-size: 1.4rem;
        right: 10px;
        top: 10px;
    }
    .content-area {
        padding: 0.75rem !important;
    }
    .navbar {
        height: auto;
        min-height: 50px;
        padding: 0.5rem !important;
    }
    .navbar h5 {
        font-size: 0.95rem;
    }
    .cal-table {
        font-size: 0.65rem;
    }
    .cal-day {
        height: 60px;
        padding: 2px !important;
    }
    .cal-day-num {
        font-size: 0.7rem;
    }
    .cal-event {
        font-size: 0.55rem;
        padding: 0 2px;
    }
    .cal-table th {
        padding: 4px 2px !important;
        font-size: 0.6rem;
    }
    .pipeline-container {
        gap: 10px;
        padding: 5px 0;
    }
    .pipeline-column {
        min-width: 160px;
        max-width: 200px;
        padding: 8px;
    }
    .pipeline-column-header {
        font-size: 0.7rem;
        padding: 6px;
    }
    .nav-pills .nav-link {
        font-size: 0.75rem;
        padding: 0.4rem 0.6rem;
    }
    .card-header {
        font-size: 0.85rem;
        padding: 0.6rem 0.75rem;
    }
    .table {
        font-size: 0.75rem;
    }
    .table thead th {
        font-size: 0.65rem;
        padding: 0.5rem 0.4rem;
    }
    .table tbody td {
        padding: 0.5rem 0.4rem;
    }
    .btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.75rem;
    }
    .btn-sm {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
    h4 {
        font-size: 1.1rem;
    }
    .kpi-card {
        padding: 0.5rem;
    }
    .kpi-card .kpi-value {
        font-size: 1rem !important;
    }
    .kpi-card .kpi-label {
        font-size: 0.6rem;
    }
    .progress-stages {
        width: 100% !important;
        max-width: 180px;
    }
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }
    .gallery-item {
        aspect-ratio: 1;
    }
    .modal-dialog {
        margin: 0.5rem;
    }
    .modal-body {
        padding: 0.75rem;
    }
    .form-control, .form-select {
        font-size: 0.85rem;
        padding: 0.4rem 0.6rem;
    }
    .form-label {
        font-size: 0.8rem;
    }
    .timeline-item {
        margin-bottom: 1rem;
        padding-left: 15px;
    }
    .stage-timeline {
        padding-left: 20px;
    }
    .search-box input {
        min-width: 0 !important;
        width: 100%;
    }
    .empty-state {
        padding: 1.5rem;
    }
    .empty-state i {
        font-size: 2rem;
    }
}

.kpi-card {
    text-align: center;
    padding: 1rem;
}

.kpi-card .kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.kpi-card .kpi-label {
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.gallery-item {
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1;
    cursor: pointer;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #94a3b8;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.stage-timeline {
    position: relative;
    padding-left: 30px;
}

.stage-timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
    padding-left: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--primary);
}

.timeline-item .timeline-date {
    font-size: 0.75rem;
    color: #94a3b8;
}

.timeline-item .timeline-content {
    font-size: 0.85rem;
}

.nav-pills .nav-link {
    border-radius: 8px;
    color: #64748b;
    font-weight: 500;
    font-size: 0.85rem;
}

.nav-pills .nav-link.active {
    background: var(--primary);
}

.search-box {
    position: relative;
}

.search-box input {
    padding-left: 35px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.cal-table {
    table-layout: fixed;
    font-size: 0.8rem;
}

.cal-table th {
    background: #f8fafc;
    padding: 6px !important;
    font-size: 0.7rem;
}

.cal-day {
    vertical-align: top;
    padding: 4px !important;
    height: 90px;
    cursor: pointer;
    transition: background 0.15s;
}

.cal-day:hover {
    background: #f1f5f9;
}

.cal-today {
    background: #eff6ff !important;
    border-color: #3b82f6 !important;
}

.cal-empty {
    background: #fafafa;
}

.cal-day-num {
    font-size: 0.8rem;
    margin-bottom: 2px;
}

.cal-event {
    font-size: 0.65rem;
    padding: 1px 4px;
    margin-bottom: 2px;
    border-radius: 3px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.cal-event:hover {
    opacity: 0.8;
}

.cal-more {
    font-size: 0.6rem;
    color: #94a3b8;
    text-align: center;
}

@media print {
    .sidebar, .navbar, .no-print {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
    }
}
