* { box-sizing: border-box; }
body { font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif; margin: 0; background: #f6f7f9; color: #1a1a1a; }
.topnav { display: flex; justify-content: space-between; align-items: center; background: #1f2937; color: #fff; padding: 12px 24px; }
.topnav .brand { font-weight: 600; }
.topnav .links a { color: #d1d5db; text-decoration: none; margin-left: 20px; }
.topnav .links a:hover { color: #fff; }
.topnav .nav-logout { color: #d1d5db; background: none; border: none; margin-left: 20px; cursor: pointer; font-size: 14px; padding: 0; }
.topnav .nav-logout:hover { color: #fff; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #f6f7f9; }
.login-form { max-width: 340px; width: 100%; }
.login-form h1 { margin-bottom: 2px; }
.login-subtitle { color: #6b7280; font-size: 14px; margin: 0 0 16px; }
.container { max-width: 960px; margin: 24px auto; padding: 0 16px; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
h1 { font-size: 22px; margin: 0 0 16px; }
.btn { display: inline-block; padding: 8px 14px; border-radius: 6px; border: 1px solid #d1d5db; background: #fff; color: #1a1a1a; text-decoration: none; cursor: pointer; font-size: 14px; }
.btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.filter-bar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.filter-bar input[type="text"] { padding: 8px; border: 1px solid #d1d5db; border-radius: 6px; flex: 1; max-width: 280px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.data-table th, .data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #eee; font-size: 14px; }
.data-table th { background: #f9fafb; font-weight: 600; }
.inactive-row { opacity: 0.5; }
.empty-row { text-align: center; color: #888; padding: 24px; }
.row-actions a, .row-actions .link-btn { margin-right: 10px; color: #2563eb; text-decoration: none; background: none; border: none; padding: 0; font-size: 14px; cursor: pointer; }
.form { background: #fff; padding: 20px; border-radius: 8px; max-width: 480px; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.form label { display: block; margin-bottom: 14px; font-size: 14px; font-weight: 500; }
.form input, .form select { display: block; width: 100%; margin-top: 4px; padding: 8px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; }
.form small { color: #888; font-weight: 400; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.error-box { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.error-box ul { margin: 0; padding-left: 18px; }

.form-wide { max-width: 900px; }
.form-row { display: flex; gap: 20px; }
.form-row label { flex: 1; }
.picker-field { position: relative; }
.picker-results { display: none; position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid #d1d5db; border-radius: 6px; max-height: 220px; overflow-y: auto; z-index: 10; box-shadow: 0 4px 10px rgba(0,0,0,0.08); }
.picker-item { padding: 8px 10px; font-size: 14px; cursor: pointer; }
.picker-item:hover { background: #f3f4f6; }
.picker-empty { padding: 8px 10px; font-size: 14px; color: #888; }
.filter-picker { min-width: 220px; }
.filter-picker input { padding: 8px; border: 1px solid #d1d5db; border-radius: 6px; width: 100%; }
.filter-bar select { padding: 8px; border: 1px solid #d1d5db; border-radius: 6px; }

.line-items { width: 100%; border-collapse: collapse; margin: 16px 0 8px; }
.line-items th, .line-items td { text-align: left; padding: 6px 8px; font-size: 13px; border-bottom: 1px solid #eee; }
.line-items input, .line-items select { padding: 6px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 13px; width: 100%; }
.line-items td.f-cgst, .line-items td.f-sgst, .line-items td.f-igst, .line-items td.f-linetotal { white-space: nowrap; text-align: right; }

.totals-box { display: flex; gap: 20px; justify-content: flex-end; background: #f9fafb; padding: 10px 16px; border-radius: 6px; font-size: 14px; margin-bottom: 16px; }

.status-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; text-transform: capitalize; }
.status-paid { background: #dcfce7; color: #166534; }
.status-partial { background: #fef3c7; color: #92400e; }
.status-unpaid { background: #fee2e2; color: #991b1b; }

.payments-panel { max-width: 900px; margin-top: 24px; background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.payments-panel h2 { font-size: 18px; margin: 0 0 12px; }
.payments-summary { display: flex; gap: 24px; background: #f9fafb; padding: 10px 16px; border-radius: 6px; font-size: 14px; margin-bottom: 16px; align-items: center; }
.balance-zero { color: #166534; }
.balance-due { color: #991b1b; }
.payments-table { margin-bottom: 16px; }
.payment-form { max-width: 100%; display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; box-shadow: none; padding: 0; }
.payment-form label { flex: 1; min-width: 140px; margin-bottom: 0; }
.payment-form .form-actions { margin: 0; }

.report-cards { display: flex; gap: 16px; flex-wrap: wrap; }
.report-card { display: block; width: 260px; background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 2px rgba(0,0,0,0.06); text-decoration: none; color: inherit; }
.report-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.report-card h2 { font-size: 16px; margin: 0 0 8px; color: #2563eb; }
.report-card p { font-size: 13px; color: #6b7280; margin: 0; }
.report-note { color: #6b7280; font-size: 13px; margin-top: -8px; margin-bottom: 16px; max-width: 700px; }
.totals-row td { border-top: 2px solid #d1d5db; background: #f9fafb; }
.ledger-customer-name { font-size: 16px; margin: 0 0 12px; }
