/* ============================================================
   CRM Bình Minh — Global Stylesheet
   Màu sắc thương hiệu: Navy #1B3A6B, Cobalt #2C5FB3
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
    --navy:        #1B3A6B;
    --cobalt:      #2C5FB3;
    --cobalt-dark: #1E4A99;
    --bg:          #F0F4FA;
    --white:       #FFFFFF;
    --text:        #1A1A2E;
    --text-muted:  #6B7A99;
    --success:     #27AE60;
    --warning:     #F39C12;
    --danger:      #E74C3C;
    --info:        #2980B9;
    --secondary:   #95A5A6;
    --border:      #CBD5E0;
    --card-shadow: 0 2px 12px rgba(27,58,107,0.08);
    --sidebar-w:   240px;
    --topbar-h:    56px;
    --radius:      10px;
    --radius-sm:   6px;
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--cobalt);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover { color: var(--cobalt-dark); }

img { max-width: 100%; }

input, select, textarea, button {
    font-family: inherit;
    font-size: inherit;
}

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

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--navy);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s ease;
}

/* Brand / Logo */
.sidebar-brand {
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.10);
    flex-shrink: 0;
}

.brand-link {
    display: block;
    color: var(--white);
    text-decoration: none;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    font-size: 28px;
    color: #FFD700;
    filter: drop-shadow(0 0 6px rgba(255,215,0,0.5));
    flex-shrink: 0;
    line-height: 1;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--white);
    letter-spacing: 0.3px;
}

.brand-tagline {
    font-size: 11px;
    font-style: italic;
    color: #93B4E0;
    margin-top: 1px;
    line-height: 1.3;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 4px;
}

.nav-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.40);
    padding: 12px 16px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: rgba(255,255,255,0.80);
    font-size: 14px;
    font-weight: 400;
    border-radius: 0;
    transition: background 0.18s, color 0.18s;
    text-decoration: none;
    position: relative;
}

.nav-item i {
    font-size: 17px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.nav-item:hover {
    background: rgba(255,255,255,0.10);
    color: var(--white);
}

.nav-item.active {
    background: var(--cobalt);
    color: var(--white);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #FFD700;
    border-radius: 0 2px 2px 0;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.10);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--cobalt);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: rgba(255,255,255,0.50);
}

.btn-logout {
    color: rgba(255,255,255,0.60);
    font-size: 18px;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s;
    flex-shrink: 0;
}
.btn-logout:hover { color: var(--danger); }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-w);
    right: 0;
    height: var(--topbar-h);
    background: var(--white);
    border-bottom: 1px solid #E2E8F0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    z-index: 90;
    box-shadow: 0 1px 4px rgba(27,58,107,0.06);
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    line-height: 1;
    display: none; /* Hiện lên trên mobile */
}
.sidebar-toggle:hover { color: var(--cobalt); }

.topbar-title {
    flex: 1;
}

.page-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-date {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-muted);
    font-size: 13px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--navy);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.topbar-user-info {
    display: flex;
    flex-direction: column;
}

.topbar-username {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.topbar-role {
    font-size: 11px;
    color: var(--text-muted);
}

.topbar-logout {
    color: var(--text-muted);
    font-size: 20px;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s;
}
.topbar-logout:hover { color: var(--danger); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    margin-left: var(--sidebar-w);
    margin-top: var(--topbar-h);
    padding: 24px;
    min-height: calc(100vh - var(--topbar-h));
    flex: 1;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(203,213,224,0.5);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #EEF2F9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i { color: var(--cobalt); }

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 14px 20px;
    border-top: 1px solid #EEF2F9;
    background: #FAFBFE;
}

/* Stat Cards cho Dashboard */
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-left: 4px solid var(--cobalt);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(27,58,107,0.13);
}

.stat-card.stat-success { border-left-color: var(--success); }
.stat-card.stat-warning { border-left-color: var(--warning); }
.stat-card.stat-danger  { border-left-color: var(--danger); }
.stat-card.stat-info    { border-left-color: var(--info); }

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: rgba(44,95,179,0.10);
    color: var(--cobalt);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-card.stat-success .stat-icon { background: rgba(39,174,96,0.10); color: var(--success); }
.stat-card.stat-warning .stat-icon { background: rgba(243,156,18,0.10); color: var(--warning); }
.stat-card.stat-danger  .stat-icon { background: rgba(231,76,60,0.10);  color: var(--danger); }
.stat-card.stat-info    .stat-icon { background: rgba(41,128,185,0.10); color: var(--info); }

.stat-content {}
.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}
.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}

.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

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

.btn-success {
    background: var(--success);
    color: var(--white);
    border-color: var(--success);
}
.btn-success:hover:not(:disabled) {
    background: #219150;
    border-color: #219150;
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
    border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
    background: #C0392B;
    border-color: #C0392B;
    color: var(--white);
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
    border-color: var(--warning);
}
.btn-warning:hover:not(:disabled) {
    background: #D68910;
    border-color: #D68910;
    color: var(--white);
}

