/* ============================================================
   Bank Account Reconciliation — report-specific styling.

   Loaded right after redesign-reports.css. Bank Reconciliation is a
   multi-step workflow (account hub -> account statements -> new
   statement form -> live check-off reconciliation -> read-only
   reconciled view), not a single data table, so it needs its own
   set of classes beyond the generic .report-* shell in
   redesign-reports.css. Everything here is prefixed .recon-.

   IMPORTANT: the live check-off screen (reconcile-statement.html.twig)
   is driven by assets/controllers/bank_reconciliation_controller.js,
   which:
     - calls checkbox.closest('tr') and toggles the literal class
       "table-success" on that <tr> — so the transaction table MUST
       stay a real <table>/<tr> (not a CSS-grid div layout), and the
       "table-success" class name must keep working as the
       "checked/matched" row highlight.
     - directly overwrites #difference-amount's className on every
       update (to "mb-0 text-success" or "mb-0 text-danger") — so its
       base type styling is applied via the #difference-amount ID
       selector below, not via a class in the template (which would
       be wiped out at runtime).
   ============================================================ */

/* ---------- Secondary "back" nav button (used next to report_header) ---------- */

.recon-back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  background: var(--phoa-card);
  border: 1px solid var(--phoa-border-input);
  color: var(--phoa-secondary);
  font-size: 14px;
  font-weight: var(--phoa-fw-bold);
  border-radius: var(--phoa-r-button);
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
  transition: border-color 0.12s ease, color 0.12s ease;
}

.recon-back-btn:hover {
  border-color: var(--phoa-primary);
  color: var(--phoa-primary);
  text-decoration: none;
}

/* ---------- Generic recon buttons (Reconcile / New Statement / Select All / Finalize / Save) ---------- */

.recon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  font-size: 13.5px;
  font-weight: var(--phoa-fw-bold);
  border-radius: 9px;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.recon-btn:hover {
  text-decoration: none;
}

.recon-btn.is-primary {
  background: var(--phoa-primary);
  color: #fff;
}

.recon-btn.is-primary:hover {
  background: var(--phoa-primary-hover);
  color: #fff;
}

.recon-btn.is-success {
  background: var(--phoa-success-text);
  color: #fff;
}

.recon-btn.is-success:hover {
  background: #188a52;
  color: #fff;
}

.recon-btn.is-outline {
  background: var(--phoa-card);
  border-color: var(--phoa-border-input);
  color: var(--phoa-secondary);
}

.recon-btn.is-outline:hover {
  border-color: var(--phoa-primary);
  color: var(--phoa-primary);
}

.recon-btn.is-danger {
  background: var(--phoa-card);
  border-color: var(--phoa-border-input);
  color: var(--phoa-danger-text);
}

.recon-btn.is-danger:hover {
  border-color: var(--phoa-danger-text);
  background: var(--phoa-danger-bg);
}

.recon-btn.is-lg {
  height: 46px;
  padding: 0 22px;
  font-size: 14.5px;
  border-radius: 10px;
}

.recon-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ============================================================
   HUB — account cards grid
   ============================================================ */

.recon-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.recon-account-card {
  background: var(--phoa-card);
  border: 1px solid var(--phoa-border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.recon-account-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 22px;
  background: var(--phoa-primary-tint-3);
  border-bottom: 1px solid var(--phoa-border-card);
  color: var(--phoa-primary);
  font-size: 16px;
}

.recon-account-card-name {
  font-size: 15px;
  font-weight: var(--phoa-fw-extrabold);
  color: var(--phoa-text);
}

.recon-account-card-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
}

.recon-account-card-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.recon-account-card-field-label {
  font-size: 12.5px;
  color: var(--phoa-muted-3);
  margin-bottom: 4px;
}

.recon-account-card-field-value {
  font-size: 15px;
  font-weight: var(--phoa-fw-extrabold);
  color: var(--phoa-text);
}

.recon-account-card-field-value.is-body {
  font-size: 14px;
  font-weight: var(--phoa-fw-bold);
}

