* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f4f5f7;
    color: #1a1a1a;
}

#app-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 12px 20px;
    background: #1e293b;
    color: #fff;
}
#app-header .brand { font-weight: bold; }
#app-header #app-nav { display: flex; gap: 16px; flex: 1; }
#app-header .nav-link { color: #cbd5e1; text-decoration: none; padding: 4px 8px; border-radius: 4px; }
#app-header .nav-link.active, #app-header .nav-link:hover { background: #334155; color: #fff; }
#app-header .user-box { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #cbd5e1; }
#app-header button { cursor: pointer; border: none; border-radius: 4px; padding: 6px 12px; background: #475569; color: #fff; }
#app-header button:hover { background: #64748b; }

#app-content { padding: 20px; max-width: 1100px; margin: 0 auto; }
/* GĐ23 — version frontend, chỉ hỗ trợ debug, không nổi bật */
#app-footer { padding: 8px 20px; font-size: 11px; color: #94a3b8; text-align: right; }
#login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; }

.card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); margin-bottom: 16px; }
.card h2 { margin-top: 0; font-size: 18px; }
.card h3 { font-size: 15px; color: #475569; }

.page-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.page-toolbar h1 { font-size: 20px; margin: 0; }

table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th, table.data-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #e2e8f0; }
table.data-table th { background: #f1f5f9; font-weight: 600; }
table.data-table tr:hover td { background: #f8fafc; cursor: pointer; }

.form-row { margin-bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
.form-row label { font-size: 13px; font-weight: 600; color: #334155; }
.form-row input, .form-row select, .form-row textarea {
    padding: 8px; border: 1px solid #cbd5e1; border-radius: 4px; font-size: 14px;
}
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

button.btn { cursor: pointer; border: none; border-radius: 4px; padding: 8px 16px; font-size: 14px; background: #e2e8f0; }
button.btn.primary { background: #2563eb; color: #fff; }
button.btn.primary:hover { background: #1d4ed8; }
button.btn.danger { background: #dc2626; color: #fff; }
button.btn.danger:hover { background: #b91c1c; }
button.btn:hover { background: #cbd5e1; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.badge.draft { background: #e2e8f0; color: #334155; }
.badge.pending_approval { background: #fef3c7; color: #92400e; }
.badge.approved, .badge.active, .badge.available { background: #dcfce7; color: #166534; }
.badge.rejected { background: #fee2e2; color: #991b1b; }

.login-box { width: 340px; }
.login-box h1 { font-size: 22px; margin-bottom: 4px; }
.login-box p { color: #64748b; font-size: 13px; margin-top: 0; }

.item-row { display: flex; gap: 8px; margin-bottom: 8px; }
.item-row input { flex: 1; }

.file-list { list-style: none; padding: 0; margin: 8px 0; font-size: 13px; }
.file-list li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #eee; }

/* GĐ17 — panel lọc gọn, có thể ẩn/hiện (xem plan/todo/17_gon_filter.md) */
.filter-panel { margin-bottom: 16px; }
.filter-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; padding: 8px 4px; user-select: none; font-size: 14px; font-weight: 600; color: #334155;
}
.filter-toolbar:hover { color: #1d4ed8; }
.filter-toggle-icon { font-size: 12px; color: #64748b; }
.filter-body { padding-top: 4px; }
.filter-fields { display: flex; flex-wrap: wrap; gap: 12px 16px; }
.filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.filter-field label { font-size: 12px; font-weight: 600; color: #334155; }
.filter-field input, .filter-field select {
    padding: 8px; border: 1px solid #cbd5e1; border-radius: 4px; font-size: 14px;
}
.filter-actions { display: flex; gap: 8px; margin-top: 12px; }

/* GĐ20 — sub-tab cho trang Quản trị (xem plan/todo/20_admin_subtab.md) */
.tab-bar { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 2px solid #e2e8f0; flex-wrap: wrap; }
.tab-button {
    padding: 10px 18px; border: none; background: none; cursor: pointer;
    font-size: 14px; font-weight: 600; color: #64748b;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab-button:hover { color: #1d4ed8; }
.tab-button.active { color: #2563eb; border-bottom-color: #2563eb; }

/* GĐ16 — autocomplete (đối tác/phòng ban/chi nhánh/nhân viên) */
.autocomplete-wrap { position: relative; }
.autocomplete-wrap .autocomplete-input { width: 100%; }
.autocomplete-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 20;
    background: #fff; border: 1px solid #cbd5e1; border-top: none;
    border-radius: 0 0 4px 4px; max-height: 220px; overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.autocomplete-item { padding: 8px 10px; font-size: 13px; cursor: pointer; }
.autocomplete-item:hover { background: #f1f5f9; }

/* toplayer (modal) — CSS gợi ý từ doc/top_layer.md */
.toplayer { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,0.45); z-index: 1000; }
.toplayer.active { display: flex; }
.toplayer .container { min-width: 360px; max-width: 640px; width: 90%; max-height: 85vh; overflow-y: auto; background: #fff; color: #1a1a1a; border-radius: 8px; }
.toplayer .head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid #e2e8f0; }
.toplayer .title { font-weight: bold; font-size: 16px; }
.toplayer .btn-close { cursor: pointer; font-size: 18px; background: none; border: none; }
.toplayer .content { padding: 18px; }
.toplayer .foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid #e2e8f0; }

/* toast — CSS gợi ý từ doc/toast.md */
.toast-item { position: fixed; right: 24px; bottom: 24px; padding: 12px 16px; border-radius: 6px; background: #334155; color: #fff; margin-top: 8px; font-size: 14px; max-width: 320px; }
.toast-item.success { background: #16a34a; }
.toast-item.error { background: #dc2626; }
.toast-item.warning { background: #d97706; }
.toast-item.info { background: #2563eb; }
