/* ========== RESET & BASE ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    min-height: 100vh;
    overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 1rem; }

/* ========== PAGES ========== */
.page { display: none; min-height: 100vh; }
.page.active { display: flex; }

/* ========== LOGIN ========== */
.login-container {
    display: flex; width: 100%; min-height: 100vh;
}
.login-left {
    flex: 1; background: linear-gradient(135deg, #1a5632 0%, #2d8a4e 50%, #1a5632 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 3rem; color: white; position: relative; overflow: hidden;
}
.login-left::before {
    content: ''; position: absolute; top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 60%);
    animation: pulse 8s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}
.login-brand { text-align: center; position: relative; z-index: 1; }
.logo-icon {
    width: 100px; height: 100px; background: rgba(255,255,255,0.15);
    border-radius: 24px; display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.5rem; font-size: 3rem; backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.2);
}
.login-brand h1 { font-size: 3rem; font-weight: 800; letter-spacing: 4px; margin-bottom: 0.5rem; }
.brand-subtitle { font-size: 1.1rem; opacity: 0.9; font-weight: 500; margin-bottom: 1.5rem; }
.brand-desc { font-size: 0.95rem; opacity: 0.7; max-width: 350px; line-height: 1.6; }

.login-right {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 3rem; background: #fff;
}
.login-form-container { width: 100%; max-width: 420px; }
.login-form-container h2 { font-size: 1.8rem; font-weight: 700; margin-bottom: 0.5rem; }
.login-subtitle { color: #666; margin-bottom: 2rem; }

.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.5rem; font-size: 0.9rem; }
.input-icon {
    position: relative; display: flex; align-items: center;
}
.input-icon i {
    position: absolute; left: 14px; color: #999; font-size: 1rem;
}
.input-icon input {
    width: 100%; padding: 12px 14px 12px 42px;
    border: 2px solid #e0e0e0; border-radius: 10px;
    transition: border-color 0.3s, box-shadow 0.3s; font-size: 1rem;
}
.input-icon input:focus {
    outline: none; border-color: #1a5632;
    box-shadow: 0 0 0 3px rgba(26,86,50,0.1);
}