.recon-account-card-field-value.is-positive {
  color: var(--phoa-success-text);
}

.recon-account-card-field-value.is-negative {
  color: var(--phoa-danger-text);
}

.recon-account-card-last {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: var(--phoa-fw-bold);
}

.recon-account-card-last.is-ok {
  color: var(--phoa-success-text);
}

.recon-account-card-last.is-warning {
  color: var(--phoa-warning-text-2);
}

.recon-account-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  background: var(--phoa-subtle-3);
  border-top: 1px solid var(--phoa-border-divider);
}

/* ============================================================
   ACCOUNT SCREEN — statement list (no clean mockup equivalent;
   themed consistently with the hub/report shell using the shared
   .report-stat-grid / .report-card / .report-table-grid classes)
   ============================================================ */

.report-table-grid.is-recon-statements,
.report-table-row.is-recon-statements {
  grid-template-columns: 1.6fr 1.1fr 1fr 1fr 0.9fr 1.3fr;
}

.recon-tx-desc {
  font-size: 14px;
  font-weight: var(--phoa-fw-bold);
  color: var(--phoa-text);
}

/* Generic spacing/alignment helpers reused across the recon screens
   so no template needs an inline style attribute. */
.recon-mt {
  margin-top: 18px;
}

.recon-align-right {
  text-align: right;
}

.recon-align-center {
  text-align: center;
}

.recon-table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.recon-table-actions form {
  display: inline-flex;
}

/* ============================================================
   NEW STATEMENT — form
   ============================================================ */

.recon-form-card {
  background: var(--phoa-card);
  border: 1px solid var(--phoa-border);
  border-radius: 16px;
  padding: 26px 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 1000px;
}

.recon-form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.recon-form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}

.recon-field label {
  display: block;
  font-size: 13.5px;
  font-weight: var(--phoa-fw-bold);
  color: var(--phoa-heading);
  margin-bottom: 7px;
}

.recon-field-hint {
  font-size: 12px;
  color: var(--phoa-muted-4);
  margin-top: 6px;
}

.recon-input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--phoa-border-input-2);
  border-radius: var(--phoa-r-input);
  font-size: 14px;
  color: var(--phoa-text);
  box-sizing: border-box;
  background: var(--phoa-card);
}

.recon-input:focus {
  border-color: var(--phoa-primary);
  outline: none;
}

.recon-input-money {
  display: flex;
  align-items: center;
  height: 46px;
  border: 1px solid var(--phoa-border-input-2);
  border-radius: var(--phoa-r-input);
  overflow: hidden;
  background: var(--phoa-card);
}

.recon-input-money:focus-within {
  border-color: var(--phoa-primary);
}

.recon-input-money-prefix {
  padding: 0 12px;
  color: var(--phoa-muted-4);
  font-size: 15px;
}

.recon-input-money input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--phoa-text);
  background: transparent;
  padding: 0 14px 0 0;
}

.recon-callout {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  background: var(--phoa-primary-tint);
  border-left: 3px solid var(--phoa-primary);
  border-radius: 8px;
  font-size: 13.5px;
  color: #2A4899;
  line-height: 1.5;
}

.recon-callout i {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--phoa-primary);
}

.recon-form-actions {
  display: flex;
  justify-content: flex-end;
}

/* ============================================================
   RECONCILE — live check-off screen
   ============================================================ */

.recon-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.recon-stat-card {
  background: var(--phoa-card);
  border: 1px solid var(--phoa-border);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
}

.recon-stat-label {
  font-size: 13px;
  color: var(--phoa-muted-3);
}

.recon-stat-value {
  font-size: 24px;
  font-weight: var(--phoa-fw-extrabold);
  color: var(--phoa-text);
  margin-top: 8px;
}

/* #difference-amount's className is overwritten at runtime by
   bank_reconciliation_controller.js (to "mb-0 text-success" /
   "mb-0 text-danger"), so its base type styling must be applied via
   the ID rather than a template class, or it would be lost as soon
   as the controller re-renders it. */
