body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hero-section {
    position: relative;
    padding: 6rem 0;
    color: white;
    margin-bottom: 3rem;
    overflow: hidden;
    min-height: 500px;
}

.hero-section .overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1;
}

.hero-section .content {
    position: relative;
    z-index: 2;
}

.hero-section .background-slideshow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
}

.hero-section .background-slideshow .slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 2s ease-in-out;
}

.hero-section .background-slideshow .slide:nth-child(1) {
    background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 50%, #388e3c 100%);
    opacity: 1;
}

.hero-section .background-slideshow .slide:nth-child(2) {
    background: linear-gradient(135deg, #0d47a1 0%, #1565c0 50%, #1976d2 100%);
}

.hero-section .background-slideshow .slide:nth-child(3) {
    background: linear-gradient(135deg, #33691e 0%, #558b2f 50%, #689f38 100%);
}

.hero-logo {
    width: 150px;
    height: 150px;
    margin: 0 auto 2rem auto;
    border-radius: 50%;
    background: rgba(76, 175, 80, 0.2);
    box-shadow:
        0 5px 15px rgba(0, 0, 0, 0.3),
        inset 0 5px 15px rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 3px solid rgba(76, 175, 80, 0.5);
}

.hero-logo::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg,
                rgba(255, 255, 255, 0.3) 0%,
                rgba(255, 255, 255, 0.1) 50%,
                rgba(255, 255, 255, 0) 51%,
                rgba(255, 255, 255, 0.05) 100%);
    border-radius: 50%;
    z-index: 2;
}

.hero-logo::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(30deg);
    animation: shine 3s infinite;
    z-index: 3;
    border-radius: 50%;
    overflow: hidden;
}

@keyframes shine {
    0% { transform: translateX(-100%) rotate(30deg); }
    100% { transform: translateX(100%) rotate(30deg); }
}

.content-wrapper {
    flex: 1;
}

.sidebar {
    min-height: calc(100vh - 56px);
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
}

.sidebar-sticky {
    position: sticky;
    top: 0;
    height: calc(100vh - 56px);
    padding-top: 1rem;
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar .nav-link {
    font-weight: 500;
    color: #e9e9e9;
    padding: 0.5rem 1rem;
    margin-bottom: 0.2rem;
    border-radius: 0.25rem;
}

.sidebar .nav-link:hover {
    background-color: rgba(76, 175, 80, 0.15);
}

.sidebar .nav-link.active {
    color: #4CAF50;
    background-color: rgba(76, 175, 80, 0.15);
}

.card {
    margin-bottom: 1.5rem;
    box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15);
}

.card-header {
    font-weight: 600;
}

.stat-card {
    border-left: 4px solid;
}

.stat-card.primary { border-left-color: var(--bs-primary); }
.stat-card.success { border-left-color: #4CAF50; }
.stat-card.warning { border-left-color: var(--bs-warning); }
.stat-card.danger { border-left-color: var(--bs-danger); }
.stat-card.info { border-left-color: var(--bs-info); }

.stat-card .card-title {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
    color: var(--bs-gray-600);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0;
}

.table-responsive {
    border-radius: 0.25rem;
    overflow: hidden;
}

.table th {
    background-color: rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

.table .actions {
    white-space: nowrap;
}

.form-label {
    font-weight: 500;
}

.required-field::after {
    content: "*";
    color: var(--bs-danger);
    margin-left: 0.25rem;
}

.chart-container {
    height: 300px;
    margin-bottom: 1.5rem;
}

.status-badge {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
}

.offline-indicator {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 1050;
    padding: 0.5rem 1rem;
    background-color: var(--bs-danger);
    color: white;
    border-radius: 0.25rem;
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15);
}

.offline-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
}

@media (max-width: 768px) {
    .sidebar {
        position: static;
        height: auto;
        min-height: auto;
    }
    .sidebar-sticky {
        position: static;
        height: auto;
    }
    .stat-card .stat-value {
        font-size: 1.5rem;
    }
    .chart-container {
        height: 250px;
    }
}

.status-pending, .status-draft { color: var(--bs-warning); }
.status-active, .status-approved, .status-completed { color: #4CAF50; }
.status-rejected, .status-cancelled, .status-failed { color: var(--bs-danger); }
.status-submitted, .status-payment_received { color: var(--bs-info); }

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

.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top: 2px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@media print {
    .sidebar, .navbar, .no-print { display: none !important; }
    .main { margin-left: 0 !important; width: 100% !important; }
    .card { break-inside: avoid; }
}

.btn-success {
    background-color: #4CAF50;
    border-color: #4CAF50;
}

.btn-success:hover {
    background-color: #388e3c;
    border-color: #388e3c;
}

.btn-outline-success {
    color: #4CAF50;
    border-color: #4CAF50;
}

.btn-outline-success:hover {
    background-color: #4CAF50;
    border-color: #4CAF50;
}

/* ── iOS PWA Safe Area (status bar / notch / Dynamic Island) ─────────────── */
@supports (padding-top: env(safe-area-inset-top)) {
    @media all and (display-mode: standalone) {
        .navbar {
            padding-top: env(safe-area-inset-top) !important;
        }
        /* Ensure fixed-top doesn't lose height on notched devices */
        body {
            --safe-top: env(safe-area-inset-top);
        }
    }
}
