* { box-sizing: border-box; }
body { margin: 0; background: #f5f7fb; color: #002080; font-family: Arial, sans-serif; font-size: 18px; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
.login-body { align-items: center; background: linear-gradient(135deg, #f39a13, #ffe0a8); display: flex; min-height: 100vh; justify-content: center; padding: 24px; }
.login-card { background: #030303; border-radius: 10px; box-shadow: 0 18px 50px rgba(0,0,0,.25); color: #fff; max-width: 520px; padding: 56px 50px 42px; position: relative; width: 100%; }
.login-home-link { align-items: center; background: #ff9f00; border-radius: 999px; color: #fff; display: inline-flex; font-weight: 900; left: 18px; min-height: 34px; padding: 7px 15px; position: absolute; text-decoration: none; top: 16px; }
.login-card h1 { color: #ff9f00; font-size: 40px; font-weight: 400; margin: 0 0 28px; text-align: center; }
.login-card label { display: block; margin: 16px 0 7px; }
.login-card input { background: #eaf2ff; border: 1px solid #cfd8ea; border-radius: 7px; color: #001b65; display: block; padding: 12px 14px; width: 100%; }
.login-card button, .primary-btn { background: linear-gradient(100deg, #f59a13, #0826d9); border: 0; border-radius: 7px; color: #fff; cursor: pointer; font-weight: 800; min-height: 44px; padding: 10px 18px; text-decoration: none; }
.error { background: #ffe9e9; border: 1px solid #ffb6b6; border-radius: 8px; color: #9a1111; margin-bottom: 14px; padding: 10px 12px; }
.app-header { background: #fff; border-bottom: 1px solid #d8dde8; min-height: 190px; overflow: hidden; position: relative; }
.header-logo { display: block; height: auto; margin: 10px auto; max-height: 170px; object-fit: contain; padding: 0; width: min(1082px, calc(100% - 48px)); }
.logout { background: #f20b0b; border-radius: 9px; color: #fff; font-weight: 900; padding: 14px 24px; position: absolute; right: 22px; text-decoration: none; top: 18px; }
.toolbar { align-items: center; display: flex; gap: 14px; justify-content: space-between; padding: 0 16px 12px; }
.toolbar-left, .toolbar-right { align-items: center; display: flex; flex-wrap: wrap; gap: 10px; }
.create-invoice-form { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; }
.create-invoice-form select { border: 1px solid #aab4c5; border-radius: 6px; color: #002080; min-height: 42px; min-width: 360px; padding: 8px 10px; }
.nav-button, .blue-btn, .danger-btn, .green-btn { border: 0; border-radius: 7px; color: #fff; cursor: pointer; display: inline-flex; font-weight: 800; min-height: 42px; padding: 9px 15px; text-decoration: none; }
.nav-button, .blue-btn { background: #062b86; }
.danger-btn { background: #df3044; }
.green-btn { background: #11a05d; }
.search-form { display: grid; grid-template-columns: minmax(260px, 420px) 52px; }
.search-form input { border: 1px solid #d8dde8; border-radius: 7px 0 0 7px; padding: 11px 14px; }
.search-form button { background: #ff9f00; border: 0; border-radius: 0 7px 7px 0; color: #fff; font-size: 24px; font-weight: 900; }
.page { margin: 30px auto; max-width: 1620px; padding: 0 18px; }
.panel { background: #fff; border: 1px solid #d8dde8; border-radius: 8px; box-shadow: 0 10px 22px rgba(15,23,42,.07); margin-bottom: 20px; overflow: hidden; }
.panel-header { align-items: center; background: #f0f5fc; display: flex; gap: 12px; justify-content: space-between; padding: 16px 18px; }
.panel-header h2 { margin: 0; }
.panel-body { padding: 18px; }
.table-wrap { max-height: 560px; overflow: auto; }
table { border-collapse: collapse; width: 100%; }
th { background: #ff9f00; color: #002080; font-size: 22px; padding: 14px; text-align: center; }
td { border: 1px solid #d8dde8; padding: 12px; text-align: center; vertical-align: middle; }
.invoice-list td { color: #002080; font-size: 20px; font-weight: 700; }
.actions { align-items: center; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(180px, 1fr)); }
.form-grid label, .settings-grid label { color: #002080; font-weight: 800; }
.form-grid input, .form-grid select, .settings-grid input, .settings-grid select, .settings-grid textarea { border: 1px solid #d8dde8; border-radius: 4px; color: #002080; display: block; margin-top: 5px; padding: 10px; width: 100%; }
.invoice-sheet { background: #fff; border: 1px solid #ddd; margin: 18px auto; max-width: 1650px; padding: 12px; }
.invoice-banner img { display: block; width: 100%; }
.invoice-top { display: grid; gap: 24px; grid-template-columns: 1fr 1fr; padding: 18px 6px; }
.invoice-top .field-row { align-items: center; display: grid; gap: 12px; grid-template-columns: 220px 1fr; margin-bottom: 10px; }
.invoice-top label, .invoice-top span { color: #002080; font-size: 22px; }
.invoice-top input, .invoice-top select { border: 1px solid #d8dde8; color: #002080; font-size: 21px; padding: 9px 12px; width: 100%; }
.invoice-for { color: #002080; font-size: 22px; line-height: 1.55; margin-top: 22px; }
.house-moving-invoice { background: #f7fbff; border: 1px solid #d8dde8; border-left: 6px solid #ff9f00; border-radius: 8px; display: grid; gap: 12px; grid-template-columns: repeat(6, minmax(140px, 1fr)); margin: 0 6px 16px; padding: 14px; }
.house-moving-invoice h3 { grid-column: 1 / -1; margin: 0; }
.house-moving-invoice label { color: #002080; font-weight: 800; }
.house-moving-invoice input { border: 1px solid #d8dde8; border-radius: 4px; color: #002080; display: block; margin-top: 5px; padding: 8px; width: 100%; }
.quotation-card { background: #eef6ff; border: 1px solid #b9cbed; border-left: 6px solid #ff9f00; border-radius: 8px; color: #002080; margin: 0 6px 16px; padding: 14px 18px; }
.quotation-card h3 { font-size: 24px; margin: 0 0 8px; }
.quotation-card p { line-height: 1.45; margin: 6px 0; }
.quotation-pricing-card { background: #fff; border: 1px solid #d8dde8; border-left: 6px solid #ff9f00; border-radius: 8px; color: #002080; margin: 0 6px 16px; padding: 14px 18px; }
.quotation-pricing-card h3 { font-size: 24px; margin: 0 0 8px; }
.quotation-pricing-card p { color: #355171; font-size: 16px; margin: 0 0 12px; }
.quotation-pricing-grid { display: grid; gap: 10px; grid-template-columns: repeat(4, minmax(170px, 1fr)); }
.quotation-price-option { background: #f7fbff; border: 1px solid #d8dde8; border-radius: 8px; display: grid; gap: 8px; padding: 10px; }
.quotation-price-option span { align-items: center; display: flex; font-weight: 900; gap: 8px; }
.quotation-price-option input[type=checkbox] { height: 18px; width: 18px; }
.quotation-price-option input[type=number] { border: 1px solid #d8dde8; border-radius: 4px; color: #002080; padding: 8px; width: 100%; }
.quotation-price-option:not(.quotation-selected) input[type=number] { opacity: .55; }
.moving-address-card { background: #f7fbff; border: 1px solid #d8dde8; border-left: 6px solid #ff9f00; border-radius: 8px; display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(240px, 1fr)); margin: 0 6px 16px; padding: 14px; }
.moving-address-card h3 { grid-column: 1 / -1; margin: 0; }
.moving-address-card label { color: #002080; font-weight: 800; }
.moving-address-card textarea { border: 1px solid #d8dde8; border-radius: 4px; color: #002080; display: block; margin-top: 6px; min-height: 76px; padding: 9px; resize: vertical; width: 100%; }
.empty-runsheets { background: #fff8e8; border: 1px solid #ffd289; border-left: 6px solid #ff9f00; border-radius: 8px; color: #002080; font-weight: 800; margin: 8px 6px 16px; padding: 16px; }
.is-hidden { display: none !important; }
.sticky-actions { align-items: center; background: rgba(255,255,255,.95); display: flex; gap: 10px; justify-content: space-between; padding: 14px 8px; position: sticky; top: 0; z-index: 5; }
.invoice-action-right { align-items: center; display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.invoice-actions-bottom { border-top: 2px solid #062b86; margin-top: 18px; position: static; }
.saved-location { align-items: center; background: #ecfff2; border: 1px solid #a8e4ba; border-left: 7px solid #23a553; border-radius: 8px; color: #002080; display: flex; gap: 12px; justify-content: space-between; margin: 10px 8px; padding: 12px 14px; }
.saved-location strong { display: block; font-size: 20px; }
.saved-location span { color: #355171; display: block; font-size: 16px; }
.runsheet-title { align-items: center; background: #f4a019; color: #000; display: flex; flex-wrap: wrap; font-size: 23px; font-weight: 900; gap: 18px; min-height: 54px; padding: 7px 10px; text-align: left; }
.runsheet-meta { align-items: center; display: inline-flex; gap: 7px; white-space: nowrap; }
.runsheet-meta strong { background: transparent; border: 0; color: #000; display: inline-block; min-width: 130px; padding: 0 4px; }
.runsheet-actions { align-items: center; display: inline-flex; gap: 8px; margin-left: auto; }
.runsheet-title input { border: 1px solid #d8dde8; font-size: 22px; margin: 0; padding: 6px 8px; width: 190px; }
.charge-table th { font-size: 21px; }
.charge-table td { border: 2px solid #111; color: #002080; min-width: 86px; padding: 8px; }
.customer-info input, .amount-cell input, .note-cell textarea, .moving-note-cell textarea, .service-cell input[type=number] { border: 1px solid #d8dde8; color: #002080; padding: 8px; width: 100%; }
.service-cell { font-size: 16px; min-width: 86px; }
.service-cell input[type=checkbox] { height: 18px; width: 18px; }
.service-cell input[type=number] { display: none; margin-top: 6px; }
.service-cell.service-selected input[type=number] { display: block; }
.service-cell input[type=checkbox]:checked ~ input[type=number] { display: block; }
.service-cell.service-unselected { color: #111; }
.pickup-cell select { border: 1px solid #aab4c5; color: #000; padding: 8px; width: 100%; }
.note-cell textarea { min-height: 54px; resize: vertical; }
.moving-note-cell textarea { min-height: 78px; resize: vertical; }
.house-moving-table th:nth-child(1), .house-moving-table td:nth-child(1) { width: 260px; }
.house-moving-table th:nth-child(2), .house-moving-table td:nth-child(2) { min-width: 620px; text-align: left; }
.house-moving-table th:nth-child(3), .house-moving-table td:nth-child(3) { width: 190px; }
.handyman-table th, .handyman-table td { vertical-align: top; }
.handyman-table th:nth-child(1), .handyman-table td:nth-child(1) { width: 220px; }
.handyman-table th:nth-child(2), .handyman-table td:nth-child(2) { min-width: 300px; text-align: left; }
.handyman-table th:nth-child(3), .handyman-table td:nth-child(3) { min-width: 240px; text-align: left; }
.handyman-table th:nth-child(4), .handyman-table td:nth-child(4),
.handyman-table th:nth-child(5), .handyman-table td:nth-child(5) { width: 150px; }
.handyman-table th:nth-child(6), .handyman-table td:nth-child(6) { width: 170px; }
.handyman-table th:nth-child(7), .handyman-table td:nth-child(7) { width: 150px; }
.handyman-text-cell textarea { border: 1px solid #d8dde8; color: #002080; min-height: 72px; padding: 8px; resize: vertical; width: 100%; }
.amount-cell strong { display: block; font-size: 20px; margin-bottom: 8px; }
.invoice-summary-row { display: flex; justify-content: flex-end; margin: 20px 0 14px; }
.invoice-summary-row .totals-table { max-width: 520px; width: 100%; }
.invoice-footer { background: #062b86; color: #ff9f00; margin-top: 0; padding: 24px 28px; text-align: center; }
.invoice-footer h2, .invoice-footer p { margin: 0 0 14px; text-align: center; }
.totals-table td { background: #fff; border: 1px solid #002080; color: #002080; font-size: 21px; font-weight: 800; }
.totals-table td:first-child { background: #f4a019; color: #002080; text-align: center; }
.tax-toggle { align-items: center; display: inline-flex; font-size: 14px; gap: 5px; margin-left: 8px; vertical-align: middle; }
.tax-toggle input { height: 16px; width: 16px; }
.input-with-suffix { align-items: center; display: flex; gap: 8px; }
.input-with-suffix input { margin-top: 5px; }
.input-with-suffix b { color: #002080; font-size: 24px; padding-top: 4px; }
.settings-grid { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(170px, 1fr)); }
.settings-grid label small { color: #435979; display: block; font-size: 13px; margin-top: 5px; }
.settings-wide { grid-column: span 2; }
.service-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-top: 18px; }
.service-chip { align-items: center; background: #f3f7ff; border: 1px solid #d8dde8; border-radius: 8px; display: flex; justify-content: space-between; padding: 10px; }
.service-chip small { color: #435979; display: block; font-size: 14px; margin-top: 4px; }
.department-checks { border: 1px solid #d8dde8; border-radius: 8px; display: grid; gap: 6px; grid-column: span 2; grid-template-columns: repeat(3, minmax(130px, 1fr)); margin: 0; padding: 12px; }
.department-checks legend { color: #002080; font-weight: 900; padding: 0 6px; }
.department-checks label { align-items: center; display: flex; gap: 7px; margin: 0; }
.department-checks input { margin: 0; width: auto; }
.print-only { display: none; }
.invoice-modal[hidden] { display: none; }
.invoice-modal { align-items: center; background: rgba(0,0,0,.55); display: flex; inset: 0; justify-content: center; padding: 20px; position: fixed; z-index: 30; }
.invoice-modal-card { background: #fff; border-radius: 9px; box-shadow: 0 25px 70px rgba(0,0,0,.32); max-width: 620px; padding: 24px; position: relative; width: 100%; }
.invoice-modal-card h2 { color: #002080; font-size: 28px; margin: 0 0 20px; }
.invoice-modal-card label { color: #002080; display: block; font-size: 20px; font-weight: 700; margin: 16px 0; }
.invoice-modal-card input { border: 1px solid #d8dde8; color: #002080; display: block; font-size: 20px; margin-top: 8px; padding: 11px; width: 100%; }
.modal-close { background: transparent; border: 0; color: #777; cursor: pointer; font-size: 40px; line-height: 1; position: absolute; right: 16px; top: 12px; }
.modal-actions { align-items: center; border-top: 1px solid #d8dde8; display: flex; gap: 10px; justify-content: flex-end; margin: 22px -24px -24px; padding: 18px 24px; }
.muted-btn { background: #707780; border: 0; border-radius: 7px; color: #fff; cursor: pointer; font-weight: 800; min-height: 42px; padding: 9px 15px; }
.quick-row-buttons { display: flex; gap: 10px; margin-top: 10px; }
@media (max-width: 900px) {
    body { font-size: 16px; }
    .app-header { min-height: 180px; }
    .toolbar, .invoice-top { grid-template-columns: 1fr; }
    .invoice-summary-row { justify-content: stretch; }
    .toolbar { align-items: stretch; flex-direction: column; }
    .form-grid, .settings-grid { grid-template-columns: 1fr; }
    .house-moving-invoice, .quotation-pricing-grid, .department-checks { grid-template-columns: 1fr; }
    .department-checks { grid-column: auto; }
    .search-form { grid-template-columns: 1fr 52px; }
    .invoice-top .field-row { grid-template-columns: 1fr; }
    .table-wrap { overflow-x: auto; }
}
@media print {
    body { background: #fff; font-size: 12px; }
    .app-header, .toolbar, .sticky-actions, .no-print, .logout { display: none !important; }
    .page, .invoice-sheet { margin: 0; max-width: none; padding: 0; }
    .panel { border: 0; box-shadow: none; }
    .invoice-top input, .invoice-top select, .customer-info input, .amount-cell input, .note-cell textarea, .moving-note-cell textarea, .handyman-text-cell textarea, .service-cell input[type=number] { border: 0; padding: 0; }
    .charge-table-print .print-unused { display: none !important; }
    .charge-table-print .service-cell input[type=checkbox] { display: none !important; }
    .charge-table-print .service-cell input[type=number] { display: block !important; font-weight: 700; text-align: center; }
    .charge-table-print .pickup-cell select { border: 0; padding: 0; text-align: center; }
    .print-only { display: inline; }
}
