/* Invoices (invoices.js). The main app's style.css has bare label/input/button/* rules, so the
   invoice windows reset what they use (same approach as mailCompose.css). */
.inv-root, .inv-root * { font-family: var(--font-body, 'Public Sans', system-ui, sans-serif); box-sizing: border-box; }
.inv-root label { margin: 0; font-size: 13px; font-weight: 400; color: inherit; }
.inv-root button { margin: 0; }
.inv-root input, .inv-root select, .inv-root textarea { font-size: 13.5px; font-weight: 400; width: auto; }
.inv-root [hidden], .inv-hidden { display: none !important; }
/* style.css: "table { height: 300px; overflow-y: scroll }", "td:where(…) { border: 5px solid; bold;
   centered; width: fit-content }", "th:where(…) { color: white; border: 5px solid white }". */
.inv-root table { height: auto; overflow: visible; }
.inv-root td, .inv-root th { border: none; font-weight: inherit; text-align: left; width: auto; color: inherit; white-space: normal; }
/* style.css "thead:not(…):not(…):not(…) { border: 5.5px solid black }" outranks any normal selector here. */
.inv-root thead { border: none !important; color: inherit; }

.inv-backdrop {
  position: fixed; inset: 0; z-index: 3200;
  background: rgba(12, 44, 73, .45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.inv-panel {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow-frame, 0 24px 60px rgba(16,42,67,.14));
  display: flex; flex-direction: column; max-height: calc(100vh - 32px); width: 100%;
  color: var(--harbor-navy, #0C2C49);
}
.inv-list-panel { max-width: 760px; height: min(720px, calc(100vh - 32px)); }
.inv-editor-panel { max-width: 900px; }
.inv-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px 10px; }
.inv-root .inv-title { font: 700 18px var(--font-display, 'Archivo', system-ui, sans-serif); margin-right: auto; }
.inv-x { border: none; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: #5A6B7D; padding: 0 4px; }
.inv-x-small { font-size: 20px; }
.inv-body { overflow-y: auto; padding: 4px 20px 16px; flex: 1; }
.inv-foot { display: flex; gap: 10px; align-items: center; padding: 12px 20px 16px; border-top: 1px solid var(--card-border, #E8EDF2); }
.inv-spacer { flex: 1; }
.inv-muted { color: #6B7C8F; font-size: 12.5px; }
.inv-warn { color: #9A3412; }
.inv-empty { color: #6B7C8F; font-size: 13.5px; padding: 28px 4px; text-align: center; }
.inv-note { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: #F4F7FA; font-size: 12.5px; color: #3D4F60; }

.inv-btn {
  padding: 9px 16px; font: 600 13px var(--font-body, system-ui, sans-serif);
  border-radius: var(--radius-control, 10px); border: 1.5px solid var(--card-border, #E8EDF2);
  background: #fff; color: var(--harbor-navy, #0C2C49); cursor: pointer; white-space: nowrap;
}
.inv-btn:disabled { opacity: .55; cursor: default; }
.inv-primary { background: var(--signal-blue, #1462B8); border-color: var(--signal-blue, #1462B8); color: #fff; }
.inv-danger-ghost { color: #B3261E; border-color: #F2D7D5; }
.inv-small { padding: 6px 12px; font-size: 12px; }
.inv-link { border: none; background: none; padding: 0; color: var(--signal-blue, #1462B8); font: 600 12.5px var(--font-body, system-ui, sans-serif); cursor: pointer; }

.inv-tabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--card-border, #E8EDF2); }
.inv-tab { border: none; background: none; padding: 9px 12px; font: 600 13px var(--font-body, system-ui, sans-serif); color: #6B7C8F; cursor: pointer; border-bottom: 2px solid transparent; }
.inv-tab.inv-on { color: var(--harbor-navy, #0C2C49); border-bottom-color: var(--signal-blue, #1462B8); }
.inv-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 20px 6px; }
.inv-seg { display: inline-flex; background: #F1F4F7; border-radius: 9px; padding: 3px; }
.inv-seg-btn { border: none; background: none; padding: 5px 11px; border-radius: 7px; font: 600 12.5px var(--font-body, system-ui, sans-serif); color: #5A6B7D; cursor: pointer; }
.inv-seg-btn.inv-on { background: #fff; color: var(--harbor-navy, #0C2C49); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.inv-root .inv-search, .inv-root .inv-since { flex: 1; min-width: 180px; padding: 7px 10px; border: 1.5px solid var(--card-border, #E8EDF2); border-radius: 9px; }
.inv-root .inv-since { flex: none; min-width: 0; }

.inv-row, .inv-q-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 11px 6px; border: none; border-bottom: 1px solid #EEF2F6; background: none; cursor: pointer;
}
.inv-q-row { cursor: default; }
.inv-row:hover { background: #F8FAFC; }
.inv-row-num { font: 600 12px var(--font-mono, 'Spline Sans Mono', monospace); color: var(--signal-blue, #1462B8); width: 112px; flex-shrink: 0; }
.inv-row-main { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.inv-row-name { font-weight: 600; font-size: 13px; color: var(--text-body, #1d2733); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-row-sub { font-size: 11.5px; color: #6B7C8F; margin-top: 2px; }
.inv-row-total { font: 600 13px var(--font-mono, 'Spline Sans Mono', monospace); flex-shrink: 0; }

.inv-pill { font: 700 10.5px var(--font-body, system-ui, sans-serif); letter-spacing: .03em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; flex-shrink: 0; }
.inv-pill-draft { background: #EEF2F6; color: #5A6B7D; }
.inv-pill-open { background: #E6F0FB; color: #1462B8; }
.inv-pill-partial { background: #FFF4E5; color: #9A5B00; }
.inv-pill-paid { background: #E7F6EE; color: #1E7F4F; }
.inv-pill-void { background: #F4F4F5; color: #8A8F98; text-decoration: line-through; }
.inv-pill-overdue { background: #FDECEC; color: #B3261E; }

.inv-ed-body { display: flex; flex-direction: column; gap: 14px; }
.inv-ed-who { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; position: relative; }
.inv-field { display: flex; flex-direction: column; gap: 4px; min-width: 200px; }
.inv-field > span { font-size: 12px; font-weight: 600; color: #5A6B7D; }
.inv-grow { flex: 1; }
.inv-who-name { font-weight: 700; font-size: 14px; }
.inv-root .inv-field select, .inv-root .inv-field input, .inv-root .inv-field textarea {
  padding: 8px 10px; border: 1.5px solid var(--card-border, #E8EDF2); border-radius: 9px; background: #fff; width: 100%;
}
.inv-cust-results { position: absolute; top: 64px; left: 0; right: 0; z-index: 2; background: #fff; border-radius: 10px; box-shadow: 0 8px 24px rgba(12,44,73,.16); max-height: 260px; overflow-y: auto; }
.inv-cust-results:empty { display: none; }
.inv-cust-hit { display: block; width: 100%; text-align: left; padding: 9px 12px; border: none; border-bottom: 1px solid #EEF2F6; background: #fff; cursor: pointer; font-size: 13px; }
.inv-cust-hit:hover { background: #F4F7FA; }

.inv-lines { width: 100%; border-collapse: collapse; font-size: 13px; }
.inv-root .inv-lines th { text-align: left; font-size: 11px; font-weight: 600; color: #6B7C8F; padding: 0 6px 6px; border-bottom: 1px solid var(--card-border, #E8EDF2); }
.inv-root .inv-lines td { padding: 6px; border-bottom: 1px solid #EEF2F6; vertical-align: middle; }
.inv-root .inv-lines .inv-num { text-align: right; white-space: nowrap; }
.inv-root .inv-lines .inv-c { text-align: center; width: 44px; }
.inv-root .inv-in { width: 100%; padding: 6px 8px; border: 1.5px solid var(--card-border, #E8EDF2); border-radius: 8px; }
.inv-root .inv-in-num { width: 92px; text-align: right; }
.inv-root .inv-in-warn { border-color: #F5B26B; background: #FFF8EF; }
.inv-root .inv-lines input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--signal-blue, #1462B8); }
.inv-chip { display: inline-block; font: 600 10.5px var(--font-mono, monospace); color: #5A6B7D; background: #EEF2F6; border-radius: 6px; padding: 1px 6px; margin-bottom: 4px; }

.inv-ed-bottom { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.inv-totals { min-width: 260px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.inv-totals > div { display: flex; justify-content: space-between; gap: 16px; }
.inv-totals > div > span:last-child { font-family: var(--font-mono, 'Spline Sans Mono', monospace); }
.inv-totals .inv-total { font-weight: 700; font-size: 14.5px; border-top: 1px solid var(--card-border, #E8EDF2); padding-top: 6px; margin-top: 2px; }
.inv-meta { line-height: 1.6; }

@media (max-width: 640px) {
  .inv-backdrop { padding: 0; align-items: stretch; }
  .inv-panel { max-height: none; height: 100%; border-radius: 0; }
  .inv-row-num { width: 84px; }
  .inv-lines thead { display: none; }
  /* Each line: the description on top, then qty · price · tax · amount · remove on one row. */
  .inv-root .inv-lines tr { display: grid; grid-template-columns: 64px 1fr 30px auto 26px; gap: 4px 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid #EEF2F6; }
  .inv-root .inv-lines td { border: none; padding: 2px; }
  .inv-root .inv-lines td:first-child { grid-column: 1 / -1; }
  .inv-root .inv-in-num { width: 100%; }
}
@media print { .inv-backdrop { display: none !important; } }

/* Payments (payments.js) */
.pay-backdrop { z-index: 3300; }
.pay-panel { max-width: 640px; }
.pay-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.pay-credit { grid-template-columns: 1fr 120px auto; }
.pay-apply td { vertical-align: middle; }
.pay-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.pay-facts > div { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.pay-facts > div > span { font-size: 11.5px; color: #6B7C8F; font-weight: 600; }
.pay-app-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid #EEF2F6; font-size: 13px; }
.rcpt-btn-primary { color: #fff; background: var(--signal-blue); }
.rcpt-btn { color: var(--harbor-navy); background: #fff; border: 1.5px solid var(--card-border) !important; }
@media (max-width: 640px) { .pay-credit { grid-template-columns: 1fr; } }

/* Accounts tab (accounts.js) */
.acct-bar { display: flex; align-items: center; gap: 10px; margin: 4px 0 10px; }
.inv-root .acct-bar select { padding: 5px 8px; border: 1.5px solid var(--card-border, #E8EDF2); border-radius: 8px; margin-left: 6px; }
.acct-scroll { overflow-x: auto; }
.inv-root .acct-table { min-width: 720px; }
.inv-root .acct-table td, .inv-root .acct-table th { white-space: nowrap; }
.acct-late { color: #B3261E; }
.inv-root .acct-total td { font-weight: 700; border-top: 1.5px solid var(--card-border, #E8EDF2); }
.acct-progress { margin-top: 10px; }

/* Late payments (accounts.js: finance charges dialog, reminded note) */
.acct-reminded { font-size: 11.5px; font-weight: 500; }
.inv-root .fin-table td { vertical-align: top; }
.inv-root .fin-table .inv-muted { font-size: 12px; }