.btn {
    padding: 12px 24px; border-radius: 10px; font-weight: 600;
    font-size: 1rem; transition: all 0.3s; display: inline-flex;
    align-items: center; gap: 8px; justify-content: center;
}
.btn-primary {
    background: linear-gradient(135deg, #1a5632, #2d8a4e);
    color: white; box-shadow: 0 4px 15px rgba(26,86,50,0.3);
}
.btn-primary:hover {
    transform: translateY(-2px); box-shadow: 0 6px 20px rgba(26,86,50,0.4);
}
.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; border-radius: 8px; }
.btn-success { background: #27ae60; color: white; }
.btn-success:hover { background: #219a52; }
.btn-danger { background: #e74c3c; color: white; }
.btn-danger:hover { background: #c0392b; }
.btn-warning { background: #f39c12; color: white; }
.btn-warning:hover { background: #d68910; }
.btn-outline {
    background: transparent; border: 2px solid #1a5632; color: #1a5632;
}
.btn-outline:hover { background: #1a5632; color: white; }
.btn-secondary { background: #6c757d; color: white; }

.demo-accounts {
    margin-top: 2rem; padding: 1.25rem; background: #f8f9fa;
    border-radius: 12px; border: 1px solid #e9ecef;
}
.demo-accounts p { font-size: 0.85rem; margin-bottom: 0.75rem; color: #555; }
.demo-item {
    padding: 10px 14px; background: white; border-radius: 8px;
    margin-bottom: 8px; cursor: pointer; font-size: 0.85rem;
    border: 1px solid #e9ecef; transition: all 0.2s; color: #333;
}
.demo-item:hover { border-color: #1a5632; background: #f0fff5; }
.demo-item:last-child { margin-bottom: 0; }

/* ========== SIDEBAR ========== */
.sidebar {
    width: 260px; background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: white; display: flex; flex-direction: column;
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 100;
    transition: transform 0.3s;
}
.sidebar-admin {
    background: linear-gradient(180deg, #1a5632 0%, #0d3320 100%);
}
.sidebar-header {
    padding: 1.25rem; display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.logo-small {
    width: 38px; height: 38px; background: rgba(255,255,255,0.15);
    border-radius: 10px; display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}
.sidebar-title { font-weight: 700; font-size: 1.2rem; letter-spacing: 2px; }
.sidebar-toggle { display: none; color: white; font-size: 1.2rem; margin-left: auto; }

.sidebar-user {
    padding: 1.25rem; display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.user-avatar {
    width: 42px; height: 42px; background: linear-gradient(135deg, #3498db, #2980b9);
    border-radius: 12px; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.9rem; flex-shrink: 0;
}
.admin-avatar { background: linear-gradient(135deg, #f39c12, #e67e22); }
.user-info { display: flex; flex-direction: column; overflow: hidden; }
.user-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.75rem; opacity: 0.6; }

.sidebar-menu {
    list-style: none; padding: 0.75rem 0; flex: 1; overflow-y: auto;
}
.sidebar-menu li {
    padding: 11px 1.25rem; display: flex; align-items: center; gap: 12px;
    cursor: pointer; transition: all 0.2s; font-size: 0.9rem;
    position: relative; color: rgba(255,255,255,0.7);
}
.sidebar-menu li:hover { background: rgba(255,255,255,0.08); color: white; }
.sidebar-menu li.active {
    background: rgba(255,255,255,0.12); color: white;
    border-right: 3px solid #27ae60;
}
.sidebar-menu li i { width: 20px; text-align: center; font-size: 1rem; }
.menu-separator {
    height: 1px !important; background: rgba(255,255,255,0.1) !important;
    margin: 0.5rem 1.25rem !important; padding: 0 !important;
    cursor: default !important;
}
.menu-badge {
    margin-left: auto; background: #e74c3c; color: white;
    font-size: 0.7rem; font-weight: 700; padding: 2px 7px;
    border-radius: 10px; min-width: 20px; text-align: center;
}

/* ========== MAIN CONTENT ========== */
.main-content {
    flex: 1; margin-left: 260px; display: flex; flex-direction: column;
    min-height: 100vh;
}
.top-bar {
    background: white; padding: 1rem 1.5rem; display: flex;
    align-items: center; gap: 1rem; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    position: sticky; top: 0; z-index: 50;
}
.top-bar h2 { font-size: 1.25rem; font-weight: 700; }
.top-bar-right { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.mobile-toggle { display: none; font-size: 1.3rem; color: #333; }

.notification-bell {
    position: relative; cursor: pointer; font-size: 1.2rem; color: #666;
    padding: 8px; border-radius: 10px; transition: background 0.2s;
}
.notification-bell:hover { background: #f0f2f5; }
.notif-badge {
    position: absolute; top: 2px; right: 2px; background: #e74c3c;
    color: white; font-size: 0.65rem; font-weight: 700;
    width: 18px; height: 18px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

.content-area { padding: 1.5rem; flex: 1; }

/* ========== CARDS & STATS ========== */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
    background: white; border-radius: 14px; padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex; align-items: flex-start; gap: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; flex-shrink: 0;
}
.stat-icon.green { background: #e8f5e9; color: #1a5632; }
.stat-icon.blue { background: #e3f2fd; color: #1565c0; }
.stat-icon.orange { background: #fff3e0; color: #e65100; }
.stat-icon.red { background: #fce4ec; color: #c62828; }
.stat-icon.purple { background: #f3e5f5; color: #6a1b9a; }
.stat-info { flex: 1; }
.stat-label { font-size: 0.8rem; color: #888; font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: #1a1a2e; }
.stat-sub { font-size: 0.75rem; color: #999; margin-top: 2px; }

.card {
    background: white; border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-bottom: 1.5rem;
}
.card-header {
    padding: 1.25rem 1.5rem; border-bottom: 1px solid #f0f0f0;
    display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 1.05rem; font-weight: 700; }
.card-body { padding: 1.5rem; }

/* ========== TABLE ========== */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left; padding: 12px 14px; font-size: 0.8rem;
    font-weight: 600; color: #888; text-transform: uppercase;
    letter-spacing: 0.5px; border-bottom: 2px solid #f0f0f0;
    white-space: nowrap;
}
td {
    padding: 12px 14px; border-bottom: 1px solid #f5f5f5;
    font-size: 0.9rem; vertical-align: middle;
}
tr:hover td { background: #fafbfc; }

/* ========== BADGES ========== */
.badge {
    display: inline-flex; align-items: center; padding: 4px 10px;
    border-radius: 6px; font-size: 0.75rem; font-weight: 600;
    white-space: nowrap;
}
.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-warning { background: #fff3e0; color: #e65100; }
.badge-danger { background: #fce4ec; color: #c62828; }
.badge-info { background: #e3f2fd; color: #1565c0; }
.badge-secondary { background: #f0f0f0; color: #666; }
.badge-purple { background: #f3e5f5; color: #6a1b9a; }

/* ========== FORMS ========== */
.form-section { max-width: 700px; }
.form-section .form-group { margin-bottom: 1.25rem; }
.form-section label { display: block; font-weight: 600; margin-bottom: 0.4rem; font-size: 0.9rem; }
.form-section input,
.form-section select,
.form-section textarea {
    width: 100%; padding: 10px 14px; border: 2px solid #e0e0e0;
    border-radius: 10px; transition: border-color 0.3s; font-size: 0.95rem;
}
.form-section input:focus,
.form-section select:focus,
.form-section textarea:focus {
    outline: none; border-color: #1a5632;
    box-shadow: 0 0 0 3px rgba(26,86,50,0.1);
}
.form-section textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 0.8rem; color: #999; margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.file-upload {
    border: 2px dashed #d0d0d0; border-radius: 10px; padding: 1.25rem;
    text-align: center; cursor: pointer; transition: all 0.3s;
    background: #fafafa;
}
.file-upload:hover { border-color: #1a5632; background: #f0fff5; }
.file-upload i { font-size: 1.5rem; color: #999; margin-bottom: 0.5rem; }
.file-upload p { font-size: 0.85rem; color: #777; }
.file-upload .file-name { font-size: 0.85rem; color: #1a5632; font-weight: 600; margin-top: 0.5rem; }
.file-upload input[type="file"] { display: none; }

/* ========== DETAIL VIEW ========== */
.detail-header {
    display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem;
}
.detail-header .back-btn {
    width: 40px; height: 40px; border-radius: 10px; background: white;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08); font-size: 1rem; color: #333;
    transition: all 0.2s;
}
.detail-header .back-btn:hover { background: #f0f2f5; }
.info-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}
.info-item { padding: 1rem; background: #f8f9fa; border-radius: 10px; }
.info-item .info-label { font-size: 0.75rem; color: #888; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.info-item .info-value { font-size: 1rem; font-weight: 600; margin-top: 4px; }

/* ========== TIMELINE ========== */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
    content: ''; position: absolute; left: 8px; top: 0; bottom: 0;
    width: 2px; background: #e0e0e0;
}
.timeline-item { position: relative; margin-bottom: 1.25rem; }
.timeline-item::before {
    content: ''; position: absolute; left: -24px; top: 6px;
    width: 12px; height: 12px; border-radius: 50%;
    background: #1a5632; border: 2px solid white;
    box-shadow: 0 0 0 2px #1a5632;
}
.timeline-item.pending::before { background: #f39c12; box-shadow: 0 0 0 2px #f39c12; }
.timeline-date { font-size: 0.75rem; color: #999; font-weight: 500; }
.timeline-text { font-size: 0.9rem; margin-top: 2px; }

/* ========== PROGRESS BAR ========== */
.progress-bar {
    width: 100%; height: 8px; background: #e9ecef; border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%; border-radius: 4px; transition: width 0.5s;
    background: linear-gradient(90deg, #1a5632, #27ae60);
}
.progress-fill.warning { background: linear-gradient(90deg, #f39c12, #e67e22); }
.progress-fill.danger { background: linear-gradient(90deg, #e74c3c, #c0392b); }

/* ========== MODAL ========== */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 1000; align-items: center; justify-content: center; padding: 1rem;
    backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; }
.modal-content {
    background: white; border-radius: 16px; width: 100%; max-width: 550px;
    max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-header {
    padding: 1.25rem 1.5rem; border-bottom: 1px solid #f0f0f0;
    display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close { font-size: 1.5rem; color: #999; padding: 0 4px; }
.modal-close:hover { color: #333; }
.modal-body { padding: 1.5rem; }
.modal-body .form-group { margin-bottom: 1rem; }
.modal-body label { display: block; font-weight: 600; margin-bottom: 0.4rem; font-size: 0.9rem; }
.modal-body input, .modal-body select, .modal-body textarea {
    width: 100%; padding: 10px 14px; border: 2px solid #e0e0e0;
    border-radius: 10px; font-size: 0.95rem;
}
.modal-body input:focus, .modal-body select:focus {
    outline: none; border-color: #1a5632;
}

/* ========== TOAST ========== */
#toast-container {
    position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 2000;
    display: flex; flex-direction: column; gap: 0.5rem;
}
.toast {
    padding: 14px 20px; border-radius: 12px; color: white;
    font-weight: 500; font-size: 0.9rem; min-width: 280px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease;
    display: flex; align-items: center; gap: 10px;
}
.toast.success { background: #27ae60; }
.toast.error { background: #e74c3c; }
.toast.info { background: #2980b9; }
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center; padding: 3rem 1rem; color: #999;
}
.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.3; }
.empty-state p { font-size: 1rem; }

/* ========== ACTION BUTTONS ROW ========== */
.action-row {
    display: flex; gap: 0.5rem; flex-wrap: wrap;
}

/* ========== SEARCH ========== */
.search-bar {
    display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem;
}
.search-bar input {
    flex: 1; padding: 10px 14px 10px 38px; border: 2px solid #e0e0e0;
    border-radius: 10px; font-size: 0.95rem;
}
.search-bar input:focus { outline: none; border-color: #1a5632; }
.search-wrapper { position: relative; flex: 1; }
.search-wrapper i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #999; }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .login-container { flex-direction: column; }
    .login-left { padding: 2rem; min-height: auto; }
    .login-brand h1 { font-size: 2rem; }
    .logo-icon { width: 70px; height: 70px; font-size: 2rem; }
    .login-right { padding: 2rem; }

    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: block; }
    .mobile-toggle { display: block; }
    .main-content { margin-left: 0; }

    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr; }
    html { font-size: 13px; }
}
