:root{--navy:#082f4f;--green:#72bf2e;--bg:#f5f7f9;--border:#dce3e8;--text:#18303f;--muted:#667784;--white:#fff;--danger:#b42318}*{box-sizing:border-box}body{margin:0;font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;background:var(--bg);color:var(--text)}button,input,textarea,select{font:inherit}.topbar{position:sticky;top:0;z-index:10;background:#fff;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;padding:10px 4vw}.brand{display:flex;align-items:center;gap:10px}.brand img{width:52px;height:52px;object-fit:contain;border-radius:8px}.brand div{display:flex;flex-direction:column}.brand strong{color:var(--navy);font-size:18px}.brand span{font-size:12px;color:var(--muted)}nav{display:flex;gap:6px}.nav-btn,.secondary,.primary,.danger{border:0;border-radius:9px;padding:10px 14px;cursor:pointer}.nav-btn{background:transparent;color:var(--muted)}.nav-btn.active{background:#edf6e7;color:#315d17;font-weight:700}.primary{background:var(--navy);color:#fff;font-weight:700}.secondary{background:#fff;color:var(--navy);border:1px solid var(--border)}.danger{background:#fff0ef;color:var(--danger);border:1px solid #f3c9c5}main{max-width:1180px;margin:auto;padding:28px 20px 60px}.view{display:none}.view.active{display:block}.page-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px}.page-head h1{margin:0 0 5px;color:var(--navy)}.page-head p{margin:0;color:var(--muted)}.card{background:#fff;border:1px solid var(--border);border-radius:14px;padding:18px;margin-bottom:16px;box-shadow:0 1px 2px rgba(0,0,0,.02)}.form-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:14px}.wide{grid-column:1/-1}label{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:650;color:#405462}input,textarea,select{width:100%;border:1px solid #cdd8df;border-radius:9px;padding:10px 11px;background:#fff;color:#173042}textarea{resize:vertical}.notice{background:#fff8db;border:1px solid #f4dda0;color:#6a5310;padding:11px 13px;border-radius:10px;margin-bottom:14px}.card-title{display:flex;align-items:center;justify-content:space-between}.card-title h2,.help h2{margin:0;font-size:18px}.items-header,.item-row{display:grid;grid-template-columns:2.2fr .6fr .8fr .8fr 40px;gap:9px;align-items:end}.items-header{font-size:12px;color:var(--muted);padding:12px 4px 6px}.item-row{padding:8px 0;border-top:1px solid #eef2f4}.desc-wrap{display:grid;grid-template-columns:1fr 1fr;gap:7px}.line-total{padding:10px 4px;font-weight:750}.remove{border:0;background:#fff;color:#a33;font-size:20px;cursor:pointer}.totals-wrap{display:grid;grid-template-columns:1fr 380px;gap:16px}.notes-card{margin-bottom:0}.totals{margin-bottom:0}.totals div{display:flex;justify-content:space-between;padding:9px 0}.totals .grand{border-top:2px solid var(--navy);margin-top:8px;padding-top:14px;font-size:18px}.actions{display:flex;gap:10px;justify-content:flex-end;margin-top:18px;flex-wrap:wrap}.summary-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:16px}.metric{background:#fff;border:1px solid var(--border);border-radius:13px;padding:16px}.metric span{font-size:12px;color:var(--muted);display:block}.metric strong{display:block;font-size:23px;color:var(--navy);margin-top:5px}.filters{display:grid;grid-template-columns:220px 1fr auto;gap:12px;align-items:end}.table-scroll{overflow:auto}table{width:100%;border-collapse:collapse;min-width:900px}th,td{text-align:left;padding:11px 9px;border-bottom:1px solid #edf1f3;font-size:13px}th{font-size:11px;text-transform:uppercase;color:var(--muted)}td.num{text-align:right}.row-actions{display:flex;gap:6px}.row-actions button{padding:6px 8px;font-size:12px}.modal{display:none;position:fixed;inset:0;background:rgba(5,28,42,.55);z-index:30;padding:20px;overflow:auto}.modal.open{display:block}.modal-box{background:#fff;border-radius:16px;max-width:850px;margin:30px auto;padding:26px;position:relative}.close{position:absolute;right:14px;top:10px;border:0;background:transparent;font-size:28px;cursor:pointer}.inv-preview{color:#263845}.inv-preview-head{display:flex;justify-content:space-between;gap:20px;border-bottom:2px solid var(--navy);padding-bottom:18px}.inv-preview-head img{width:150px}.inv-company{text-align:right;font-size:13px}.inv-title{display:flex;justify-content:space-between;margin:24px 0}.inv-title h2{font-size:30px;color:var(--navy);margin:0}.inv-table{width:100%;min-width:0}.inv-table th{background:#f2f6f8}.inv-summary{margin-left:auto;width:330px;margin-top:20px}.inv-summary div{display:flex;justify-content:space-between;padding:6px}.inv-summary .grand{font-weight:800;border-top:2px solid var(--navy);font-size:18px}.inv-footer{margin-top:28px;padding-top:16px;border-top:1px solid var(--border);font-size:13px}#toast{position:fixed;right:18px;bottom:18px;background:#0f5132;color:#fff;padding:11px 14px;border-radius:9px;opacity:0;transform:translateY(8px);transition:.2s;z-index:50}#toast.show{opacity:1;transform:none}code{background:#eff3f5;padding:2px 5px;border-radius:5px}@media(max-width:760px){.topbar{align-items:flex-start;gap:8px;padding:10px 12px}.brand img{width:42px;height:42px}.brand span{display:none}nav{overflow:auto}.nav-btn{white-space:nowrap;padding:9px}.form-grid{grid-template-columns:1fr}.wide{grid-column:auto}.items-header{display:none}.item-row{grid-template-columns:1fr 70px 1fr 1fr 34px;align-items:end}.desc-wrap{grid-column:1/-1}.totals-wrap{grid-template-columns:1fr}.summary-grid{grid-template-columns:repeat(2,1fr)}.filters{grid-template-columns:1fr}.actions>*{flex:1}.inv-preview-head{flex-direction:column}.inv-company{text-align:left}.inv-summary{width:100%}}
.settings-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.settings-grid .card{margin-bottom:0}.compact{margin-top:14px}.hint{color:var(--muted);font-size:13px;margin:7px 0 14px}.settings-row{display:grid;gap:10px;align-items:end;padding:10px 0;border-top:1px solid #eef2f4}.settings-row:first-child{border-top:0}.bank-row{grid-template-columns:1.2fr 1.2fr 110px auto}.product-row{grid-template-columns:2fr 1fr auto}.default-check{display:flex;flex-direction:row;align-items:center;gap:7px;padding-bottom:10px}.default-check input{width:auto}.settings-logo-preview{width:160px;height:90px;object-fit:contain;border:1px solid var(--border);border-radius:10px;background:#fff}.logo-preview-wrap{display:flex;align-items:center;gap:12px;flex-wrap:wrap}small{font-weight:400;color:var(--muted)}.template-minimal .inv-preview-head{border-bottom:1px solid var(--border)}.template-minimal .inv-table th{background:#fff;border-bottom:2px solid var(--navy)}.template-modern .inv-title{background:#f5f7f9;padding:18px;border-radius:12px}@media(max-width:900px){.settings-grid{grid-template-columns:1fr}}@media(max-width:760px){.bank-row,.product-row{grid-template-columns:1fr}.default-check{padding-bottom:0}.settings-row .danger{justify-self:start}}

.design-preview-panel{margin-top:18px;border-top:1px solid var(--border);padding-top:16px}.preview-panel-head{display:flex;justify-content:space-between;gap:10px;align-items:baseline;margin-bottom:10px}.preview-panel-head span{font-size:12px;color:var(--muted)}#settingsInvoicePreview{background:#eef2f4;border-radius:12px;padding:12px;overflow:auto}.settings-invoice-preview{--preview-primary:#082f4f;--preview-accent:#72bf2e;background:#fff;color:#263845;min-width:570px;padding:18px;border-radius:8px;box-shadow:0 2px 10px rgba(20,45,60,.08);font-size:10px}.preview-top{display:flex;justify-content:space-between;gap:18px;border-bottom:3px solid var(--preview-primary);padding-bottom:12px}.preview-top img{width:95px;height:58px;object-fit:contain}.preview-company{text-align:right;display:flex;flex-direction:column;gap:2px}.preview-company strong{color:var(--preview-primary);font-size:12px}.preview-title{display:flex;justify-content:space-between;gap:20px;margin:16px 0 8px}.preview-title>div{display:flex;flex-direction:column;gap:2px}.preview-title>div:last-child{text-align:right}.preview-title h3{margin:0;color:var(--preview-primary);font-size:23px;letter-spacing:.5px}.preview-date{color:#667784;margin-bottom:10px}.settings-invoice-preview table{min-width:0;font-size:9px}.settings-invoice-preview th,.settings-invoice-preview td{padding:6px}.settings-invoice-preview th{background:var(--preview-primary);color:#fff}.settings-invoice-preview th:nth-child(n+2),.settings-invoice-preview td:nth-child(n+2){text-align:right}.preview-totals{width:220px;margin:10px 0 0 auto;display:flex;flex-direction:column;gap:5px}.preview-totals span{display:flex;justify-content:space-between}.preview-grand{border-top:2px solid var(--preview-primary);padding-top:6px;color:var(--preview-primary);font-size:12px}.preview-payment{margin-top:14px;border-top:1px solid #e3e8eb;padding-top:9px}.preview-minimal{box-shadow:none;border:1px solid #e7ecef}.preview-minimal .preview-top{border-bottom:1px solid #dce3e8}.preview-minimal th{background:#fff;color:var(--preview-primary);border-bottom:2px solid var(--preview-primary)}.preview-minimal .preview-title h3{font-weight:500}.preview-modern .preview-title{background:linear-gradient(90deg,var(--preview-primary),var(--preview-accent));color:#fff;padding:12px;border-radius:8px}.preview-modern .preview-title h3{color:#fff}.preview-modern .preview-title span,.preview-modern .preview-title strong{color:#fff}.preview-modern th{background:var(--preview-primary)}.preview-modern .preview-grand{border-color:var(--preview-accent)}@media(max-width:760px){.preview-panel-head{align-items:flex-start;flex-direction:column}#settingsInvoicePreview{margin-left:-4px;margin-right:-4px}}

/* Pastel invoice templates */
.preview-pastel-cute,.template-pastel-cute{border-radius:18px!important;background:linear-gradient(180deg,#fff 0%,#fffafd 100%)}
.preview-pastel-cute .preview-top,.template-pastel-cute .inv-preview-head{border-bottom:0!important;background:color-mix(in srgb,var(--preview-accent,#f4c9d9) 38%,white);padding:14px;border-radius:14px}
.preview-pastel-cute .preview-title,.template-pastel-cute .inv-title{background:color-mix(in srgb,var(--preview-primary,#9f6f86) 9%,white);padding:12px;border-radius:14px}
.preview-pastel-cute th{background:color-mix(in srgb,var(--preview-primary) 78%,white)!important;border:0}.preview-pastel-cute table{border-radius:10px;overflow:hidden}
.preview-pastel-cute .preview-grand{background:color-mix(in srgb,var(--preview-accent) 28%,white);padding:7px;border:0;border-radius:9px}
.preview-pastel-elegant,.template-pastel-elegant{background:#fff;border-top:10px solid var(--preview-accent,#ddd2f2)!important}
.preview-pastel-elegant .preview-top{border-bottom:1px solid var(--preview-accent)}.preview-pastel-elegant .preview-title h3{font-family:Georgia,serif;font-weight:500;letter-spacing:2px}.preview-pastel-elegant th{background:color-mix(in srgb,var(--preview-primary) 70%,white)!important}.preview-pastel-elegant .preview-grand{border-color:var(--preview-accent)}
.template-pastel-cute .inv-title{background:#fff5fa}.template-pastel-cute .inv-table th{background:#f6dce7;color:#68485a}.template-pastel-elegant .inv-preview-head{border-bottom:1px solid #e8dcec}.template-pastel-elegant .inv-title h2{font-family:Georgia,serif;letter-spacing:2px}

/* Reporting module */
.report-controls{display:flex;justify-content:space-between;align-items:end;gap:18px;flex-wrap:wrap}.quick-ranges{display:flex;gap:8px;flex-wrap:wrap}.report-date-grid{display:grid;grid-template-columns:170px 170px auto;gap:10px;align-items:end}.chart-wrap{height:360px;position:relative;margin-top:10px}.chart-wrap canvas{max-height:360px}.row-actions{flex-wrap:wrap}.row-actions .secondary,.row-actions .danger{white-space:nowrap}
@media(max-width:760px){.report-controls{align-items:stretch}.quick-ranges{display:grid;grid-template-columns:1fr 1fr;width:100%}.report-date-grid{grid-template-columns:1fr 1fr}.report-date-grid button{grid-column:1/-1}.chart-wrap{height:300px}.row-actions{min-width:190px}}

/* v7 invoice options, recurring controls and interaction feedback */
button{transition:transform .12s ease,box-shadow .12s ease,filter .12s ease,background-color .12s ease}
button:hover{filter:brightness(.985)}
button.pressed,button:active{transform:translateY(1px) scale(.97);box-shadow:inset 0 2px 5px rgba(0,0,0,.12)}
button.clicked{box-shadow:0 0 0 3px rgba(114,191,46,.22);filter:saturate(1.08)}
.invoice-options-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:18px}
.invoice-options-grid>div{padding:2px 4px}.invoice-options-grid h2{font-size:16px;margin:0 0 10px;color:var(--navy)}
.option-fields{display:grid;grid-template-columns:1fr 1fr;gap:10px}.tick-option{display:flex;flex-direction:row;align-items:center;gap:8px;cursor:pointer}.tick-option input{width:18px;height:18px}.balance-due{border-top:1px solid var(--border);font-size:16px;font-weight:800;color:var(--navy)}
.inv-summary .balance{font-weight:800;color:var(--navy);border-top:1px solid var(--border)}
.invoice-email{display:flex;gap:6px;margin-bottom:7px;min-width:250px}.invoice-email input{padding:7px 8px;font-size:12px;min-width:170px}.invoice-email button{padding:7px 9px;font-size:12px}.badge{display:inline-block;margin-top:4px;margin-left:6px;padding:2px 6px;border-radius:999px;background:#edf6e7;color:#315d17;font-size:10px;text-transform:capitalize}.table-card td small{display:block;color:var(--muted);margin-top:3px}
@media(max-width:900px){.invoice-options-grid{grid-template-columns:1fr 1fr}}
@media(max-width:760px){.invoice-options-grid{grid-template-columns:1fr}.option-fields{grid-template-columns:1fr}.invoice-email{min-width:220px}}


/* v9 mobile-first polish for iOS + Android */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{min-height:100dvh;-webkit-tap-highlight-color:transparent}
button,input,textarea,select{touch-action:manipulation}
button{min-height:44px}
input,textarea,select{min-height:44px}

@media(max-width:760px){
  body{padding-bottom:calc(76px + env(safe-area-inset-bottom));background:#f5f7f9}
  .topbar{position:sticky;top:0;z-index:20;display:block;padding:8px 14px calc(8px + env(safe-area-inset-top));box-shadow:0 1px 8px rgba(8,47,79,.07)}
  .brand{justify-content:flex-start;min-width:0}
  .brand img{width:42px;height:42px;flex:0 0 42px}
  .brand div{min-width:0}
  .brand strong{font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:calc(100vw - 90px)}
  .brand span{display:block;font-size:11px}
  nav{position:fixed;left:0;right:0;bottom:0;z-index:40;background:rgba(255,255,255,.97);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border-top:1px solid var(--border);display:grid;grid-template-columns:repeat(4,1fr);gap:0;padding:6px 6px calc(6px + env(safe-area-inset-bottom));box-shadow:0 -4px 18px rgba(8,47,79,.08);overflow:visible}
  .nav-btn{min-height:52px;border-radius:12px;padding:6px 4px;font-size:11px;line-height:1.15;display:flex;align-items:center;justify-content:center;text-align:center;white-space:normal}
  .nav-btn.active{background:color-mix(in srgb,var(--green) 14%,white);color:var(--navy)}
  main{padding:18px 12px 36px;max-width:none}
  .page-head{align-items:flex-start;gap:12px;margin-bottom:14px}
  .page-head h1{font-size:24px;line-height:1.15}
  .page-head p{font-size:13px;line-height:1.4}
  .page-head>.secondary{flex:0 0 auto;padding:10px 12px}
  .card{border-radius:14px;padding:14px;margin-bottom:12px}
  .form-grid{gap:11px}
  label{font-size:12px;gap:5px}
  input,textarea,select{font-size:16px!important;padding:11px 12px;border-radius:10px}
  textarea{line-height:1.35}
  .card-title{gap:10px;align-items:center}
  .card-title h2,.help h2{font-size:16px}
  .card-title button{padding:9px 11px;white-space:nowrap}

  /* Invoice item entry becomes a thumb-friendly two-column card */
  .item-row{position:relative;grid-template-columns:1fr 1fr;gap:9px;padding:14px 38px 14px 0;border-top:1px solid #e9eef1}
  .item-row:first-of-type{border-top:0}
  .desc-wrap{grid-column:1/-1;display:grid;grid-template-columns:1fr;gap:8px}
  .item-row>input[data-k="qty"]{grid-column:1}
  .item-row>input[data-k="unit_price"]{grid-column:2}
  .line-total{grid-column:1/-1;background:#f6f8fa;border-radius:9px;padding:10px 12px;text-align:right;font-size:15px}
  .line-total:before{content:"Line total  ";font-size:11px;color:var(--muted);font-weight:600;float:left;padding-top:2px}
  .remove{position:absolute;right:0;top:13px;width:34px;height:34px;min-height:34px;border-radius:50%;background:#fff0ef;font-size:22px}

  .invoice-options-grid{gap:10px}
  .invoice-options-grid>div{border-bottom:1px solid #edf1f3;padding:4px 0 12px}
  .invoice-options-grid>div:last-child{border-bottom:0;padding-bottom:0}
  .tick-option{min-height:44px;padding:7px 0}
  .tick-option input{width:22px;height:22px;min-height:22px}
  .totals{font-size:14px}
  .totals div{padding:10px 0}
  .totals .grand,.balance-due{font-size:18px}

  /* Keep primary invoice actions reachable without covering the bottom nav */
  #view-create>.actions{position:sticky;bottom:calc(66px + env(safe-area-inset-bottom));z-index:15;background:rgba(245,247,249,.96);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);padding:9px 0 4px;margin-top:10px;display:grid;grid-template-columns:1fr 1fr}
  #view-create>.actions #emailInvoice{grid-column:1/-1}
  #view-create>.actions button{min-height:48px}

  .summary-grid{gap:8px;margin-bottom:12px}
  .metric{padding:12px;border-radius:12px}
  .metric strong{font-size:19px}
  .filters{gap:9px}

  /* My Invoices: rows become cards instead of a tiny desktop table */
  .invoice-list-card{padding:0;background:transparent;border:0;box-shadow:none}
  .invoice-list-card .table-scroll{overflow:visible}
  .invoice-list-card table,.invoice-list-card tbody,.invoice-list-card tr,.invoice-list-card td{display:block;width:100%;min-width:0}
  .invoice-list-card thead{display:none}
  .invoice-list-card tr{background:#fff;border:1px solid var(--border);border-radius:14px;padding:12px 13px;margin-bottom:10px;box-shadow:0 1px 2px rgba(0,0,0,.02)}
  .invoice-list-card td{border:0;padding:5px 0;font-size:13px;display:grid;grid-template-columns:92px 1fr;gap:8px;align-items:start}
  .invoice-list-card td:before{font-size:11px;color:var(--muted);font-weight:700;text-transform:uppercase;letter-spacing:.02em}
  .invoice-list-card td:nth-child(1):before{content:"Date"}.invoice-list-card td:nth-child(2):before{content:"Invoice"}.invoice-list-card td:nth-child(3):before{content:"Customer"}.invoice-list-card td:nth-child(4):before{content:"Address"}.invoice-list-card td:nth-child(5):before{content:"Excl GST"}.invoice-list-card td:nth-child(6):before{content:"GST"}.invoice-list-card td:nth-child(7):before{content:"Total"}.invoice-list-card td:nth-child(8):before{content:"Actions"}
  .invoice-list-card td:nth-child(8){display:block;border-top:1px solid #edf1f3;margin-top:7px;padding-top:11px}
  .invoice-list-card td:nth-child(8):before{display:block;margin-bottom:7px}
  .invoice-email{min-width:0;width:100%;display:grid;grid-template-columns:1fr auto;gap:7px}
  .invoice-email input{min-width:0;width:100%;font-size:16px!important}
  .invoice-email button{min-width:68px}
  .row-actions{display:grid;grid-template-columns:repeat(2,1fr);gap:7px;min-width:0!important}
  .row-actions button{min-height:42px;font-size:13px}

  /* Reports stay scrollable but are easier to use */
  .quick-ranges button{min-height:46px}
  .report-date-grid{grid-template-columns:1fr 1fr}
  .report-date-grid button{min-height:48px}
  .chart-wrap{height:280px;margin-left:-8px;margin-right:-4px}
  #view-reports .table-scroll{-webkit-overflow-scrolling:touch}
  #view-reports table{min-width:720px}

  /* Settings and preview */
  .settings-logo-preview{width:125px;height:76px}
  .logo-preview-wrap{align-items:flex-start}
  .design-preview-panel{margin-top:14px}
  #settingsInvoicePreview{padding:8px;overflow:auto;-webkit-overflow-scrolling:touch}
  .settings-invoice-preview{min-width:520px;transform-origin:top left}
  .bank-row,.product-row{gap:8px;padding:12px 0}
  .settings-row .danger{width:100%}
  #view-settings>.actions{padding-bottom:8px}
  #view-settings>.actions button{width:100%;min-height:50px}

  /* Modal/PDF preview mobile sheet */
  .modal{padding:0;align-items:flex-end}
  .modal.open{display:flex}
  .modal-box{width:100%;max-width:none;max-height:92dvh;overflow:auto;margin:auto 0 0;border-radius:18px 18px 0 0;padding:42px 14px 24px;overscroll-behavior:contain}
  .close{position:sticky;float:right;top:4px;right:2px;width:42px;height:42px;min-height:42px;border-radius:50%;background:#f1f4f6;z-index:3}
  .inv-preview{font-size:12px;overflow-x:auto}
  .inv-preview-head img{width:105px}
  .inv-title{gap:12px;flex-direction:column;margin:16px 0}
  .inv-title h2{font-size:24px}
  .inv-table{min-width:520px}
  .inv-summary{width:100%;font-size:13px}
  #toast{left:12px;right:12px;bottom:calc(82px + env(safe-area-inset-bottom));text-align:center;border-radius:12px}
}

@media(max-width:390px){
  main{padding-left:9px;padding-right:9px}
  .brand strong{max-width:calc(100vw - 82px)}
  .page-head{flex-direction:column}
  .page-head>.secondary{width:100%}
  .summary-grid{grid-template-columns:1fr 1fr}
  .metric{padding:10px}.metric strong{font-size:17px}
  .invoice-list-card td{grid-template-columns:80px 1fr}
  .quick-ranges{grid-template-columns:1fr 1fr}
}


/* v11 My Customers */
.head-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}.customer-pick{display:grid;grid-template-columns:1fr auto;gap:7px}.mini-btn{padding:8px 10px;min-height:44px;white-space:nowrap}.customer-number-pill{display:inline-block;padding:4px 9px;border-radius:999px;background:#eef4f7;color:var(--navy);font-size:12px;font-weight:800}.customer-list-card small,.contact-card small,.history-row small{display:block;color:var(--muted);margin-top:3px}.birthday-highlight{background:#fff1f5!important;color:#9b2556!important;font-weight:800;border-radius:8px;padding:5px 7px!important}.customer-modal-box{max-width:920px}.small-modal{max-width:560px}.modal-head,.profile-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:16px}.section-space{margin-top:22px}.contact-card{border:1px solid var(--border);border-radius:12px;padding:12px;margin:10px 0;background:#fbfcfd}.billing-contact-card{box-shadow:inset 3px 0 0 var(--green)}.contact-card-head{display:grid;grid-template-columns:1fr auto auto;align-items:center;gap:10px;margin-bottom:10px}.billing-check{display:flex;flex-direction:row;align-items:center;gap:6px}.billing-check input{min-height:auto;width:18px;height:18px}.custom-field-row,.category-row{display:grid;grid-template-columns:1fr 1fr auto;gap:8px;margin:8px 0;align-items:center}.category-row{grid-template-columns:1fr auto}.profile-grid{display:grid;grid-template-columns:2fr 1fr;gap:12px;margin:14px 0}.profile-grid>div,.custom-profile>div{background:#f7f9fa;border-radius:10px;padding:11px}.profile-grid p{margin:5px 0}.contacts-profile{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}.custom-profile{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}.custom-profile div{display:flex;justify-content:space-between;gap:10px}.customer-invoice-history{display:grid;gap:8px}.history-row{border:1px solid var(--border);border-radius:10px;padding:10px;display:flex;align-items:center;justify-content:space-between;gap:10px}.history-row .row-actions{display:flex}.customer-filters{grid-template-columns:2fr 1fr auto}
@media(max-width:760px){nav{grid-template-columns:repeat(5,1fr)}.nav-btn{font-size:10px;padding:5px 2px}.head-actions{width:100%;display:grid;grid-template-columns:1fr 1fr}.head-actions .primary{grid-column:1/-1}.customer-filters{display:grid;grid-template-columns:1fr}.customer-list-card{padding:0;background:transparent;border:0;box-shadow:none}.customer-list-card .table-scroll{overflow:visible}.customer-list-card table,.customer-list-card tbody,.customer-list-card tr,.customer-list-card td{display:block;width:100%;min-width:0}.customer-list-card thead{display:none}.customer-list-card tr{background:#fff;border:1px solid var(--border);border-radius:14px;padding:12px;margin-bottom:10px}.customer-list-card td{border:0;padding:4px 0;display:grid;grid-template-columns:92px 1fr;gap:8px}.customer-list-card td:before{font-size:10px;text-transform:uppercase;color:var(--muted);font-weight:800}.customer-list-card td:nth-child(1):before{content:'Customer #'}.customer-list-card td:nth-child(2):before{content:'Customer'}.customer-list-card td:nth-child(3):before{content:'Category'}.customer-list-card td:nth-child(4):before{content:'Address'}.customer-list-card td:nth-child(5):before{content:'Billing contact'}.customer-list-card td:nth-child(6):before{content:'Phone / Mobile'}.customer-list-card td:nth-child(7):before{content:'Email'}.customer-list-card td:nth-child(8):before{content:'DOB'}.customer-list-card td:nth-child(9){display:block;border-top:1px solid var(--border);margin-top:8px;padding-top:9px}.customer-list-card td:nth-child(9):before{content:'Actions';display:block;margin-bottom:6px}.customer-list-card .row-actions{display:grid;grid-template-columns:1fr 1fr}.contacts-profile,.custom-profile,.profile-grid{grid-template-columns:1fr}.history-row{display:block}.history-row .row-actions{display:grid;grid-template-columns:1fr 1fr;margin-top:8px}.custom-field-row{grid-template-columns:1fr auto}.custom-field-row input:nth-child(2){grid-column:1}.contact-card-head{grid-template-columns:1fr auto}.contact-card-head .billing-check{grid-row:2;grid-column:1/-1}.customer-modal-box{max-height:94dvh}}

/* v16 email delivery status */
.send-unsent,.send-sent{border:0;border-radius:9px;padding:7px 11px;font-weight:700;cursor:pointer;transition:.15s}
.send-unsent{background:#fff0ef;color:#b42318;border:1px solid #f0b9b4}
.send-sent{background:#e7f7ea;color:#176b2c;border:1px solid #9dd7aa}
.send-unsent:hover{background:#ffe5e2}.send-sent:hover{background:#d9f1df}
.send-unsent:disabled,.send-sent:disabled{opacity:.65;cursor:wait}
.email-status-text{display:block;margin:-2px 0 7px 2px;font-size:10px;line-height:1.35}
.email-status-text.is-sent{color:#176b2c}.email-status-text.is-unsent{color:#9b3a32}

/* ============================================================
   v17 PROFESSIONAL UI REFRESH
   Visual-only refresh inspired by modern accounting dashboards.
   Business logic/workflows are intentionally unchanged.
   ============================================================ */
:root{
  --navy:#123f63;
  --blue:#1976bd;
  --blue-dark:#125f99;
  --blue-soft:#eaf4fb;
  --green:#62b52f;
  --bg:#f2f5f7;
  --surface:#ffffff;
  --border:#d7e0e6;
  --border-soft:#e9eef2;
  --text:#20313d;
  --muted:#6c7b86;
  --danger:#c53d34;
  --shadow:0 2px 10px rgba(30,55,70,.07);
  --shadow-hover:0 8px 22px rgba(30,55,70,.10);
}
body{background:var(--bg);color:var(--text)}

/* Desktop application bar */
.topbar{
  background:linear-gradient(180deg,#1b7fc4 0%,#1875b8 100%);
  border-bottom:0;
  min-height:68px;
  padding:0 3.5vw;
  box-shadow:0 2px 8px rgba(18,63,99,.18);
}
.brand{gap:12px;min-width:290px}
.brand img{
  width:44px;height:44px;border-radius:9px;
  border:1px solid rgba(255,255,255,.45);
  box-shadow:0 1px 4px rgba(0,0,0,.15);
  background:#fff;
}
.brand strong{color:#fff;font-size:17px;font-weight:750;letter-spacing:.01em}
.brand span{color:rgba(255,255,255,.78);font-size:11px;letter-spacing:.04em;text-transform:uppercase}
nav{align-self:stretch;gap:0}
.nav-btn{
  position:relative;border-radius:0;padding:0 17px;min-height:68px;
  color:rgba(255,255,255,.88);font-size:13px;font-weight:650;
  transition:background .16s,color .16s;
}
.nav-btn:hover{background:rgba(255,255,255,.09);color:#fff}
.nav-btn.active{background:rgba(0,0,0,.08);color:#fff;font-weight:750}
.nav-btn.active:after{
  content:"";position:absolute;left:14px;right:14px;bottom:0;height:4px;
  background:#fff;border-radius:4px 4px 0 0;
}

main{max-width:1260px;padding:32px 24px 72px}
.page-head{margin-bottom:20px;border-bottom:1px solid var(--border);padding-bottom:17px}
.page-head h1{font-size:25px;font-weight:700;letter-spacing:-.02em;color:#173f5c}
.page-head p{font-size:13px;color:var(--muted)}

/* Cards and panels */
.card{
  border:1px solid var(--border);border-radius:5px;padding:20px;margin-bottom:18px;
  box-shadow:var(--shadow);background:var(--surface);
}
.card:hover{border-color:#ced9df}
.card-title{min-height:34px;padding-bottom:8px}
.card-title h2,.help h2,.card>h2{color:#233b4b;font-size:16px;font-weight:720}

/* Fields */
label{font-size:12px;color:#536672;font-weight:700;letter-spacing:.005em}
input,textarea,select{
  border:1px solid #c9d4db;border-radius:4px;padding:10px 11px;background:#fff;
  color:#213643;box-shadow:inset 0 1px 1px rgba(18,63,99,.025);
  transition:border-color .15s,box-shadow .15s;
}
input:hover,textarea:hover,select:hover{border-color:#9fb4c1}
input:focus,textarea:focus,select:focus{
  outline:0;border-color:var(--blue);box-shadow:0 0 0 3px rgba(25,118,189,.13)
}
input[readonly]{background:#f5f7f8;color:#5d6c76}

/* Buttons */
.nav-btn,.secondary,.primary,.danger,.send-unsent,.send-sent{transition:all .16s ease}
.primary{
  background:linear-gradient(180deg,#2184c8,#1672b5);color:#fff;border:1px solid #12649f;
  border-radius:4px;font-weight:700;box-shadow:0 1px 2px rgba(18,63,99,.16)
}
.primary:hover{background:linear-gradient(180deg,#187abc,#1268a5);box-shadow:0 3px 9px rgba(18,63,99,.18)}
.secondary{
  background:#fff;color:#31546b;border:1px solid #c7d3da;border-radius:4px;font-weight:650
}
.secondary:hover{background:#f5f8fa;border-color:#aebfc9;color:#173f5c}
.danger{border-radius:4px}

.notice{border-radius:4px;background:#fff9e8;border-color:#efdca2;border-left:4px solid #e2bb43}

/* KPI tiles — lighter, accounting-dashboard feel */
.summary-grid{gap:14px;margin-bottom:18px}
.metric{
  position:relative;border-radius:5px;border:1px solid var(--border);padding:18px 18px 16px;
  box-shadow:var(--shadow);overflow:hidden
}
.metric:before{content:"";position:absolute;left:0;right:0;top:0;height:3px;background:#58a9da}
.metric span{text-transform:uppercase;letter-spacing:.055em;font-size:10px;font-weight:750;color:#788791}
.metric strong{font-size:25px;letter-spacing:-.025em;color:#20394a;margin-top:7px;font-weight:730}

/* Tables */
.table-card{padding:0;overflow:hidden}
.table-scroll{background:#fff}
table{background:#fff}
th{
  background:#f6f8f9;color:#667783;font-size:10px;font-weight:800;letter-spacing:.045em;
  border-bottom:1px solid #dbe3e8;padding:12px 11px
}
td{padding:13px 11px;border-bottom:1px solid #e9eef1;color:#2e424f}
tbody tr{transition:background .12s}
tbody tr:hover{background:#f8fbfd}
tbody tr:last-child td{border-bottom:0}
.row-actions button{border-radius:4px}
.invoice-email input{border-radius:4px}

/* Invoice creation — clearer visual hierarchy */
#view-create>.card.form-grid{border-top:3px solid #5ea8d6}
#view-create>.card:nth-of-type(3){border-top:3px solid #7cb860}
.items-header{
  background:#f6f8f9;border:1px solid var(--border-soft);border-radius:4px 4px 0 0;
  padding:9px 8px;text-transform:uppercase;letter-spacing:.04em;font-size:10px;font-weight:800
}
.item-row{padding:11px 6px}
.line-total{color:#243f51}
.totals{border-top:3px solid #287eb7}
.totals .grand{border-top:1px solid #a9bcc8;color:#173f5c;font-size:19px}
.balance-due{background:#f1f7fb;margin:7px -10px -8px;padding:12px 10px!important;border-radius:4px;color:#143f5d}

/* Filters / report controls */
.filters,.report-controls{background:#fbfcfd}
.quick-ranges{gap:8px}
.report-range{font-size:12px}
.chart-wrap{padding-top:8px}

/* Customer/profile surfaces */
.contact-card,.history-row{border-radius:5px;background:#fbfcfd}
.billing-contact-card{box-shadow:inset 4px 0 0 var(--green)}
.customer-number-pill{background:var(--blue-soft);color:#17679d}
.profile-grid>div,.custom-profile>div{background:#f4f7f9;border:1px solid #e4eaee;border-radius:5px}

/* Modal */
.modal{background:rgba(15,39,55,.58);backdrop-filter:blur(2px)}
.modal-box{border-radius:7px;box-shadow:0 24px 60px rgba(9,32,47,.24);border:1px solid rgba(255,255,255,.5)}
.close{color:#51636f}

/* Delivery status keeps user-requested red/green semantics */
.send-unsent{border-radius:4px;background:#fff1f0;color:#b6342c;border-color:#edb7b2}
.send-sent{border-radius:4px;background:#e9f7eb;color:#216d32;border-color:#a9d9b3}
.send-unsent:hover{background:#ffe5e2}.send-sent:hover{background:#dbf1df}

/* Toast */
#toast{border-radius:5px;box-shadow:0 8px 28px rgba(8,47,79,.2);padding:12px 16px}

/* Settings */
.settings-grid .card{height:100%}
.design-preview-panel{background:#f7f9fa;border:1px solid #e2e8ec;border-radius:5px;padding:14px;margin-top:18px}
#settingsInvoicePreview{border-radius:4px;background:#e9eef1}
.settings-logo-preview{border-radius:5px}

@media(max-width:980px) and (min-width:761px){
  .topbar{padding:0 18px}.brand{min-width:230px}.nav-btn{padding:0 11px;font-size:12px}
  main{padding-left:18px;padding-right:18px}
}

/* Mobile app treatment */
@media(max-width:760px){
  body{background:#f1f4f6;padding-bottom:calc(76px + env(safe-area-inset-bottom))}
  .topbar{
    display:flex;align-items:center;min-height:64px;padding:8px 12px calc(8px + env(safe-area-inset-top));
    background:linear-gradient(180deg,#1b7fc4,#1875b8);box-shadow:0 2px 8px rgba(18,63,99,.18)
  }
  .brand{min-width:0;gap:9px}.brand img{width:40px;height:40px;flex-basis:40px}.brand strong{font-size:15px;color:#fff}.brand span{display:block;color:rgba(255,255,255,.75);font-size:9px}
  nav{
    background:rgba(255,255,255,.98);border-top:1px solid #d6e0e6;
    box-shadow:0 -5px 18px rgba(28,57,73,.10);padding:5px 5px calc(5px + env(safe-area-inset-bottom));
    grid-template-columns:repeat(5,1fr)
  }
  .nav-btn{
    min-height:54px;color:#61727d!important;background:transparent!important;border-radius:6px!important;
    font-size:10px!important;font-weight:700;padding:5px 2px!important
  }
  .nav-btn.active{color:#176fae!important;background:#edf6fc!important}
  .nav-btn.active:after{left:22%;right:22%;bottom:2px;height:3px;background:#1976bd;border-radius:4px}
  main{padding:18px 10px 38px}
  .page-head{border-bottom:0;padding-bottom:0;margin-bottom:14px}.page-head h1{font-size:23px}.page-head p{font-size:12px}
  .card{border-radius:7px;padding:14px;box-shadow:0 2px 8px rgba(30,55,70,.055)}
  .metric{border-radius:7px;padding:13px}.metric strong{font-size:19px}.metric:before{height:3px}
  input,textarea,select{border-radius:5px!important}
  .primary,.secondary,.danger{border-radius:5px}
  .invoice-list-card tr,.customer-list-card tr{border-radius:7px;box-shadow:0 2px 8px rgba(30,55,70,.055)}
  #view-create>.actions{
    background:rgba(241,244,246,.95);border-top:1px solid rgba(203,215,222,.8);padding:9px 0 5px
  }
  .modal-box{border-radius:14px 14px 0 0}
  .balance-due{margin-left:-6px;margin-right:-6px}
}


/* v19: product/service picker — always shows the full configured list while preserving free-text descriptions */
.product-picker{position:relative;min-width:0}
.product-picker>input{padding-right:42px}
.product-picker-toggle{position:absolute;right:1px;top:1px;bottom:1px;width:38px;border:0;border-left:1px solid #d8e0e5;background:#f8fafb;color:#3f5666;font-size:18px;line-height:1;cursor:pointer;border-radius:0 4px 4px 0}
.product-picker-toggle:hover,.product-picker-toggle:focus{background:#edf4f8;color:#173f5c;outline:none}
.product-picker-menu{display:none;position:absolute;z-index:45;left:0;right:0;top:calc(100% + 5px);max-height:260px;overflow:auto;background:#fff;border:1px solid #cbd7de;border-radius:5px;box-shadow:0 12px 28px rgba(21,52,72,.16);padding:5px}
.product-picker-menu.open{display:block}
.product-picker-option{width:100%;display:flex;align-items:center;justify-content:space-between;gap:14px;border:0;background:#fff;color:#263f50;text-align:left;padding:10px 11px;border-radius:4px;cursor:pointer}
.product-picker-option:hover,.product-picker-option:focus{background:#eef6fb;outline:none}
.product-picker-option span{font-weight:650;white-space:normal}
.product-picker-option small{color:#6c7d88;white-space:nowrap;font-size:12px}
@media(max-width:760px){.product-picker-menu{position:fixed;left:14px;right:14px;top:auto;bottom:82px;max-height:45vh;border-radius:7px;box-shadow:0 18px 45px rgba(9,32,47,.28)}.product-picker-option{padding:13px 12px}.product-picker-toggle{width:42px}}

