.mtai-wrap { max-width: 1400px; }
.mtai-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mtai-header h1 { margin: 0; }

.mtai-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 18px 0 26px; }
.mtai-stat-card { background: #fff; border: 1px solid #e2e2e8; border-radius: 8px; padding: 16px 18px; box-shadow: 0 1px 2px rgba(0,0,0,0.03); }
.mtai-stat-card.mtai-stat-good { border-left: 4px solid #1F9D8B; }
.mtai-stat-card.mtai-stat-warn { border-left: 4px solid #d97706; }
.mtai-stat-label { display: block; font-size: 12px; color: #767b8a; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.mtai-stat-value { display: block; font-size: 22px; font-weight: 700; color: #1d2327; }

.mtai-columns { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.mtai-col { flex: 1; min-width: 320px; }

.mtai-badge { display: inline-block; padding: 3px 10px; border-radius: 100px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.mtai-badge-draft { background: #eef0f4; color: #555; }
.mtai-badge-sent { background: #e0edff; color: #1a56b0; }
.mtai-badge-pending_approval { background: #fdeecb; color: #92600a; }
.mtai-badge-partial { background: #fff2d9; color: #9a6300; }
.mtai-badge-paid { background: #dcf6ea; color: #0f7a4d; }
.mtai-badge-completed { background: #dcf6ea; color: #0f7a4d; }
.mtai-badge-overdue { background: #fde2e1; color: #b71d1d; }
.mtai-badge-cancelled { background: #f0f0f0; color: #999; text-decoration: line-through; }
.mtai-badge-pending { background: #fdeecb; color: #92600a; }
.mtai-badge-approved { background: #dcf6ea; color: #0f7a4d; }
.mtai-badge-rejected { background: #fde2e1; color: #b71d1d; }

.mtai-approval-note { background: #f5f6fb; border-left: 3px solid #5B2E90; padding: 8px 12px; font-size: 12.5px; color: #555; border-radius: 4px; margin: 10px 0; }
.mtai-pending-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 100px; background: #d63638; color: #fff; font-size: 11px; font-weight: 700; margin-left: 6px; }

.mtai-panel { background: #fff; border: 1px solid #e2e2e8; border-radius: 8px; padding: 20px 22px; margin-bottom: 20px; }
.mtai-panel h2 { margin-top: 0; }

.mtai-form-row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; position: relative; }
.mtai-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 14px; }
.mtai-form-field { display: flex; flex-direction: column; gap: 5px; }
.mtai-form-field.mtai-grow { grid-column: 1 / -1; }
.mtai-form-field label { font-weight: 600; font-size: 12.5px; color: #3c434a; }
.mtai-form-field input[type=text], .mtai-form-field input[type=email], .mtai-form-field input[type=number],
.mtai-form-field input[type=date], .mtai-form-field select, .mtai-form-field textarea {
	width: 100%; padding: 7px 9px; border: 1px solid #d0d3d9; border-radius: 5px;
}
.mtai-checkbox-row { display: flex; align-items: center; gap: 6px; font-weight: 400 !important; }

.mtai-autocomplete { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid #d0d3d9; border-top: none; z-index: 50; max-height: 260px; overflow-y: auto; box-shadow: 0 6px 14px rgba(0,0,0,0.08); border-radius: 0 0 6px 6px; }
.mtai-autocomplete-item { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid #f0f0f4; font-size: 13.5px; }
.mtai-autocomplete-item:hover { background: #f5f6fb; }
.mtai-autocomplete-empty { padding: 10px 12px; color: #888; font-size: 13px; }

.mtai-selected-client { background: #f5f6fb; border: 1px solid #dcdfea; border-radius: 6px; padding: 12px 14px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.mtai-selected-client .mtai-sc-name { font-weight: 700; }
.mtai-selected-client .mtai-sc-meta { color: #666; font-size: 12.5px; }

.mtai-client-form { background: #fbfbfd; border: 1px dashed #ccc; border-radius: 6px; padding: 16px; margin-top: 10px; }

.mtai-items-table th, .mtai-items-table td { vertical-align: middle; padding: 6px 8px; }
.mtai-items-table input, .mtai-items-table select { width: 100%; padding: 5px 6px; border: 1px solid #d0d3d9; border-radius: 4px; font-size: 12.5px; }
.mtai-items-table .mtai-item-name { font-weight: 600; }
.mtai-remove-item { color: #b71d1d; cursor: pointer; font-weight: 700; }
#mtai-items-empty td { color: #888; text-align: center; padding: 20px; }

.mtai-totals-panel { display: flex; gap: 30px; flex-wrap: wrap; }
.mtai-totals-left { flex: 1.3; min-width: 280px; }
.mtai-totals-right { flex: 1; min-width: 300px; }
.mtai-tax-mode-label { font-weight: 600; color: #1a56b0; margin-bottom: 10px; }
.mtai-totals-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.mtai-totals-table th { text-align: left; font-weight: 400; color: #555; padding: 5px 0; }
.mtai-totals-table td { text-align: right; padding: 5px 0; font-weight: 600; }
.mtai-totals-table .mtai-total-row th, .mtai-totals-table .mtai-total-row td { border-top: 2px solid #333; padding-top: 9px; font-size: 15px; font-weight: 800; }
.mtai-detail-table { width: 100%; border-collapse: collapse; }
.mtai-detail-table th { text-align: left; width: 40%; color: #666; font-weight: 400; padding: 4px 0; }
.mtai-detail-table td { padding: 4px 0; font-weight: 600; }
.mtai-detail-table .mtai-total-row th, .mtai-detail-table .mtai-total-row td { border-top: 1.5px solid #333; padding-top: 6px; }

.mtai-modal-overlay { position: fixed; inset: 0; background: rgba(20,20,30,0.55); z-index: 100000; display: flex; align-items: flex-start; justify-content: center; padding: 40px 20px; overflow-y: auto; }
.mtai-modal { background: #fff; border-radius: 10px; padding: 26px 30px; max-width: 720px; width: 100%; position: relative; box-shadow: 0 20px 50px rgba(0,0,0,0.3); }
.mtai-modal-close { position: absolute; top: 14px; right: 16px; background: none; border: none; font-size: 26px; cursor: pointer; color: #888; line-height: 1; }
.mtai-modal-actions { margin-top: 18px; display: flex; gap: 10px; }

.mtai-report-block { background: #fff; border: 1px solid #e2e2e8; border-radius: 8px; padding: 18px 20px; margin-bottom: 20px; }
.mtai-report-header { display: flex; justify-content: space-between; align-items: center; }
.mtai-filter-row { display: flex; gap: 14px; align-items: end; margin: 14px 0 20px; }
.mtai-filter-row label { display: flex; flex-direction: column; font-size: 12.5px; font-weight: 600; gap: 4px; }

.mtai-logo-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.mtai-logo-preview { width: 160px; height: 70px; border: 1px dashed #ccc; border-radius: 6px; display: flex; align-items: center; justify-content: center; background: #fafafc; overflow: hidden; }
.mtai-logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }

.mtai-actions .button { margin-right: 3px; }
