/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #f0f2f5; color: #333; line-height: 1.5; }
a { color: #2a5298; text-decoration: none; }
a:hover { color: #1e3c72; }
img { max-width: 100%; }

/* ===== LOGIN PAGE ===== */
.login-page {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #3d6cb9 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-container { width: 100%; max-width: 420px; padding: 20px; }
.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}
.login-header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    padding: 32px 24px;
    text-align: center;
    color: #fff;
}
.login-header h1 { font-size: 28px; letter-spacing: 3px; margin-top: 12px; }
.login-header p { opacity: 0.8; font-size: 13px; margin-top: 4px; }
.login-form { padding: 32px 24px; }
.login-form .form-group { margin-bottom: 20px; }
.login-form label { display: block; font-weight: 600; margin-bottom: 6px; color: #1e3c72; font-size: 13px; }
.login-form input {
    width: 100%; padding: 12px 16px; border: 2px solid #e0e6ed; border-radius: 10px;
    font-size: 14px; transition: border-color 0.3s, box-shadow 0.3s; outline: none;
}
.login-form input:focus { border-color: #2a5298; box-shadow: 0 0 0 3px rgba(42,82,152,0.1); }
.login-footer { text-align: center; color: rgba(255,255,255,0.6); font-size: 12px; margin-top: 16px; }

/* ===== LAYOUT ===== */
.app-wrapper { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
    width: 260px; min-height: 100vh; background: linear-gradient(180deg, #1a2a4a 0%, #1e3c72 100%);
    color: #fff; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; z-index: 100;
    transition: transform 0.3s ease;
}
.sidebar-header {
    padding: 20px; display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; letter-spacing: 2px; }
.sidebar-toggle { background: none; border: none; color: rgba(255,255,255,0.6); cursor: pointer; display: none; }
.sidebar-user {
    padding: 16px 20px; display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px;
}
.user-info { display: flex; flex-direction: column; }
.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 11px; opacity: 0.6; }
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 11px 20px; color: rgba(255,255,255,0.7);
    transition: all 0.2s; font-size: 13px; font-weight: 500; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.12); color: #fff; border-left-color: #5b9aff; }
.nav-item svg { flex-shrink: 0; opacity: 0.7; }
.nav-item.active svg, .nav-item:hover svg { opacity: 1; }
.sidebar-footer { padding: 12px 0; border-top: 1px solid rgba(255,255,255,0.1); }

/* ===== MAIN CONTENT ===== */
.main-content { flex: 1; margin-left: 260px; display: flex; flex-direction: column; min-height: 100vh; }
.top-bar {
    background: #fff; padding: 16px 24px; display: flex; align-items: center; gap: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08); position: sticky; top: 0; z-index: 50;
}
.mobile-toggle { display: none; background: none; border: none; cursor: pointer; color: #1e3c72; }
.breadcrumb { font-size: 16px; font-weight: 600; color: #1e3c72; }
.top-bar-right { margin-left: auto; color: #666; font-size: 13px; }
.page-content { padding: 24px; flex: 1; }

/* ===== CARDS ===== */
.card {
    background: #fff; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 20px; overflow: hidden;
}
.card-header {
    padding: 16px 20px; border-bottom: 1px solid #eee; display: flex;
    align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 15px; color: #1e3c72; font-weight: 600; }
.card-body { padding: 20px; }

/* ===== STATS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: #fff; border-radius: 12px; padding: 20px; display: flex; align-items: center; gap: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06); transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
.stat-icon {
    width: 56px; height: 56px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
}
.stat-icon.blue { background: linear-gradient(135deg, #1e3c72, #2a5298); color: #fff; }
.stat-icon.orange { background: linear-gradient(135deg, #f39c12, #e67e22); color: #fff; }
.stat-icon.green { background: linear-gradient(135deg, #27ae60, #2ecc71); color: #fff; }
.stat-icon.purple { background: linear-gradient(135deg, #8e44ad, #9b59b6); color: #fff; }
.stat-number { display: block; font-size: 28px; font-weight: 700; color: #1e3c72; line-height: 1.1; }
.stat-label { display: block; font-size: 12px; color: #888; margin-top: 2px; }

/* ===== TABLES ===== */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
    background: #f8f9fc; padding: 10px 14px; text-align: left; font-size: 12px; font-weight: 600;
    color: #1e3c72; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid #e8eef5;
    position: sticky; top: 0;
}
.table td { padding: 10px 14px; border-bottom: 1px solid #f0f0f0; font-size: 13px; vertical-align: middle; }
.table tbody tr:hover { background: #f8f9fc; }
.table tbody tr:nth-child(even) { background: #fafbfd; }
.table tbody tr:nth-child(even):hover { background: #f0f4f8; }
.table.table-compact th, .table.table-compact td { padding: 6px 8px; font-size: 12px; }
.table.table-compact input { width: 100%; padding: 5px 6px; font-size: 12px; border: 1px solid #ddd; border-radius: 6px; }
.table.table-compact input:focus { border-color: #2a5298; outline: none; box-shadow: 0 0 0 2px rgba(42,82,152,0.1); }
.totals-row td { background: #f0f4f8 !important; font-weight: 700; color: #1e3c72; font-size: 13px !important; }
.calc-field { font-weight: 600; color: #2a5298; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: none; border-radius: 8px;
    font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s; text-decoration: none; line-height: 1.4;
}
.btn-primary { background: linear-gradient(135deg, #1e3c72, #2a5298); color: #fff; }
.btn-primary:hover { background: linear-gradient(135deg, #163060, #1e3c72); color: #fff; box-shadow: 0 4px 12px rgba(30,60,114,0.3); }
.btn-success { background: #27ae60; color: #fff; }
.btn-success:hover { background: #219a52; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-outline {
    background: transparent; color: #2a5298; border: 1.5px solid #d0d8e8;
}
.btn-outline:hover { background: #f0f4f8; border-color: #2a5298; color: #2a5298; }
.btn-danger-outline { background: transparent; color: #e74c3c; border: 1.5px solid #f5c6cb; }
.btn-danger-outline:hover { background: #fdf0f0; border-color: #e74c3c; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }
.btn-group { display: flex; gap: 4px; }

/* ===== BADGES ===== */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge-blue { background: #e8f0fe; color: #1e3c72; }
.badge-orange { background: #fff3e0; color: #e67e22; }
.badge-green { background: #e8f8ef; color: #27ae60; }
.badge-red { background: #fde8e8; color: #e74c3c; }
.badge-gray { background: #f0f0f0; color: #666; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 5px; color: #1e3c72; font-size: 12px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 9px 12px; border: 1.5px solid #d0d8e8; border-radius: 8px;
    font-size: 13px; transition: border-color 0.3s, box-shadow 0.3s; outline: none;
    font-family: inherit; background: #fff;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: #2a5298; box-shadow: 0 0 0 3px rgba(42,82,152,0.1);
}
.form-group textarea { resize: vertical; min-height: 60px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 12px; }
.sticky-actions {
    position: sticky; bottom: 0; background: #fff; padding: 16px 20px; margin: 0 -24px -24px;
    border-top: 1px solid #eee; box-shadow: 0 -2px 8px rgba(0,0,0,0.06); z-index: 10;
}
.radio-group { display: flex; gap: 20px; padding: 8px 0; }
.radio-label { display: flex; align-items: center; gap: 6px; font-weight: 500; cursor: pointer; font-size: 13px; }
.radio-label input[type="radio"] { accent-color: #2a5298; }

/* ===== SEARCH & FILTERS ===== */
.page-actions { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-actions h2 { font-size: 16px; color: #1e3c72; }
.search-box {
    display: flex; align-items: center; gap: 8px; background: #fff; border: 1.5px solid #d0d8e8;
    border-radius: 8px; padding: 8px 12px; flex: 1; max-width: 400px;
}
.search-box input { border: none; outline: none; font-size: 13px; flex: 1; }
.search-box svg { color: #999; flex-shrink: 0; }
.filters-bar { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; align-items: flex-end; }
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 11px; font-weight: 600; color: #666; }
.filter-group select, .filter-group input {
    padding: 7px 10px; border: 1.5px solid #d0d8e8; border-radius: 8px; font-size: 13px; outline: none;
}
.filter-group select:focus, .filter-group input:focus { border-color: #2a5298; }

/* ===== TABS ===== */
.tabs { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 2px solid #e8eef5; }
.tab-btn {
    padding: 10px 20px; background: none; border: none; font-size: 14px; font-weight: 600;
    color: #888; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s;
}
.tab-btn:hover { color: #2a5298; }
.tab-btn.active { color: #1e3c72; border-bottom-color: #1e3c72; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== INFO GRID ===== */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.info-item label { display: block; font-size: 11px; color: #888; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.info-item span { font-size: 14px; color: #333; }

/* ===== MODAL ===== */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5);
    z-index: 1000; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: #fff; border-radius: 16px; width: 90%; max-width: 600px; max-height: 90vh;
    overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3); animation: modalIn 0.25s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
.modal-header {
    padding: 16px 20px; border-bottom: 1px solid #eee; display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 16px; color: #1e3c72; }
.modal-close {
    background: none; border: none; font-size: 24px; color: #999; cursor: pointer; line-height: 1; padding: 0 4px;
}
.modal-close:hover { color: #333; }
.modal-body { padding: 20px; }

/* ===== TOAST ===== */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 12px 20px; border-radius: 10px; color: #fff; font-size: 13px; font-weight: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15); animation: toastIn 0.3s ease; min-width: 250px;
    display: flex; align-items: center; gap: 8px;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
.toast.toast-success { background: #27ae60; }
.toast.toast-error { background: #e74c3c; }
.toast.toast-info { background: #2a5298; }

/* ===== ALERTS ===== */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.alert-danger { background: #fde8e8; color: #721c24; border: 1px solid #f5c6cb; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }

/* ===== UTILITY ===== */
.text-center { text-align: center; }
.text-muted { color: #999; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .mobile-toggle { display: block; }
    .sidebar-toggle { display: block; }
}
@media (max-width: 768px) {
    .page-content { padding: 16px; }
    .form-row { grid-template-columns: 1fr; }
    .form-row-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .info-grid { grid-template-columns: 1fr; }
    .filters-bar { flex-direction: column; }
    .page-actions { flex-direction: column; align-items: stretch; }
    .search-box { max-width: none; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .top-bar { padding: 12px 16px; }
    .breadcrumb { font-size: 14px; }
}

/* Quick Add Button */
.btn-quick-add {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #2a5298;
    background: #e8f0fe;
    border: 1px solid #c4d7f2;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    vertical-align: middle;
    margin-left: 6px;
}
.btn-quick-add:hover {
    background: #2a5298;
    color: #fff;
    border-color: #2a5298;
}
.btn-quick-add svg {
    flex-shrink: 0;
}