.btn-secondary {
    background: #F8FAFC;
    color: var(--text);
    border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
    background: #EEF2F9;
    border-color: #B8C4D8;
}

.btn-outline {
    background: transparent;
    color: var(--cobalt);
    border-color: var(--cobalt);
}
.btn-outline:hover:not(:disabled) {
    background: var(--cobalt);
    color: var(--white);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-icon {
    padding: 7px 8px;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-weight: 500;
    font-size: 13px;
    color: var(--text);
    margin-bottom: 5px;
}

.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-control {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--text);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.18s, box-shadow 0.18s;
    outline: none;
    line-height: 1.5;
}

.form-control:focus {
    border-color: var(--cobalt);
    box-shadow: 0 0 0 3px rgba(44,95,179,0.12);
}

.form-control:disabled, .form-control[readonly] {
    background: #F5F8FF;
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-control.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(231,76,60,0.12);
}

.invalid-feedback {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.is-invalid + .invalid-feedback,
.form-control.is-invalid ~ .invalid-feedback {
    display: block;
}

select.form-control {
    cursor: pointer;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%236B7A99' d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    gap: 16px;
}

.form-row.cols-2  { grid-template-columns: repeat(2, 1fr); }
.form-row.cols-3  { grid-template-columns: repeat(3, 1fr); }
.form-row.cols-4  { grid-template-columns: repeat(4, 1fr); }
.form-row.cols-12 { grid-template-columns: 1fr 2fr; }
.form-row.cols-21 { grid-template-columns: 2fr 1fr; }

.form-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--cobalt);
}

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table th {
    background: #EEF2F9;
    color: var(--text);
    font-weight: 600;
    padding: 10px 12px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 2px solid #D1DCF0;
    position: sticky;
    top: 0;
    z-index: 1;
}

.table td {
    padding: 9px 12px;
    border-bottom: 1px solid #EEF2F9;
    vertical-align: middle;
    color: var(--text);
}

