/* Invoice Management — Reconciliation tab (public/invoiceReconciliation.js).
   Uses the portal's tokens from index.html (:root) and the inv- table styles
   from invoices.css. Everything here is prefixed rec-. */

.rec-pick { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.rec-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.rec-field select { width: auto; min-width: 160px; padding: 9px 12px; font-size: 14px; }
.rec-info { max-width: 780px; }

/* Month tiles */
.rec-grid-title { margin: 22px 0 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); }
.rec-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.rec-tile { border: 1px solid var(--border); border-radius: 10px; padding: 9px 10px; background: var(--surface); font-size: 12px; display: flex; flex-direction: column; gap: 2px; min-height: 74px; }
.rec-tile.ok { border-color: #BBF7D0; background: #F6FEF9; }
.rec-tile.current { border-color: var(--indigo); box-shadow: 0 0 0 2px var(--indigo-light); }
.rec-tile-pick { all: unset; cursor: pointer; font-weight: 700; font-size: 13px; color: var(--text); }
.rec-tile-pick:hover, .rec-tile-pick:focus-visible { color: var(--indigo); text-decoration: underline; }
.rec-tile-status { font-weight: 600; }
.rec-tile-status.ok { color: var(--success); }
.rec-tile-status.open { color: var(--amber); }
.rec-tile-sub { color: var(--text-muted); }
.rec-link { all: unset; cursor: pointer; color: var(--indigo); font-weight: 600; margin-top: 2px; }
.rec-link:hover, .rec-link:focus-visible { text-decoration: underline; }

/* Step bar */
.rec-steps { list-style: none; padding: 0; margin: 4px 0 18px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.rec-step { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: var(--surface); font-size: 11.5px; color: var(--text-muted); }
.rec-step b { display: block; color: var(--text); font-size: 12.5px; margin-bottom: 2px; }
.rec-step-n { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #F2EEEE; font-size: 10.5px; font-weight: 700; margin-right: 5px; color: var(--text-muted); }
.rec-step.ok { border-color: #BBF7D0; background: #F6FEF9; } .rec-step.ok .rec-step-n { background: var(--success); color: #fff; }
.rec-step.bad { border-color: #FECACA; background: #FFF8F8; } .rec-step.bad .rec-step-n { background: #DC2626; color: #fff; }
.rec-step.warn { border-color: #FDE68A; background: #FFFDF5; } .rec-step.warn .rec-step-n { background: var(--amber); color: #fff; }
.rec-step.todo { opacity: .6; }

/* The two report uploads */
.rec-files { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.rec-file { border: 1.5px dashed #D9C9CA; border-radius: 14px; background: var(--bg); padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.rec-file.ok { border-style: solid; border-color: #BBF7D0; background: #F6FEF9; }
.rec-file.bad { border-style: solid; border-color: #FECACA; background: #FFF8F8; }
.rec-file-title { font-weight: 600; font-size: 14.5px; color: var(--text); }
.rec-file-hint { font-size: 12.5px; color: var(--text-muted); }
.rec-file-chip { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.rec-file-sub { display: block; font-size: 12px; color: var(--text-muted); }
.rec-xls { width: 32px; height: 38px; border-radius: 6px; background: #1D6F42; color: #fff; font: 700 10.5px 'Inter', sans-serif; display: grid; place-items: center; flex: none; }
.rec-file-btn { cursor: pointer; }
.rec-file-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rec-file-drop-hint { font-size: 12.5px; color: var(--text-muted); }
/* After .ok/.bad so a box with a file already in it still lights up. */
.rec-file.dragging { border-style: dashed; border-color: var(--indigo); background: var(--indigo-light); }
.rec-reject { margin: 0; font-size: 12.5px; width: 100%; }
.rec-reject ul { margin: 6px 0; padding-left: 18px; }

/* Results */
.rec-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 6px 0 14px; }
.rec-stat { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface); }
.rec-stat .k { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.rec-stat .v { font-size: 22px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }
.rec-stat .s { font-size: 12px; color: var(--text-muted); }
.rec-stat.bad { border-color: #FECACA; background: #FFF8F8; } .rec-stat.bad .v { color: #B91C1C; }
.rec-stat.ok .v { color: var(--success); }
.rec-table { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 14px; background: var(--surface); }
.rec-table-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.rec-table-head h3 { margin: 0; font-size: 14px; }
.rec-table-head h3 small { font-weight: 500; color: var(--text-muted); font-size: 12px; margin-left: 4px; }
.rec-table .inv-table-wrap { border: 0; border-radius: 0; }
tr.rec-bad td { background: #FEF2F2; }
tr.rec-bad td:first-child { box-shadow: inset 4px 0 0 #DC2626; }
tr.rec-warn td { background: #FFFBEB; }
tr.rec-warn td:first-child { box-shadow: inset 4px 0 0 var(--amber); }
td.rec-cell-bad { color: #B91C1C; font-weight: 600; }
.rec-was { display: block; font-size: 11px; font-weight: 500; color: #B91C1C; }
.rec-neg { color: #B91C1C; }
.rec-manual { width: 110px; padding: 6px 8px; font-size: 13px; text-align: right; }
.rec-sums td { font-size: 13px; }
.rec-note { font-size: 12.5px; color: var(--text-muted); margin: 8px 14px 12px; }
.rec-foot { display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; margin: 6px 0 4px; }
.rec-foot .rec-note { flex: 1 1 280px; margin: 0; }
.rec-clear { font-size: 13.5px; }
.rec-done { display: flex; gap: 14px; align-items: center; background: var(--success-light); color: #15803D; border: 1px solid #BBF7D0; font-size: 13.5px; }
.rec-done-icon { font-size: 24px; font-weight: 700; }
.rec-done-text { flex: 1; }
.rec-done .btn { flex: none; }
.rec-lock-note { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 14px; font-size: 13px; }
.rec-ok-icon { background: #DCFCE7 !important; color: #15803D !important; }
.mono { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; }
.muted { color: var(--text-muted); }

@media (max-width: 900px) {
  .rec-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rec-steps, .rec-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rec-files { grid-template-columns: 1fr; }
  .rec-done { flex-wrap: wrap; }
}

/* The portal's .alert is a flex row; here alerts hold sentences with bold
   parts, which a flex row would split into columns. */
#invReconView .alert { display: block; margin-bottom: 14px; }
#invReconView .alert.rec-done, #invLockNote .alert.rec-lock-note { display: flex; }
#screen-invoices .alert-info { background: var(--blue-light); color: #1E40AF; border: 1px solid #BFDBFE; }
#screen-invoices .alert-warn { background: var(--amber-light); color: #92400E; border: 1px solid #FDE68A; }
#screen-invoices .alert-ok { background: var(--success-light); color: #15803D; border: 1px solid #BBF7D0; }
#screen-invoices .inv-pill-blue, #recBody .inv-pill-blue { background: var(--blue-light); color: var(--blue); }

/* .btn sets display, which beats the hidden attribute. */
#recStart[hidden] { display: none; }