#reconciled-amount,
#difference-amount {
  font-size: 24px;
  font-weight: var(--phoa-fw-extrabold);
  margin-top: 8px;
  display: block;
}

.recon-table-card {
  background: var(--phoa-card);
  border: 1px solid var(--phoa-border);
  border-radius: 16px;
  overflow: hidden;
}

.recon-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  background: var(--phoa-primary-tint-3);
  border-bottom: 1px solid var(--phoa-border-card);
  flex-wrap: wrap;
}

.recon-table-toolbar-title {
  font-size: 15px;
  font-weight: var(--phoa-fw-extrabold);
  color: var(--phoa-primary);
}

.recon-table-toolbar-subtitle {
  font-size: 12.5px;
  color: var(--phoa-muted-1);
  margin-top: 2px;
}

.recon-table-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.recon-table-scroll {
  overflow-x: auto;
}

/* Real <table>/<tr> markup is required here (not the CSS-grid div
   rows used elsewhere in the reports redesign) because
   bank_reconciliation_controller.js calls checkbox.closest('tr'). */
.recon-table {
  width: 100%;
  border-collapse: collapse;
}

.recon-table thead th {
  text-align: left;
  padding: 12px 22px;
  background: var(--phoa-subtle-1);
  border-bottom: 1px solid var(--phoa-border-divider);
  font-size: 11px;
  font-weight: var(--phoa-fw-extrabold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--phoa-muted-2);
}

.recon-table thead th.is-amount {
  text-align: right;
}

.recon-table tbody td {
  padding: 14px 22px;
  border-bottom: 1px solid var(--phoa-border-divider);
  font-size: 13.5px;
  color: var(--phoa-secondary);
  vertical-align: middle;
}

.recon-table tbody tr:last-child td {
  border-bottom: none;
}

.recon-table tbody tr:hover td {
  background: var(--phoa-subtle-2);
}

.recon-table td.is-amount {
  text-align: right;
  font-size: 14px;
  font-weight: var(--phoa-fw-bold);
  color: var(--phoa-secondary);
}

.recon-table td.is-payment {
  color: var(--phoa-danger-text);
}

.recon-table td.is-deposit {
  color: var(--phoa-success-text);
}

.recon-table td.is-muted {
  color: var(--phoa-muted-4);
}

.recon-table .recon-tx-cat {
  font-size: 12.5px;
  color: var(--phoa-muted-3);
  margin-top: 1px;
}

/* Beginning / ending balance boundary rows */
.recon-table tr.recon-row-boundary td {
  background: #E9F6FB;
  font-weight: var(--phoa-fw-bold);
  color: var(--phoa-text);
}

.recon-table tr.recon-row-boundary:hover td {
  background: #E9F6FB;
}

/* Checked/matched row — bank_reconciliation_controller.js toggles
   this exact class name on the <tr>, so it must stay "table-success". */
.recon-table tr.table-success td {
  background: var(--phoa-success-bg);
}

.recon-table tr.table-success:hover td {
  background: var(--phoa-success-bg);
}

/* Custom checkbox appearance — still a real <input type="checkbox">
   so data-action / data-transaction-id / checked state all keep
   working with the Stimulus controller as-is. */
.recon-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--phoa-border-input);
  border-radius: 6px;
  background: var(--phoa-card);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  margin: 0;
}

.recon-checkbox:checked {
  background: var(--phoa-success-text);
  border-color: var(--phoa-success-text);
}

.recon-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ============================================================
   VIEW STATEMENT — read-only reconciled statement (no Stimulus
   controller on this screen, free to use the shared .report-table
   grid classes below).
   ============================================================ */

.report-table-grid.is-recon-view,
.report-table-row.is-recon-view {
  grid-template-columns: 1.1fr 2.4fr 1fr 1fr;
}

.recon-amount-payment {
  font-weight: var(--phoa-fw-bold);
  color: var(--phoa-danger-text);
}

.recon-amount-deposit {
  font-weight: var(--phoa-fw-bold);
  color: var(--phoa-success-text);
}
