:root{--background:#f4f6fa;--surface:#fff;--surface-soft:#f8fafc;--sidebar:#101828;--sidebar-soft:#1d2939;--text:#182230;--muted:#667085;--border:#e4e7ec;--primary:#2563eb;--primary-hover:#1d4ed8;--success:#15803d;--success-soft:#dcfce7;--warning:#b45309;--warning-soft:#fef3c7;--neutral-soft:#eef2f6;--danger:#dc2626;--shadow:0 18px 45px rgba(16,24,40,.1)}
*{box-sizing:border-box}html{min-height:100%}body{margin:0;min-height:100vh;background:var(--background);color:var(--text);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}button,input,select,textarea{font:inherit}button{cursor:pointer}button:disabled{cursor:not-allowed;opacity:.55}.hidden{display:none!important}
.app-shell{display:grid;grid-template-columns:245px minmax(0,1fr);min-height:100vh}.sidebar{position:sticky;top:0;height:100vh;display:flex;flex-direction:column;padding:26px 18px;background:var(--sidebar);color:#fff}.brand{display:flex;align-items:center;gap:12px;padding:0 8px 26px}.brand-mark{display:grid;place-items:center;width:42px;height:42px;border-radius:12px;background:var(--primary);font-size:1.2rem;font-weight:900}.brand h1,.brand p{margin:0}.brand h1{font-size:1rem;letter-spacing:.08em}.brand p{margin-top:2px;color:#98a2b3;font-size:.85rem}.sidebar-nav{display:flex;flex-direction:column;gap:7px}.nav-link{display:grid;grid-template-columns:24px 1fr;align-items:center;gap:8px;width:100%;padding:12px;border:0;border-radius:10px;background:transparent;color:#d0d5dd;text-align:left}.nav-link:hover,.nav-link.active{background:var(--sidebar-soft);color:#fff}.back-link{margin-top:auto;padding:12px;color:#98a2b3;text-decoration:none}.back-link:hover{color:#fff}
.main-content{min-width:0;padding:34px}.topbar{display:flex;align-items:center;justify-content:space-between;gap:24px;margin-bottom:24px}.topbar h2{margin:2px 0 0;font-size:clamp(1.7rem,3vw,2.25rem)}.eyebrow{margin:0;color:var(--muted);font-size:.76rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase}
.primary-button,.secondary-button,.text-button,.icon-button,.remove-item-button{border-radius:10px;font-weight:750}.primary-button{min-height:43px;padding:10px 17px;border:0;background:var(--primary);color:#fff}.primary-button:hover{background:var(--primary-hover)}.secondary-button{min-height:41px;padding:9px 15px;border:1px solid var(--border);background:#fff;color:var(--text)}.secondary-button:hover{background:var(--surface-soft)}.text-button{padding:0;border:0;background:transparent;color:var(--primary)}.text-button:hover{text-decoration:underline}.icon-button{width:39px;height:39px;border:0;background:var(--surface-soft);color:var(--muted);font-size:1.5rem}.icon-button:hover{background:var(--neutral-soft);color:var(--text)}
.message{margin-bottom:20px;padding:13px 15px;border-radius:10px;font-weight:650}.message.success{background:var(--success-soft);color:var(--success)}.message.error{background:#fee2e2;color:#b91c1c}.screen{display:none}.screen.active{display:block}
.summary-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px;margin-bottom:22px}.summary-card{padding:22px;border:1px solid var(--border);border-radius:14px;background:var(--surface);box-shadow:0 8px 24px rgba(16,24,40,.04)}.summary-card span{display:block;margin-bottom:8px;color:var(--muted);font-size:.88rem;font-weight:650}.summary-card strong{font-size:1.65rem}
.panel{overflow:hidden;border:1px solid var(--border);border-radius:15px;background:var(--surface);box-shadow:0 8px 24px rgba(16,24,40,.04)}.panel-header{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:22px;border-bottom:1px solid var(--border)}.panel-header h3,.panel-header p,.section-heading h3,.section-heading p{margin:0}.panel-header h3,.section-heading h3{margin-bottom:5px}.panel-header p,.section-heading p{color:var(--muted);font-size:.9rem}
.table-wrap{width:100%;overflow-x:auto}.data-table,.item-table{width:100%;border-collapse:collapse}.data-table th,.data-table td,.item-table th,.item-table td{padding:14px 16px;border-bottom:1px solid var(--border);text-align:left;vertical-align:middle}.data-table th,.item-table th{background:var(--surface-soft);color:var(--muted);font-size:.76rem;letter-spacing:.04em;text-transform:uppercase}.data-table tbody tr:last-child td,.item-table tbody tr:last-child td{border-bottom:0}.data-table tbody tr:hover{background:#fbfcfe}.empty-state{padding:46px!important;color:var(--muted);text-align:center!important}.invoice-number,.customer-name{font-weight:800}.customer-subtext{display:block;margin-top:2px;color:var(--muted);font-size:.82rem}
.status-badge{display:inline-flex;align-items:center;padding:5px 9px;border-radius:999px;font-size:.75rem;font-weight:800}.status-badge.draft{background:var(--neutral-soft);color:#475467}.status-badge.sent{background:var(--warning-soft);color:var(--warning)}.status-badge.paid{background:var(--success-soft);color:var(--success)}
.modal{position:fixed;inset:0;z-index:100;display:grid;place-items:center;padding:22px}.modal-backdrop{position:absolute;inset:0;background:rgba(16,24,40,.62);backdrop-filter:blur(3px)}.modal-card{position:relative;width:min(100%,760px);max-height:calc(100vh - 44px);overflow-y:auto;border-radius:17px;background:#fff;box-shadow:var(--shadow)}.invoice-modal-card{width:min(100%,1040px)}.customer-modal-card{width:min(100%,680px)}.modal-header,.modal-footer{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:21px 24px}.modal-header{border-bottom:1px solid var(--border)}.modal-header h2{margin:3px 0 0}.modal-footer{justify-content:flex-end;border-top:1px solid var(--border)}
form{margin:0}.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;padding:24px}.field{display:flex;flex-direction:column;gap:8px}.field-wide{grid-column:1/-1}.field label,.field-label-row label,.editable-total label{color:#344054;font-size:.86rem;font-weight:750}.field-label-row{display:flex;align-items:center;justify-content:space-between;gap:12px}input,select,textarea{width:100%;border:1px solid #d0d5dd;border-radius:9px;background:#fff;color:var(--text)}input,select{min-height:43px;padding:9px 11px}textarea{resize:vertical;padding:11px}input:focus,select:focus,textarea:focus{border-color:var(--primary);outline:3px solid rgba(37,99,235,.13)}
.items-section{padding:0 24px 24px}.section-heading{display:flex;align-items:center;justify-content:space-between;gap:18px;margin-bottom:13px}.item-table{min-width:720px;border:1px solid var(--border)}.item-table input{min-width:100px}.item-description{min-width:260px!important}.line-total{white-space:nowrap;font-weight:750}.remove-item-button{width:34px;height:34px;border:0;background:#fee2e2;color:var(--danger)}.remove-item-button:hover{background:#fecaca}
.invoice-bottom{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:26px;padding:0 24px 24px}.notes-field{align-self:start}.totals-card{overflow:hidden;border:1px solid var(--border);border-radius:12px}.totals-card>div{display:grid;grid-template-columns:1fr 140px;align-items:center;gap:16px;min-height:52px;padding:10px 15px;border-bottom:1px solid var(--border)}.totals-card>div:last-child{border-bottom:0}.totals-card strong,.totals-card input{text-align:right}.editable-total input{min-height:36px}.total-line{font-size:1.05rem;font-weight:800}.amount-due-line{background:#eff6ff;color:#1d4ed8;font-size:1.1rem;font-weight:850}
@media(max-width:900px){.app-shell{grid-template-columns:1fr}.sidebar{position:static;width:100%;height:auto;padding:16px}.brand{padding-bottom:14px}.sidebar-nav{flex-direction:row;overflow-x:auto}.nav-link{min-width:135px}.back-link{display:none}.main-content{padding:22px}.invoice-bottom{grid-template-columns:1fr}}
@media(max-width:680px){.main-content{padding:16px}.topbar{align-items:flex-start;flex-direction:column}.topbar .primary-button{width:100%}.summary-grid{grid-template-columns:1fr}.panel-header,.section-heading{align-items:flex-start;flex-direction:column}.panel-header button,.section-heading button{width:100%}.form-grid{grid-template-columns:1fr;padding:18px}.field-wide{grid-column:auto}.items-section,.invoice-bottom{padding-right:18px;padding-left:18px}.modal{padding:8px}.modal-card{max-height:calc(100vh - 16px)}.modal-header,.modal-footer{padding:17px 18px}.modal-footer{flex-direction:column-reverse}.modal-footer button{width:100%}.totals-card>div{grid-template-columns:1fr 120px}}
.invoice-row{cursor:pointer}.invoice-row:focus{outline:3px solid rgba(37,99,235,.18);outline-offset:-3px}.invoice-row:hover{background:#f8fbff!important}
.danger-button,.success-button{min-height:41px;padding:9px 15px;border:0;border-radius:10px;font-weight:750}.danger-button{background:#fee2e2;color:#b91c1c}.danger-button:hover{background:#fecaca}.success-button{background:var(--success);color:#fff}.success-button:hover{background:#166534}
.invoice-modal-footer{justify-content:space-between}.invoice-danger-actions,.invoice-primary-actions{display:flex;align-items:center;gap:10px}
@media(max-width:680px){.invoice-modal-footer,.invoice-danger-actions,.invoice-primary-actions{width:100%}.invoice-modal-footer{align-items:stretch}.invoice-primary-actions{flex-direction:column-reverse}.invoice-danger-actions button,.invoice-primary-actions button{width:100%}}

.customer-row{cursor:pointer;transition:background .15s ease}
.customer-row:hover,.customer-row:focus{background:#f8fafc;outline:none}
.customer-row:focus-visible{box-shadow:inset 0 0 0 2px var(--primary)}

.settings-panel{max-width:820px}.settings-footer{display:flex;justify-content:flex-end;padding:20px 24px;border-top:1px solid var(--border)}.field-help{margin:0;color:var(--muted);font-size:.8rem;line-height:1.45}.invoice-document-actions{display:flex;align-items:center;gap:10px;margin-left:auto;margin-right:10px}@media(max-width:900px){.invoice-modal-footer{flex-wrap:wrap}.invoice-document-actions{order:2;width:100%;margin:0}.invoice-document-actions button{flex:1}}@media(max-width:680px){.settings-footer{padding:17px 18px}.settings-footer button,.invoice-document-actions{width:100%}.invoice-document-actions{flex-direction:column}.invoice-document-actions button{width:100%}}