.table tbody tr:hover {
    background: #F5F8FF;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Column filter row */
.table .filter-row th {
    padding: 6px 8px;
    background: #F5F8FF;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 38px;
}

.table .filter-row input,
.table .filter-row select {
    width: 100%;
    padding: 4px 6px;
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    outline: none;
    background: var(--white);
    color: var(--text);
}

.table .filter-row input:focus,
.table .filter-row select:focus {
    border-color: var(--cobalt);
}

/* Cột action luôn sticky bên phải */
.table th.col-action,
.table td.col-action {
    text-align: center;
    white-space: nowrap;
    width: 100px;
}

/* Số thứ tự */
.table th.col-stt,
.table td.col-stt {
    text-align: center;
    width: 45px;
    color: var(--text-muted);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.badge-success  { background: rgba(39,174,96,0.12);  color: #1A7A40; }
.badge-warning  { background: rgba(243,156,18,0.15); color: #A06000; }
.badge-danger   { background: rgba(231,76,60,0.12);  color: #A52030; }
.badge-info     { background: rgba(41,128,185,0.12); color: #1A5C90; }
.badge-primary  { background: rgba(44,95,179,0.12);  color: var(--cobalt-dark); }
.badge-secondary{ background: rgba(149,165,166,0.15);color: #5A6A6B; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 20, 50, 0.50);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-box {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.25s ease;
}

.modal-box.modal-sm { max-width: 440px; }
.modal-box.modal-lg { max-width: 900px; }
.modal-box.modal-xl { max-width: 1100px; }

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #EEF2F9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.2s;
}
.modal-close:hover { color: var(--danger); }

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid #EEF2F9;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
    background: #FAFBFE;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 8px;
    background: var(--white);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 280px;
    max-width: 420px;
    font-size: 14px;
    font-weight: 500;
    pointer-events: all;
    animation: toastIn 0.3s ease;
    border-left: 4px solid var(--cobalt);
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error   { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-info    { border-left-color: var(--info); }

.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast.toast-success .toast-icon { color: var(--success); }
.toast.toast-error   .toast-icon { color: var(--danger); }
.toast.toast-warning .toast-icon { color: var(--warning); }
.toast.toast-info    .toast-icon { color: var(--info); }

.toast-message { flex: 1; color: var(--text); }
.toast-close {
    background: none;
    border: none;
    font-size: 16px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
    pointer-events: all;
}
.toast-close:hover { color: var(--text); }

.toast.toast-hiding { animation: toastOut 0.25s ease forwards; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.pagination .page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}

.pagination .page-btn:hover { background: #EEF2F9; }
.pagination .page-btn.active { background: var(--cobalt); color: var(--white); border-color: var(--cobalt); font-weight: 600; }
.pagination .page-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ============================================================
   CHECKLIST (Tiến độ)
   ============================================================ */
.checklist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    background: #F5F8FF;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-size: 12px;
    font-weight: 500;
}

.checklist-item.checked {
    background: rgba(39,174,96,0.10);
    border-color: rgba(39,174,96,0.30);
    color: #1A7A40;
}

.checklist-item input[type="checkbox"] {
    accent-color: var(--success);
    width: 14px;
    height: 14px;
}

/* Progress bar */
.progress-bar-wrap {
    background: #EEF2F9;
    border-radius: 20px;
    height: 8px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 20px;
    background: linear-gradient(90deg, var(--cobalt), var(--success));
    transition: width 0.4s ease;
}

/* ============================================================
   TOOLBAR (trên bảng)
   ============================================================ */
.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.toolbar-left { display: flex; align-items: center; gap: 8px; flex: 1; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }

.search-input {
    width: 260px;
    padding: 8px 12px 8px 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16' fill='%236B7A99'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.099zm-5.242 1.656a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 10px center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--cobalt); }

/* ============================================================
   TABS
   ============================================================ */
.tabs {
    display: flex;
    border-bottom: 2px solid #EEF2F9;
    gap: 0;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tab-btn:hover { color: var(--cobalt); }
.tab-btn.active { color: var(--cobalt); border-bottom-color: var(--cobalt); font-weight: 600; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
   FILE UPLOAD
   ============================================================ */
.file-drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.file-drop-zone:hover,
.file-drop-zone.drag-over {
    border-color: var(--cobalt);
    background: rgba(44,95,179,0.03);
}

.file-drop-zone i { font-size: 32px; color: var(--cobalt); margin-bottom: 8px; display: block; }

.file-list { margin-top: 12px; }

.file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    background: #F5F8FF;
    border: 1px solid var(--border);
    margin-bottom: 6px;
    font-size: 13px;
}

.file-item i { color: var(--cobalt); }
.file-item .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .file-size { color: var(--text-muted); font-size: 12px; }
.file-item .file-del { color: var(--danger); background: none; border: none; cursor: pointer; font-size: 16px; }

/* ============================================================
   UTILITIES
   ============================================================ */
.text-center   { text-align: center; }
.text-right    { text-align: right; }
.text-muted    { color: var(--text-muted); }
.text-success  { color: var(--success); }
.text-warning  { color: var(--warning); }
.text-danger   { color: var(--danger); }
.text-primary  { color: var(--cobalt); }
.fw-bold       { font-weight: 700; }
.fw-semibold   { font-weight: 600; }
.d-flex        { display: flex; }
.align-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8         { gap: 8px; }
.gap-12        { gap: 12px; }
.gap-16        { gap: 16px; }
.mt-4          { margin-top: 4px; }
.mt-8          { margin-top: 8px; }
.mt-12         { margin-top: 12px; }
.mt-16         { margin-top: 16px; }
.mt-20         { margin-top: 20px; }
.mt-24         { margin-top: 24px; }
.mb-4          { margin-bottom: 4px; }
.mb-8          { margin-bottom: 8px; }
.mb-12         { margin-bottom: 12px; }
.mb-16         { margin-bottom: 16px; }
.mb-20         { margin-bottom: 20px; }
.p-20          { padding: 20px; }
.w-100         { width: 100%; }
.grid-2        { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3        { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4        { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state i { font-size: 48px; display: block; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 15px; }
.divider {
    height: 1px;
    background: #EEF2F9;
    margin: 16px 0;
}
.section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #EEF2F9;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

@keyframes toastOut {
    from { transform: translateX(0);    opacity: 1; }
    to   { transform: translateX(110%); opacity: 0; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   RESPONSIVE — Mobile (max 768px)
   ============================================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        padding: 16px;
    }
    .topbar {
        left: 0;
    }
    .sidebar-toggle {
        display: flex;
    }
    .topbar-date { display: none; }
    .form-row.cols-3,
    .form-row.cols-4 {
        grid-template-columns: 1fr 1fr;
    }
    .form-row.cols-2 {
        grid-template-columns: 1fr;
    }
    .grid-4, .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid-2 {
        grid-template-columns: 1fr;
    }
    .search-input { width: 100%; }
    .topbar-username, .topbar-role { display: none; }
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--navy) 0%, #0F2550 60%, #0A1A38 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.30);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--navy), var(--cobalt));
    padding: 36px 40px 28px;
    text-align: center;
    color: var(--white);
}

.login-logo {
    font-size: 48px;
    margin-bottom: 8px;
    filter: drop-shadow(0 0 8px rgba(255,215,0,0.5));
}

.login-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 13px;
    opacity: 0.75;
    font-style: italic;
}

.login-body {
    padding: 32px 40px 36px;
}

.login-body .form-label { font-size: 13px; font-weight: 600; }

.login-body .form-control {
    padding: 10px 14px;
    font-size: 15px;
}

.btn-login {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    margin-top: 8px;
    justify-content: center;
}

.login-error {
    background: rgba(231,76,60,0.10);
    color: var(--danger);
    border: 1px solid rgba(231,76,60,0.25);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-footer-text {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 20px;
}

/* ============================================================
   DETAIL VIEW
   ============================================================ */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
}

.detail-item {
    padding: 12px 16px;
    border-bottom: 1px solid #EEF2F9;
    border-right: 1px solid #EEF2F9;
}

.detail-item:nth-child(3n) { border-right: none; }

.detail-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

.detail-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

/* Số tiền lớn */
.money-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--cobalt);
}
