* { box-sizing: border-box; }
body {
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f2f4f7;
    margin: 0;
    color: #1f2937;
}
.wrap { max-width: 1000px; margin: 0 auto; padding: 24px 16px 60px; }
header h1 { margin: 0 0 8px; font-size: 22px; }
nav { margin-bottom: 20px; }
nav a {
    display: inline-block;
    margin-right: 8px;
    padding: 8px 14px;
    border-radius: 6px;
    text-decoration: none;
    color: #374151;
    background: #e5e7eb;
    font-size: 14px;
}
nav a.active, nav a:hover { background: #2563eb; color: #fff; }

.card {
    background: #fff;
    border-radius: 10px;
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.card h2 { margin-top: 0; font-size: 18px; }
.hint { color: #6b7280; font-size: 14px; }

.field { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.field label { font-size: 13px; font-weight: 600; color: #374151; }
.field-row { display: flex; gap: 16px; }
.checkbox-field label { display: flex; align-items: center; gap: 8px; font-weight: 400; }

input[type=file], input[type=number], select {
    padding: 9px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
}

.btn {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.btn:hover { background: #1d4ed8; }
.btn-secondary { background: #9ca3af; }
.btn-secondary:hover { background: #6b7280; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert.success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert.error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

.filter-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.summary-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.total { font-size: 14px; color: #374151; }

.data-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; }
.data-table th, .data-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #e5e7eb; }
.data-table th { background: #f9fafb; font-weight: 600; white-space: nowrap; }
.data-table td.num { text-align: right; }
.link-delete { color: #dc2626; text-decoration: none; font-size: 12px; }
.link-delete:hover { text-decoration: underline; }

/* Wrap any <table> in this so wide tables scroll horizontally inside their
   card instead of squeezing cell contents and spilling past the edges. */
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Only records.php's table needs a wide floor (Reason dropdown + specify
   box) — other .data-table uses (Loan Types) stay their natural width. */
.records-table { min-width: 1000px; }

.reason-form { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
.reason-select, .reason-other {
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
}
.reason-select { width: 170px; flex-shrink: 0; }
.reason-other { width: 140px; flex-shrink: 0; }
.btn-small { padding: 6px 10px; font-size: 12px; }

/* Reasons Report */
.wrap.wide { max-width: 1400px; }
.report-table { border: 1px solid #cbd5e1; font-size: 12.5px; min-width: 1300px; }
.report-table th, .report-table td { border: 1px solid #cbd5e1; padding: 6px 8px; }
.report-table thead th { background: #dbeafe; text-align: center; font-weight: 700; }
.report-table td.reason-label { font-weight: 600; color: #92400e; background: #fef3e2; }
.report-table tbody tr:nth-child(odd) td.reason-label,
.report-table tbody tr:nth-child(odd) { background-color: #eef2ff; }
.report-table tbody tr:nth-child(odd) td.reason-label { background-color: #fde9c8; }
.report-table tfoot .footer-row td {
    background: #fde3cf;
    font-weight: 700;
    border-top: 2px solid #9ca3af;
}

@media print {
    body { background: #fff; }
    .no-print { display: none !important; }
    .card { box-shadow: none; padding: 0; margin: 0 0 24px; }
    .wrap { max-width: 100%; padding: 0; }
    .members-report { page-break-after: always; }
}

/* Delinquent Members report */
.members-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.members-collector { font-weight: 600; margin-bottom: 10px; color: #374151; }
.members-table th.hl { background: #fde047; }
.members-table { min-width: 700px; }
.members-table td.member-name { font-weight: 600; }
.members-table tbody tr.member-first td { border-top: 2px solid #cbd5e1; }
.members-table tfoot .footer-row td {
    background: #fde3cf;
    font-weight: 700;
    border-top: 2px solid #9ca3af;
}
