/* Bổ sung cho Tailwind và theme Fluent của DevExpress. */
html, body { height: 100%; font-family: "Segoe UI", system-ui, -apple-system, sans-serif; }

#print-heading { display: none; }

/* Điện thoại: lề hẹp hơn để nội dung rộng ra */
@media (max-width: 640px) {
    main .px-6 { padding-left: 12px !important; padding-right: 12px !important; }
    main .mx-6 { margin-left: 12px !important; margin-right: 12px !important; }
    main .p-6 { padding: 12px !important; }
    .screen-toolbar { padding: 4px 6px; }
}

/* Thanh bên (nền sáng): chức năng trong phân hệ */
.sidebar-link { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0 8px; padding-top: 5px; padding-bottom: 5px; padding-right: 10px; border-radius: 6px; font-size: 13px; color: #475569 !important; text-decoration: none !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-link:hover { background: #f1f5f9; color: #0f172a !important; }
.sidebar-link.is-active { background: #eff6ff; color: #1d4ed8 !important; font-weight: 600; box-shadow: inset 3px 0 0 #2563eb; }

/* Trang phân hệ: danh sách chức năng có biểu tượng */
.module-link { display: flex; align-items: center; gap: 8px; padding: 4px 6px; margin: 0 -6px; border-radius: 6px; font-size: 14px; color: #334155 !important; text-decoration: none !important; }
.module-link:hover { background: #f1f5f9; color: #1d4ed8 !important; }

/* Khung màn hình: lưới, thanh công cụ, bộ lọc (danh mục, chứng từ, báo cáo) */
.screen-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; box-shadow: 0 1px 2px rgba(15,23,42,.04); overflow: hidden; }
.screen-card .dxbl-grid { border: 0 !important; border-radius: 0 !important; }
.screen-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px 10px; border-bottom: 1px solid #e2e8f0; background: #fcfcfd; }
.screen-toolbar .dxbl-btn { font-weight: 500; }
.screen-toolbar-sep { width: 1px; height: 18px; margin: 0 6px; background: #e2e8f0; }
.screen-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 12px 14px; border-bottom: 1px solid #e2e8f0; }
.screen-card.screen-filter { border-bottom: 1px solid #e2e8f0; }
.screen-filter > div > label, .screen-filter-field > span { display: block; margin-bottom: 3px; font-size: 12px; color: #64748b; }

/* Nút "Hướng dẫn" và khung hướng dẫn ở đầu trang */
.page-help-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 6px; border: 1px solid #cbd5e1; background: #fff; color: #334155; font-size: 13px; font-weight: 500; }
.page-help-btn:hover, .page-help-btn.is-open { border-color: #93c5fd; background: #eff6ff; color: #1d4ed8; }
.page-help-icon { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 999px; background: currentColor; font-size: 11px; font-weight: 700; }
.page-help-icon { color: #fff; background: #64748b; }
.page-help-btn:hover .page-help-icon, .page-help-btn.is-open .page-help-icon { background: #2563eb; }
.page-help-panel { margin-top: 12px; max-width: 64rem; border-radius: 10px; border: 1px solid #bfdbfe; background: #f5f9ff; padding: 14px 16px; }
.page-help-steps { margin: 8px 0 0 !important; padding-left: 20px !important; list-style: decimal; display: grid; gap: 4px; font-size: 14px; line-height: 1.55; color: #334155; }
.page-help-steps b { color: #0f172a; font-weight: 600; }

/* Form sửa: nhóm có tiêu đề, nhãn bên trái */
.edit-popup .dxbl-modal-body { background: #f8fafc; }
.form-section { border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; padding: 10px 14px 12px; margin: 0; min-width: 0; }
.form-section-title { padding: 0; margin: 0 0 8px; float: none; width: auto; font-size: 13px; font-weight: 600; color: #0f172a; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 8px 20px; }
.form-row { display: grid; grid-template-columns: 128px minmax(0, 1fr); align-items: center; gap: 10px; min-width: 0; }
.form-wide { grid-column: 1 / -1; }
.form-label { margin: 0; font-size: 13px; color: #475569; line-height: 1.25; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; gap: 3px; } }

/* Màn hình đăng nhập */
.login-hero { background: radial-gradient(120% 90% at 0% 0%, #2563eb 0%, #1e3a8a 55%, #172554 100%); }
.login-hero::before {
    content: ""; position: absolute; inset: 0; opacity: .14; pointer-events: none;
    background-image: linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.5) 1px, transparent 1px);
    background-size: 44px 44px; mask-image: radial-gradient(80% 70% at 30% 40%, #000 0%, transparent 100%);
}
.login-tick { flex: none; display: grid; place-items: center; width: 22px; height: 22px; margin-top: 1px; border-radius: 999px; background: rgba(255,255,255,.16); font-size: 12px; }
.login-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: #334155; }
.login-input {
    width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid #cbd5e1; background: #fff;
    font-size: 15px; color: #0f172a; outline: none; transition: border-color .15s, box-shadow .15s;
}
.login-input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.18); }
.login-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); padding: 4px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; color: #475569; }
.login-eye:hover { background: #f1f5f9; color: #0f172a; }
.login-button {
    width: 100%; height: 44px; border-radius: 10px; background: #2563eb; color: #fff; font-size: 15px; font-weight: 600;
    transition: background .15s, box-shadow .15s;
}
.login-button:hover:not(:disabled) { background: #1d4ed8; box-shadow: 0 6px 16px -6px rgba(37,99,235,.6); }
.login-button:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,.35); }
.login-button:disabled { opacity: .7; cursor: progress; }
.login-error { border-radius: 10px; background: #fff1f2; border: 1px solid #fecdd3; color: #be123c; padding: 10px 12px; font-size: 13px; line-height: 1.45; }

#print-footer { display: none; }

/* In báo cáo, sổ sách: biểu mẫu dùng Times New Roman (cả lưới số liệu), tiêu đề đơn vị / mẫu số, chữ ký cuối trang. */
@media print {
    aside, header, .no-print, .dxbl-grid-pager, .dxbl-grid-filter-row, button, .screen-filter, .screen-toolbar, .page-help-panel { display: none !important; }
    main { overflow: visible !important; }
    .h-screen, .h-dvh { height: auto !important; }
    html, body, main, main *, .dxbl-grid, .dxbl-grid * { font-family: "Times New Roman", Times, serif !important; color: #000 !important; }
    .dxbl-grid { font-size: 11pt !important; }
    .dxbl-grid th, .dxbl-grid td { border: 1px solid #000 !important; padding: 2px 4px !important; background: #fff !important; }
    .dxbl-grid-header-content, .dxbl-grid th { font-weight: 700 !important; white-space: normal !important; text-align: center !important; }
    .dxbl-grid .dxbl-grid-empty-cell { display: none !important; }
    .dxbl-grid table { width: 100% !important; }
    .dxbl-grid tr { break-inside: avoid; page-break-inside: avoid; }
    .dxbl-grid thead { display: table-header-group; }
    .screen-card { border: 0 !important; box-shadow: none !important; }
    main .px-6 { padding-left: 0 !important; padding-right: 0 !important; }
    #print-heading { display: block; margin-bottom: 10pt; }
    #print-heading .ph-top { display: flex; justify-content: space-between; gap: 16pt; }
    #print-heading .ph-left { flex: 3; font-size: 11pt; }
    #print-heading .ph-company { font-size: 12pt; font-weight: 700; }
    #print-heading .ph-right { flex: 2; text-align: center; }
    #print-heading .ph-form { font-size: 12pt; font-weight: 700; }
    #print-heading .ph-circular { font-size: 10pt; font-style: italic; }
    #print-heading .ph-title { font-size: 16pt; font-weight: 700; margin-top: 12pt; text-align: center; }
    #print-heading .ph-period { font-size: 12pt; font-style: italic; text-align: center; }
    #print-footer { display: block; margin-top: 14pt; break-inside: avoid; page-break-inside: avoid; }
    #print-footer .pf-date { text-align: right; font-style: italic; font-size: 11pt; padding-right: 4%; }
    #print-footer .pf-row { display: flex; }
    #print-footer .pf-col { flex: 1; text-align: center; }
    #print-footer .pf-role { font-weight: 700; font-size: 12pt; }
    #print-footer .pf-note { font-style: italic; font-size: 10pt; }
    #print-footer .pf-name { font-weight: 700; font-size: 12pt; margin-top: 60pt; }
    .print-area { padding: 0 !important; gap: 0 !important; display: block !important; }
    .print-page { overflow: visible !important; }
    .print-sheet { box-shadow: none !important; margin: 0 !important; page: sheet; break-after: page; }
    .print-sheet.half { break-after: auto; }
    .print-sheet.land { page: land; }
    .print-sheet table { break-inside: auto; }
    .print-sheet tr { break-inside: avoid; }
    @page { margin: 8mm; }
    @page sheet { size: A4 portrait; margin: 0; }
    @page land { size: A4 landscape; margin: 0; }
}

/* Tờ mẫu in chứng từ (HTML chuyển từ mẫu in của bản WPF): trang giấy trắng trên nền xám. */
.print-sheet { box-sizing: border-box; background: #fff; color: #000; line-height: 1.2; box-shadow: 0 1px 3px rgba(15,23,42,.12), 0 0 0 1px #e2e8f0; margin: 0 auto; }
.print-sheet p { margin: 0; }
/* Giữ xuống dòng và khoảng trắng liền nhau trong chữ của mẫu in như FlowDocument của WPF (chức danh ký hai dòng, “Kế toán      Chủ tài khoản”). */
.print-sheet span { white-space: pre-wrap; }
.print-sheet table { border-spacing: 0; }
.print-sheet td { word-wrap: break-word; }
.print-sheet td > p:last-child { margin-bottom: 0 !important; }
.print-sheet.half { min-height: 0 !important; }