:root {
    --ink: #1d2630;
    --muted: #667085;
    --line: #e6eaf0;
    --bg: #f5f7fa;
    --nav: #17202a;
    --accent: #0f766e;
    --accent-2: #2563eb;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif; letter-spacing: 0; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: var(--nav); color: #fff; padding: 22px 16px; flex: 0 0 260px; }
.brand { font-weight: 800; font-size: 20px; margin-bottom: 26px; }
.sidebar a { display: flex; align-items: center; gap: 12px; color: #d9e2ec; text-decoration: none; padding: 11px 12px; border-radius: 8px; margin-bottom: 4px; }
.sidebar a:hover { background: rgba(255,255,255,.09); color: #fff; }
.content { flex: 1; padding: 24px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 22px; }
.topbar h1, .login-panel h1 { margin: 0; font-size: 28px; font-weight: 800; }
.eyebrow { color: var(--accent); text-transform: uppercase; font-size: 12px; font-weight: 800; letter-spacing: 0; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 18px; box-shadow: 0 8px 30px rgba(16,24,40,.04); }
.panel h2 { font-size: 18px; font-weight: 800; margin-bottom: 16px; }
.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 16px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; min-height: 106px; display: flex; flex-direction: column; justify-content: space-between; }
.stat-card span, .list-line span { color: var(--muted); font-size: 13px; display: block; }
.stat-card strong { font-size: 24px; line-height: 1.1; }
.list-line { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 12px 0; }
.list-line:last-child { border-bottom: 0; }
.table thead th { color: var(--muted); font-size: 12px; text-transform: uppercase; white-space: nowrap; }
.actions { display: flex; gap: 8px; justify-content: flex-end; }
.login-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #edf7f5, #f5f7fa 55%, #eef4ff); padding: 24px; }
.login-panel { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 28px; box-shadow: 0 22px 60px rgba(16,24,40,.12); }
.form-control, .form-select, .btn { border-radius: 8px; }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.print-sheet { max-width: 860px; margin: 0 auto; background: #fff; padding: 36px; }
.quotation-actions { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.quotation-shell { max-width: 1040px; margin: 0 auto; }
.quotation-letter { width: min(920px, 100%); margin: 0 auto; background: #fff; color: #111; border: 1px solid #d8dde5; padding: 34px 42px; box-shadow: 0 14px 45px rgba(16,24,40,.08); font: 12px/1.35 "Courier New", Courier, monospace; }
.quotation-letter p { margin: 0 0 6px; }
.quotation-letter h2 { margin: 10px 0 4px; font: 700 15px/1.2 "Times New Roman", serif; }
.quotation-letter-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 8px; }
.quotation-logo { width: 300px; max-width: 50%; height: auto; object-fit: contain; }
.quotation-meta { min-width: 240px; border: 1px solid #111; text-align: center; font-family: Calibri, Arial, sans-serif; }
.quotation-meta strong, .quotation-meta span { display: block; padding: 4px 8px; }
.quotation-meta strong { color: #111; border-bottom: 1px solid #111; }
.quotation-meta span { background: #111; color: #fff; font-weight: 700; font-size: 12px; }
.quotation-date { margin: 8px 0 16px; }
.quotation-recipient { margin-bottom: 14px; }
.quotation-recipient strong { display: block; min-height: 18px; }
.quotation-up { margin-top: 16px !important; }
.quotation-specs { margin: 4px 0 12px; }
.quotation-specs > strong { display: block; margin-bottom: 4px; }
.quotation-specs div { display: grid; grid-template-columns: 255px minmax(0, 1fr); min-height: 18px; gap: 12px; }
.quotation-table-wrap { margin: 12px 0; }
.quotation-manual-table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 11px; }
.quotation-manual-table th, .quotation-manual-table td { border: 1px solid #111; padding: 5px 7px; vertical-align: middle; }
.quotation-manual-table thead th { background: #111; color: #fff; text-align: center; font-weight: 700; }
.quotation-manual-table tfoot th { background: #c4bc96; color: #111; font-weight: 700; }
.quotation-manual-table .grand-total-row th { background: #111; color: #fff; font-size: 12px; }
.quotation-terms { margin-top: 10px; }
.quotation-terms > strong { display: block; color: #d40000; font-style: italic; margin: 2px 0 6px; }
.quotation-terms ol { margin: 6px 0 10px 22px; padding-left: 14px; }
.quotation-terms li { margin-bottom: 3px; }
.quotation-signature { width: 285px; margin-top: 18px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.quotation-signature p { margin-bottom: 0; }
.quotation-signature img { width: 190px; height: auto; margin: 2px 0 0; }
.quotation-signature span { margin-top: 4px; }
.quotation-footer { margin-top: 16px; background: #111; color: #fff; text-align: center; padding: 7px 10px; font-family: Calibri, Arial, sans-serif; font-size: 11px; line-height: 1.25; }
.quotation-footer strong, .quotation-footer span { display: block; }
.quotation-form-panel { overflow: hidden; }
.quotation-form-heading { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 18px; }
.quotation-form-heading h2 { margin: 2px 0 0; }
.quotation-form-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.quotation-form-grid { display: grid; grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(130px, 1fr)); gap: 16px; margin-bottom: 20px; }
.quotation-form-section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.quotation-form-section-title h3 { margin: 0; font-size: 15px; font-weight: 800; }
.quotation-form-table { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.quotation-form-table .table { margin-bottom: 0; }
.quotation-form-table thead th { background: var(--nav); color: #fff; }
.quotation-form-table th:first-child, .quotation-form-table td:first-child { width: 58px; }
.quotation-form-table th:nth-child(3), .quotation-form-table td:nth-child(3) { width: 120px; }
.quotation-form-table th:nth-child(4), .quotation-form-table td:nth-child(4) { width: 180px; }
.quotation-form-table th:nth-child(5), .quotation-form-table td:nth-child(5) { width: 170px; }
.quotation-line-total { text-align: right; white-space: nowrap; font-weight: 700; }
.quotation-form-bottom { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; margin-top: 18px; }
.quotation-form-summary { border: 1px solid var(--nav); font-family: "Courier New", Courier, monospace; background: #fff; }
.quotation-form-summary div { display: flex; justify-content: space-between; gap: 14px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.quotation-form-summary div:last-child { border-bottom: 0; }
.quotation-form-summary span { color: var(--muted); }
.quotation-form-summary strong { white-space: nowrap; }
.quotation-form-summary .grand-total { background: var(--nav); color: #fff; font-weight: 800; }
.quotation-form-summary .grand-total span { color: #fff; }
.stored-file-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--accent); text-decoration: none; font-size: 13px; font-weight: 700; }
.stored-file-link:hover { text-decoration: underline; }
.invoice-print-shell { max-width: 980px; margin: 0 auto; }
.invoice-manual-sheet { width: min(900px, 100%); margin: 0 auto; background: #fff; color: #111; border: 1px solid #d8dde5; padding: 30px 42px 22px; box-shadow: 0 14px 45px rgba(16,24,40,.08); font: 12px/1.28 "Times New Roman", Times, serif; }
.invoice-manual-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 2px; }
.invoice-manual-header img { width: 300px; max-width: 55%; height: auto; }
.invoice-manual-header span { font-size: 12px; margin-top: 72px; }
.invoice-title-block { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; border-top: 2px solid #111; border-bottom: 2px solid #111; padding: 8px 0; margin-bottom: 12px; }
.invoice-title-block h2 { margin: 0 0 3px; font-size: 19px; font-weight: 800; letter-spacing: 0; }
.invoice-title-block p { margin: 0 0 3px; }
.invoice-title-block > div:last-child { text-align: right; }
.invoice-customer-block { margin-bottom: 12px; font-family: Calibri, Arial, sans-serif; font-size: 12px; }
.invoice-customer-block div { display: grid; grid-template-columns: 86px minmax(0, 1fr); min-height: 21px; }
.invoice-customer-block span { font-weight: 700; }
.invoice-customer-block strong { font-weight: 700; }
.invoice-manual-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-family: Calibri, Arial, sans-serif; font-size: 11px; }
.invoice-manual-table th, .invoice-manual-table td { border: 1px solid #111; padding: 5px 7px; vertical-align: top; }
.invoice-manual-table th { text-align: center; font-weight: 800; }
.invoice-manual-table th:nth-child(1) { width: 46px; }
.invoice-manual-table th:nth-child(2) { width: auto; }
.invoice-manual-table th:nth-child(3), .invoice-manual-table th:nth-child(4), .invoice-manual-table th:nth-child(5) { width: 82px; }
.invoice-manual-table th:nth-child(6) { width: 150px; }
.invoice-empty-row td { height: 28px; }
.invoice-summary-label { text-align: right; font-weight: 800; }
.invoice-payment-row td { font-weight: 800; font-size: 12px; }
.invoice-narrative { margin: 14px 0 10px; text-align: justify; font-size: 12px; }
.invoice-words { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 10px; align-items: center; margin: 10px 0 14px; font-family: Calibri, Arial, sans-serif; }
.invoice-words span { font-weight: 800; }
.invoice-words strong { border-bottom: 1px solid #111; min-height: 24px; padding: 4px 8px; font-size: 13px; }
.invoice-bank { width: 430px; max-width: 100%; margin-top: 8px; font-family: Calibri, Arial, sans-serif; font-size: 12px; }
.invoice-bank p { margin: 0 0 5px; }
.invoice-bank div { display: grid; grid-template-columns: 116px minmax(0, 1fr); min-height: 20px; }
.invoice-bank span { font-weight: 700; }
.invoice-signature { width: 295px; margin: 18px 0 0 auto; text-align: center; font-family: Calibri, Arial, sans-serif; font-size: 12px; }
.invoice-signature p { margin: 0; }
.invoice-signature strong, .invoice-signature span { display: block; }
.invoice-signature img { width: 82px; height: 205px; object-fit: cover; object-position: center; margin: 0 auto -6px; display: block; }
.invoice-footer { margin-top: 10px; border-top: 2px solid #111; padding-top: 6px; text-align: center; font-family: Calibri, Arial, sans-serif; font-size: 10px; line-height: 1.25; font-weight: 700; }
.invoice-form-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.invoice-form-heading h2 { margin: 2px 0 0; }
.invoice-form-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.invoice-form-grid { display: grid; grid-template-columns: minmax(260px, 2fr) repeat(2, minmax(170px, 1fr)); gap: 16px; }
.invoice-form-project, .invoice-form-notes { grid-column: span 2; }
.invoice-form-reference { margin-top: 18px; border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; display: grid; gap: 4px; background: #f8fafc; }
.invoice-form-reference strong { font-size: 14px; }
.invoice-form-reference span { color: var(--muted); font-size: 13px; }
.receipt-print-shell { max-width: 980px; margin: 0 auto; }
.receipt-manual-sheet { width: min(900px, 100%); min-height: 620px; margin: 0 auto; background: #fff; color: #111; border: 1px solid #d8dde5; padding: 34px 46px 38px; box-shadow: 0 14px 45px rgba(16,24,40,.08); font-family: "Courier New", Courier, monospace; position: relative; overflow: hidden; }
.receipt-head { display: grid; grid-template-columns: 290px 1fr; gap: 18px; align-items: start; margin-bottom: 22px; }
.receipt-head img { width: 290px; max-width: 100%; height: auto; grid-row: span 3; }
.receipt-number { text-align: center; font: 700 13px/1.2 "Courier New", Courier, monospace; margin-top: 6px; }
.receipt-head h2 { margin: 14px 0 0; text-align: center; color: #009049; font: 800 20px/1.1 Arial, sans-serif; letter-spacing: 0; }
.receipt-body { margin-top: 10px; display: grid; gap: 8px; }
.receipt-line { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 12px; align-items: start; min-height: 28px; }
.receipt-line span { color: #009049; font: 700 14px/1.3 Arial, sans-serif; }
.receipt-line strong { font: 700 14px/1.35 "Courier New", Courier, monospace; }
.receipt-description strong { min-height: 58px; }
.receipt-total-panel { width: 360px; margin: 28px 0 0 auto; display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: center; gap: 8px; }
.receipt-total-label { color: #009049; font: 800 26px/1 Brush Script MT, Segoe Script, cursive; white-space: nowrap; }
.receipt-total-value { border: 2px solid #009049; color: #111; padding: 8px 12px; text-align: center; font: 700 17px/1.2 "Courier New", Courier, monospace; }
.receipt-sign-area { display: grid; grid-template-columns: 1fr 300px; gap: 30px; margin-top: 28px; align-items: end; }
.receipt-party { min-height: 150px; display: flex; flex-direction: column; justify-content: flex-end; gap: 18px; text-align: center; }
.receipt-party strong { font: 700 13px/1.35 "Courier New", Courier, monospace; }
.receipt-party span, .receipt-company span { font: 12px/1.2 Arial, sans-serif; color: #009049; }
.receipt-company { display: flex; flex-direction: column; align-items: center; text-align: center; min-height: 230px; }
.receipt-company > span:first-child { color: #111; font: 700 13px/1.2 "Courier New", Courier, monospace; align-self: flex-start; margin-left: 12px; }
.receipt-company > strong:nth-child(2) { color: #009049; font: 700 15px/1.2 Arial, sans-serif; margin: 12px 0 0; }
.receipt-company img { width: 72px; height: 180px; object-fit: cover; object-position: center; margin: 2px 0 -8px; }
.receipt-company strong:last-child { font: 700 13px/1.2 "Courier New", Courier, monospace; color: #111; margin-top: 4px; }
.payment-form-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.payment-form-heading h2 { margin: 2px 0 0; }
.payment-form-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.payment-form-grid { display: grid; grid-template-columns: minmax(260px, 2fr) repeat(2, minmax(170px, 1fr)); gap: 16px; }
.payment-form-project, .payment-form-notes { grid-column: span 2; }
.payment-form-reference { margin-top: 18px; border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; display: grid; gap: 4px; background: #f8fafc; }
.payment-form-reference strong { font-size: 14px; }
.payment-form-reference span { color: var(--muted); font-size: 13px; }
@media (max-width: 980px) {
    .app-shell { display: block; }
    .sidebar { width: 100%; min-height: auto; }
    .sidebar nav { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
    .content { padding: 16px; }
    .topbar { align-items: flex-start; flex-direction: column; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .quotation-form-grid, .quotation-form-bottom { grid-template-columns: 1fr; }
    .quotation-form-heading { flex-direction: column; }
    .quotation-form-actions { justify-content: flex-start; }
    .quotation-letter { padding: 26px; }
    .invoice-title-block, .invoice-form-grid { grid-template-columns: 1fr; }
    .invoice-title-block > div:last-child { text-align: left; }
    .invoice-form-project, .invoice-form-notes { grid-column: auto; }
    .invoice-form-heading { flex-direction: column; }
    .invoice-form-actions { justify-content: flex-start; }
    .invoice-manual-sheet { padding: 26px; }
    .receipt-manual-sheet { padding: 26px; }
    .receipt-head { grid-template-columns: 1fr; }
    .receipt-head img { grid-row: auto; }
    .receipt-line { grid-template-columns: 1fr; gap: 2px; }
    .receipt-total-panel { width: 100%; }
    .receipt-sign-area, .payment-form-grid { grid-template-columns: 1fr; }
    .payment-form-project, .payment-form-notes { grid-column: auto; }
    .payment-form-heading { flex-direction: column; }
    .payment-form-actions { justify-content: flex-start; }
}
@media (max-width: 560px) {
    .stats-grid, .sidebar nav { grid-template-columns: 1fr; }
    .quotation-letter { padding: 18px; font-size: 11px; }
    .quotation-letter-head { display: block; }
    .quotation-logo { max-width: 100%; width: 260px; margin-bottom: 12px; }
    .quotation-meta { min-width: 0; width: 100%; }
    .quotation-specs div { grid-template-columns: 1fr; gap: 0; margin-bottom: 4px; }
    .quotation-signature { width: 100%; }
    .invoice-manual-sheet { padding: 18px; font-size: 11px; }
    .invoice-manual-header { display: block; }
    .invoice-manual-header img { width: 260px; max-width: 100%; }
    .invoice-manual-header span { display: block; margin-top: 8px; }
    .invoice-customer-block div, .invoice-bank div, .invoice-words { grid-template-columns: 1fr; gap: 2px; }
    .invoice-signature { width: 100%; }
    .receipt-manual-sheet { padding: 18px; }
    .receipt-total-panel { grid-template-columns: 1fr; }
    .receipt-head h2 { font-size: 16px; }
}
@media print {
    @page { size: A4; margin: 10mm; }
    .sidebar, .topbar, .no-print { display: none !important; }
    .content { padding: 0; }
    body { background: #fff; }
    .quotation-shell { max-width: none; margin: 0; }
    .quotation-letter { width: 100%; max-width: none; border: 0; box-shadow: none; padding: 0; font-size: 9.5px; }
    .quotation-logo { width: 230px; }
    .quotation-meta { min-width: 205px; }
    .quotation-meta span { font-size: 10px; }
    .quotation-specs div { min-height: 14px; grid-template-columns: 215px 1fr; }
    .quotation-table-wrap, .table-responsive { overflow: visible !important; }
    .quotation-manual-table { min-width: 0; font-size: 8.8px; }
    .quotation-manual-table th, .quotation-manual-table td { padding: 3px 5px; }
    .quotation-manual-table .grand-total-row th { font-size: 10px; }
    .quotation-terms li { margin-bottom: 1px; }
    .quotation-signature { margin-top: 10px; }
    .quotation-signature img { width: 150px; }
    .quotation-footer { font-size: 9px; margin-top: 8px; }
    .invoice-print-shell { max-width: none; margin: 0; }
    .invoice-manual-sheet { width: 100%; max-width: none; border: 0; box-shadow: none; padding: 0; font-size: 10px; }
    .invoice-manual-header img { width: 255px; }
    .invoice-manual-header span { margin-top: 58px; }
    .invoice-title-block { margin-bottom: 9px; padding: 6px 0; }
    .invoice-title-block h2 { font-size: 17px; }
    .invoice-customer-block { font-size: 10.5px; margin-bottom: 9px; }
    .invoice-customer-block div { min-height: 17px; }
    .invoice-manual-table { font-size: 9.3px; }
    .invoice-manual-table th, .invoice-manual-table td { padding: 3px 5px; }
    .invoice-empty-row td { height: 18px; }
    .invoice-payment-row td { font-size: 10px; }
    .invoice-narrative { font-size: 10px; margin: 10px 0 8px; }
    .invoice-words { grid-template-columns: 160px 1fr; margin: 8px 0 10px; }
    .invoice-words strong { min-height: 20px; padding: 3px 6px; font-size: 10.5px; }
    .invoice-bank { font-size: 10px; }
    .invoice-bank div { min-height: 17px; }
    .invoice-signature { margin-top: 8px; font-size: 10px; }
    .invoice-signature img { width: 62px; height: 155px; margin-bottom: -6px; }
    .invoice-footer { font-size: 8.5px; margin-top: 8px; }
    .receipt-print-shell { max-width: none; margin: 0; }
    .receipt-manual-sheet { width: 100%; min-height: 0; max-width: none; border: 0; box-shadow: none; padding: 0; }
    .receipt-head { grid-template-columns: 230px 1fr; gap: 14px; margin-bottom: 18px; }
    .receipt-head img { width: 230px; }
    .receipt-number { font-size: 11px; }
    .receipt-head h2 { font-size: 17px; margin-top: 10px; }
    .receipt-body { gap: 6px; }
    .receipt-line { grid-template-columns: 160px 1fr; min-height: 22px; }
    .receipt-line span { font-size: 11px; }
    .receipt-line strong { font-size: 11px; }
    .receipt-description strong { min-height: 44px; }
    .receipt-total-panel { width: 310px; margin-top: 20px; grid-template-columns: 100px 1fr; }
    .receipt-total-label { font-size: 22px; }
    .receipt-total-value { font-size: 14px; padding: 6px 10px; }
    .receipt-sign-area { grid-template-columns: 1fr 260px; gap: 24px; margin-top: 20px; }
    .receipt-party { min-height: 125px; gap: 14px; }
    .receipt-party strong, .receipt-company > span:first-child, .receipt-company strong:last-child { font-size: 10px; }
    .receipt-party span, .receipt-company span { font-size: 10px; }
    .receipt-company { min-height: 190px; }
    .receipt-company > strong:nth-child(2) { font-size: 12px; margin-top: 8px; }
    .receipt-company img { width: 58px; height: 145px; }
}
