:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel2: #1f2630;
  --text: #e6edf3;
  --muted: #8b949e;
  --border: #30363d;
  --good: #3fb950;
  --bad: #f85149;
  --warn: #d29922;
  --accent: #58a6ff;
  --accent2: #1f6feb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--accent);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
  background: #010409;
}

.topbar h1 {
  margin: 0;
  font-size: 1.3rem;
}

.topbar p,
.timestamp,
small {
  color: var(--muted);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: #0b1017;
  position: sticky;
  top: 0;
  z-index: 5;
}

.nav a,
.filters a {
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  font-size: 0.9rem;
}

.nav a.active,
.filters a.active {
  background: var(--accent2);
  border-color: var(--accent);
}

main {
  max-width: 1500px;
  margin: 0 auto;
  padding: 1rem;
}

.hero,
.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
}

.hero {
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.hero h2,
.panel h2,
.panel h3 {
  margin-top: 0;
}

.hero-mini {
  display: grid;
  grid-template-columns: auto auto;
  gap: 0.15rem 0.8rem;
  align-items: baseline;
  min-width: 220px;
}

.hero-mini span {
  color: var(--muted);
}

.hero-mini strong {
  text-align: right;
}

.hero-mini strong.budget-balance-positive {
  color: var(--cf-flow-in, #22c55e) !important;
}

.hero-mini strong.budget-balance-negative {
  color: var(--cf-flow-out, #ff4040) !important;
}

.hero-mini strong.budget-balance-neutral {
  color: var(--text) !important;
}

.cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.card span {
  display: block;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.card strong {
  display: block;
  font-size: 1.45rem;
}

.card.positive strong,
td.positive {
  color: var(--good);
}

.card.negative strong,
td.negative {
  color: var(--bad);
}

.card.neutral strong,
td.neutral {
  color: var(--text);
}

.grid.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.panel {
  margin-bottom: 1rem;
  overflow: hidden;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  font-size: 0.9rem;
}
th,
td {
  border-bottom: 1px solid var(--border);
  padding: 0.55rem;
  vertical-align: top;
}

th {
  color: var(--muted);
  text-align: left;
  font-weight: 600;
  background: var(--panel2);
}

td.id {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.badge {
  display: inline-block;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  white-space: nowrap;
}

.status-cleared {
  color: var(--good);
  border-color: rgba(63, 185, 80, 0.45);
}

.status-planned {
  color: var(--warn);
  border-color: rgba(210, 153, 34, 0.45);
}

.status-committed {
  color: var(--accent);
  border-color: rgba(88, 166, 255, 0.45);
}

.status-skipped,
.status-mitigated,
.status-cancelled {
  color: var(--muted);
}

.empty {
  color: var(--muted);
  padding: 0.75rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.error {
  border-color: var(--bad);
}

pre {
  white-space: pre-wrap;
}

@media (max-width: 1100px) {
  .cards {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .grid.two {
    grid-template-columns: 1fr;
  }

  th {
    position: static;
  }
}

@media (max-width: 650px) {
  .topbar,
  .hero {
    flex-direction: column;
    align-items: stretch;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  main {
    padding: 0.75rem;
  }
}

/* Phase 1C additions */
.mini-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.mini-link:hover {
  text-decoration: underline;
}

.kv-table th {
  color: var(--muted);
}
.kv-table td,
.kv-table th {
  border-bottom: 1px solid var(--border);
}

.panel > p:first-of-type {
  margin-top: -0.25rem;
}

/* Phase 1D table formatting fixes */
.center {
  text-align: center;
}

.bool-badge {
  display: inline-block;
  min-width: 2.6rem;
  text-align: center;
  padding: 0.16rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.78rem;
  white-space: nowrap;
}

.bool-yes {
  color: var(--warn);
  border-color: rgba(210, 153, 34, 0.45);
  background: rgba(210, 153, 34, 0.08);
}

.bool-no {
  color: var(--muted);
  border-color: rgba(139, 148, 158, 0.35);
  background: rgba(139, 148, 158, 0.05);
}

.muted {
  color: var(--muted);
}

td,
th {
  line-height: 1.35;
}

td.num,
th.num {
  text-align: right;
  white-space: nowrap;
}

td.id,
th.id {
  white-space: nowrap;
}

.table-wrap table {
  min-width: 720px;
}

/* Phase 2A edit forms */
.button-link,
button {
  display: inline-block;
  text-decoration: none;
  color: var(--text);
  background: var(--accent2);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  font: inherit;
  cursor: pointer;
}

.button-link:hover,
button:hover {
  filter: brightness(1.12);
}

.edit-form {
  display: grid;
  gap: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 1rem;
}

.edit-form label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
}

.edit-form input[type="text"],
.edit-form input[type="date"],
.edit-form select,
.edit-form textarea {
  width: 100%;
  background: #0d1117;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  font: inherit;
}

.edit-form textarea {
  resize: vertical;
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.check-row label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text);
}

.flash {
  border-radius: 12px;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}

.ok-flash {
  color: var(--good);
  border-color: rgba(63, 185, 80, 0.45);
  background: rgba(63, 185, 80, 0.08);
}

.error-flash {
  color: var(--bad);
  border-color: rgba(248, 81, 73, 0.45);
  background: rgba(248, 81, 73, 0.08);
}

@media (max-width: 900px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* Event/detail key-value table alignment fix */
.kv-table {
  min-width: 0 !important;
}

.kv-table th {
  width: 260px;
  min-width: 220px;
  max-width: 320px;
  text-align: left;
  vertical-align: middle;
}

.kv-table td,
.kv-table td.num,
.kv-table td.center,
.kv-table td.positive,
.kv-table td.negative,
.kv-table td.neutral {
  text-align: left;
  vertical-align: middle;
  white-space: normal;
}

.kv-table .bool-badge {
  margin-left: 0;
}

.kv-table td.num {
  font-variant-numeric: tabular-nums;
}

/* Event detail two-column layout */
.detail-grid {
  display: grid;
  grid-template-columns: minmax(520px, 0.95fr) minmax(420px, 1.05fr);
  gap: 1rem;
  align-items: start;
}

.detail-panel,
.related-panel {
  margin-bottom: 1rem;
}

.detail-panel .table-wrap,
.related-panel .table-wrap {
  max-height: calc(100vh - 260px);
  overflow: auto;
}

.detail-panel .kv-table th {
  width: 210px;
  min-width: 190px;
  max-width: 240px;
}

.related-panel table {
  min-width: 760px;
}

.related-panel h2,
.detail-panel h2 {
  margin-bottom: 0.75rem;
}

@media (max-width: 1150px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-panel .table-wrap,
  .related-panel .table-wrap {
    max-height: none;
  }
}

/* Phase 2A5 event detail layout polish */
.detail-grid {
  grid-template-columns: minmax(390px, 0.8fr) minmax(520px, 1.2fr);
}

.detail-panel .table-wrap,
.related-panel .table-wrap {
  max-height: none;
  overflow: visible;
}

.detail-panel .kv-table th {
  width: 170px;
  min-width: 150px;
  max-width: 190px;
}

.detail-panel .kv-table td {
  width: auto;
}

/* Compact related-events table on event detail pages */
.related-panel table {
  min-width: 0 !important;
  table-layout: fixed;
}

/* Related table columns:
   1 ID, 2 Date, 3 Due, 4 Status, 5 Account, 6 Direction, 7 Amount, 8 Role, 9 Description
   Hide noisy columns in the compact side panel.
*/
.related-panel th:nth-child(3),
.related-panel td:nth-child(3),
.related-panel th:nth-child(5),
.related-panel td:nth-child(5),
.related-panel th:nth-child(6),
.related-panel td:nth-child(6),
.related-panel th:nth-child(8),
.related-panel td:nth-child(8) {
  display: none;
}

.related-panel th:nth-child(1),
.related-panel td:nth-child(1) {
  width: 3.5rem;
}

.related-panel th:nth-child(2),
.related-panel td:nth-child(2) {
  width: 6.2rem;
}

.related-panel th:nth-child(4),
.related-panel td:nth-child(4) {
  width: 6.4rem;
}

.related-panel th:nth-child(7),
.related-panel td:nth-child(7) {
  width: 6.5rem;
}

.related-panel td,
.related-panel th {
  white-space: normal;
}

.related-panel td.num,
.related-panel th.num {
  text-align: right;
  white-space: nowrap;
}

.related-panel .badge {
  font-size: 0.75rem;
}

@media (max-width: 1150px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .related-panel th:nth-child(3),
  .related-panel td:nth-child(3),
  .related-panel th:nth-child(5),
  .related-panel td:nth-child(5),
  .related-panel th:nth-child(6),
  .related-panel td:nth-child(6),
  .related-panel th:nth-child(8),
  .related-panel td:nth-child(8) {
    display: table-cell;
  }

  .related-panel table {
    min-width: 760px !important;
  }

  .related-panel .table-wrap {
    overflow-x: auto;
  }
}

/* Phase 2A6 dashboard compact tables */
.dashboard-page .panel .table-wrap {
  overflow-x: visible;
}

.dashboard-page .panel table {
  min-width: 0 !important;
  table-layout: fixed;
}

.dashboard-page .panel th,
.dashboard-page .panel td {
  padding: 0.5rem 0.55rem;
  white-space: normal;
}

/* Dashboard reserve table:
   Keep the useful quick-read columns visible.
   1 Reserve, 2 Move From Main, 3 Planned Charges, 4 Planned Funding,
   5 Actual Net, 6 Planned Net
*/
.dashboard-reserve th:nth-child(4),
.dashboard-reserve td:nth-child(4),
.dashboard-reserve th:nth-child(6),
.dashboard-reserve td:nth-child(6) {
  display: none;
}

.dashboard-reserve th:nth-child(1),
.dashboard-reserve td:nth-child(1) {
  width: 28%;
}

.dashboard-reserve th:nth-child(2),
.dashboard-reserve td:nth-child(2),
.dashboard-reserve th:nth-child(3),
.dashboard-reserve td:nth-child(3),
.dashboard-reserve th:nth-child(5),
.dashboard-reserve td:nth-child(5) {
  width: 24%;
}

/* Dashboard income table */
.dashboard-income th:nth-child(1),
.dashboard-income td:nth-child(1) {
  width: 36%;
}

.dashboard-income th:nth-child(2),
.dashboard-income td:nth-child(2),
.dashboard-income th:nth-child(3),
.dashboard-income td:nth-child(3) {
  width: 32%;
}

/* Dashboard spending table */
.dashboard-spending th:nth-child(1),
.dashboard-spending td:nth-child(1) {
  width: 65%;
}

.dashboard-spending th:nth-child(2),
.dashboard-spending td:nth-child(2) {
  width: 35%;
}

/* Dashboard open/recent event tables can still need horizontal scroll. */
.dashboard-open .table-wrap,
.dashboard-recent .table-wrap {
  overflow-x: auto;
}

.dashboard-open table,
.dashboard-recent table {
  min-width: 860px !important;
  table-layout: auto;
}

/* Make dashboard cards a little tighter vertically. */
.dashboard-page .panel {
  padding: 0.9rem;
}

.dashboard-page .panel h2 {
  margin-bottom: 0.8rem;
}

.dashboard-page .empty {
  padding: 0.7rem;
}

/* On normal-width desktop, reduce wasted card spacing a hair. */
.dashboard-page .grid.two {
  gap: 0.85rem;
}

@media (max-width: 900px) {
  .dashboard-page .panel .table-wrap {
    overflow-x: auto;
  }

  .dashboard-reserve th:nth-child(4),
  .dashboard-reserve td:nth-child(4),
  .dashboard-reserve th:nth-child(6),
  .dashboard-reserve td:nth-child(6) {
    display: table-cell;
  }

  .dashboard-page .panel table {
    min-width: 720px !important;
    table-layout: auto;
  }
}

/* Phase 2A7 Reserves / Diagnostics compact layout */

/* Reserves page: give the summary tables room instead of cramming them side-by-side. */
.page-reserves .grid.two {
  grid-template-columns: 1fr;
}

.page-reserves .panel .table-wrap {
  overflow-x: visible;
}

.page-reserves .panel table {
  min-width: 0 !important;
  table-layout: fixed;
}

.page-reserves .panel th,
.page-reserves .panel td {
  white-space: normal;
}

/* Reserve Events can still be wide, but compact the noisy columns on desktop. */
.page-reserves .panel:last-child table {
  table-layout: fixed;
}

/* Reserve Events columns:
   1 ID, 2 Date, 3 Due, 4 Status, 5 Account, 6 Direction, 7 Amount, 8 Role, 9 Description
   Hide Account + Role on the reserve page; the page context already tells us what these are.
*/
.page-reserves .panel:last-child th:nth-child(5),
.page-reserves .panel:last-child td:nth-child(5),
.page-reserves .panel:last-child th:nth-child(8),
.page-reserves .panel:last-child td:nth-child(8) {
  display: none;
}

.page-reserves .panel:last-child th:nth-child(1),
.page-reserves .panel:last-child td:nth-child(1) {
  width: 4rem;
}

.page-reserves .panel:last-child th:nth-child(2),
.page-reserves .panel:last-child td:nth-child(2),
.page-reserves .panel:last-child th:nth-child(3),
.page-reserves .panel:last-child td:nth-child(3) {
  width: 7rem;
}

.page-reserves .panel:last-child th:nth-child(4),
.page-reserves .panel:last-child td:nth-child(4) {
  width: 7rem;
}

.page-reserves .panel:last-child th:nth-child(6),
.page-reserves .panel:last-child td:nth-child(6) {
  width: 7.5rem;
}

.page-reserves .panel:last-child th:nth-child(7),
.page-reserves .panel:last-child td:nth-child(7) {
  width: 7rem;
}

/* Diagnostics page: small diagnostic tables should not horizontal-scroll. */
.page-diagnostics .grid.two .panel .table-wrap,
.page-diagnostics .panel .table-wrap {
  overflow-x: visible;
}

.page-diagnostics .grid.two .panel table,
.page-diagnostics .panel table {
  min-width: 0 !important;
  table-layout: fixed;
}

.page-diagnostics .panel th,
.page-diagnostics .panel td {
  white-space: normal;
}

/* Diagnostics event tables: compact if they ever contain rows. */
.page-diagnostics .panel table th:nth-child(5),
.page-diagnostics .panel table td:nth-child(5),
.page-diagnostics .panel table th:nth-child(8),
.page-diagnostics .panel table td:nth-child(8) {
  max-width: 12rem;
}

/* Keep mobile/tablet behavior sane: allow scrolling instead of crushing columns. */
@media (max-width: 900px) {
  .page-reserves .panel .table-wrap,
  .page-diagnostics .panel .table-wrap {
    overflow-x: auto;
  }

  .page-reserves .panel table,
  .page-diagnostics .panel table {
    min-width: 720px !important;
    table-layout: auto;
  }

  .page-reserves .panel:last-child th:nth-child(5),
  .page-reserves .panel:last-child td:nth-child(5),
  .page-reserves .panel:last-child th:nth-child(8),
  .page-reserves .panel:last-child td:nth-child(8) {
    display: table-cell;
  }
}

/* Phase 2B Add Event */
.preset-row {
  margin-bottom: 1.25rem;
}

.preset-row a {
  font-size: 0.86rem;
}

.page-add_event .panel {
  max-width: 1280px;
}

.page-add_event .form-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

@media (max-width: 1200px) {
  .page-add_event .form-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 700px) {
  .page-add_event .form-grid {
    grid-template-columns: 1fr;
  }
}

/* Phase 2C Dashboard Quick Add */
.quick-add-panel {
  margin-bottom: 1rem;
}

.quick-add-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.quick-add-header h2 {
  margin: 0;
}

.quick-add-grid {
  grid-template-columns: repeat(4, minmax(210px, 1fr));
  gap: 0.75rem;
}
.quick-add-form {
  grid-template-columns: 1fr;
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 14px;
}
.quick-add-form strong {
  font-size: 0.95rem;
}

.quick-add-form input[type="text"] {
  width: 100%;
  background: #010409;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  font: inherit;
}

.quick-add-form button {
  width: 100%;
  justify-content: center;
}

@media (max-width: 1250px) {
  .quick-add-grid {
    grid-template-columns: repeat(2, minmax(210px, 1fr));
  }
}

@media (max-width: 650px) {
  .quick-add-header {
    align-items: stretch;
    flex-direction: column;
  }

  .quick-add-grid {
    grid-template-columns: 1fr;
  }
}

/* Phase 2C2 compact Quick Add */
.quick-add-panel {
  padding: 0.85rem;
}

.quick-add-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(420px, 1fr));
  gap: 0.5rem;
}

.quick-add-form {
  display: grid;
  grid-template-columns: 105px 120px minmax(180px, 1fr) 72px;
  gap: 0.5rem;
  padding: 0.55rem;
  border-radius: 12px;
}
.quick-add-form strong {
  font-size: 0.9rem;
  white-space: nowrap;
}

.quick-add-form input[type="text"] {
  padding: 0.42rem 0.55rem;
  min-width: 0;
}

.quick-add-form button {
  padding: 0.42rem 0.65rem;
  min-width: 0;
}

.quick-add-header {
  margin-bottom: 0.65rem;
}

.quick-add-header .button-link {
  padding: 0.38rem 0.7rem;
}

@media (max-width: 1100px) {
  .quick-add-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 650px) {
  .quick-add-form {
    grid-template-columns: 1fr;
  }

  .quick-add-form strong {
    margin-bottom: 0.15rem;
  }
}

/* Phase 2D Void Event controls */
.event-detail-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.event-detail-actions p {
  margin: 0;
}

.inline-action-form {
  margin: 0;
}

.danger-button {
  background: rgba(248, 81, 73, 0.18);
  border-color: rgba(248, 81, 73, 0.65);
  color: #ffb3ad;
}

.danger-button:hover {
  background: rgba(248, 81, 73, 0.28);
}

.voided-note {
  display: inline-block;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
}

.status-cancelled {
  color: var(--bad);
  border-color: rgba(248, 81, 73, 0.45);
}

@media (max-width: 700px) {
  .event-detail-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .event-detail-actions .danger-button {
    width: 100%;
  }
}

/* Phase 2E Scheduled Item editing */
.scheduled-edit-form {
  max-width: 1400px;
}

.scheduled-edit-form > label:first-of-type {
  max-width: 720px;
}

.page-edit_scheduled .panel {
  max-width: 1450px;
}

/* Phase 2F Scheduled Item delete controls */
.danger-zone {
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px solid rgba(248, 81, 73, 0.45);
  background: rgba(248, 81, 73, 0.06);
  border-radius: 16px;
}

.danger-zone h3 {
  margin-top: 0;
  color: #ffb3ad;
}

.danger-zone form {
  margin: 0;
}

/* Phase 2G hard delete for already-cancelled events */
.hard-delete-button {
  background: rgba(248, 81, 73, 0.30);
  border-color: rgba(248, 81, 73, 0.85);
  color: #ffd7d3;
}

.event-detail-actions {
  flex-wrap: wrap;
}

/* Phase 2H debt/card edit forms */
.debt-card-edit-form {
  max-width: 1400px;
}

.page-edit_debt .panel,
.page-edit_card .panel {
  max-width: 1450px;
}

/* Phase 3A scenarios */
@media (max-width: 900px) {
  .scenario-live-cards {
    grid-template-columns: 1fr;
  }
}

/* Phase 3A scenarios */
.page-scenarios .scenario-create-form {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.scenario-live-cards {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.scenario-banner > .cards {
  margin-top: 1rem;
}

.scenario-notes {
  margin-top: 1rem;
  background: #0d1117;
}

@media (max-width: 900px) {
  .scenario-live-cards {
    grid-template-columns: 1fr;
  }
}

/* Phase 3B fresh scenario */
/* Phase 3B fresh scenario */
.soft-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

.page-scenarios h3 {
  margin-bottom: 0.35rem;
}

/* Phase 3C new-month preview wording/defaults */
.page-scenarios .scenario-create-form .muted {
  margin-top: -0.25rem;
}

/* Phase 3D scenario essentials preview */
.essentials-panel {
  margin-top: 1rem;
}

.essentials-panel h4 {
  margin-bottom: 0.5rem;
}

.essentials-insert-form {
  margin-top: 1rem;
}

.essentials-panel .table-wrap {
  overflow-x: auto;
}

.essentials-panel table {
  min-width: 980px;
}

/* Phase 3E scenario event tools */
.page-scenario_add_event .panel,
.page-scenario_edit_event .panel {
  max-width: 1450px;
}

.page-scenario_event .panel {
  max-width: 1450px;
}

/* Phase 3F scenario essentials polish */
.scenario-generated-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.65rem 0.8rem;
  margin: 0.75rem 0;
  background: #0d1117;
}

.scenario-card-review-panel {
  margin-top: 1rem;
}

.scenario-card-review-panel table {
  min-width: 1000px;
}

@media (max-width: 800px) {
  .scenario-generated-note {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Phase 3F2 table alignment polish */

/* General table sanity */
.table-wrap table,
.panel table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrap th,
.table-wrap td,
.panel table th,
.panel table td {
  vertical-align: middle;
}

.table-wrap th,
.panel table th {
  text-align: left;
  white-space: nowrap;
}

td.num,
th.num,
.table-wrap td.num,
.panel table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Keep common narrow fields from wrapping into ugly stair-steps */
.table-wrap td.id,
.table-wrap th.id,
.table-wrap td:nth-child(1),
.table-wrap th:nth-child(1) {
  white-space: nowrap;
}

.table-wrap td:nth-child(2),
.table-wrap td:nth-child(3),
.table-wrap th:nth-child(2),
.table-wrap th:nth-child(3) {
  white-space: nowrap;
}

/* Dashboard compact summary tables */
/* Reserve Funding Needed:
   Reserve | Move From Main | Planned Charges | Planned Funding | Actual Net | Planned Net
*/
.page-dashboard .dashboard-grid .panel:nth-child(1) table th:nth-child(n+2),
.page-dashboard .dashboard-grid .panel:nth-child(1) table td:nth-child(n+2) {
  font-variant-numeric: tabular-nums;
}
.page-dashboard .dashboard-grid .panel:nth-child(1) table th:nth-child(1),
.page-dashboard .dashboard-grid .panel:nth-child(1) table td:nth-child(1) {
  width: 24%;
}

/* Income Totals:
   Type | Actual | Projected
*/
.page-dashboard .dashboard-grid .panel:nth-child(2) table th:nth-child(2),
.page-dashboard .dashboard-grid .panel:nth-child(2) table td:nth-child(2),
.page-dashboard .dashboard-grid .panel:nth-child(2) table th:nth-child(3),
.page-dashboard .dashboard-grid .panel:nth-child(2) table td:nth-child(3) {
  font-variant-numeric: tabular-nums;
}
/* Discretionary Spending:
   Category | Spent
*/
.page-dashboard .dashboard-grid .panel:nth-child(3) table th:nth-child(2),
.page-dashboard .dashboard-grid .panel:nth-child(3) table td:nth-child(2) {
  font-variant-numeric: tabular-nums;
}
/* Scenario essentials and card review tables */
.essentials-panel table,
.scenario-card-review-panel table,
.page-scenario table {
  font-variant-numeric: tabular-nums;
}

.essentials-panel td:nth-child(2),
.essentials-panel td:nth-child(3),
.essentials-panel th:nth-child(2),
.essentials-panel th:nth-child(3),
.scenario-card-review-panel td:nth-child(4),
.scenario-card-review-panel th:nth-child(4),
.page-scenario td:nth-child(2),
.page-scenario td:nth-child(3),
.page-scenario th:nth-child(2),
.page-scenario th:nth-child(3) {
  white-space: nowrap;
}

.essentials-panel td:nth-child(6),
.essentials-panel th:nth-child(6),
.scenario-card-review-panel td:nth-child(n+5):nth-child(-n+9),
.scenario-card-review-panel th:nth-child(n+5):nth-child(-n+9),
.page-scenario td:nth-child(7),
.page-scenario th:nth-child(7) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Description columns should breathe instead of forcing horizontal scroll early */
.essentials-panel td:last-child,
.page-scenario table td:nth-child(9),
.page-dashboard .dashboard-grid td:first-child {
  white-space: normal;
}

/* Keep badges centered enough to not look drunk */
.status,
td .status,
.badge,
td span[class*="status-"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

/* On smaller screens, scrolling is better than crushed columns */
@media (max-width: 900px) {
  .page-dashboard .dashboard-grid .panel .table-wrap {
    overflow-x: auto;
  }

  .page-dashboard .dashboard-grid .panel table {
    min-width: 650px !important;
    table-layout: auto;
  }
}

/* Dashboard table polish v2 */

/* Make dashboard cards less wonky */
.page-dashboard .dashboard-grid {
  align-items: start;
}

.page-dashboard .dashboard-grid .panel {
  min-height: unset;
}

.page-dashboard .dashboard-grid .panel .table-wrap {
  overflow-x: visible;
}

.page-dashboard .dashboard-grid .panel table {
  width: 100%;
  min-width: 0 !important;
  font-variant-numeric: tabular-nums;
}
.page-dashboard .dashboard-grid .panel th,
.page-dashboard .dashboard-grid .panel td {
  vertical-align: middle;
  white-space: normal;
}

/* Reserve Funding Needed */
.page-dashboard .dashboard-grid .panel:nth-child(1) table th:nth-child(1),
.page-dashboard .dashboard-grid .panel:nth-child(1) table td:nth-child(1) {
  width: 32%;
  text-align: left;
}

.page-dashboard .dashboard-grid .panel:nth-child(1) table th:nth-child(n+2),
.page-dashboard .dashboard-grid .panel:nth-child(1) table td:nth-child(n+2) {
  text-align: right;
  white-space: nowrap;
}

/* Income Totals */
.page-dashboard .dashboard-grid .panel:nth-child(2) table th:nth-child(1),
.page-dashboard .dashboard-grid .panel:nth-child(2) table td:nth-child(1) {
  width: 42%;
  text-align: left;
}

.page-dashboard .dashboard-grid .panel:nth-child(2) table th:nth-child(2),
.page-dashboard .dashboard-grid .panel:nth-child(2) table td:nth-child(2),
.page-dashboard .dashboard-grid .panel:nth-child(2) table th:nth-child(3),
.page-dashboard .dashboard-grid .panel:nth-child(2) table td:nth-child(3) {
  width: 29%;
  text-align: right;
  white-space: nowrap;
}

/* Discretionary Spending */
.page-dashboard .dashboard-grid .panel:nth-child(3) table th:nth-child(1),
.page-dashboard .dashboard-grid .panel:nth-child(3) table td:nth-child(1) {
  width: 70%;
  text-align: left;
}

.page-dashboard .dashboard-grid .panel:nth-child(3) table th:nth-child(2),
.page-dashboard .dashboard-grid .panel:nth-child(3) table td:nth-child(2) {
  width: 30%;
  text-align: right;
  white-space: nowrap;
}

/* Recent Events: class-based primary targeting */
.recent-events-panel {
  overflow: hidden;
}

.recent-events-panel .table-wrap {
  overflow-x: auto;
}

.recent-events-panel table {
  table-layout: fixed;
  width: 100%;
  min-width: 1220px;
  font-variant-numeric: tabular-nums;
}

.recent-events-panel th,
.recent-events-panel td {
  vertical-align: middle;
  padding-top: 0.68rem;
  padding-bottom: 0.68rem;
}

.recent-events-panel th:nth-child(1),
.recent-events-panel td:nth-child(1) {
  width: 5%;
  white-space: nowrap;
}

.recent-events-panel th:nth-child(2),
.recent-events-panel td:nth-child(2),
.recent-events-panel th:nth-child(3),
.recent-events-panel td:nth-child(3) {
  width: 10%;
  white-space: nowrap;
}

.recent-events-panel th:nth-child(4),
.recent-events-panel td:nth-child(4) {
  width: 10%;
  white-space: nowrap;
}

.recent-events-panel th:nth-child(5),
.recent-events-panel td:nth-child(5) {
  width: 14%;
  white-space: normal;
  line-height: 1.25;
}

.recent-events-panel th:nth-child(6),
.recent-events-panel td:nth-child(6) {
  width: 9%;
  white-space: nowrap;
}

.recent-events-panel th:nth-child(7),
.recent-events-panel td:nth-child(7) {
  width: 9%;
  text-align: right;
  white-space: nowrap;
}

.recent-events-panel th:nth-child(8),
.recent-events-panel td:nth-child(8) {
  width: 13%;
  white-space: nowrap;
}

.recent-events-panel th:nth-child(9),
.recent-events-panel td:nth-child(9) {
  width: 20%;
  white-space: normal;
  line-height: 1.25;
}

/* Fallback for modern browsers if class injection misses */
@supports selector(:has(*)) {
  .page-dashboard section.panel:has(> h2) table {
    font-variant-numeric: tabular-nums;
  }

  .page-dashboard section.panel:has(> h2) td.num,
  .page-dashboard section.panel:has(> h2) td:nth-child(7) {
    text-align: right;
  }
}

@media (max-width: 1250px) {
  .recent-events-panel table {
    min-width: 1120px;
  }

  .page-dashboard .dashboard-grid .panel .table-wrap {
    overflow-x: auto;
  }

  .page-dashboard .dashboard-grid .panel table {
    min-width: 620px !important;
    table-layout: auto;
  }
}

/* Dashboard width / breathing-room polish */

/* Let the app use more of a wide desktop screen */
main,
.app-main,
.content,
.container,
.page,
.page-dashboard {
  max-width: 1760px !important;
}

body .page-dashboard {
  width: min(96vw, 1760px);
  margin-left: auto;
  margin-right: auto;
}

/* Keep dashboard cards from feeling like postage stamps */
.page-dashboard .cards {
  grid-template-columns: repeat(5, minmax(190px, 1fr));
}
.page-dashboard .cards .card {
  min-height: 110px;
}

/* Top budget month banner can be wider and cleaner */
.page-dashboard > .panel:first-of-type,
.page-dashboard .budget-header,
.page-dashboard .month-summary {
  width: 100%;
}

/* Quick Add should remain compact but not cramped */
.page-dashboard .quick-add-grid {
  grid-template-columns: repeat(2, minmax(520px, 1fr));
}

.page-dashboard .quick-add-form {
  grid-template-columns: 115px 140px minmax(220px, 1fr) 78px;
}

/* Dashboard two-column cards: use the space better */
.page-dashboard .dashboard-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem;
}

.page-dashboard .dashboard-grid .panel {
  padding: 1.1rem;
}

/* Summary card tables should not look like they're hiding in the corner */
.page-dashboard .dashboard-grid .panel table {
  font-size: 0.98rem;
}

.page-dashboard .dashboard-grid .panel th,
.page-dashboard .dashboard-grid .panel td {
  padding-left: 0.7rem;
  padding-right: 0.7rem;
}

/* Recent Events: wider, ledger-like, but not comically huge */
.recent-events-panel table {
  min-width: 1320px;
}

.recent-events-panel th:nth-child(5),
.recent-events-panel td:nth-child(5) {
  width: 16%;
}

.recent-events-panel th:nth-child(9),
.recent-events-panel td:nth-child(9) {
  width: 24%;
}

/* On medium screens, avoid the ugly squeeze */
@media (max-width: 1350px) {
  .page-dashboard .cards {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .page-dashboard .quick-add-grid {
    grid-template-columns: 1fr;
  }

  .page-dashboard .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 750px) {
  body .page-dashboard {
    width: 100%;
  }

  .page-dashboard .cards {
    grid-template-columns: 1fr;
  }

  .page-dashboard .quick-add-form {
    grid-template-columns: 1fr;
  }
}

/* Phase 3G scenario promotion */
.promote-scenario-panel {
  margin-top: 1rem;
  border-color: rgba(210, 153, 34, 0.45);
}

.promo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 0.85rem;
  margin: 1rem 0;
}

.promo-grid > div {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.75rem;
}

.warn-flash {
  border: 1px solid rgba(210, 153, 34, 0.55);
  background: rgba(210, 153, 34, 0.12);
  color: #ffd98a;
}

.promote-button {
  border-color: rgba(210, 153, 34, 0.75);
  background: rgba(210, 153, 34, 0.18);
  color: #ffe2a3;
}

.promote-button:hover {
  background: rgba(210, 153, 34, 0.28);
}

@media (max-width: 1100px) {
  .promo-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 650px) {
  .promo-grid {
    grid-template-columns: 1fr;
  }
}

/* Phase 3H month history/archive */
.months-panel table,
.month-events-panel table {
  font-variant-numeric: tabular-nums;
}

.month-history-cards {
  margin: 1rem 0;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.months-table th:nth-child(1),
.months-table td:nth-child(1),
.months-table th:nth-child(3),
.months-table td:nth-child(3),
.months-table th:nth-child(4),
.months-table td:nth-child(4),
.months-table th:nth-child(5),
.months-table td:nth-child(5),
.months-table th:nth-child(8),
.months-table td:nth-child(8) {
  white-space: nowrap;
}

.months-table th:nth-child(6),
.months-table td:nth-child(6),
.months-table th:nth-child(7),
.months-table td:nth-child(7),
.months-table th:nth-child(8),
.months-table td:nth-child(8) {
  text-align: right;
}

.month-archive-grid {
  margin-top: 1rem;
}

.month-view-banner .cards {
  margin-top: 1rem;
}

.month-events-table {
  min-width: 1180px;
  table-layout: fixed;
}

.month-events-table th:nth-child(1),
.month-events-table td:nth-child(1) {
  width: 5%;
}

.month-events-table th:nth-child(2),
.month-events-table td:nth-child(2),
.month-events-table th:nth-child(3),
.month-events-table td:nth-child(3),
.month-events-table th:nth-child(4),
.month-events-table td:nth-child(4) {
  width: 10%;
  white-space: nowrap;
}

.month-events-table th:nth-child(5),
.month-events-table td:nth-child(5) {
  width: 15%;
}

.month-events-table th:nth-child(6),
.month-events-table td:nth-child(6) {
  width: 10%;
  white-space: nowrap;
}

.month-events-table th:nth-child(7),
.month-events-table td:nth-child(7) {
  width: 10%;
  text-align: right;
  white-space: nowrap;
}

.month-events-table th:nth-child(8),
.month-events-table td:nth-child(8) {
  width: 13%;
  white-space: nowrap;
}

.month-events-table th:nth-child(9),
.month-events-table td:nth-child(9) {
  width: 27%;
}

@media (max-width: 900px) {
  .month-history-cards {
    grid-template-columns: 1fr;
  }
}

/* Phase 3H2 month history count cards */
.month-history-cards .card-value {
  color: var(--text);
}

.month-history-cards .card .card-value {
  font-variant-numeric: tabular-nums;
}

.month-view-banner {
  margin-bottom: 1rem;
}

/* Phase 3I month close checklist */
.close-checklist-cards {
  grid-template-columns: repeat(6, minmax(160px, 1fr));
  margin-top: 1rem;
}

.close-reconcile-box {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  background: #0d1117;
}

.reconcile-form-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 0.85rem;
}

.reconcile-form-row input {
  width: 100%;
}

.close-checklist-grid {
  margin-top: 1rem;
}

.checklist-event-table {
  min-width: 1050px;
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}

.checklist-event-table th:nth-child(1),
.checklist-event-table td:nth-child(1) {
  width: 5%;
}

.checklist-event-table th:nth-child(2),
.checklist-event-table td:nth-child(2),
.checklist-event-table th:nth-child(3),
.checklist-event-table td:nth-child(3),
.checklist-event-table th:nth-child(4),
.checklist-event-table td:nth-child(4) {
  width: 10%;
  white-space: nowrap;
}

.checklist-event-table th:nth-child(5),
.checklist-event-table td:nth-child(5) {
  width: 15%;
}

.checklist-event-table th:nth-child(6),
.checklist-event-table td:nth-child(6) {
  width: 10%;
  white-space: nowrap;
}

.checklist-event-table th:nth-child(7),
.checklist-event-table td:nth-child(7) {
  width: 10%;
  text-align: right;
  white-space: nowrap;
}

.checklist-event-table th:nth-child(8),
.checklist-event-table td:nth-child(8) {
  width: 13%;
  white-space: nowrap;
}

.checklist-event-table th:nth-child(9),
.checklist-event-table td:nth-child(9) {
  width: 27%;
}

.checklist-ul {
  line-height: 1.6;
}

@media (max-width: 1300px) {
  .close-checklist-cards {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }
}

@media (max-width: 800px) {
  .close-checklist-cards,
  .reconcile-form-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Phase 3J UI Polish Pass
   Goal: consistent command-center feel without touching logic.
   ============================================================ */

/* ---------- App-wide layout ---------- */

:root {
  --panel-bg-polish: #171c23;
  --panel-bg-polish-2: #1b2129;
  --input-bg-polish: #080c11;
  --hover-bg-polish: rgba(59, 130, 246, 0.08);
  --soft-blue-glow: rgba(59, 130, 246, 0.20);
  --soft-green-glow: rgba(34, 197, 94, 0.18);
  --soft-red-glow: rgba(239, 68, 68, 0.18);
}

body {
  background:
    radial-gradient(circle at 20% 0%, rgba(59, 130, 246, 0.06), transparent 32rem),
    radial-gradient(circle at 85% 10%, rgba(34, 197, 94, 0.035), transparent 26rem),
    #11151b;
}

/* Let each page breathe on desktop, but keep it centered. */
main,
.app-main,
.content,
.container,
.page,
[class^="page-"],
[class*=" page-"] {
  max-width: 1760px !important;
}

body main,
body .app-main,
body .content,
body .container,
body .page,
body [class^="page-"],
body [class*=" page-"] {
  width: min(96vw, 1760px);
  margin-left: auto;
  margin-right: auto;
}

/* Screenshots were zoomed out, so do not overreact; normal zoom still needs room. */
@media (min-width: 1800px) {
  body main,
  body .app-main,
  body .content,
  body .container,
  body .page,
  body [class^="page-"],
  body [class*=" page-"] {
    width: min(94vw, 1760px);
  }
}

/* ---------- Header / nav polish ---------- */

header,
.app-header,
.site-header {
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  box-shadow: 0 1px 0 rgba(255,255,255,0.02);
}

nav,
.nav,
.tabs,
.tab-nav {
  gap: 0.45rem !important;
  flex-wrap: wrap;
  align-items: center;
}

nav a,
.nav a,
.tabs a,
.tab-nav a,
.filters a {
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    transform 0.12s ease,
    box-shadow 0.16s ease;
}

nav a:hover,
.nav a:hover,
.tabs a:hover,
.tab-nav a:hover,
.filters a:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.10);
}

nav a.active,
.nav a.active,
.tabs a.active,
.tab-nav a.active,
.filters a.active {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.12),
    0 0 0 3px rgba(59, 130, 246, 0.14);
}

/* ---------- Panels / cards ---------- */

.panel,
.card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.005)),
    var(--panel-bg-polish);
  border-color: rgba(148, 163, 184, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.035),
    0 10px 28px rgba(0,0,0,0.12);
}

.panel:hover {
  border-color: rgba(148, 163, 184, 0.25);
}

.card {
  min-height: 104px;
}

.card-value {
  letter-spacing: -0.02em;
}

/* Keep diagnostic/stat count cards from inheriting money vibes. */
.month-history-cards .card-value,
.close-checklist-cards .card-value {
  color: var(--text);
}

/* ---------- Tables: global consistency ---------- */

.table-wrap {
  border-radius: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.55) rgba(15, 23, 42, 0.35);
}

.table-wrap::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

.table-wrap::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.35);
  border-radius: 999px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.45);
  border-radius: 999px;
}

.table-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.7);
}

table {
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

th {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.005)),
    #242b34;
  color: #aeb9c8;
  font-weight: 700;
  letter-spacing: 0.01em;
}

td,
th {
  vertical-align: middle;
}

tbody tr {
  transition: background-color 0.12s ease;
}

tbody tr:hover {
  background: var(--hover-bg-polish);
}

td.num,
th.num,
td.amount,
th.amount,
td.money,
th.money {
  text-align: right;
  white-space: nowrap;
}

/* Dates, IDs, status, direction, and role should avoid weird wrapping. */
td.id,
th.id,
td:nth-child(1),
th:nth-child(1),
td:nth-child(2),
th:nth-child(2),
td:nth-child(3),
th:nth-child(3) {
  white-space: nowrap;
}

/* Text-heavy last columns should wrap nicely instead of forcing scroll too soon. */
td:last-child {
  line-height: 1.25;
}

/* ---------- Forms ---------- */

input,
select,
textarea {
  background: var(--input-bg-polish);
  border-color: rgba(148, 163, 184, 0.22);
  transition:
    border-color 0.14s ease,
    box-shadow 0.14s ease,
    background-color 0.14s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(96, 165, 250, 0.78);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
  outline: none;
}

button,
.button-link,
input[type="submit"] {
  transition:
    transform 0.12s ease,
    box-shadow 0.16s ease,
    background-color 0.16s ease,
    border-color 0.16s ease;
}

button:hover,
.button-link:hover,
input[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.13);
}

.danger-button:hover {
  box-shadow: 0 0 0 3px var(--soft-red-glow);
}

/* ---------- Status / pill polish ---------- */

.status,
.badge,
.pill,
td span[class*="status"],
td span[class*="badge"],
td span[class*="pill"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.35rem;
  line-height: 1;
  white-space: nowrap;
  font-weight: 650;
}

/* ---------- Dashboard-specific polish ---------- */

.page-dashboard .cards {
  gap: 1rem;
}

.page-dashboard .quick-add-grid {
  gap: 0.75rem;
}

.page-dashboard .quick-add-form {
  align-items: center;
}

.page-dashboard .quick-add-form input[type="text"] {
  min-height: 2.35rem;
}

/* Make dashboard summary cards more balanced. */
.page-dashboard .dashboard-grid .panel {
  min-height: 0;
}

.page-dashboard .dashboard-grid .panel table {
  table-layout: fixed;
}

.page-dashboard .dashboard-grid .panel th,
.page-dashboard .dashboard-grid .panel td {
  padding-top: 0.62rem;
  padding-bottom: 0.62rem;
}

/* ---------- Recent Events / ledger-like pages ---------- */

.recent-events-panel table,
.month-events-table,
.checklist-event-table {
  font-size: 0.95rem;
}

.recent-events-panel td,
.month-events-table td,
.checklist-event-table td {
  padding-top: 0.68rem;
  padding-bottom: 0.68rem;
}

/* Event list pages benefit from a little more width. */
.page-events .panel,
.page-income .panel,
.page-spending .panel,
.page-reserves .panel,
.page-scheduled .panel,
.page-debts .panel,
.page-review .panel,
.page-diagnostics .panel,
.page-months .panel,
.page-close_checklist .panel {
  max-width: 1600px;
}

/* ---------- Scenario pages ---------- */

.page-scenarios .panel,
.page-scenario .panel,
.page-scenario_add_event .panel,
.page-scenario_edit_event .panel,
.page-scenario_event .panel {
  max-width: 1600px;
}

.scenario-generated-note {
  background:
    linear-gradient(180deg, rgba(34,197,94,0.05), rgba(34,197,94,0.015)),
    #0d1117;
}

/* Promotion panel should look important, not terrifying. */
.promote-scenario-panel {
  background:
    linear-gradient(180deg, rgba(210,153,34,0.08), rgba(210,153,34,0.02)),
    var(--panel-bg-polish);
}

/* ---------- Close checklist / reserve table polish ---------- */

.page-close_checklist .close-checklist-cards {
  gap: 0.75rem;
}

.page-close_checklist .close-reconcile-box {
  background:
    linear-gradient(180deg, rgba(59,130,246,0.035), rgba(59,130,246,0.01)),
    #0d1117;
}

/* The reserve funding check has verbose column names; let headers wrap. */
.page-close_checklist table th {
  white-space: normal;
  line-height: 1.15;
}

.page-close_checklist table td {
  line-height: 1.2;
}

/* Make the reserve funding check less horizontally cranky. */
.page-close_checklist .panel table {
  font-size: 0.92rem;
}

/* Keep event/checklist tables readable even with long descriptions. */
.page-close_checklist .checklist-event-table {
  min-width: 1080px;
}

/* ---------- Review / scheduled pages ---------- */

.page-scheduled table,
.page-review table {
  font-size: 0.93rem;
}

.page-scheduled td:last-child,
.page-review td:last-child {
  max-width: 420px;
  white-space: normal;
}

/* ---------- Debts/cards page ---------- */

.page-debts table {
  font-size: 0.95rem;
}

.page-debts td:nth-child(4),
.page-debts td:nth-child(5),
.page-debts td:nth-child(6),
.page-debts td:nth-child(7),
.page-debts td:nth-child(9),
.page-debts td:nth-child(10) {
  white-space: nowrap;
}

/* ---------- Diagnostics ---------- */

.page-diagnostics .dashboard-grid {
  gap: 1rem;
}

.page-diagnostics .panel {
  min-height: 0;
}

/* ---------- Empty states ---------- */

.empty {
  color: #97a3b4;
  background: rgba(15, 23, 42, 0.35);
  border-color: rgba(148, 163, 184, 0.13);
}

/* ---------- Responsive sanity ---------- */

@media (max-width: 1350px) {
  body main,
  body .app-main,
  body .content,
  body .container,
  body .page,
  body [class^="page-"],
  body [class*=" page-"] {
    width: 96vw;
  }

  .page-dashboard .dashboard-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .page-dashboard .quick-add-grid {
    grid-template-columns: 1fr;
  }

  .page-dashboard .cards,
  .cards {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 760px) {
  body main,
  body .app-main,
  body .content,
  body .container,
  body .page,
  body [class^="page-"],
  body [class*=" page-"] {
    width: 100%;
  }

  .cards,
  .page-dashboard .cards {
    grid-template-columns: 1fr;
  }

  nav,
  .nav,
  .tabs,
  .tab-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.35rem;
  }

  nav a,
  .nav a,
  .tabs a,
  .tab-nav a {
    flex: 0 0 auto;
  }

  .panel {
    border-radius: 16px;
  }
}

/* ============================================================
   Phase 3J2 Full-Width Layout Fix
   Restore command-center width after the polish pass.
   ============================================================ */

/* Kill old centered/document-width behavior. */
html,
body {
  width: 100%;
  max-width: none !important;
}
/* Main application wrappers should use almost the whole available screen. */
main,
.app-main,
.content,
.container,
.page,
[class^="page-"],
[class*=" page-"] {
  width: 100% !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Give the content a consistent gutter instead of a narrow centered column. */
main,
.app-main,
.content,
.container {
  padding-left: clamp(0.75rem, 1.4vw, 1.5rem) !important;
  padding-right: clamp(0.75rem, 1.4vw, 1.5rem) !important;
}

/* Page sections should span the usable width. */
.panel,
.page-dashboard > .panel,
.page-dashboard .panel,
.page-scenarios .panel,
.page-scenario .panel,
.page-months .panel,
.page-close_checklist .panel,
.page-events .panel,
.page-income .panel,
.page-spending .panel,
.page-reserves .panel,
.page-scheduled .panel,
.page-debts .panel,
.page-review .panel,
.page-diagnostics .panel,
.page-add_event .panel,
.page-edit_event .panel,
.page-event .panel {
  width: 100% !important;
  max-width: none !important;
}

/* Header/nav should also run full-width. */
header,
.app-header,
.site-header,
nav,
.nav,
.tabs,
.tab-nav {
  width: 100% !important;
  max-width: none !important;
}

/* Dashboard should use full screen width again. */
.page-dashboard {
  width: 100% !important;
  max-width: none !important;
}

.page-dashboard .cards {
  grid-template-columns: repeat(5, minmax(180px, 1fr));
}

.page-dashboard .dashboard-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.page-dashboard .quick-add-grid {
  grid-template-columns: repeat(2, minmax(480px, 1fr));
}

/* Ledger/report tables should use available width, then scroll only when necessary. */
.table-wrap {
  width: 100%;
  max-width: 100%;
}

.table-wrap table {
  width: 100%;
}

/* Wide report pages: use space, don't huddle in the middle. */
.page-events .table-wrap table,
.page-income .table-wrap table,
.page-spending .table-wrap table,
.page-reserves .table-wrap table,
.page-scheduled .table-wrap table,
.page-debts .table-wrap table,
.page-review .table-wrap table,
.page-diagnostics .table-wrap table,
.page-months .table-wrap table,
.page-close_checklist .table-wrap table,
.recent-events-panel table,
.month-events-table,
.checklist-event-table {
  min-width: min(1320px, 100%) !important;
}

/* On very wide monitors, prevent tiny-card syndrome but still use the room. */
@media (min-width: 1700px) {
  main,
  .app-main,
  .content,
  .container {
    padding-left: 2rem !important;
    padding-right: 2rem !important;
  }

  .page-dashboard .cards {
    grid-template-columns: repeat(5, minmax(220px, 1fr));
  }
}

/* Medium screens still stack sanely. */
@media (max-width: 1250px) {
  .page-dashboard .dashboard-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .page-dashboard .quick-add-grid {
    grid-template-columns: 1fr;
  }

  .page-dashboard .cards,
  .cards {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

/* Mobile: full width with scrollable nav. */
@media (max-width: 760px) {
  main,
  .app-main,
  .content,
  .container {
    padding-left: 0.65rem !important;
    padding-right: 0.65rem !important;
  }

  .page-dashboard .cards,
  .cards {
    grid-template-columns: 1fr;
  }
}

/* Phase 3I2 v2 close checklist readiness */

.close-readiness-indicator {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #0d1117;
}

.close-readiness-indicator h3 {
  margin: 0 0 0.25rem 0;
}

.close-readiness-indicator p {
  margin: 0;
  color: #a6b1c2;
}

.readiness-icon {
  display: grid;
  place-items: center;
  width: 4.25rem;
  height: 4.25rem;
  flex: 0 0 4.25rem;
  border-radius: 999px;
  font-size: 2.6rem;
  font-weight: 900;
  line-height: 1;
  border: 2px solid rgba(148, 163, 184, 0.28);
}

.close-readiness-indicator.ready-wait {
  border-color: rgba(210, 153, 34, 0.45);
  background: linear-gradient(180deg, rgba(210, 153, 34, 0.10), rgba(210, 153, 34, 0.025)), #0d1117;
}

.close-readiness-indicator.ready-wait .readiness-icon {
  color: #facc15;
  border-color: rgba(250, 204, 21, 0.55);
  box-shadow: 0 0 0 5px rgba(250, 204, 21, 0.09);
}

.close-readiness-indicator.ready-ok {
  border-color: rgba(34, 197, 94, 0.55);
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.12), rgba(34, 197, 94, 0.025)), #0d1117;
}

.close-readiness-indicator.ready-ok .readiness-icon {
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.7);
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.11);
}

.close-readiness-indicator.ready-bad {
  border-color: rgba(239, 68, 68, 0.55);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.12), rgba(239, 68, 68, 0.025)), #0d1117;
}

.close-readiness-indicator.ready-bad .readiness-icon {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.75);
  box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.11);
}

.reconcile-form-row-wide,
.close-reconcile-box .reconcile-form-row {
  grid-template-columns: repeat(3, minmax(240px, 1fr));
}

.close-reconcile-box label {
  font-size: 1rem;
  font-weight: 700;
}

.close-reconcile-box input {
  min-height: 2.7rem;
  font-size: 1.15rem;
  padding: 0.5rem 0.7rem;
}

.reconcile-helper {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.reconcile-helper h4 {
  margin: 0 0 0.65rem 0;
}

#varianceOutput,
#calculatedPreDepositOutput,
#dbTrueInput {
  font-weight: 800;
  letter-spacing: 0.01em;
}

#calculatedPreDepositOutput {
  cursor: pointer;
}

@media (max-width: 900px) {
  .close-readiness-indicator {
    align-items: flex-start;
  }

  .reconcile-form-row-wide,
  .close-reconcile-box .reconcile-form-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Phase 3J3 Input Visibility Fix
   Dark UI should not mean invisible typing.
   ============================================================ */

input,
select,
textarea {
  color: #e8eef7 !important;
  background-color: #070b10 !important;
  caret-color: #60a5fa !important;
}

input::placeholder,
textarea::placeholder {
  color: #8b96a8 !important;
  opacity: 1 !important;
}

select option {
  color: #e8eef7;
  background-color: #111827;
}

/* Readonly fields should still be readable, just visually distinct. */
input[readonly],
textarea[readonly],
select[disabled],
input[disabled],
textarea[disabled] {
  color: #cbd5e1 !important;
  background-color: #111820 !important;
  opacity: 1 !important;
}

/* Firefox/Chromium autofill can get weird in dark themes. Beat it with a stick. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: #e8eef7 !important;
  box-shadow: 0 0 0 1000px #070b10 inset !important;
  caret-color: #60a5fa !important;
}

/* Close Checklist reconciliation fields: bigger and clearer. */
.close-reconcile-box input {
  color: #f1f5f9 !important;
  background: #05080c !important;
  border-color: rgba(96, 165, 250, 0.35) !important;
  font-size: 1.18rem !important;
  font-weight: 700 !important;
}

.close-reconcile-box input:focus {
  border-color: rgba(96, 165, 250, 0.95) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25) !important;
}

.close-reconcile-box input[readonly] {
  color: #dbeafe !important;
  background: #101722 !important;
}

/* Variance can stand out slightly. */
#varianceOutput {
  color: #f8fafc !important;
}

.ready-ok ~ .close-reconcile-box #varianceOutput,
.ready-ok ~ .close-reconcile-box #dbTrueInput {
  color: #86efac !important;
}

.ready-bad ~ .close-reconcile-box #varianceOutput {
  color: #fca5a5 !important;
}


/* Phase 3J4 human-readable UI labels */

.ui-hidden-col {
  display: none !important;
}

.ui-humanized {
  letter-spacing: 0.005em;
}

/* Role/type/direction columns are now readable labels; give them room. */
table td:nth-child(6),
table td:nth-child(8),
table th:nth-child(6),
table th:nth-child(8) {
  white-space: nowrap;
}

/* Cleaner report tables after hiding internal columns. */
.page-income table,
.page-spending table,
.page-reserves table,
.page-close_checklist table {
  width: 100%;
}

/* Reserve/checklist report tables can now breathe without looking like SQL output. */
.page-close_checklist .panel table th,
.page-reserves .panel table th {
  line-height: 1.15;
}

/* Prevent labels with buttons/inputs from becoming cramped after humanizing. */
label {
  line-height: 1.25;
}


/* Phase 3J5 status pills and review queue */

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.45rem;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid rgba(148, 163, 184, 0.34);
  background: rgba(148, 163, 184, 0.10);
  color: #cbd5e1;
}

.status-pill.status-cleared,
.status-pill.status-active {
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.11);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.035);
}

.status-pill.status-planned,
.status-pill.status-expected {
  color: #facc15;
  border-color: rgba(250, 204, 21, 0.48);
  background: rgba(250, 204, 21, 0.10);
}

.status-pill.status-committed {
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.52);
  background: rgba(96, 165, 250, 0.10);
}

.status-pill.status-mitigated,
.status-pill.status-skipped {
  color: #a8b3c5;
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.08);
}

.status-pill.status-cancelled,
.status-pill.status-inactive {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.10);
}

.ui-hidden-review-row {
  display: none !important;
}

.review-empty-note {
  margin-top: 0.75rem;
}


/* ============================================================
   Phase 3J6 Credit Card / Debt Alignment Polish
   ============================================================ */

/* Review page: Credit Cards to Watch and Active Debts / Loans */
.page-review table,
.page-debts table {
  table-layout: fixed;
  width: 100%;
  font-variant-numeric: tabular-nums;
}

.page-review table th,
.page-review table td,
.page-debts table th,
.page-debts table td {
  vertical-align: middle;
}

/* Review page first table: Scheduled items needing review can keep more flexible notes. */
.page-review .panel:first-of-type table {
  table-layout: auto;
}

/* Credit Cards to Watch:
   ID | Card | Issuer | Balance | Available | Limit | Minimum | Due Day | APR | Active
*/
.page-review table th:nth-child(1),
.page-review table td:nth-child(1),
.page-debts table th:nth-child(1),
.page-debts table td:nth-child(1) {
  width: 4.5rem;
  white-space: nowrap;
}

.page-review table th:nth-child(2),
.page-review table td:nth-child(2) {
  width: 16%;
}

.page-review table th:nth-child(3),
.page-review table td:nth-child(3) {
  width: 16%;
}

.page-review table th:nth-child(4),
.page-review table td:nth-child(4),
.page-review table th:nth-child(5),
.page-review table td:nth-child(5),
.page-review table th:nth-child(6),
.page-review table td:nth-child(6),
.page-review table th:nth-child(7),
.page-review table td:nth-child(7) {
  text-align: right;
  white-space: nowrap;
}

.page-review table th:nth-child(8),
.page-review table td:nth-child(8),
.page-review table th:nth-child(9),
.page-review table td:nth-child(9),
.page-review table th:nth-child(10),
.page-review table td:nth-child(10) {
  text-align: center;
  white-space: nowrap;
}

/* Active Debts / Loans:
   ID | Name | Type | Lender | Balance | Payment | Due Day | APR | Strict | Active
*/
.page-review .panel:last-of-type table th:nth-child(5),
.page-review .panel:last-of-type table td:nth-child(5),
.page-review .panel:last-of-type table th:nth-child(6),
.page-review .panel:last-of-type table td:nth-child(6),
.page-debts table th:nth-child(5),
.page-debts table td:nth-child(5),
.page-debts table th:nth-child(6),
.page-debts table td:nth-child(6) {
  text-align: right;
  white-space: nowrap;
}

.page-review .panel:last-of-type table th:nth-child(7),
.page-review .panel:last-of-type table td:nth-child(7),
.page-review .panel:last-of-type table th:nth-child(8),
.page-review .panel:last-of-type table td:nth-child(8),
.page-review .panel:last-of-type table th:nth-child(9),
.page-review .panel:last-of-type table td:nth-child(9),
.page-review .panel:last-of-type table th:nth-child(10),
.page-review .panel:last-of-type table td:nth-child(10),
.page-debts table th:nth-child(7),
.page-debts table td:nth-child(7),
.page-debts table th:nth-child(8),
.page-debts table td:nth-child(8),
.page-debts table th:nth-child(9),
.page-debts table td:nth-child(9),
.page-debts table th:nth-child(10),
.page-debts table td:nth-child(10) {
  text-align: center;
  white-space: nowrap;
}

/* Keep lender/issuer links visually consistent. */
.page-review td a,
.page-debts td a {
  font-weight: 800;
}

/* Make zeroed manual credit-card amounts look intentionally neutral. */
.page-review td:nth-child(7),
.page-debts td:nth-child(7),
.page-debts td:nth-child(8) {
  color: #cbd5e1;
}

/* Avoid note-heavy scheduled review table crushing everything. */
.page-review .panel:first-of-type td:last-child {
  max-width: 520px;
  white-space: normal;
  line-height: 1.25;
}

/* Header labels can wrap slightly if needed instead of forcing ugly overflow. */
.page-review th,
.page-debts th {
  line-height: 1.15;
}


/* ============================================================
   Phase 3J7 Paid This Month + Review Table Tighten
   ============================================================ */

.paid-this-month-col,
.paid-this-month-cell {
  text-align: right !important;
  white-space: nowrap;
}

.paid-this-month-cell.good {
  color: #22c55e;
  font-weight: 800;
}

.paid-this-month-cell.muted-money {
  color: #cbd5e1;
}

/* Credit card tables now have one more money column. Keep them aligned. */
.page-debts .panel:has(h2, h3) table,
.page-review .panel:has(h2, h3) table {
  font-variant-numeric: tabular-nums;
}

/* Prevent the closed loan name from bleeding into the type column. */
.page-debts table td:nth-child(2),
.page-review .panel:last-of-type table td:nth-child(2) {
  white-space: normal !important;
  line-height: 1.2;
}

.page-debts table td:nth-child(3),
.page-review .panel:last-of-type table td:nth-child(3) {
  white-space: nowrap;
}

/* Review Needed top table: stop the giant row-height / squished-column problem. */
.page-review .panel:first-of-type table {
  table-layout: fixed !important;
  min-width: 1680px !important;
  width: 100%;
}

.page-review .panel:first-of-type th,
.page-review .panel:first-of-type td {
  vertical-align: middle;
  line-height: 1.2;
}

.page-review .panel:first-of-type th:nth-child(1),
.page-review .panel:first-of-type td:nth-child(1) {
  width: 4rem;
  white-space: nowrap;
}

.page-review .panel:first-of-type th:nth-child(2),
.page-review .panel:first-of-type td:nth-child(2) {
  width: 15rem;
}

.page-review .panel:first-of-type th:nth-child(3),
.page-review .panel:first-of-type td:nth-child(3) {
  width: 12rem;
}

.page-review .panel:first-of-type th:nth-child(4),
.page-review .panel:first-of-type td:nth-child(4) {
  width: 8rem;
  text-align: right;
  white-space: nowrap;
}

.page-review .panel:first-of-type th:nth-child(5),
.page-review .panel:first-of-type td:nth-child(5),
.page-review .panel:first-of-type th:nth-child(6),
.page-review .panel:first-of-type td:nth-child(6),
.page-review .panel:first-of-type th:nth-child(7),
.page-review .panel:first-of-type td:nth-child(7),
.page-review .panel:first-of-type th:nth-child(8),
.page-review .panel:first-of-type td:nth-child(8),
.page-review .panel:first-of-type th:nth-child(9),
.page-review .panel:first-of-type td:nth-child(9),
.page-review .panel:first-of-type th:nth-child(10),
.page-review .panel:first-of-type td:nth-child(10) {
  width: 7.5rem;
  text-align: center;
  white-space: nowrap;
}

.page-review .panel:first-of-type th:nth-child(11),
.page-review .panel:first-of-type td:nth-child(11) {
  width: 12rem;
}

.page-review .panel:first-of-type th:nth-child(12),
.page-review .panel:first-of-type td:nth-child(12) {
  width: 28rem;
  white-space: normal;
  line-height: 1.25;
}

/* Make note-heavy rows readable without turning each row into a skyscraper. */
.page-review .panel:first-of-type td:last-child {
  max-width: none !important;
}

/* Credit card/debt tables: line up money and due columns better after dynamic column insertion. */
.page-debts table th,
.page-debts table td,
.page-review table th,
.page-review table td {
  vertical-align: middle;
}

.page-debts table td,
.page-review table td {
  overflow-wrap: anywhere;
}

.page-debts table td.num,
.page-review table td.num,
.page-debts table td.paid-this-month-cell,
.page-review table td.paid-this-month-cell {
  overflow-wrap: normal;
}

/* Slightly clearer hint under Credit Cards. */
.card-payment-hint {
  margin-top: -0.25rem;
  margin-bottom: 0.85rem;
}


/* ============================================================
   Phase 3J8 Review Needed table tighten v2
   ============================================================ */

.page-review .review-needed-table {
  min-width: 1320px !important;
  font-variant-numeric: tabular-nums;
}
.page-review .review-needed-table th,
.page-review .review-needed-table td {
  padding: 0.58rem 0.6rem !important;
  vertical-align: middle !important;
  line-height: 1.18 !important;
}

/* Scheduled Items Needing Review columns:
   ID | Name | Type | Amount | Variable | Due Day | Due Date | Frequency | Status | Review | Pay Account | Notes
*/
.page-review .review-needed-table th:nth-child(1),
.page-review .review-needed-table td:nth-child(1) {
  width: 4%;
  white-space: nowrap;
}

.page-review .review-needed-table th:nth-child(2),
.page-review .review-needed-table td:nth-child(2) {
  width: 12%;
}

.page-review .review-needed-table th:nth-child(3),
.page-review .review-needed-table td:nth-child(3) {
  width: 10%;
}

.page-review .review-needed-table th:nth-child(4),
.page-review .review-needed-table td:nth-child(4) {
  width: 7%;
  text-align: right;
  white-space: nowrap;
}

.page-review .review-needed-table th:nth-child(5),
.page-review .review-needed-table td:nth-child(5),
.page-review .review-needed-table th:nth-child(6),
.page-review .review-needed-table td:nth-child(6),
.page-review .review-needed-table th:nth-child(10),
.page-review .review-needed-table td:nth-child(10) {
  width: 5%;
  text-align: center;
  white-space: nowrap;
}

.page-review .review-needed-table th:nth-child(7),
.page-review .review-needed-table td:nth-child(7),
.page-review .review-needed-table th:nth-child(8),
.page-review .review-needed-table td:nth-child(8),
.page-review .review-needed-table th:nth-child(9),
.page-review .review-needed-table td:nth-child(9) {
  width: 7%;
  text-align: center;
  white-space: nowrap;
}

.page-review .review-needed-table th:nth-child(11),
.page-review .review-needed-table td:nth-child(11) {
  width: 8%;
}

.page-review .review-needed-table th:nth-child(12),
.page-review .review-needed-table td:nth-child(12) {
  width: 23%;
}

/* Stop note-heavy rows from becoming skyscrapers. */
.review-note-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-height: 4.25em;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: break-word;
}

.review-pay-text {
  line-height: 1.22;
}
/* The first review table should scroll horizontally only when needed,
   not stretch vertically like a circus mirror. */
.page-review .panel:first-of-type .table-wrap {
  overflow-x: auto;
  overflow-y: visible;
}

/* Make hover still useful on dense review rows. */
.page-review .review-needed-table tbody tr:hover .review-note-text {
  -webkit-line-clamp: 5;
  line-clamp: 5;
  max-height: 6.75em;
}

/* Tighten header text and avoid Pay Account / Notes collision. */
.page-review .review-needed-table th {
  white-space: normal !important;
  line-height: 1.08 !important;
}


/* ============================================================
   Phase 3J9 Review Needed Name Column Fix
   Stop long names from invading the Type column.
   ============================================================ */

.page-review .review-needed-table {
  table-layout: fixed !important;
  min-width: 1500px !important;
  width: 100% !important;
}

/* ID */
.page-review .review-needed-table th:nth-child(1),
.page-review .review-needed-table td:nth-child(1) {
  width: 4rem !important;
  white-space: nowrap !important;
}

/* Name */
.page-review .review-needed-table th:nth-child(2),
.page-review .review-needed-table td:nth-child(2) {
  width: 17rem !important;
  min-width: 17rem !important;
  max-width: 17rem !important;
  white-space: normal !important;
  overflow: hidden !important;
}

/* Type */
.page-review .review-needed-table th:nth-child(3),
.page-review .review-needed-table td:nth-child(3) {
  width: 10rem !important;
  min-width: 10rem !important;
  max-width: 10rem !important;
  white-space: nowrap !important;
  overflow: hidden !important;
}

/* Amount */
.page-review .review-needed-table th:nth-child(4),
.page-review .review-needed-table td:nth-child(4) {
  width: 7rem !important;
  text-align: right !important;
  white-space: nowrap !important;
}

/* Variable / Due Day / Due Date / Frequency / Status / Review */
.page-review .review-needed-table th:nth-child(5),
.page-review .review-needed-table td:nth-child(5),
.page-review .review-needed-table th:nth-child(6),
.page-review .review-needed-table td:nth-child(6),
.page-review .review-needed-table th:nth-child(7),
.page-review .review-needed-table td:nth-child(7),
.page-review .review-needed-table th:nth-child(8),
.page-review .review-needed-table td:nth-child(8),
.page-review .review-needed-table th:nth-child(9),
.page-review .review-needed-table td:nth-child(9),
.page-review .review-needed-table th:nth-child(10),
.page-review .review-needed-table td:nth-child(10) {
  width: 7rem !important;
  text-align: center !important;
  white-space: nowrap !important;
}

/* Pay Account */
.page-review .review-needed-table th:nth-child(11),
.page-review .review-needed-table td:nth-child(11) {
  width: 11rem !important;
  white-space: normal !important;
}

/* Notes */
.page-review .review-needed-table th:nth-child(12),
.page-review .review-needed-table td:nth-child(12) {
  width: auto !important;
  white-space: normal !important;
}

/* Actual content behavior */
.review-name-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.25;
  max-height: 2.7em;
}

.review-type-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.review-pay-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.25;
  max-height: 2.7em;
}

/* Let hovered names/notes breathe a little without exploding the whole table. */
.page-review .review-needed-table tbody tr:hover .review-name-text,
.page-review .review-needed-table tbody tr:hover .review-pay-text {
  -webkit-line-clamp: 3;
  line-clamp: 3;
  max-height: 4em;
}

/* Keep row heights sane. */
.page-review .review-needed-table td {
  height: auto !important;
  max-height: none !important;
}


/* ============================================================
   Phase 3J10 Debt / Loan Paid This Month
   ============================================================ */

.debt-paid-this-month-cell.good {
  color: #22c55e;
}
.debt-paid-this-month-cell.muted-money {
  color: #cbd5e1;
}

/* Debt/loan tables now have one extra money column. */
.page-debts table,
.page-review .panel:last-of-type table {
  table-layout: fixed;
  width: 100%;
  font-variant-numeric: tabular-nums;
}

/* Debts page columns after Paid This Month insertion:
   ID | Name | Type | Lender | Balance | Payment | Paid This Month | Due Day | Next Due | APR | Strict | Active
*/
.page-debts table th:nth-child(1),
.page-debts table td:nth-child(1),
.page-review .panel:last-of-type table th:nth-child(1),
.page-review .panel:last-of-type table td:nth-child(1) {
  width: 4rem;
}

.page-debts table th:nth-child(2),
.page-debts table td:nth-child(2),
.page-review .panel:last-of-type table th:nth-child(2),
.page-review .panel:last-of-type table td:nth-child(2) {
  width: 18%;
  white-space: normal !important;
}

.page-debts table th:nth-child(3),
.page-debts table td:nth-child(3),
.page-debts table th:nth-child(4),
.page-debts table td:nth-child(4),
.page-review .panel:last-of-type table th:nth-child(3),
.page-review .panel:last-of-type table td:nth-child(3),
.page-review .panel:last-of-type table th:nth-child(4),
.page-review .panel:last-of-type table td:nth-child(4) {
  white-space: nowrap;
}

.page-debts table th:nth-child(5),
.page-debts table td:nth-child(5),
.page-debts table th:nth-child(6),
.page-debts table td:nth-child(6),
.page-debts table th:nth-child(7),
.page-debts table td:nth-child(7),
.page-review .panel:last-of-type table th:nth-child(5),
.page-review .panel:last-of-type table td:nth-child(5),
.page-review .panel:last-of-type table th:nth-child(6),
.page-review .panel:last-of-type table td:nth-child(6),
.page-review .panel:last-of-type table th:nth-child(7),
.page-review .panel:last-of-type table td:nth-child(7) {
  text-align: right !important;
  white-space: nowrap !important;
}

.page-debts table th:nth-child(8),
.page-debts table td:nth-child(8),
.page-debts table th:nth-child(9),
.page-debts table td:nth-child(9),
.page-debts table th:nth-child(10),
.page-debts table td:nth-child(10),
.page-debts table th:nth-child(11),
.page-debts table td:nth-child(11),
.page-debts table th:nth-child(12),
.page-debts table td:nth-child(12),
.page-review .panel:last-of-type table th:nth-child(8),
.page-review .panel:last-of-type table td:nth-child(8),
.page-review .panel:last-of-type table th:nth-child(9),
.page-review .panel:last-of-type table td:nth-child(9),
.page-review .panel:last-of-type table th:nth-child(10),
.page-review .panel:last-of-type table td:nth-child(10),
.page-review .panel:last-of-type table th:nth-child(11),
.page-review .panel:last-of-type table td:nth-child(11),
.page-review .panel:last-of-type table th:nth-child(12),
.page-review .panel:last-of-type table td:nth-child(12) {
  text-align: center;
  white-space: nowrap;
}


/* Phase 3J10B force debt paid-this-month column */

.debt-paid-table {
  table-layout: fixed;
  width: 100%;
  font-variant-numeric: tabular-nums;
}

.debt-paid-this-month-col,
.debt-paid-this-month-cell {
  text-align: right !important;
  white-space: nowrap !important;
}

.debt-paid-this-month-cell.good {
  color: #22c55e !important;
  font-weight: 800;
}

.debt-paid-this-month-cell.muted-money {
  color: #cbd5e1 !important;
}

/* After insertion:
   ID | Name | Type | Lender | Balance | Payment | Paid This Month | Due Day | ...
*/
.debt-paid-table th:nth-child(5),
.debt-paid-table td:nth-child(5),
.debt-paid-table th:nth-child(6),
.debt-paid-table td:nth-child(6),
.debt-paid-table th:nth-child(7),
.debt-paid-table td:nth-child(7) {
  text-align: right !important;
  white-space: nowrap !important;
}

.debt-paid-table th:nth-child(8),
.debt-paid-table td:nth-child(8),
.debt-paid-table th:nth-child(9),
.debt-paid-table td:nth-child(9),
.debt-paid-table th:nth-child(10),
.debt-paid-table td:nth-child(10),
.debt-paid-table th:nth-child(11),
.debt-paid-table td:nth-child(11),
.debt-paid-table th:nth-child(12),
.debt-paid-table td:nth-child(12) {
  text-align: center !important;
  white-space: nowrap !important;
}

.debt-paid-table th:nth-child(2),
.debt-paid-table td:nth-child(2) {
  width: 18%;
  white-space: normal !important;
}


/* Phase 3J10C paid-column cleanup */

/* Credit-card table after Paid This Month insertion:
   ID | Card | Issuer | Balance | Available | Limit | Min. | Planned | Paid This Month | Due Day | Next Due | APR | Active
*/
.credit-card-paid-table {
  table-layout: fixed !important;
  width: 100% !important;
  min-width: 1420px !important;
  font-variant-numeric: tabular-nums;
}

.credit-card-paid-table th,
.credit-card-paid-table td {
  vertical-align: middle !important;
}

.credit-card-paid-table th:nth-child(1),
.credit-card-paid-table td:nth-child(1) {
  width: 4rem !important;
  white-space: nowrap !important;
}

.credit-card-paid-table th:nth-child(2),
.credit-card-paid-table td:nth-child(2) {
  width: 14rem !important;
}

.credit-card-paid-table th:nth-child(3),
.credit-card-paid-table td:nth-child(3) {
  width: 13rem !important;
}

.credit-card-paid-table th:nth-child(4),
.credit-card-paid-table td:nth-child(4),
.credit-card-paid-table th:nth-child(5),
.credit-card-paid-table td:nth-child(5),
.credit-card-paid-table th:nth-child(6),
.credit-card-paid-table td:nth-child(6),
.credit-card-paid-table th:nth-child(7),
.credit-card-paid-table td:nth-child(7),
.credit-card-paid-table th:nth-child(8),
.credit-card-paid-table td:nth-child(8),
.credit-card-paid-table th:nth-child(9),
.credit-card-paid-table td:nth-child(9) {
  width: 8.5rem !important;
  text-align: right !important;
  white-space: nowrap !important;
}

.credit-card-paid-table th:nth-child(10),
.credit-card-paid-table td:nth-child(10) {
  width: 6rem !important;
  text-align: center !important;
  white-space: nowrap !important;
}

.credit-card-paid-table th:nth-child(11),
.credit-card-paid-table td:nth-child(11) {
  width: 9rem !important;
  text-align: center !important;
  white-space: nowrap !important;
}

.credit-card-paid-table th:nth-child(12),
.credit-card-paid-table td:nth-child(12),
.credit-card-paid-table th:nth-child(13),
.credit-card-paid-table td:nth-child(13) {
  width: 6rem !important;
  text-align: center !important;
  white-space: nowrap !important;
}

/* Debt paid values should remain aligned and not wrap. */
.debt-paid-table th:nth-child(7),
.debt-paid-table td:nth-child(7) {
  text-align: right !important;
  white-space: nowrap !important;
}

/* Allow table wrappers to scroll if needed instead of crushing headers. */
.page-debts .table-wrap,
.page-review .table-wrap {
  overflow-x: auto;
}

/* ============================================================
   Phase 3K3 General Table Polish Pass
   ============================================================ */

.smart-table-wrap {
  overflow-x: auto;
  overflow-y: visible;
}

.smart-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.smart-table.smart-table-medium,
.smart-table.smart-table-wide {
  min-width: var(--smart-table-min-width, 1100px);
}

.smart-table th,
.smart-table td {
  vertical-align: middle;
}

.smart-table th {
  line-height: 1.12;
}

.smart-table .col-id {
  width: 4.25rem;
  text-align: left;
  white-space: nowrap;
}

.smart-table td.col-id {
  font-weight: 800;
}

.smart-table .col-money {
  text-align: right !important;
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums;
}

.smart-table .col-date,
.smart-table .col-smallnum,
.smart-table .col-rate,
.smart-table .col-status {
  text-align: center !important;
  white-space: nowrap !important;
}

.smart-table .col-text {
  text-align: left;
}

.smart-table .col-description {
  text-align: left;
  white-space: normal;
  min-width: 16rem;
}

.smart-table .smart-long-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.28;
  max-height: 4em;
  white-space: normal;
  overflow-wrap: break-word;
}

.smart-table tbody tr:hover .smart-long-text {
  -webkit-line-clamp: 6;
  line-clamp: 6;
  max-height: 8em;
}

/* Make status pills sit visually centered in status columns. */
.smart-table td.col-status .status-pill,
.smart-table td.col-status .badge,
.smart-table td.col-status .pill {
  margin-left: auto;
  margin-right: auto;
}

/* Reduce accidental crowding in generic wide tables. */
.smart-table-wide th,
.smart-table-wide td {
  padding-left: 0.65rem;
  padding-right: 0.65rem;
}

/* Keep money columns calm and readable. */
.smart-table td.col-money {
  letter-spacing: 0.005em;
}

/* Let small dashboards stay compact. */
.card .smart-table,
.panel .smart-table {
  margin-top: 0.25rem;
}

/* Avoid crushing link-heavy lender/issuer columns. */
.smart-table td.col-text a {
  white-space: normal;
}

/* Header/body alignment cleanup for summary-style tables. */
.smart-table th.col-money {
  text-align: right !important;
}

.smart-table th.col-date,
.smart-table th.col-smallnum,
.smart-table th.col-rate,
.smart-table th.col-status {
  text-align: center !important;
}

/* Narrow report tables should not grow silly-wide just because of generic rules. */
.panel:not(.page-review .panel) .smart-table:not(.smart-table-medium):not(.smart-table-wide) {
  min-width: 0;
}


/* ============================================================
   Phase 3L1 Date Safety
   ============================================================ */

.quick-add-form .quick-date-input {
  min-width: 9.5rem;
  max-width: 11rem;
  color: var(--text);
  background: #050a0f;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  padding: 0.55rem 0.7rem;
}
.workflow-warning {
  margin-top: 0.5rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(234, 179, 8, 0.35);
  border-radius: 0.8rem;
  background: rgba(234, 179, 8, 0.06);
  color: #facc15;
}

/* Let quick add rows breathe after adding the date field. */
.quick-add-form {
  gap: 0.45rem;
}

.quick-add-form input[type="date"] {
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Phase 3L1B Quick Add Layout Polish
   ============================================================ */

/* Quick Add rows now include:
   date | label | amount | description | add button
*/
.quick-add-grid {
  align-items: stretch;
}

.quick-add-form {
  grid-template-columns: 9.75rem 8rem minmax(8rem, 12rem) minmax(14rem, 1fr) 5.25rem;
  gap: 0.55rem;
  padding: 0.7rem;
}
.quick-add-form .quick-date-input {
  grid-column: 1;
  width: 100%;
  min-width: 0;
  max-width: none;
  font-size: 0.95rem;
}

.quick-add-form strong,
.quick-add-form label:first-of-type {
  grid-column: 2;
}
.quick-add-form input[name="amount"] {
  grid-column: 3;
  width: 100%;
  min-width: 0;
}

.quick-add-form input[name="description"] {
  grid-column: 4;
  width: 100%;
  min-width: 0;
}

.quick-add-form button[type="submit"] {
  grid-column: 5;
  width: 100%;
  min-width: 0;
  padding-left: 0.85rem;
  padding-right: 0.85rem;
}

/* Undo the ugly wrapping caused by the newly added date field. */
@media (max-width: 1200px) {
  .quick-add-form {
    grid-template-columns: 9.75rem 7rem minmax(7rem, 10rem) minmax(10rem, 1fr) 5rem;
  }
}

@media (max-width: 900px) {
  .quick-add-form {
    grid-template-columns: 1fr 1fr;
  }

  .quick-add-form .quick-date-input,
  .quick-add-form strong,
  .quick-add-form label:first-of-type,
  .quick-add-form input[name="amount"],
  .quick-add-form input[name="description"],
  .quick-add-form button[type="submit"] {
    grid-column: auto;
  }

  .quick-add-form button[type="submit"] {
    grid-column: 1 / -1;
  }
}

/* ============================================================
   Phase 3L1C Quick Add Layout Fix
   Date + label + button on row 1.
   Amount + description + same button on row 2.
   ============================================================ */

.quick-add-form {
  display: grid !important;
  grid-template-columns: 11.75rem minmax(8rem, 1fr) 5.25rem !important;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 0.55rem 0.7rem;
  padding: 0.75rem;
}

.quick-add-form .quick-date-input {
  grid-column: 1 !important;
  grid-row: 1 !important;
  width: 100% !important;
  min-width: 11.75rem !important;
  max-width: none !important;
  font-size: 1rem;
  padding: 0.58rem 0.75rem;
}

.quick-add-form strong,
.quick-add-form label:first-of-type {
  grid-column: 2 !important;
  grid-row: 1 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  align-self: center;
}

.quick-add-form input[name="amount"] {
  grid-column: 1 !important;
  grid-row: 2 !important;
  width: 100% !important;
  min-width: 0 !important;
}

.quick-add-form input[name="description"] {
  grid-column: 2 !important;
  grid-row: 2 !important;
  width: 100% !important;
  min-width: 0 !important;
}

.quick-add-form button[type="submit"] {
  grid-column: 3 !important;
  grid-row: 1 / span 2 !important;
  width: 100% !important;
  height: 100%;
  min-height: 2.8rem;
  align-self: stretch;
  padding-left: 0.7rem;
  padding-right: 0.7rem;
}

.quick-add-form > * {
  min-width: 0;
}

/* At narrower widths, each quick-add card stacks cleanly. */
@media (max-width: 900px) {
  .quick-add-form {
    grid-template-columns: 1fr 5.25rem !important;
    grid-template-rows: auto auto auto;
  }

  .quick-add-form .quick-date-input {
    grid-column: 1 !important;
    grid-row: 1 !important;
    min-width: 0 !important;
  }

  .quick-add-form strong,
  .quick-add-form label:first-of-type {
    grid-column: 2 !important;
    grid-row: 1 !important;
  }

  .quick-add-form input[name="amount"] {
    grid-column: 1 !important;
    grid-row: 2 !important;
  }

  .quick-add-form input[name="description"] {
    grid-column: 1 !important;
    grid-row: 3 !important;
  }

  .quick-add-form button[type="submit"] {
    grid-column: 2 !important;
    grid-row: 2 / span 2 !important;
  }
}

/* ============================================================
   Phase 3L1D Unified Quick Add
   ============================================================ */

.unified-quick-add-wrap {
  margin-bottom: 1rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: rgba(5, 10, 15, 0.28);
}

.unified-quick-add-form {
  display: grid;
  grid-template-columns: 11rem minmax(11rem, 14rem) minmax(8rem, 11rem) minmax(18rem, 1fr) 5.5rem 8.25rem;
  gap: 0.65rem;
  align-items: center;
}

.unified-quick-add-form input,
.unified-quick-add-form select {
  width: 100%;
  min-width: 0;
  font-size: 1rem;
  color: var(--text);
  background: #050a0f;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  padding: 0.58rem 0.75rem;
}

.unified-quick-add-form select {
  cursor: pointer;
}

.unified-quick-button {
  width: 100%;
}

.unified-quick-toggle {
  width: 100%;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  white-space: nowrap;
}

.quick-add-grid-hidden {
  display: none !important;
}

/* If the old grid is shown manually, tone down the huge oval buttons from 3L1C. */
.quick-add-form button[type="submit"] {
  border-radius: 999px;
  min-height: 2.7rem;
  height: auto;
}

@media (max-width: 1250px) {
  .unified-quick-add-form {
    grid-template-columns: 10.5rem minmax(10rem, 1fr) minmax(8rem, 10rem) minmax(14rem, 1.5fr) 5.25rem;
  }

  .unified-quick-toggle {
    grid-column: 1 / -1;
  }
}

@media (max-width: 850px) {
  .unified-quick-add-form {
    grid-template-columns: 1fr;
  }

  .unified-quick-button,
  .unified-quick-toggle {
    width: 100%;
  }
}

/* ============================================================
   Phase 3L2 Clear Transfer Pair UI
   ============================================================ */

.inline-row-action {
  margin-top: 0.35rem;
}

.mini-action-button,
.clear-transfer-pair-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(59, 130, 246, 0.65);
  background: rgba(37, 99, 235, 0.18);
  color: #bfdbfe;
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.15;
  cursor: pointer;
  white-space: nowrap;
}

.mini-action-button:hover,
.clear-transfer-pair-button:hover {
  background: rgba(37, 99, 235, 0.35);
}

.mini-action-button:disabled,
.clear-transfer-pair-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

/* ============================================================
   Phase 3L3 Late Prior-Month Adjustment
   ============================================================ */

.late-adjust-page .app-header {
  margin-bottom: 1rem;
}

.late-adjust-page .nav-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.warning-note {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(234, 179, 8, 0.35);
  border-radius: 0.85rem;
  background: rgba(234, 179, 8, 0.06);
  color: #facc15;
}

.success-panel {
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.07);
}

.error-panel {
  border-color: rgba(239, 68, 68, 0.65);
  background: rgba(239, 68, 68, 0.08);
  color: #fecaca;
}

.late-adjust-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(14rem, 1fr));
  gap: 0.9rem;
}

.late-adjust-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--muted);
  font-weight: 700;
}

.late-adjust-form input,
.late-adjust-form select,
.late-adjust-form textarea {
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: #050a0f;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
}

.late-adjust-form textarea {
  min-height: 6rem;
  resize: vertical;
}

.late-adjust-form .wide {
  grid-column: 1 / -1;
}

.checkbox-line {
  flex-direction: row !important;
  align-items: center;
}

.checkbox-line input {
  width: auto;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.form-actions .secondary-button {
  text-decoration: none;
}

/* ============================================================
   Phase 3L10S57 Existing Prior-Month Item Clearing
   Phase 3L10S57B Prior-Month Status Dropdown
   ============================================================ */

.late-adjust-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.late-adjust-section-heading h2,
.late-adjust-section-heading p {
  margin-top: 0;
}

.late-adjust-section-heading p {
  margin-bottom: 0;
}

.late-adjust-unresolved-scroll {
  overflow-x: auto;
}

.late-adjust-unresolved-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.late-adjust-unresolved-table th,
.late-adjust-unresolved-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.late-adjust-unresolved-table th {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.late-adjust-unresolved-table td:nth-child(5) {
  white-space: nowrap;
  font-weight: 800;
}

.late-adjust-unresolved-table td strong,
.late-adjust-unresolved-table td small {
  display: block;
}

.late-adjust-unresolved-table td small {
  margin-top: 0.25rem;
  color: var(--muted);
}

.late-prior-status-form {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  min-width: 28rem;
}

.late-prior-status-form select,
.late-prior-status-form input[type="date"] {
  min-width: 10.5rem;
  color: var(--text);
  background: #050a0f;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  padding: 0.55rem 0.65rem;
  font: inherit;
}

.late-prior-status-form select {
  min-width: 9.5rem;
}

.late-prior-status-form input[type="date"]:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.late-prior-status-form.is-clearing input[type="date"] {
  border-color: rgba(34, 197, 94, 0.65);
}

.late-prior-status-form .primary-button {
  white-space: nowrap;
}

.late-adjust-empty-state {
  margin: 0;
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: 0.75rem;
  color: var(--muted);
  text-align: center;
}

.late-adjust-resolved-note {
  margin: 0.85rem 0 0;
}

@media (max-width: 900px) {
  .late-adjust-form {
    grid-template-columns: 1fr;
  }

  .late-adjust-section-heading {
    align-items: stretch;
    flex-direction: column;
  }
}

/* ============================================================
   Phase 3L3B Late Adjustment Category / Type
   ============================================================ */

.late-adjust-form select[name="category_id"] {
  border-color: rgba(59, 130, 246, 0.45);
}

.late-adjust-form label:has(select[name="category_id"]) {
  color: #bfdbfe;
}

/* ============================================================
   Phase 3L4 Add Bill / Service Wizard
   ============================================================ */

.add-bill-service-page .app-header {
  margin-bottom: 1rem;
}

.add-bill-service-page .nav-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(14rem, 1fr));
  gap: 0.85rem;
}

.info-card {
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  padding: 0.9rem;
  background: rgba(5, 10, 15, 0.25);
}

.info-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.warning-card {
  border-color: rgba(234, 179, 8, 0.35);
  background: rgba(234, 179, 8, 0.06);
}

.add-bill-service-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(14rem, 1fr));
  gap: 0.9rem;
}

.add-bill-service-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--muted);
  font-weight: 700;
}

.add-bill-service-form input,
.add-bill-service-form select,
.add-bill-service-form textarea {
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: #050a0f;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
}

.add-bill-service-form textarea {
  min-height: 6rem;
  resize: vertical;
}

.add-bill-service-form .wide {
  grid-column: 1 / -1;
}

.add-bill-service-form .checkbox-line {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
}

.add-bill-service-form .checkbox-line input {
  width: auto;
}

.add-bill-service-form .annual-only {
  border-left: 3px solid rgba(59, 130, 246, 0.65);
  padding-left: 0.75rem;
}

.add-bill-service-form .monthly-only {
  border-left: 3px solid rgba(34, 197, 94, 0.55);
  padding-left: 0.75rem;
}

@media (max-width: 1000px) {
  .info-grid,
  .add-bill-service-form {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Phase 3L4C Standalone Page Nav Shell
   ============================================================ */

.standalone-top-shell {
  background: rgba(5, 10, 15, 0.72);
  backdrop-filter: blur(10px);
}
.standalone-brand-row {
  padding: 1.1rem 1.25rem 0.9rem;
}
.standalone-main-nav {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}
.standalone-main-nav .nav-pill.active {
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  border-color: rgba(147, 197, 253, 0.75);
  color: white;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

@media (max-width: 800px) {
  .standalone-brand-row {
    flex-direction: column;
  }

  .standalone-main-nav {
    gap: 0.4rem;
  }
}

/* ============================================================
   Phase 3L4D Standalone Nav Pill Styling
   Fixes Late Adjust / Add Bill-Service standalone nav so it
   matches the main app nav instead of plain browser links.
   ============================================================ */

.standalone-top-shell {
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(circle at 20% 0%, rgba(34, 197, 94, 0.06), transparent 32rem),
    rgba(5, 10, 15, 0.86);
  margin-bottom: 1rem;
}

.standalone-brand-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.15rem 1.35rem 1rem;
}

.standalone-brand-row h1 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.15;
}

.standalone-brand-row p {
  margin: 0.45rem 0 0;
}

.standalone-brand-row time {
  color: var(--muted);
  font-size: 0.95rem;
  white-space: nowrap;
}

.standalone-main-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.35rem;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

/* Deliberately target anchors directly so this works even if the
   inherited nav-pill class does not exist elsewhere. */
.standalone-main-nav a,
.standalone-main-nav .nav-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: var(--text);
  text-decoration: none !important;
  font-size: 0.95rem;
  line-height: 1;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.standalone-main-nav a:hover,
.standalone-main-nav .nav-pill:hover {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(30, 41, 59, 0.92);
  color: #ffffff;
  text-decoration: none !important;
}

.standalone-main-nav a.active,
.standalone-main-nav a[aria-current="page"],
.standalone-main-nav .nav-pill.active,
.standalone-main-nav .nav-pill[aria-current="page"] {
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  border-color: rgba(147, 197, 253, 0.82);
  color: #ffffff;
  box-shadow:
    0 0 0 2px rgba(59, 130, 246, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.standalone-page-title {
  margin-top: 0;
}

.standalone-page-title h1 {
  margin-top: 0;
}

/* Keep the old page-local nav from showing like plain text links
   if any older header fragments remain after previous patches. */
.add-bill-service-page > header.app-header,
.late-adjust-page > header.app-header {
  display: none;
}

@media (max-width: 800px) {
  .standalone-brand-row {
    flex-direction: column;
  }

  .standalone-main-nav {
    gap: 0.4rem;
  }

  .standalone-main-nav a,
  .standalone-main-nav .nav-pill {
    font-size: 0.9rem;
    padding: 0.42rem 0.68rem;
  }
}

/* ============================================================
   Phase 3L4E Unified Main Nav Shell
   Makes the normal app header/nav match the newer standalone tools.
   CSS-only. No DB/function changes.
   ============================================================ */

:root {
  --shell-bg-1: rgba(5, 10, 15, 0.92);
  --shell-bg-2: rgba(15, 23, 42, 0.82);
  --shell-border: rgba(148, 163, 184, 0.18);
  --nav-pill-bg: rgba(15, 23, 42, 0.78);
  --nav-pill-bg-hover: rgba(30, 41, 59, 0.94);
  --nav-pill-border: rgba(148, 163, 184, 0.25);
  --nav-pill-active-1: #3b82f6;
  --nav-pill-active-2: #2563eb;
}

/* Main app shell/header. These selectors intentionally cover the
   original app header plus the newer standalone tool header. */
body > header,
body > .app-header,
header.app-header,
.standalone-top-shell {
  background:
    radial-gradient(circle at 18% 0%, rgba(34, 197, 94, 0.075), transparent 34rem),
    linear-gradient(180deg, var(--shell-bg-1), rgba(5, 10, 15, 0.72));
  border-bottom: 1px solid var(--shell-border);
  margin-bottom: 1rem;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.025),
    0 14px 36px rgba(0, 0, 0, 0.18);
}

/* Header content alignment. */
body > header > div:first-child,
body > .app-header > div:first-child,
header.app-header > div:first-child,
.standalone-brand-row {
  padding: 1.05rem 1.35rem 0.95rem;
}

body > header h1,
body > .app-header h1,
header.app-header h1,
.standalone-brand-row h1 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

body > header p,
body > .app-header p,
header.app-header p,
.standalone-brand-row p {
  margin: 0.45rem 0 0;
  color: var(--muted);
}

/* Make the main nav row match the standalone nav row. */
body > nav,
body > header nav,
body > .app-header nav,
header.app-header nav,
.main-nav,
.app-nav,
.nav-row,
.tabs,
.page-tabs,
.standalone-main-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.35rem;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  border-bottom: 1px solid rgba(148, 163, 184, 0.06);
  background:
    radial-gradient(circle at 14% 40%, rgba(34, 197, 94, 0.055), transparent 28rem),
    rgba(5, 10, 15, 0.34);
}

/* Main app nav links/buttons. */
.nav-pill,
body > nav a,
body > header nav a,
body > .app-header nav a,
header.app-header nav a,
.main-nav a,
.app-nav a,
.nav-row a,
.tabs a,
.page-tabs a,
.standalone-main-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: 0.45rem 0.82rem;
  border: 1px solid var(--nav-pill-border);
  border-radius: 999px;
  background: var(--nav-pill-bg);
  color: var(--text);
  text-decoration: none !important;
  font-size: 0.95rem;
  line-height: 1;
  white-space: nowrap;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 1px 2px rgba(0, 0, 0, 0.18);
  transition:
    background 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.nav-pill:hover,
body > nav a:hover,
body > header nav a:hover,
body > .app-header nav a:hover,
header.app-header nav a:hover,
.main-nav a:hover,
.app-nav a:hover,
.nav-row a:hover,
.tabs a:hover,
.page-tabs a:hover,
.standalone-main-nav a:hover {
  border-color: rgba(96, 165, 250, 0.55);
  background: var(--nav-pill-bg-hover);
  color: #ffffff;
  text-decoration: none !important;
  transform: translateY(-1px);
}

/* Active/current nav state. */
.nav-pill.active,
.nav-pill[aria-current="page"],
body > nav a.active,
body > nav a[aria-current="page"],
body > header nav a.active,
body > header nav a[aria-current="page"],
body > .app-header nav a.active,
body > .app-header nav a[aria-current="page"],
header.app-header nav a.active,
header.app-header nav a[aria-current="page"],
.main-nav a.active,
.main-nav a[aria-current="page"],
.app-nav a.active,
.app-nav a[aria-current="page"],
.nav-row a.active,
.nav-row a[aria-current="page"],
.tabs a.active,
.tabs a[aria-current="page"],
.page-tabs a.active,
.page-tabs a[aria-current="page"],
.standalone-main-nav a.active,
.standalone-main-nav a[aria-current="page"] {
  background: linear-gradient(180deg, var(--nav-pill-active-1), var(--nav-pill-active-2));
  border-color: rgba(147, 197, 253, 0.82);
  color: #ffffff;
  box-shadow:
    0 0 0 2px rgba(59, 130, 246, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 4px 14px rgba(37, 99, 235, 0.22);
  transform: none;
}

/* Avoid double-top padding on standalone pages now that both shells share styling. */
.standalone-top-shell .standalone-brand-row {
  padding: 1.05rem 1.35rem 0.95rem;
}

.standalone-top-shell .standalone-main-nav {
  padding: 0.8rem 1.35rem;
}

/* Keep content from visually crashing into the improved shell. */
.container {
  padding-top: 0.25rem;
}

/* Compact but still tappable on smaller screens. */
@media (max-width: 900px) {
  body > nav,
  body > header nav,
  body > .app-header nav,
  header.app-header nav,
  .main-nav,
  .app-nav,
  .nav-row,
  .tabs,
  .page-tabs,
  .standalone-main-nav {
    gap: 0.4rem;
    padding: 0.7rem 1rem;
  }

  .nav-pill,
  body > nav a,
  body > header nav a,
  body > .app-header nav a,
  header.app-header nav a,
  .main-nav a,
  .app-nav a,
  .nav-row a,
  .tabs a,
  .page-tabs a,
  .standalone-main-nav a {
    font-size: 0.9rem;
    padding: 0.42rem 0.68rem;
  }
}

/* ============================================================
   Phase 3L4F Real Main Nav Styling
   Applies to nav/header after JS tags the real DOM.
   ============================================================ */

.budget-command-header {
  background:
    radial-gradient(circle at 18% 0%, rgba(34, 197, 94, 0.075), transparent 34rem),
    linear-gradient(180deg, rgba(5, 10, 15, 0.94), rgba(5, 10, 15, 0.72)) !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18) !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.025),
    0 14px 36px rgba(0, 0, 0, 0.18) !important;
}

.budget-command-nav {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 0.5rem !important;
  padding: 0.8rem 1.35rem !important;
  border-top: 1px solid rgba(148, 163, 184, 0.14) !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.06) !important;
  background:
    radial-gradient(circle at 14% 40%, rgba(34, 197, 94, 0.055), transparent 28rem),
    rgba(5, 10, 15, 0.34) !important;
}

.budget-command-nav a,
.budget-command-nav .nav-pill {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 2.35rem !important;
  padding: 0.45rem 0.82rem !important;
  border: 1px solid rgba(148, 163, 184, 0.25) !important;
  border-radius: 999px !important;
  background: rgba(15, 23, 42, 0.78) !important;
  color: var(--text) !important;
  text-decoration: none !important;
  font-size: 0.95rem !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 1px 2px rgba(0, 0, 0, 0.18) !important;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease !important;
}

.budget-command-nav a:hover,
.budget-command-nav .nav-pill:hover {
  border-color: rgba(96, 165, 250, 0.55) !important;
  background: rgba(30, 41, 59, 0.94) !important;
  color: #ffffff !important;
  text-decoration: none !important;
  transform: translateY(-1px) !important;
}

.budget-command-nav a.active,
.budget-command-nav a[aria-current="page"],
.budget-command-nav .nav-pill.active,
.budget-command-nav .nav-pill[aria-current="page"] {
  background: linear-gradient(180deg, #3b82f6, #2563eb) !important;
  border-color: rgba(147, 197, 253, 0.82) !important;
  color: #ffffff !important;
  box-shadow:
    0 0 0 2px rgba(59, 130, 246, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 4px 14px rgba(37, 99, 235, 0.22) !important;
  transform: none !important;
}

@media (max-width: 900px) {
  .budget-command-nav {
    gap: 0.4rem !important;
    padding: 0.7rem 1rem !important;
  }

  .budget-command-nav a,
  .budget-command-nav .nav-pill {
    font-size: 0.9rem !important;
    padding: 0.42rem 0.68rem !important;
  }
}

/* ============================================================
   Phase 3L4G Shell Spacing Consistency
   Normal app pages and standalone tool pages should have the
   same header height, nav height, and content gap.
   ============================================================ */

:root {
  --budget-shell-brand-min-height: 6.85rem;
  --budget-shell-nav-min-height: 4.15rem;
  --budget-shell-xpad: 1.65rem;
  --budget-shell-content-gap: 1.1rem;
}

/* Shared outer shell */
.budget-command-header,
.standalone-top-shell {
  margin: 0 0 var(--budget-shell-content-gap) 0 !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18) !important;
}

/* Shared brand/title row height */
.budget-command-header > div:first-child,
.budget-command-header .standalone-brand-row,
.budget-command-header .brand-row,
.standalone-brand-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  box-sizing: border-box !important;
  min-height: var(--budget-shell-brand-min-height) !important;
  padding: 1.55rem var(--budget-shell-xpad) 1.25rem !important;
}

/* Keep app title/subtitle consistent */
.budget-command-header h1,
.standalone-brand-row h1 {
  margin: 0 !important;
  font-size: 1.35rem !important;
  line-height: 1.15 !important;
}

.budget-command-header p,
.standalone-brand-row p {
  margin: 0.45rem 0 0 !important;
}

/* Shared nav row height */
.budget-command-nav,
.standalone-main-nav {
  box-sizing: border-box !important;
  min-height: var(--budget-shell-nav-min-height) !important;
  padding: 0.85rem var(--budget-shell-xpad) !important;
  margin: 0 !important;
  align-content: center !important;
}

/* Prevent old standalone rules from tightening the nav/header again */
.standalone-top-shell .standalone-brand-row {
  min-height: var(--budget-shell-brand-min-height) !important;
  padding: 1.55rem var(--budget-shell-xpad) 1.25rem !important;
}

.standalone-top-shell .standalone-main-nav {
  min-height: var(--budget-shell-nav-min-height) !important;
  padding: 0.85rem var(--budget-shell-xpad) !important;
}

/* Same breathing room before page content */
body > .container,
main.container,
.container {
  padding-top: 0.75rem !important;
}

.standalone-page-title {
  margin-top: 0 !important;
}

/* Mobile/tablet: still consistent, just tighter */
@media (max-width: 900px) {
  :root {
    --budget-shell-brand-min-height: 5.8rem;
    --budget-shell-nav-min-height: 3.7rem;
    --budget-shell-xpad: 1rem;
    --budget-shell-content-gap: 0.85rem;
  }

  .budget-command-header > div:first-child,
  .budget-command-header .standalone-brand-row,
  .budget-command-header .brand-row,
  .standalone-brand-row,
  .standalone-top-shell .standalone-brand-row {
    padding-top: 1.2rem !important;
    padding-bottom: 1rem !important;
  }

  .budget-command-nav,
  .standalone-main-nav,
  .standalone-top-shell .standalone-main-nav {
    padding-top: 0.7rem !important;
    padding-bottom: 0.7rem !important;
  }
}

/* ============================================================
   Phase 3L4H Main Brand Row Height
   This is the missing piece: style the actual tagged title row,
   not just the outer shell.
   ============================================================ */

:root {
  --budget-brand-row-height-preferred: 6.85rem;
  --budget-brand-row-pad-x-preferred: 1.65rem;
}

/* Main app title row, now tagged by JS. */
.budget-command-brand-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  box-sizing: border-box !important;
  min-height: var(--budget-brand-row-height-preferred) !important;
  padding: 1.55rem var(--budget-brand-row-pad-x-preferred) 1.25rem !important;
}

/* Match standalone title row exactly. */
.standalone-brand-row {
  min-height: var(--budget-brand-row-height-preferred) !important;
  padding: 1.55rem var(--budget-brand-row-pad-x-preferred) 1.25rem !important;
}

/* Keep title/subtitle identical across both shells. */
.budget-command-brand-row h1,
.budget-command-brand-row h2,
.budget-command-brand-row strong,
.standalone-brand-row h1 {
  margin: 0 !important;
  font-size: 1.35rem !important;
  line-height: 1.15 !important;
  letter-spacing: -0.01em !important;
}

.budget-command-brand-row p,
.budget-command-brand-row .muted,
.standalone-brand-row p,
.standalone-brand-row .muted {
  margin-top: 0.45rem !important;
}

/* If the timestamp is inside the row, keep it in the upper-right. */
.budget-command-brand-row time,
.budget-command-brand-row > :last-child,
.standalone-brand-row time {
  color: var(--muted);
  white-space: nowrap;
}

/* Give normal app nav the same relationship to the taller brand row. */
.budget-command-nav,
.standalone-main-nav {
  min-height: 4.15rem !important;
  padding-top: 0.85rem !important;
  padding-bottom: 0.85rem !important;
}

/* Do not let old generic header rules collapse the main title row. */
.budget-command-header > div:first-child:not(.budget-command-brand-row):has(+ .budget-command-nav) {
  min-height: var(--budget-brand-row-height-preferred) !important;
}

/* Slightly tighter on small screens, but still consistent. */
@media (max-width: 900px) {
  :root {
    --budget-brand-row-height-preferred: 5.8rem;
    --budget-brand-row-pad-x-preferred: 1rem;
  }

  .budget-command-brand-row,
  .standalone-brand-row {
    padding-top: 1.2rem !important;
    padding-bottom: 1rem !important;
  }

  .budget-command-nav,
  .standalone-main-nav {
    min-height: 3.7rem !important;
    padding-top: 0.7rem !important;
    padding-bottom: 0.7rem !important;
  }
}

/* ============================================================
   Phase 3L4I Stable Main Shell Markup
   Main index.php now emits real shell classes instead of relying
   on JS guessing. This matches Late Adjust / Add Bill-Service.
   ============================================================ */

.topbar.budget-command-header {
  display: block !important;
  margin: 0 0 0 !important;
  background:
    radial-gradient(circle at 18% 0%, rgba(34, 197, 94, 0.075), transparent 34rem),
    linear-gradient(180deg, rgba(5, 10, 15, 0.94), rgba(5, 10, 15, 0.72)) !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18) !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.025),
    0 14px 36px rgba(0, 0, 0, 0.18) !important;
}

.topbar.budget-command-header .budget-command-brand-row {
  min-height: 6.85rem !important;
  box-sizing: border-box !important;
  padding: 1.55rem 1.65rem 1.25rem !important;
}
.topbar.budget-command-header .brand-copy h1 {
  font-size: 1.35rem !important;
  line-height: 1.15 !important;
  letter-spacing: -0.01em !important;
}
.topbar.budget-command-header .brand-copy p {
  color: var(--muted) !important;
}
.topbar.budget-command-header .timestamp {
  color: var(--muted) !important;
  white-space: nowrap !important;
  font-size: 0.95rem !important;
}

.nav.budget-command-nav {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 0.5rem !important;
  min-height: 4.15rem !important;
  box-sizing: border-box !important;
  padding: 0.85rem 1.65rem !important;
  margin: 0 0 1.1rem 0 !important;
  border-top: 1px solid rgba(148, 163, 184, 0.14) !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.06) !important;
  background:
    radial-gradient(circle at 14% 40%, rgba(34, 197, 94, 0.055), transparent 28rem),
    rgba(5, 10, 15, 0.34) !important;
}

.nav.budget-command-nav a,
.nav.budget-command-nav .nav-pill {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 2.35rem !important;
  padding: 0.45rem 0.82rem !important;
  border: 1px solid rgba(148, 163, 184, 0.25) !important;
  border-radius: 999px !important;
  background: rgba(15, 23, 42, 0.78) !important;
  color: var(--text) !important;
  text-decoration: none !important;
  font-size: 0.95rem !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 1px 2px rgba(0, 0, 0, 0.18) !important;
}

.nav.budget-command-nav a:hover,
.nav.budget-command-nav .nav-pill:hover {
  border-color: rgba(96, 165, 250, 0.55) !important;
  background: rgba(30, 41, 59, 0.94) !important;
  color: #ffffff !important;
  text-decoration: none !important;
  transform: translateY(-1px) !important;
}

.nav.budget-command-nav a.active,
.nav.budget-command-nav a[aria-current="page"],
.nav.budget-command-nav .nav-pill.active,
.nav.budget-command-nav .nav-pill[aria-current="page"] {
  background: linear-gradient(180deg, #3b82f6, #2563eb) !important;
  border-color: rgba(147, 197, 253, 0.82) !important;
  color: #ffffff !important;
  box-shadow:
    0 0 0 2px rgba(59, 130, 246, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 4px 14px rgba(37, 99, 235, 0.22) !important;
  transform: none !important;
}

@media (max-width: 900px) {
  .topbar.budget-command-header .budget-command-brand-row {
    min-height: 5.8rem !important;
    padding: 1.2rem 1rem 1rem !important;
  }

  .nav.budget-command-nav {
    gap: 0.4rem !important;
    min-height: 3.7rem !important;
    padding: 0.7rem 1rem !important;
  }

  .nav.budget-command-nav a,
  .nav.budget-command-nav .nav-pill {
    font-size: 0.9rem !important;
    padding: 0.42rem 0.68rem !important;
  }
}

/* ============================================================
   Phase 3L4J Shell Gremlin Cleanup
   Now that index.php emits stable shell classes, prevent old
   runtime tagging side effects from forcing brand-copy into flex.
   ============================================================ */

.topbar.budget-command-header .budget-command-brand-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
}

.topbar.budget-command-header .brand-copy,
.topbar.budget-command-header .brand-copy.budget-command-brand-row {
  display: block !important;
  min-height: 0 !important;
  padding: 0 !important;
  flex: 1 1 auto !important;
}

.topbar.budget-command-header .brand-copy h1 {
  display: block !important;
  margin: 0 !important;
}

.topbar.budget-command-header .brand-copy p {
  display: block !important;
  margin: 0.45rem 0 0 !important;
}

.topbar.budget-command-header .timestamp {
  display: block !important;
  flex: 0 0 auto !important;
  margin-left: 1rem !important;
}

/* ============================================================
   Phase 3L5 Scheduled Confidence Polish
   ============================================================ */

.scheduled-confidence-panel {
  border-color: rgba(59, 130, 246, 0.35);
  background:
    radial-gradient(circle at 15% 0%, rgba(59, 130, 246, 0.08), transparent 28rem),
    linear-gradient(180deg, rgba(15, 23, 42, 0.68), rgba(15, 23, 42, 0.42));
}

.scheduled-confidence-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.scheduled-confidence-header h2 {
  margin-bottom: 0.35rem;
}

.intent-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.intent-badge.future-plan {
  color: #bfdbfe;
  border: 1px solid rgba(96, 165, 250, 0.55);
  background: rgba(37, 99, 235, 0.18);
}

.scheduled-confidence-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(13rem, 1fr));
  gap: 0.85rem;
}

.scheduled-confidence-card {
  border: 1px solid rgba(148, 163, 184, 0.20);
  border-radius: 0.9rem;
  padding: 0.9rem;
  background: rgba(5, 10, 15, 0.28);
}

.scheduled-confidence-card strong {
  display: block;
  margin-bottom: 0.4rem;
}

.scheduled-confidence-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.scheduled-confidence-card.good {
  border-color: rgba(34, 197, 94, 0.35);
}

.scheduled-confidence-card.caution {
  border-color: rgba(234, 179, 8, 0.35);
}

.scheduled-confidence-card.info {
  border-color: rgba(59, 130, 246, 0.35);
}

.scheduled-confidence-card.warning {
  border-color: rgba(248, 113, 113, 0.35);
}

.scheduled-confidence-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
}

.scheduled-confidence-actions a {
  text-decoration: none !important;
}

@media (max-width: 1200px) {
  .scheduled-confidence-grid {
    grid-template-columns: repeat(2, minmax(13rem, 1fr));
  }
}

@media (max-width: 700px) {
  .scheduled-confidence-header {
    flex-direction: column;
  }

  .scheduled-confidence-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Phase 3L5B Scheduled Confidence Action Buttons
   Makes Add Bill/Service, Open Events, and Late Adjust visually consistent.
   ============================================================ */

.scheduled-confidence-actions a,
.scheduled-confidence-actions .primary-button,
.scheduled-confidence-actions .secondary-button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 2.35rem !important;
  padding: 0.45rem 0.85rem !important;
  border-radius: 999px !important;
  border: 1px solid rgba(148, 163, 184, 0.25) !important;
  background: rgba(15, 23, 42, 0.78) !important;
  color: var(--text) !important;
  text-decoration: none !important;
  font-size: 0.95rem !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 1px 2px rgba(0, 0, 0, 0.18) !important;
}

.scheduled-confidence-actions a:hover,
.scheduled-confidence-actions .primary-button:hover,
.scheduled-confidence-actions .secondary-button:hover {
  border-color: rgba(96, 165, 250, 0.55) !important;
  background: rgba(30, 41, 59, 0.94) !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
}

.scheduled-confidence-actions a:first-child {
  background: linear-gradient(180deg, #3b82f6, #2563eb) !important;
  border-color: rgba(147, 197, 253, 0.82) !important;
  color: #ffffff !important;
  box-shadow:
    0 0 0 2px rgba(59, 130, 246, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 4px 14px rgba(37, 99, 235, 0.18) !important;
}

/* ============================================================
   Phase 3L6 Events Quick Status Controls
   ============================================================ */

.quick-event-status-cell {
  white-space: nowrap;
}

.quick-event-status-select {
  display: inline-flex;
  margin-left: 0.45rem;
  min-height: 1.85rem;
  max-width: 9.5rem;
  padding: 0.2rem 1.6rem 0.2rem 0.55rem;
  border: 1px solid rgba(96, 165, 250, 0.38);
  border-radius: 999px;
  background-color: rgba(15, 23, 42, 0.88);
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1;
}

.quick-event-status-select:hover {
  border-color: rgba(96, 165, 250, 0.7);
  background-color: rgba(30, 41, 59, 0.95);
}

.quick-event-status-select:disabled {
  opacity: 0.65;
  cursor: wait;
}

@media (max-width: 900px) {
  .quick-event-status-select {
    max-width: 8rem;
    font-size: 0.78rem;
  }
}

/* ============================================================
   Phase 3L6F Visible Clear Pair State
   ============================================================ */

.clear-transfer-pair-state-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.85rem;
  margin-left: 0.45rem;
  padding: 0.22rem 0.62rem;
  border-radius: 999px;
  border: 1px solid rgba(34, 197, 94, 0.45);
  background: rgba(22, 101, 52, 0.22);
  color: #86efac;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.clear-transfer-pair-state-button:hover:not(:disabled) {
  border-color: rgba(34, 197, 94, 0.78);
  background: rgba(22, 101, 52, 0.36);
  color: #bbf7d0;
}

.clear-transfer-pair-state-button:disabled {
  cursor: default;
}

.clear-transfer-pair-state-button.pair-cleared {
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(71, 85, 105, 0.20);
  color: rgba(203, 213, 225, 0.72);
}


/* ============================================================
   Phase 3L8A Rollover Date Guardrails
   ============================================================ */

.date-suggestion-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-top: -0.25rem;
}

.date-suggestion-row .small-button {
  min-height: 2.1rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  border-radius: 999px;
}


/* ============================================================
   Phase 3L8B v2 CSS-Only Unified Top Shell
   Normalizes the top header/nav across the main app and standalone
   tools without touching PHP body/header markup.
   ============================================================ */

:root {
  --phase3l8b-shell-max: 1760px;
  --phase3l8b-shell-pad: clamp(0.85rem, 1.8vw, 1.45rem);
  --phase3l8b-header-radius: 1.25rem;
  --phase3l8b-pill-height: 2.42rem;
}

/* Same outer width on main app and standalone utility pages. */
body[class^="page-"],
body[class*=" page-"],
.standalone-shell,
.app-shell,
.budget-shell,
.page-shell {
  max-width: var(--phase3l8b-shell-max) !important;
}

/* Normalize the command header block everywhere it appears. */
.topbar,
.budget-command-header,
.standalone-header,
.app-header,
.brand-row,
.budget-command-brand-row {
  box-sizing: border-box !important;
}

/* Main app header and standalone page header should have same visual height. */
header.topbar,
.topbar.budget-command-header,
.standalone-header,
.standalone-shell > header,
.app-shell > header {
  min-height: 5.35rem !important;
  padding: 1rem var(--phase3l8b-shell-pad) !important;
  margin: 0 auto 0.75rem auto !important;
  width: min(var(--phase3l8b-shell-max), calc(100vw - 1.5rem)) !important;
  max-width: var(--phase3l8b-shell-max) !important;
  border-radius: var(--phase3l8b-header-radius) !important;
  border: 1px solid rgba(148, 163, 184, 0.18) !important;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.14), transparent 34rem),
    linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.84)) !important;
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
}

/* Inner header row alignment. */
.budget-command-brand-row,
.standalone-header,
.standalone-shell > header,
.app-shell > header,
header.topbar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 1rem !important;
}

/* Header text scale. */
.budget-command-header h1,
.topbar h1,
.standalone-header h1,
.standalone-shell > header h1,
.app-shell > header h1 {
  margin: 0 !important;
  font-size: clamp(1.45rem, 2vw, 2rem) !important;
  line-height: 1.08 !important;
  letter-spacing: -0.03em !important;
}

.budget-command-header p,
.topbar p,
.standalone-header p,
.standalone-shell > header p,
.app-shell > header p {
  margin: 0.28rem 0 0 0 !important;
  color: rgba(203, 213, 225, 0.78) !important;
  font-size: 0.95rem !important;
}

.timestamp,
time.timestamp,
.topbar time,
.standalone-header time {
  color: rgba(203, 213, 225, 0.78) !important;
  font-size: 0.9rem !important;
  white-space: nowrap !important;
}

/* Normalize nav strip shape/spacing. */
.budget-command-nav,
.main-nav,
.app-nav,
.standalone-nav,
nav[aria-label="Main navigation"],
nav[aria-label="Budget navigation"],
header + nav {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 0.42rem !important;
  min-height: 3.25rem !important;
  padding: 0.42rem !important;
  margin: 0 auto 0.95rem auto !important;
  width: min(var(--phase3l8b-shell-max), calc(100vw - 1.5rem)) !important;
  max-width: var(--phase3l8b-shell-max) !important;
  border-radius: 999px !important;
  border: 1px solid rgba(148, 163, 184, 0.16) !important;
  background: rgba(2, 6, 23, 0.42) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 8px 26px rgba(0, 0, 0, 0.12) !important;
}

/* Normalize all nav anchors/pills. */
.budget-command-nav a,
.main-nav a,
.app-nav a,
.standalone-nav a,
.nav-pill,
.nav-link,
header + nav a {
  min-height: var(--phase3l8b-pill-height) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0.46rem 0.82rem !important;
  border-radius: 999px !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  color: rgba(226, 232, 240, 0.82) !important;
  text-decoration: none !important;
  line-height: 1 !important;
  font-size: 0.92rem !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
}

.budget-command-nav a:hover,
.main-nav a:hover,
.app-nav a:hover,
.standalone-nav a:hover,
.nav-pill:hover,
.nav-link:hover,
header + nav a:hover {
  background: rgba(30, 41, 59, 0.86) !important;
  border-color: rgba(96, 165, 250, 0.34) !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
}

/* Active/current page state. */
.budget-command-nav a.active,
.main-nav a.active,
.app-nav a.active,
.standalone-nav a.active,
.nav-pill.active,
.nav-link.active,
a[aria-current="page"],
.page-dashboard .budget-command-nav a[href="/"],
.page-events .budget-command-nav a[href="/?page=events"],
.page-income .budget-command-nav a[href="/?page=income"],
.page-spending .budget-command-nav a[href="/?page=spending"],
.page-reserves .budget-command-nav a[href="/?page=reserves"],
.page-scheduled .budget-command-nav a[href="/?page=scheduled"],
.page-debts .budget-command-nav a[href="/?page=debts"],
.page-review .budget-command-nav a[href="/?page=review"],
.page-scenarios .budget-command-nav a[href="/?page=scenarios"],
.page-months .budget-command-nav a[href="/?page=months"],
.page-close_checklist .budget-command-nav a[href="/?page=close_checklist"] {
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.98), rgba(29, 78, 216, 0.94)) !important;
  border-color: rgba(147, 197, 253, 0.72) !important;
  color: #ffffff !important;
  box-shadow:
    0 0 0 2px rgba(59, 130, 246, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 8px 20px rgba(37, 99, 235, 0.22) !important;
}

/* Prevent first content card/hero from visually colliding with the normalized nav. */
.hero,
.panel:first-of-type {
  margin-top: 0 !important;
}

@media (max-width: 900px) {
  header.topbar,
  .topbar.budget-command-header,
  .standalone-header,
  .standalone-shell > header,
  .app-shell > header,
  .budget-command-brand-row {
    align-items: flex-start !important;
    flex-direction: column !important;
    min-height: unset !important;
  }

  .timestamp,
  time.timestamp,
  .topbar time,
  .standalone-header time {
    white-space: normal !important;
  }

  .budget-command-nav,
  .main-nav,
  .app-nav,
  .standalone-nav,
  header + nav {
    border-radius: 1.1rem !important;
  }
}


/* ============================================================
   Phase 3L8B v3 Standalone Shell Cleanup
   Removes failed v1 body-scope behavior and lets the CSS-only
   unified shell rules apply consistently.
   ============================================================ */

body.standalone-page .standalone-shell {
  width: min(var(--phase3l8b-shell-max, 1760px), calc(100vw - 1.5rem)) !important;
  max-width: var(--phase3l8b-shell-max, 1760px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

body.standalone-page header,
body.standalone-page nav {
  width: 100% !important;
}


/* ============================================================
   Phase 3L8C Shared Top Shell Markup
   Late Adjust and Add Bill/Service now use the same top shell
   markup as the main app.
   ============================================================ */

body.standalone-page .topbar.budget-command-header,
body.standalone-page .nav.budget-command-nav {
  width: min(var(--phase3l8b-shell-max, 1760px), calc(100vw - 1.5rem)) !important;
  max-width: var(--phase3l8b-shell-max, 1760px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

body.standalone-page .standalone-page-title {
  margin-top: 0 !important;
}


/* ============================================================
   Phase 3L8D Top Shell Horizontal Alignment
   Forces Dashboard/main app and standalone tools to use the same
   horizontal shell width and left/right positioning.
   ============================================================ */

:root {
  --phase3l8d-page-gutter: clamp(1.25rem, 1.45vw, 1.65rem);
}

/* Remove standalone-page horizontal weirdness. */
body.standalone-page {
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* One shared horizontal frame for header, nav, and main content. */
header.topbar.budget-command-header,
nav.nav.budget-command-nav,
body > main,
body.standalone-page > main.container {
  width: calc(100vw - (var(--phase3l8d-page-gutter) * 2)) !important;
  margin-left: var(--phase3l8d-page-gutter) !important;
  margin-right: var(--phase3l8d-page-gutter) !important;
}
/* Keep the standalone page title aligned with dashboard hero/panels. */
body.standalone-page .standalone-page-title,
body.standalone-page main.container > .panel:first-child,
body > main > .hero:first-child,
body > main > .panel:first-child {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Keep nav from becoming comically tall unless it actually wraps. */
/* If the nav wraps, keep the second row aligned with the first row. */
nav.nav.budget-command-nav .nav-pill,
nav.nav.budget-command-nav a {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

@media (max-width: 900px) {
  :root {
    --phase3l8d-page-gutter: 0.75rem;
  }

  header.topbar.budget-command-header,
  nav.nav.budget-command-nav,
  body > main,
  body.standalone-page > main.container {
    width: calc(100vw - (var(--phase3l8d-page-gutter) * 2)) !important;
    margin-left: var(--phase3l8d-page-gutter) !important;
    margin-right: var(--phase3l8d-page-gutter) !important;
  }
}


/* ============================================================
   Phase 3L8E Top Shell Width Fix
   Replaces the 100vw-based shell sizing from 3L8D with normal
   margin-based sizing so the right edge does not clip or drift.
   UI-only.
   ============================================================ */

:root {
  --phase3l8e-gutter: clamp(1.25rem, 1.45vw, 1.65rem);
}

/* Prevent 100vw scrollbar math from creating sideways clipping. */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

/* Same horizontal frame for every top-level app page/tool. */
header.topbar.budget-command-header,
nav.nav.budget-command-nav,
body > main,
body.standalone-page > main.container {
  box-sizing: border-box !important;
  width: auto !important;
  max-width: none !important;
  margin-left: var(--phase3l8e-gutter) !important;
  margin-right: var(--phase3l8e-gutter) !important;
}

/* The header/nav should fill the same available row, not calculate against 100vw. */
header.topbar.budget-command-header,
nav.nav.budget-command-nav {
  left: auto !important;
  right: auto !important;
}

/* Keep the inner brand row clean and consistent. */
header.topbar.budget-command-header .budget-command-brand-row {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
}

/* Main panels/hero should line up under the nav, not add a second horizontal offset. */
body > main > .hero:first-child,
body > main > .panel:first-child,
body.standalone-page main.container > .panel:first-child,
body.standalone-page .standalone-page-title {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Keep nav wrapping predictable and aligned. */
nav.nav.budget-command-nav {
  justify-content: flex-start !important;
  align-content: center !important;
  row-gap: 0.42rem !important;
  column-gap: 0.42rem !important;
}

nav.nav.budget-command-nav a,
nav.nav.budget-command-nav .nav-pill {
  flex: 0 0 auto !important;
}

@media (max-width: 900px) {
  :root {
    --phase3l8e-gutter: 0.75rem;
  }
}


/* ============================================================
   Phase 3L8F Authoritative Top Frame
   Last-word layout frame for Dashboard, Late Adjust, and
   Add Bill/Service. This overrides the older stacked shell rules
   without deleting them yet.
   UI-only. No functional/database changes.
   ============================================================ */

:root {
  --cf-top-frame-gutter: clamp(1.25rem, 1.45vw, 1.65rem);
  --cf-top-frame-width: calc(100% - (var(--cf-top-frame-gutter) * 2));
}

/* Undo body-level width differences between normal and standalone pages. */
html,
body,
body[class^="page-"],
body[class*=" page-"],
body.standalone-page {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  overflow-x: hidden !important;
}

/* One identical horizontal frame for all top-level page shells. */
body > header.topbar.budget-command-header,
body > nav.nav.budget-command-nav,
body > main,
body.standalone-page > main.container {
  box-sizing: border-box !important;
  width: var(--cf-top-frame-width) !important;
  max-width: none !important;
  min-width: 0 !important;
  margin-left: var(--cf-top-frame-gutter) !important;
  margin-right: var(--cf-top-frame-gutter) !important;
}

/* Defeat older standalone-specific width rules. */
body.standalone-page > header.topbar.budget-command-header,
body.standalone-page > nav.nav.budget-command-nav,
body.standalone-page > main.container {
  box-sizing: border-box !important;
  width: var(--cf-top-frame-width) !important;
  max-width: none !important;
  min-width: 0 !important;
  margin-left: var(--cf-top-frame-gutter) !important;
  margin-right: var(--cf-top-frame-gutter) !important;
}

/* Keep the header’s internal brand row from creating a second frame. */
body > header.topbar.budget-command-header > .budget-command-brand-row,
body.standalone-page > header.topbar.budget-command-header > .budget-command-brand-row {
  width: 100% !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box !important;
}

/* Main content panels should line up according to their parent main frame. */
body > main > .hero:first-child,
body > main > .panel:first-child,
body.standalone-page > main.container > .panel:first-child,
body.standalone-page .standalone-page-title {
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box !important;
}

/* Nav wrap should be predictable and left-aligned on every page. */
body > nav.nav.budget-command-nav,
body.standalone-page > nav.nav.budget-command-nav {
  justify-content: flex-start !important;
  align-content: center !important;
  row-gap: 0.42rem !important;
  column-gap: 0.42rem !important;
}

body > nav.nav.budget-command-nav > a,
body > nav.nav.budget-command-nav > .nav-pill,
body.standalone-page > nav.nav.budget-command-nav > a,
body.standalone-page > nav.nav.budget-command-nav > .nav-pill {
  flex: 0 0 auto !important;
}

@media (max-width: 900px) {
  :root {
    --cf-top-frame-gutter: 0.75rem;
  }
}


/* ============================================================
   Phase 3L9A Sidebar Navigation Shell
   Desktop: collapsible left sidebar.
   Mobile: hamburger drawer.
   Original top nav is hidden only after JS builds sidebar.
   ============================================================ */

:root {
  --cf-sidebar-width: 17.25rem;
  --cf-sidebar-gutter: 0.9rem;
  --cf-main-gutter: clamp(1rem, 1.35vw, 1.45rem);
}

.cf-sidebar {
  position: fixed;
  z-index: 80;
  top: var(--cf-sidebar-gutter);
  left: var(--cf-sidebar-gutter);
  bottom: var(--cf-sidebar-gutter);
  width: var(--cf-sidebar-width);
  box-sizing: border-box;
  padding: 0.85rem;
  overflow-y: auto;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 1.25rem;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.16), transparent 22rem),
    linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.95));
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transform: translateX(0);
  transition: transform 160ms ease, opacity 160ms ease;
}

.cf-sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.25rem 0.25rem 0.85rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  margin-bottom: 0.85rem;
}

.cf-sidebar-top strong {
  display: block;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.1;
}

.cf-sidebar-top span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 0.15rem;
}

.cf-sidebar-close,
.cf-sidebar-toggle {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.82);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.cf-sidebar-close {
  width: 2rem;
  height: 2rem;
  font-size: 1.2rem;
  line-height: 1;
}

.cf-sidebar-toggle {
  min-height: 2.25rem;
  padding: 0.35rem 0.75rem;
  white-space: nowrap;
}

.cf-sidebar-close:hover,
.cf-sidebar-toggle:hover {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(30, 41, 59, 0.95);
}

.cf-sidebar-section {
  margin: 0 0 0.95rem;
}

.cf-sidebar-section h2 {
  margin: 0.35rem 0.35rem 0.45rem;
  color: rgba(148, 163, 184, 0.9);
  font-size: 0.72rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cf-sidebar-link {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  width: 100% !important;
  min-height: 2.35rem !important;
  margin: 0.22rem 0 !important;
  padding: 0.52rem 0.68rem !important;
  border-radius: 0.8rem !important;
  border: 1px solid rgba(148, 163, 184, 0.16) !important;
  background: rgba(15, 23, 42, 0.58) !important;
  color: rgba(226, 232, 240, 0.9) !important;
  text-decoration: none !important;
  font-size: 0.92rem !important;
  font-weight: 750 !important;
  box-sizing: border-box !important;
}

.cf-sidebar-link:hover {
  border-color: rgba(96, 165, 250, 0.45) !important;
  background: rgba(30, 41, 59, 0.92) !important;
  color: #ffffff !important;
}

.cf-sidebar-link.active,
.cf-sidebar-link[aria-current="page"] {
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.98), rgba(29, 78, 216, 0.94)) !important;
  border-color: rgba(147, 197, 253, 0.72) !important;
  color: #ffffff !important;
  box-shadow:
    0 0 0 2px rgba(59, 130, 246, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 8px 20px rgba(37, 99, 235, 0.22) !important;
}

/* Original top nav remains as fallback until sidebar JS succeeds. */
body.cf-sidebar-ready > nav.nav.budget-command-nav {
  display: none !important;
}

/* Desktop layout with sidebar visible. */
body.cf-sidebar-ready:not(.cf-sidebar-collapsed) > header.topbar.budget-command-header,
body.cf-sidebar-ready:not(.cf-sidebar-collapsed) > main,
body.cf-sidebar-ready:not(.cf-sidebar-collapsed).standalone-page > main.container {
  width: auto !important;
  max-width: none !important;
  margin-left: calc(var(--cf-sidebar-width) + (var(--cf-sidebar-gutter) * 2)) !important;
  margin-right: var(--cf-main-gutter) !important;
}

body.cf-sidebar-ready:not(.cf-sidebar-collapsed) > header.topbar.budget-command-header {
  margin-top: var(--cf-sidebar-gutter) !important;
}

body.cf-sidebar-collapsed .cf-sidebar {
  transform: translateX(calc(-100% - 1.25rem));
  opacity: 0;
  pointer-events: none;
}

/* Collapsed desktop returns to normal full-width frame. */
body.cf-sidebar-ready.cf-sidebar-collapsed > header.topbar.budget-command-header,
body.cf-sidebar-ready.cf-sidebar-collapsed > main,
body.cf-sidebar-ready.cf-sidebar-collapsed.standalone-page > main.container {
  width: var(--cf-top-frame-width, calc(100% - 2.5rem)) !important;
  margin-left: var(--cf-top-frame-gutter, 1.25rem) !important;
  margin-right: var(--cf-top-frame-gutter, 1.25rem) !important;
}

.cf-sidebar-overlay {
  display: none;
}

@media (max-width: 900px) {
  .cf-sidebar {
    top: 0.65rem;
    left: 0.65rem;
    bottom: 0.65rem;
    width: min(18rem, calc(100vw - 1.3rem));
    transform: translateX(calc(-100% - 1.25rem));
    opacity: 0;
    pointer-events: none;
  }

  body.cf-sidebar-open .cf-sidebar {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .cf-sidebar-overlay {
    position: fixed;
    z-index: 70;
    inset: 0;
    display: none;
    border: 0;
    background: rgba(2, 6, 23, 0.62);
  }

  body.cf-sidebar-open .cf-sidebar-overlay {
    display: block;
  }

  body.cf-sidebar-ready > header.topbar.budget-command-header,
  body.cf-sidebar-ready > main,
  body.cf-sidebar-ready.standalone-page > main.container {
    width: var(--cf-top-frame-width, calc(100% - 1.5rem)) !important;
    margin-left: var(--cf-top-frame-gutter, 0.75rem) !important;
    margin-right: var(--cf-top-frame-gutter, 0.75rem) !important;
  }
}


/* ============================================================
   Phase 3L9B Standalone Sidebar JS
   Standalone pages now load budget-ui.js, so sidebar behavior
   should match the main app.
   ============================================================ */

body.standalone-page.cf-sidebar-ready > nav.nav.budget-command-nav {
  display: none !important;
}


/* ============================================================
   Phase 3L9D Sidebar Link Normalization
   Last-word sidebar link sizing. Prevents original top-nav pill
   classes from affecting sidebar button dimensions.
   ============================================================ */

body .cf-sidebar a.cf-sidebar-link,
body .cf-sidebar a.cf-sidebar-link:link,
body .cf-sidebar a.cf-sidebar-link:visited {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  height: auto !important;
  min-height: 2.35rem !important;
  margin: 0.22rem 0 !important;
  padding: 0.52rem 0.68rem !important;
  box-sizing: border-box !important;
  border-radius: 0.8rem !important;
  border: 1px solid rgba(148, 163, 184, 0.16) !important;
  background: rgba(15, 23, 42, 0.58) !important;
  color: rgba(226, 232, 240, 0.9) !important;
  text-decoration: none !important;
  font-size: 0.92rem !important;
  font-weight: 750 !important;
  line-height: 1.15 !important;
  white-space: nowrap !important;
  transform: none !important;
  box-shadow: none !important;
}

body .cf-sidebar a.cf-sidebar-link:hover {
  border-color: rgba(96, 165, 250, 0.45) !important;
  background: rgba(30, 41, 59, 0.92) !important;
  color: #ffffff !important;
  transform: none !important;
}

body .cf-sidebar a.cf-sidebar-link.active,
body .cf-sidebar a.cf-sidebar-link[aria-current="page"] {
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.98), rgba(29, 78, 216, 0.94)) !important;
  border-color: rgba(147, 197, 253, 0.72) !important;
  color: #ffffff !important;
  box-shadow:
    0 0 0 2px rgba(59, 130, 246, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 8px 20px rgba(37, 99, 235, 0.22) !important;
}


/* ============================================================
   Phase 3L9E Quick Add Date Sync Fix
   No visual changes; marker only.
   ============================================================ */



/* ============================================================
   Phase 3L10N Reserve Events Styling
   ID | Date | Due | Status | Reserve | Direction | Amount | Description
   ============================================================ */

.reserve-events-panel .table-wrap {
  overflow-x: auto !important;
}

.reserve-events-panel table {
  width: 100% !important;
  min-width: 980px !important;
  table-layout: fixed !important;
}

.reserve-events-panel table th,
.reserve-events-panel table td {
  display: table-cell !important;
  visibility: visible !important;
  box-sizing: border-box !important;
  vertical-align: middle !important;
}

.reserve-events-panel table th:nth-child(1),
.reserve-events-panel table td:nth-child(1) {
  width: 5rem !important;
  text-align: right !important;
}

.reserve-events-panel table th:nth-child(2),
.reserve-events-panel table td:nth-child(2),
.reserve-events-panel table th:nth-child(3),
.reserve-events-panel table td:nth-child(3) {
  width: 8rem !important;
  white-space: nowrap !important;
}

.reserve-events-panel table th:nth-child(4),
.reserve-events-panel table td:nth-child(4) {
  width: 7.5rem !important;
  white-space: nowrap !important;
}

.reserve-events-panel table th:nth-child(5),
.reserve-events-panel table td:nth-child(5) {
  width: 11rem !important;
  padding-right: 1rem !important;
  white-space: nowrap !important;
  color: rgba(226, 232, 240, 0.94) !important;
  font-weight: 700 !important;
}

.reserve-events-panel table th:nth-child(6),
.reserve-events-panel table td:nth-child(6) {
  width: 8.5rem !important;
  padding-left: 0.6rem !important;
  white-space: nowrap !important;
}

.reserve-events-panel table th:nth-child(7),
.reserve-events-panel table td:nth-child(7) {
  width: 8rem !important;
  text-align: right !important;
  white-space: nowrap !important;
  color: #22c55e !important;
  font-weight: 700 !important;
  font-variant-numeric: tabular-nums !important;
}

.reserve-events-panel table th:nth-child(8),
.reserve-events-panel table td:nth-child(8) {
  width: auto !important;
  min-width: 18rem !important;
  text-align: left !important;
  white-space: normal !important;
  color: var(--text, #e5eefb) !important;
  font-weight: 500 !important;
}

/* ============================================================
   Phase 3L10O Count One-Sided Reserve Top-Offs
   No layout change. Marker only.
   Reserve Funding Summary now counts cleared Main → Reserve
   transfer_out top-offs when no matching reserve transfer_in exists.
   ============================================================ */


/* ============================================================
   Phase 3L10P2 Event Notes Modal Only
   Small, safe reimplementation:
   - no MutationObserver
   - no status/dropdown changes
   - no visible Notes column
   - rows with notes open modal on click
   ============================================================ */

.event-table tr.has-event-note {
  cursor: pointer !important;
}

.event-table tr.has-event-note:hover {
  background: rgba(96, 165, 250, 0.07) !important;
}

.event-table tr.has-event-note:hover td:last-child {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.event-table tr.has-event-note a,
.event-table tr.has-event-note button,
.event-table tr.has-event-note select,
.event-table tr.has-event-note input,
.event-table tr.has-event-note textarea,
.event-table tr.has-event-note label {
  cursor: auto !important;
}

.event-note-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(2, 6, 23, 0.68);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.event-note-modal-backdrop.is-open {
  display: flex !important;
}

.event-note-modal {
  width: min(100%, 42rem);
  max-height: min(80vh, 38rem);
  overflow: auto;
  border: 1px solid rgba(96, 165, 250, 0.34);
  border-radius: 1.25rem;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  color: var(--text, #e5eefb);
}

.event-note-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.event-note-modal-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.event-note-modal-close {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.72);
  color: var(--text, #e5eefb);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  cursor: pointer;
}

.event-note-modal-body {
  padding: 1rem 1.15rem 1.2rem;
  white-space: pre-wrap;
  line-height: 1.45;
}


/* ============================================================
   Phase 3L10P3 Reserve Events Status Polish
   CSS-only.
   - Hide duplicate status badge in Reserve Events quick-status cells
   - Style existing quick dropdown as the status indicator
   - Hide ugly Pair Cleared controls
   - No JS. No MutationObserver. No global table reshaping.
   ============================================================ */

.reserve-events-panel .quick-event-status-cell .badge,
.reserve-events-panel .quick-event-status-cell .status-badge,
.reserve-events-panel .quick-event-status-cell .status-pill {
  display: none !important;
}

.reserve-events-panel .quick-event-status-cell {
  white-space: nowrap !important;
}

.reserve-events-panel .quick-event-status-select {
  min-width: 7.6rem !important;
  max-width: 8.4rem !important;
  padding: 0.34rem 1.65rem 0.34rem 0.72rem !important;
  border-radius: 999px !important;
  font-size: 0.9rem !important;
  font-weight: 800 !important;
  line-height: 1.1 !important;
  background-color: rgba(15, 23, 42, 0.78) !important;
  color: var(--text, #e5eefb) !important;
  border: 1px solid rgba(96, 165, 250, 0.42) !important;
  box-shadow: none !important;
}

.reserve-events-panel .quick-event-status-select:hover:not(:disabled),
.reserve-events-panel .quick-event-status-select:focus:not(:disabled) {
  border-color: rgba(96, 165, 250, 0.78) !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18) !important;
}

.reserve-events-panel .quick-event-status-select:disabled {
  opacity: 0.68 !important;
  cursor: not-allowed !important;
}

/* Color the select based on the currently selected option. */
.reserve-events-panel .quick-event-status-select:has(option[value="planned"]:checked) {
  color: #facc15 !important;
  border-color: rgba(202, 138, 4, 0.82) !important;
  background-color: rgba(113, 63, 18, 0.18) !important;
}

.reserve-events-panel .quick-event-status-select:has(option[value="committed"]:checked) {
  color: #fb923c !important;
  border-color: rgba(249, 115, 22, 0.78) !important;
  background-color: rgba(124, 45, 18, 0.20) !important;
}

.reserve-events-panel .quick-event-status-select:has(option[value="cleared"]:checked) {
  color: #4ade80 !important;
  border-color: rgba(34, 197, 94, 0.82) !important;
  background-color: rgba(20, 83, 45, 0.24) !important;
}

.reserve-events-panel .quick-event-status-select:has(option[value="skipped"]:checked),
.reserve-events-panel .quick-event-status-select:has(option[value="cancelled"]:checked) {
  color: #cbd5e1 !important;
  border-color: rgba(148, 163, 184, 0.58) !important;
  background-color: rgba(51, 65, 85, 0.26) !important;
}

.reserve-events-panel .quick-event-status-select:has(option[value="mitigated"]:checked),
.reserve-events-panel .quick-event-status-select:has(option[value="expected_deposit"]:checked) {
  color: #93c5fd !important;
  border-color: rgba(59, 130, 246, 0.70) !important;
  background-color: rgba(30, 64, 175, 0.20) !important;
}

/* Pair Cleared is not useful visual information once the row status already says Cleared. */
.reserve-events-panel .clear-transfer-pair-state-button.pair-cleared,
.reserve-events-panel .clear-transfer-pair-button.pair-cleared {
  display: none !important;
}


/* ============================================================
   Phase 3L10P4 Reserve Events Single Status Renderer
   Small scoped renderer for Reserve Events only.
   No MutationObserver. No global table reshaping.
   ============================================================ */

.reserve-events-panel table.reserve-events-table {
  width: 100% !important;
  min-width: 1020px !important;
  table-layout: fixed !important;
}

.reserve-events-panel table.reserve-events-table th,
.reserve-events-panel table.reserve-events-table td {
  vertical-align: middle !important;
}

.reserve-events-panel table.reserve-events-table th:nth-child(1),
.reserve-events-panel table.reserve-events-table td:nth-child(1) {
  width: 5rem !important;
  text-align: right !important;
}

.reserve-events-panel table.reserve-events-table th:nth-child(2),
.reserve-events-panel table.reserve-events-table td:nth-child(2),
.reserve-events-panel table.reserve-events-table th:nth-child(3),
.reserve-events-panel table.reserve-events-table td:nth-child(3) {
  width: 8.5rem !important;
  white-space: nowrap !important;
}

.reserve-events-panel table.reserve-events-table th:nth-child(4),
.reserve-events-panel table.reserve-events-table td:nth-child(4) {
  width: 9rem !important;
  white-space: nowrap !important;
}

.reserve-events-panel table.reserve-events-table th:nth-child(5),
.reserve-events-panel table.reserve-events-table td:nth-child(5) {
  width: 12rem !important;
  white-space: nowrap !important;
  font-weight: 700 !important;
}

.reserve-events-panel table.reserve-events-table th:nth-child(6),
.reserve-events-panel table.reserve-events-table td:nth-child(6) {
  width: 9rem !important;
  white-space: nowrap !important;
}

.reserve-events-panel table.reserve-events-table th:nth-child(7),
.reserve-events-panel table.reserve-events-table td:nth-child(7) {
  width: 8rem !important;
  text-align: right !important;
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums !important;
}

.reserve-events-panel table.reserve-events-table th:nth-child(8),
.reserve-events-panel table.reserve-events-table td:nth-child(8) {
  width: auto !important;
  min-width: 20rem !important;
  text-align: left !important;
  white-space: normal !important;
}

.reserve-events-panel .reserve-event-status-select.status-pill-select {
  min-width: 7.3rem !important;
  max-width: 7.8rem !important;
  padding: 0.34rem 1.55rem 0.34rem 0.72rem !important;
  border-radius: 999px !important;
  font-size: 0.9rem !important;
  font-weight: 800 !important;
  line-height: 1.1 !important;
  background-color: rgba(15, 23, 42, 0.78) !important;
  color: var(--text, #e5eefb) !important;
  border: 1px solid rgba(96, 165, 250, 0.42) !important;
  box-shadow: none !important;
}

.reserve-events-panel .reserve-event-status-select.status-pill-select:hover:not(:disabled),
.reserve-events-panel .reserve-event-status-select.status-pill-select:focus:not(:disabled) {
  border-color: rgba(96, 165, 250, 0.78) !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18) !important;
}

.reserve-events-panel .reserve-event-status-select.status-pill-select:disabled {
  opacity: 0.68 !important;
  cursor: not-allowed !important;
}

.reserve-events-panel .reserve-event-status-select.status-pill-planned {
  color: #facc15 !important;
  border-color: rgba(202, 138, 4, 0.82) !important;
  background-color: rgba(113, 63, 18, 0.18) !important;
}

.reserve-events-panel .reserve-event-status-select.status-pill-committed {
  color: #fb923c !important;
  border-color: rgba(249, 115, 22, 0.78) !important;
  background-color: rgba(124, 45, 18, 0.20) !important;
}

.reserve-events-panel .reserve-event-status-select.status-pill-cleared {
  color: #4ade80 !important;
  border-color: rgba(34, 197, 94, 0.82) !important;
  background-color: rgba(20, 83, 45, 0.24) !important;
}

.reserve-events-panel .reserve-event-status-select.status-pill-skipped,
.reserve-events-panel .reserve-event-status-select.status-pill-cancelled {
  color: #cbd5e1 !important;
  border-color: rgba(148, 163, 184, 0.58) !important;
  background-color: rgba(51, 65, 85, 0.26) !important;
}

.reserve-events-panel .reserve-event-status-select.status-pill-mitigated {
  color: #93c5fd !important;
  border-color: rgba(59, 130, 246, 0.70) !important;
  background-color: rgba(30, 64, 175, 0.20) !important;
}


/* ============================================================
   Phase 3L10P5 Enable Reserve Transfer Status Dropdowns
   The 3L10P4 renderer was too strict and disabled all reserve
   transfer status selects. Keep the styling, but allow interaction.
   ============================================================ */

.reserve-events-panel .reserve-event-status-select.status-pill-select:not(:disabled) {
  opacity: 1 !important;
}

/* ============================================================
   Phase 3L10P6 Wire Reserve Event Status Updates
   Marker only. Visual styling remains from 3L10P4.
   ============================================================ */
.reserve-events-panel .reserve-event-status-select.status-pill-select:not(:disabled) {
  cursor: pointer !important;
}


/* ============================================================
   Phase 3L10P7 Shared Event Status Pill
   Scoped to shared render_event_table() output only.
   No JS. No MutationObserver. No Review-page changes.
   ============================================================ */

table.shared-event-status-table .shared-event-status-cell {
  white-space: nowrap !important;
}

table.shared-event-status-table .shared-event-status-select.status-pill-select {
  min-width: 7.6rem !important;
  max-width: 8.8rem !important;
  padding: 0.34rem 1.65rem 0.34rem 0.72rem !important;
  border-radius: 999px !important;
  font-size: 0.9rem !important;
  font-weight: 800 !important;
  line-height: 1.1 !important;
  background-color: rgba(15, 23, 42, 0.78) !important;
  color: var(--text, #e5eefb) !important;
  border: 1px solid rgba(96, 165, 250, 0.42) !important;
  box-shadow: none !important;
}

table.shared-event-status-table .shared-event-status-select.status-pill-select:hover:not(:disabled),
table.shared-event-status-table .shared-event-status-select.status-pill-select:focus:not(:disabled) {
  border-color: rgba(96, 165, 250, 0.78) !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18) !important;
}

table.shared-event-status-table .shared-event-status-select.status-pill-planned {
  color: #facc15 !important;
  border-color: rgba(202, 138, 4, 0.82) !important;
  background-color: rgba(113, 63, 18, 0.18) !important;
}

table.shared-event-status-table .shared-event-status-select.status-pill-committed {
  color: #fb923c !important;
  border-color: rgba(249, 115, 22, 0.78) !important;
  background-color: rgba(124, 45, 18, 0.20) !important;
}

table.shared-event-status-table .shared-event-status-select.status-pill-expected_deposit {
  color: #93c5fd !important;
  border-color: rgba(59, 130, 246, 0.70) !important;
  background-color: rgba(30, 64, 175, 0.20) !important;
}

table.shared-event-status-table .shared-event-status-select.status-pill-cleared {
  color: #4ade80 !important;
  border-color: rgba(34, 197, 94, 0.82) !important;
  background-color: rgba(20, 83, 45, 0.24) !important;
}

table.shared-event-status-table .shared-event-status-select.status-pill-skipped,
table.shared-event-status-table .shared-event-status-select.status-pill-cancelled {
  color: #cbd5e1 !important;
  border-color: rgba(148, 163, 184, 0.58) !important;
  background-color: rgba(51, 65, 85, 0.26) !important;
}

table.shared-event-status-table .shared-event-status-select.status-pill-mitigated {
  color: #93c5fd !important;
  border-color: rgba(59, 130, 246, 0.70) !important;
  background-color: rgba(30, 64, 175, 0.20) !important;
}


/* ============================================================
   Phase 3L10P8 Shared Event Table Layout Polish
   CSS-only.
   Fixes cramped shared Events/Open Items/Recent Events tables
   after replacing status badges with pill selects.
   No JS. No MutationObserver. No backend changes.
   ============================================================ */

table.shared-event-status-table {
  width: 100% !important;
  min-width: 1040px !important;
  table-layout: fixed !important;
}

table.shared-event-status-table th,
table.shared-event-status-table td {
  vertical-align: middle !important;
}

/* ID */
table.shared-event-status-table th:nth-child(1),
table.shared-event-status-table td:nth-child(1) {
  width: 4.8rem !important;
  text-align: right !important;
  white-space: nowrap !important;
}

/* Date / Due */
table.shared-event-status-table th:nth-child(2),
table.shared-event-status-table td:nth-child(2),
table.shared-event-status-table th:nth-child(3),
table.shared-event-status-table td:nth-child(3) {
  width: 7.9rem !important;
  white-space: nowrap !important;
}

/* Status */
table.shared-event-status-table th:nth-child(4),
table.shared-event-status-table td:nth-child(4) {
  width: 10.2rem !important;
  min-width: 10.2rem !important;
  white-space: nowrap !important;
  overflow: visible !important;
}

table.shared-event-status-table .shared-event-status-select.status-pill-select {
  width: 8.7rem !important;
  min-width: 8.7rem !important;
  max-width: 8.7rem !important;
  display: inline-block !important;
}

/* Account */
table.shared-event-status-table th:nth-child(5),
table.shared-event-status-table td:nth-child(5) {
  width: 15.5rem !important;
  min-width: 15.5rem !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  padding-left: 0.7rem !important;
}

/* Direction */
table.shared-event-status-table th:nth-child(6),
table.shared-event-status-table td:nth-child(6) {
  width: 6.4rem !important;
  white-space: nowrap !important;
  text-align: center !important;
}

/* Amount */
table.shared-event-status-table th:nth-child(7),
table.shared-event-status-table td:nth-child(7) {
  width: 8.3rem !important;
  white-space: nowrap !important;
  text-align: right !important;
  font-variant-numeric: tabular-nums !important;
}

/* Role */
table.shared-event-status-table th:nth-child(8),
table.shared-event-status-table td:nth-child(8) {
  width: 10.5rem !important;
  white-space: normal !important;
}

/* Description */
table.shared-event-status-table th:nth-child(9),
table.shared-event-status-table td:nth-child(9) {
  width: auto !important;
  min-width: 15rem !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

/* Dashboard side panels are narrower; let the table scroll instead of smashing columns. */
.panel table.shared-event-status-table {
  margin-bottom: 0 !important;
}

.panel .table-wrap:has(table.shared-event-status-table) {
  overflow-x: auto !important;
  overflow-y: visible !important;
}

/* Make Open Items less ugly inside the dashboard's narrow right column. */
.panel:has(h2:first-child:is(:not(.nope))) .table-wrap:has(table.shared-event-status-table) {
  scrollbar-width: thin;
}

/* Avoid status pill touching next column in compact cards. */
table.shared-event-status-table td.shared-event-status-cell {
  padding-right: 0.9rem !important;
}

/* Keep row-note underline subtle and only on the description cell. */
table.shared-event-status-table tr.has-event-note:hover td:nth-child(9) {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}


/* ============================================================
   Phase 3L10P9 Review Needed Dedicated Layout
   Scoped to Review Needed only.
   No JS. No MutationObserver. No global table changes.
   ============================================================ */

.page-review .review-needed-panel {
  overflow: hidden !important;
}

.page-review .review-needed-panel .muted {
  max-width: 68rem;
  line-height: 1.35;
}

.page-review .review-table-wrap {
  overflow-x: auto !important;
  overflow-y: visible !important;
  scrollbar-width: thin;
}

.page-review .review-needed-panel table {
  width: 100% !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
}

.page-review .review-needed-panel th,
.page-review .review-needed-panel td {
  vertical-align: middle !important;
  padding: 0.58rem 0.7rem !important;
  line-height: 1.2 !important;
}

.page-review .review-name-cell {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

.page-review .review-main-text {
  font-weight: 700;
}

.page-review .review-subtext,
.page-review .review-note-inline {
  margin-top: 0.18rem;
  color: var(--muted, #94a3b8);
  font-size: 0.85rem;
  line-height: 1.2;
}

.page-review .review-note-inline {
  max-width: 36rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.page-review .review-reason-cell {
  color: var(--muted, #94a3b8);
  font-size: 0.9rem;
}

.page-review .review-money {
  text-align: right !important;
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums !important;
}

.page-review .review-alert-money,
.page-review .review-alert-text {
  color: #ff6b6b !important;
  font-weight: 700 !important;
}

.page-review .review-pill,
.page-review .review-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.6rem;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 800;
  border: 1px solid rgba(148, 163, 184, 0.42);
  background: rgba(15, 23, 42, 0.55);
  white-space: nowrap;
}

.page-review .review-pill-yes,
.page-review .review-status-active {
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.72);
  background: rgba(20, 83, 45, 0.22);
}

.page-review .review-pill-no {
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.42);
  background: rgba(51, 65, 85, 0.18);
}

.page-review .review-status-review,
.page-review .review-status-paused {
  color: #facc15;
  border-color: rgba(202, 138, 4, 0.72);
  background: rgba(113, 63, 18, 0.18);
}

.page-review .review-status-inactive,
.page-review .review-status-cancelled {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.68);
  background: rgba(127, 29, 29, 0.20);
}

/* Scheduled review columns:
   ID | Name | Type | Amount | Due | Frequency | Status | Reason | Pay Account */
.page-review .review-scheduled-table {
  min-width: 1180px !important;
}

.page-review .review-scheduled-table th:nth-child(1),
.page-review .review-scheduled-table td:nth-child(1) {
  width: 4.6rem !important;
  text-align: right !important;
}

.page-review .review-scheduled-table th:nth-child(2),
.page-review .review-scheduled-table td:nth-child(2) {
  width: 20rem !important;
}

.page-review .review-scheduled-table th:nth-child(3),
.page-review .review-scheduled-table td:nth-child(3) {
  width: 9.5rem !important;
}

.page-review .review-scheduled-table th:nth-child(4),
.page-review .review-scheduled-table td:nth-child(4) {
  width: 8rem !important;
  text-align: right !important;
}

.page-review .review-scheduled-table th:nth-child(5),
.page-review .review-scheduled-table td:nth-child(5),
.page-review .review-scheduled-table th:nth-child(6),
.page-review .review-scheduled-table td:nth-child(6),
.page-review .review-scheduled-table th:nth-child(7),
.page-review .review-scheduled-table td:nth-child(7) {
  width: 8.2rem !important;
  white-space: nowrap !important;
}

.page-review .review-scheduled-table th:nth-child(8),
.page-review .review-scheduled-table td:nth-child(8) {
  width: 10rem !important;
}

.page-review .review-scheduled-table th:nth-child(9),
.page-review .review-scheduled-table td:nth-child(9) {
  width: 11rem !important;
}

/* Credit card columns:
   ID | Card | Balance | Available | Limit | Minimum | Due Day | APR | Why Watch */
.page-review .review-cards-table {
  min-width: 1060px !important;
}

.page-review .review-cards-table th:nth-child(1),
.page-review .review-cards-table td:nth-child(1) {
  width: 4rem !important;
  text-align: right !important;
}

.page-review .review-cards-table th:nth-child(2),
.page-review .review-cards-table td:nth-child(2) {
  width: 18rem !important;
}

.page-review .review-cards-table th:nth-child(3),
.page-review .review-cards-table td:nth-child(3),
.page-review .review-cards-table th:nth-child(4),
.page-review .review-cards-table td:nth-child(4),
.page-review .review-cards-table th:nth-child(5),
.page-review .review-cards-table td:nth-child(5),
.page-review .review-cards-table th:nth-child(6),
.page-review .review-cards-table td:nth-child(6) {
  width: 8.4rem !important;
  text-align: right !important;
}

.page-review .review-cards-table th:nth-child(7),
.page-review .review-cards-table td:nth-child(7),
.page-review .review-cards-table th:nth-child(8),
.page-review .review-cards-table td:nth-child(8) {
  width: 7rem !important;
  white-space: nowrap !important;
}

.page-review .review-cards-table th:nth-child(9),
.page-review .review-cards-table td:nth-child(9) {
  width: 12rem !important;
}

/* Debt columns:
   ID | Debt / Loan | Type | Balance | Payment | Due Day | APR | Strict */
.page-review .review-debts-table {
  min-width: 980px !important;
}

.page-review .review-debts-table th:nth-child(1),
.page-review .review-debts-table td:nth-child(1) {
  width: 4rem !important;
  text-align: right !important;
}

.page-review .review-debts-table th:nth-child(2),
.page-review .review-debts-table td:nth-child(2) {
  width: 22rem !important;
}

.page-review .review-debts-table th:nth-child(3),
.page-review .review-debts-table td:nth-child(3) {
  width: 9rem !important;
}

.page-review .review-debts-table th:nth-child(4),
.page-review .review-debts-table td:nth-child(4),
.page-review .review-debts-table th:nth-child(5),
.page-review .review-debts-table td:nth-child(5) {
  width: 9rem !important;
  text-align: right !important;
}

.page-review .review-debts-table th:nth-child(6),
.page-review .review-debts-table td:nth-child(6),
.page-review .review-debts-table th:nth-child(7),
.page-review .review-debts-table td:nth-child(7),
.page-review .review-debts-table th:nth-child(8),
.page-review .review-debts-table td:nth-child(8) {
  width: 7rem !important;
  white-space: nowrap !important;
}

@media (max-width: 900px) {
  .page-review .review-scheduled-table,
  .page-review .review-cards-table,
  .page-review .review-debts-table {
    min-width: 900px !important;
  }
}

/* ============================================================
   Phase 3L10P15 Review Scheduled Notes Modal Wiring
   Review Scheduled rows now reuse the proven event-table-row
   notes modal hook. No visible note dot.
   ============================================================ */

.review-scheduled-panel .review-note-dot {
  display: none !important;
}

.review-scheduled-panel tr.review-scheduled-row.has-event-note {
  cursor: pointer !important;
}

.review-scheduled-panel tr.review-scheduled-row.has-event-note:hover td {
  background: rgba(59, 130, 246, 0.08) !important;
}

.review-scheduled-panel .review-name-cell .review-main-text {
  font-weight: 800 !important;
}


/* ============================================================
   Phase 3L10P16 Review CSS Sediment Cleanup
   Removed failed Review Scheduled inline-note attempts from P10-P14.
   Preserves P9 dedicated Review layout and P15 modal-only behavior.
   ============================================================ */


/* ============================================================
   Phase 3L10Q1 Debts Cards Total Rows
   Scoped to Debts & Cards page.
   Adds overview cards plus active total rows for loans/debts
   and credit cards.
   ============================================================ */

.page-debts .debt-overview-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr));
  gap: 0.85rem;
  margin-top: 0.85rem;
}

.page-debts .debt-overview-card {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 1rem;
  padding: 0.9rem 1rem;
  background:
    linear-gradient(180deg, rgba(59, 130, 246, 0.055), rgba(15, 23, 42, 0.08)),
    rgba(15, 23, 42, 0.42);
}

.page-debts .debt-overview-card span {
  display: block;
  color: var(--muted, #94a3b8);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.page-debts .debt-overview-card strong {
  display: block;
  margin-top: 0.25rem;
  font-size: clamp(1.15rem, 1.6vw, 1.65rem);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--text, #e5eefb);
}

.page-debts .debt-overview-card small {
  display: block;
  margin-top: 0.28rem;
  color: var(--muted, #94a3b8);
  line-height: 1.25;
}

.page-debts .debt-cards-table-wrap {
  overflow-x: auto !important;
  scrollbar-width: thin;
}

.page-debts table.debt-cards-table {
  width: 100% !important;
  min-width: 1120px !important;
  table-layout: fixed !important;
  font-variant-numeric: tabular-nums;
}

.page-debts table.debt-accounts-table {
  min-width: 1180px !important;
}

.page-debts table.credit-cards-table {
  min-width: 1240px !important;
}

.page-debts table.debt-cards-table th,
.page-debts table.debt-cards-table td {
  vertical-align: middle !important;
}

.page-debts table.debt-cards-table .debt-card-name-cell {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  font-weight: 700;
}

.page-debts table.debt-cards-table .debt-cards-money {
  text-align: right !important;
  white-space: nowrap !important;
}

.page-debts table.debt-cards-table tfoot td {
  border-top: 2px solid rgba(148, 163, 184, 0.34) !important;
  background: rgba(15, 23, 42, 0.72) !important;
}

.page-debts table.debt-cards-table tr.debt-cards-total-row td {
  font-weight: 800 !important;
}

.page-debts table.debt-cards-table tr.debt-cards-total-row td:first-child {
  text-align: left !important;
}

.page-debts table.debt-cards-table tr.debt-cards-total-row td:first-child small {
  display: block;
  margin-top: 0.18rem;
  color: var(--muted, #94a3b8);
  font-weight: 600;
}

.page-debts table.debt-cards-table .debt-total-money {
  color: #fbbf24 !important;
}

.page-debts .debt-card-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.8rem;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
  border: 1px solid rgba(148, 163, 184, 0.42);
}

.page-debts .debt-card-pill-yes {
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.72);
  background: rgba(20, 83, 45, 0.22);
}

.page-debts .debt-card-pill-no {
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.42);
  background: rgba(51, 65, 85, 0.18);
}

/* Column tuning: Debts / Loans */
.page-debts table.debt-accounts-table th:nth-child(1),
.page-debts table.debt-accounts-table td:nth-child(1) {
  width: 4rem !important;
  text-align: right !important;
}

.page-debts table.debt-accounts-table th:nth-child(2),
.page-debts table.debt-accounts-table td:nth-child(2) {
  width: 16rem !important;
}

.page-debts table.debt-accounts-table th:nth-child(3),
.page-debts table.debt-accounts-table td:nth-child(3),
.page-debts table.debt-accounts-table th:nth-child(4),
.page-debts table.debt-accounts-table td:nth-child(4) {
  width: 9.5rem !important;
}

.page-debts table.debt-accounts-table th:nth-child(5),
.page-debts table.debt-accounts-table td:nth-child(5),
.page-debts table.debt-accounts-table th:nth-child(6),
.page-debts table.debt-accounts-table td:nth-child(6) {
  width: 9rem !important;
  text-align: right !important;
}

.page-debts table.debt-accounts-table th:nth-child(7),
.page-debts table.debt-accounts-table td:nth-child(7),
.page-debts table.debt-accounts-table th:nth-child(8),
.page-debts table.debt-accounts-table td:nth-child(8),
.page-debts table.debt-accounts-table th:nth-child(9),
.page-debts table.debt-accounts-table td:nth-child(9),
.page-debts table.debt-accounts-table th:nth-child(10),
.page-debts table.debt-accounts-table td:nth-child(10),
.page-debts table.debt-accounts-table th:nth-child(11),
.page-debts table.debt-accounts-table td:nth-child(11) {
  width: 7rem !important;
  white-space: nowrap !important;
}

/* Column tuning: Credit Cards */
.page-debts table.credit-cards-table th:nth-child(1),
.page-debts table.credit-cards-table td:nth-child(1) {
  width: 4rem !important;
  text-align: right !important;
}

.page-debts table.credit-cards-table th:nth-child(2),
.page-debts table.credit-cards-table td:nth-child(2),
.page-debts table.credit-cards-table th:nth-child(3),
.page-debts table.credit-cards-table td:nth-child(3) {
  width: 11rem !important;
}

.page-debts table.credit-cards-table th:nth-child(4),
.page-debts table.credit-cards-table td:nth-child(4),
.page-debts table.credit-cards-table th:nth-child(5),
.page-debts table.credit-cards-table td:nth-child(5),
.page-debts table.credit-cards-table th:nth-child(6),
.page-debts table.credit-cards-table td:nth-child(6),
.page-debts table.credit-cards-table th:nth-child(7),
.page-debts table.credit-cards-table td:nth-child(7),
.page-debts table.credit-cards-table th:nth-child(8),
.page-debts table.credit-cards-table td:nth-child(8) {
  width: 8.5rem !important;
  text-align: right !important;
}

.page-debts table.credit-cards-table th:nth-child(9),
.page-debts table.credit-cards-table td:nth-child(9),
.page-debts table.credit-cards-table th:nth-child(10),
.page-debts table.credit-cards-table td:nth-child(10),
.page-debts table.credit-cards-table th:nth-child(11),
.page-debts table.credit-cards-table td:nth-child(11),
.page-debts table.credit-cards-table th:nth-child(12),
.page-debts table.credit-cards-table td:nth-child(12) {
  width: 7rem !important;
  white-space: nowrap !important;
}


/* ============================================================
   Phase 3L10Q2 Debts Cards Paid Column Polish
   Paid This Month is now rendered server-side so old JS does
   not inject a cramped column after the fact.
   ============================================================ */

.page-debts .debt-overview-cards {
  grid-template-columns: repeat(auto-fit, minmax(11.25rem, 1fr)) !important;
}

@media (min-width: 1500px) {
  .page-debts .debt-overview-cards {
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
  }
}

.page-debts .debt-overview-card {
  min-height: 7.1rem;
}

.page-debts .debt-overview-card span {
  min-height: 2.15em;
}

.page-debts table.debt-accounts-table {
  min-width: 1320px !important;
}

.page-debts table.credit-cards-table {
  min-width: 1440px !important;
}

/* Debts / Loans:
   ID | Name | Type | Lender | Balance | Payment | Paid This Month | Due Day | Next Due | APR | Strict | Active */
.page-debts table.debt-accounts-table th:nth-child(5),
.page-debts table.debt-accounts-table td:nth-child(5),
.page-debts table.debt-accounts-table th:nth-child(6),
.page-debts table.debt-accounts-table td:nth-child(6),
.page-debts table.debt-accounts-table th:nth-child(7),
.page-debts table.debt-accounts-table td:nth-child(7) {
  width: 9.25rem !important;
  text-align: right !important;
  white-space: nowrap !important;
}

.page-debts table.debt-accounts-table th:nth-child(8),
.page-debts table.debt-accounts-table td:nth-child(8),
.page-debts table.debt-accounts-table th:nth-child(9),
.page-debts table.debt-accounts-table td:nth-child(9),
.page-debts table.debt-accounts-table th:nth-child(10),
.page-debts table.debt-accounts-table td:nth-child(10),
.page-debts table.debt-accounts-table th:nth-child(11),
.page-debts table.debt-accounts-table td:nth-child(11),
.page-debts table.debt-accounts-table th:nth-child(12),
.page-debts table.debt-accounts-table td:nth-child(12) {
  width: 7.2rem !important;
  white-space: nowrap !important;
}

.page-debts table.debt-accounts-table th:nth-child(7) {
  white-space: normal !important;
  line-height: 1.1 !important;
}

/* Credit Cards:
   ID | Card | Issuer | Balance | Available | Limit | Min | Planned | Paid This Month | Due Day | Next Due | APR | Active */
.page-debts table.credit-cards-table th:nth-child(4),
.page-debts table.credit-cards-table td:nth-child(4),
.page-debts table.credit-cards-table th:nth-child(5),
.page-debts table.credit-cards-table td:nth-child(5),
.page-debts table.credit-cards-table th:nth-child(6),
.page-debts table.credit-cards-table td:nth-child(6),
.page-debts table.credit-cards-table th:nth-child(7),
.page-debts table.credit-cards-table td:nth-child(7),
.page-debts table.credit-cards-table th:nth-child(8),
.page-debts table.credit-cards-table td:nth-child(8),
.page-debts table.credit-cards-table th:nth-child(9),
.page-debts table.credit-cards-table td:nth-child(9) {
  width: 8.75rem !important;
  text-align: right !important;
  white-space: nowrap !important;
}

.page-debts table.credit-cards-table th:nth-child(10),
.page-debts table.credit-cards-table td:nth-child(10),
.page-debts table.credit-cards-table th:nth-child(11),
.page-debts table.credit-cards-table td:nth-child(11),
.page-debts table.credit-cards-table th:nth-child(12),
.page-debts table.credit-cards-table td:nth-child(12),
.page-debts table.credit-cards-table th:nth-child(13),
.page-debts table.credit-cards-table td:nth-child(13) {
  width: 7.2rem !important;
  white-space: nowrap !important;
}

.page-debts table.credit-cards-table th:nth-child(9) {
  white-space: normal !important;
  line-height: 1.1 !important;
}

/* Keep old paid-column JS styling from squeezing the native column. */
.page-debts .debt-paid-this-month-col,
.page-debts .debt-paid-this-month-cell {
  min-width: 8.75rem !important;
  white-space: nowrap !important;
}


/* ============================================================
   Phase 3L10Q3 Debts Cards Compact Tables
   Keeps the same useful information, but combines secondary
   fields so Debts & Cards does not require horizontal scrolling
   on normal desktop widths.
   ============================================================ */

.page-debts .debt-cards-table-wrap {
  overflow-x: visible !important;
}

.page-debts table.debt-cards-compact-table,
.page-debts table.debt-accounts-table.debt-cards-compact-table,
.page-debts table.credit-cards-table.debt-cards-compact-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}

.page-debts table.debt-cards-compact-table th,
.page-debts table.debt-cards-compact-table td {
  padding-left: 0.55rem !important;
  padding-right: 0.55rem !important;
  line-height: 1.16 !important;
  vertical-align: middle !important;
}

.page-debts table.debt-cards-compact-table .debt-card-name-cell {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  font-weight: 800;
}

.page-debts table.debt-cards-compact-table .debt-card-subtext {
  display: block;
  margin-top: 0.12rem;
  color: var(--muted, #94a3b8);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.15;
}

.page-debts table.debt-cards-compact-table .debt-card-inactive-note {
  color: #f87171;
}

.page-debts table.debt-cards-compact-table .debt-card-due-cell {
  white-space: normal !important;
  font-size: 0.9rem;
  line-height: 1.15 !important;
}

.page-debts table.debt-cards-compact-table .debt-cards-money {
  text-align: right !important;
  white-space: nowrap !important;
}

.page-debts table.debt-cards-compact-table .debt-card-flags-cell {
  white-space: normal !important;
}

.page-debts table.debt-cards-compact-table .debt-card-flags-cell .debt-card-pill {
  margin: 0.08rem 0.1rem 0.08rem 0;
}

/* Debts compact:
   ID | Loan/Debt | Type | Balance | Payment | Paid This Month | Due | APR | Flags */
.page-debts table.debt-accounts-table.debt-cards-compact-table th:nth-child(1),
.page-debts table.debt-accounts-table.debt-cards-compact-table td:nth-child(1) {
  width: 3.2rem !important;
  text-align: right !important;
}

.page-debts table.debt-accounts-table.debt-cards-compact-table th:nth-child(2),
.page-debts table.debt-accounts-table.debt-cards-compact-table td:nth-child(2) {
  width: 18rem !important;
}

.page-debts table.debt-accounts-table.debt-cards-compact-table th:nth-child(3),
.page-debts table.debt-accounts-table.debt-cards-compact-table td:nth-child(3) {
  width: 7rem !important;
}

.page-debts table.debt-accounts-table.debt-cards-compact-table th:nth-child(4),
.page-debts table.debt-accounts-table.debt-cards-compact-table td:nth-child(4),
.page-debts table.debt-accounts-table.debt-cards-compact-table th:nth-child(5),
.page-debts table.debt-accounts-table.debt-cards-compact-table td:nth-child(5),
.page-debts table.debt-accounts-table.debt-cards-compact-table th:nth-child(6),
.page-debts table.debt-accounts-table.debt-cards-compact-table td:nth-child(6) {
  width: 8.3rem !important;
  text-align: right !important;
}

.page-debts table.debt-accounts-table.debt-cards-compact-table th:nth-child(7),
.page-debts table.debt-accounts-table.debt-cards-compact-table td:nth-child(7) {
  width: 10rem !important;
}

.page-debts table.debt-accounts-table.debt-cards-compact-table th:nth-child(8),
.page-debts table.debt-accounts-table.debt-cards-compact-table td:nth-child(8) {
  width: 5.2rem !important;
  white-space: nowrap !important;
}

.page-debts table.debt-accounts-table.debt-cards-compact-table th:nth-child(9),
.page-debts table.debt-accounts-table.debt-cards-compact-table td:nth-child(9) {
  width: 10rem !important;
}

/* Cards compact:
   ID | Card | Balance | Available | Limit | Min | Planned | Paid This Month | Due | APR */
.page-debts table.credit-cards-table.debt-cards-compact-table th:nth-child(1),
.page-debts table.credit-cards-table.debt-cards-compact-table td:nth-child(1) {
  width: 3.2rem !important;
  text-align: right !important;
}

.page-debts table.credit-cards-table.debt-cards-compact-table th:nth-child(2),
.page-debts table.credit-cards-table.debt-cards-compact-table td:nth-child(2) {
  width: 15rem !important;
}

.page-debts table.credit-cards-table.debt-cards-compact-table th:nth-child(3),
.page-debts table.credit-cards-table.debt-cards-compact-table td:nth-child(3),
.page-debts table.credit-cards-table.debt-cards-compact-table th:nth-child(4),
.page-debts table.credit-cards-table.debt-cards-compact-table td:nth-child(4),
.page-debts table.credit-cards-table.debt-cards-compact-table th:nth-child(5),
.page-debts table.credit-cards-table.debt-cards-compact-table td:nth-child(5),
.page-debts table.credit-cards-table.debt-cards-compact-table th:nth-child(6),
.page-debts table.credit-cards-table.debt-cards-compact-table td:nth-child(6),
.page-debts table.credit-cards-table.debt-cards-compact-table th:nth-child(7),
.page-debts table.credit-cards-table.debt-cards-compact-table td:nth-child(7),
.page-debts table.credit-cards-table.debt-cards-compact-table th:nth-child(8),
.page-debts table.credit-cards-table.debt-cards-compact-table td:nth-child(8) {
  width: 7.75rem !important;
  text-align: right !important;
}

.page-debts table.credit-cards-table.debt-cards-compact-table th:nth-child(9),
.page-debts table.credit-cards-table.debt-cards-compact-table td:nth-child(9) {
  width: 10rem !important;
}

.page-debts table.credit-cards-table.debt-cards-compact-table th:nth-child(10),
.page-debts table.credit-cards-table.debt-cards-compact-table td:nth-child(10) {
  width: 5.2rem !important;
  white-space: nowrap !important;
}

@media (max-width: 1150px) {
  .page-debts .debt-cards-table-wrap {
    overflow-x: auto !important;
  }

  .page-debts table.debt-accounts-table.debt-cards-compact-table {
    min-width: 980px !important;
  }

  .page-debts table.credit-cards-table.debt-cards-compact-table {
    min-width: 1020px !important;
  }
}


/* ============================================================
   Phase 3L10Q4 Debts Cards ID Notes Modal
   Debt/Card IDs are link-styled. Rows with notes reuse the
   existing event notes modal hook.
   ============================================================ */

.page-debts tr.debt-card-note-row.has-event-note {
  cursor: pointer !important;
}

.page-debts tr.debt-card-note-row.has-event-note:hover td {
  background: rgba(59, 130, 246, 0.08) !important;
}


/* ============================================================
   Phase 3L10Q5 Debts Cards Ordinal Due
   Debts & Cards Due column now displays just the ordinal day
   such as 1st, 2nd, 3rd, 21st. Next due date remains in the
   cell title/tooltip only.
   ============================================================ */

.page-debts table.debt-cards-compact-table .debt-card-due-cell {
  white-space: nowrap !important;
  text-align: center !important;
  font-weight: 700;
}


/* ============================================================
   Phase 3L10Q6 Debts Cards Compact Polish
   CSS-only visual tightening for Debts & Cards.
   No PHP logic changes. No JS changes. No DB changes.
   ============================================================ */

/* Tighten the Debts page vertical rhythm without touching other pages. */
.page-debts .panel {
  padding-top: 1.05rem !important;
  padding-bottom: 1.05rem !important;
}

.page-debts .panel > h2 {
  margin-bottom: 0.65rem !important;
}

.page-debts .panel > p.muted {
  margin-top: 0 !important;
  margin-bottom: 0.85rem !important;
  line-height: 1.3 !important;
}

/* Make the overview cards feel like dashboard stats instead of shoeboxes. */
.page-debts .debt-overview-cards {
  gap: 0.65rem !important;
  margin-top: 0.65rem !important;
}

.page-debts .debt-overview-card {
  min-height: 5.9rem !important;
  padding: 0.72rem 0.82rem !important;
  border-radius: 0.8rem !important;
}

.page-debts .debt-overview-card span {
  min-height: 0 !important;
  font-size: 0.72rem !important;
  line-height: 1.16 !important;
}

.page-debts .debt-overview-card strong {
  margin-top: 0.22rem !important;
  font-size: clamp(1.12rem, 1.35vw, 1.42rem) !important;
  line-height: 1.05 !important;
}

.page-debts .debt-overview-card small {
  margin-top: 0.22rem !important;
  font-size: 0.78rem !important;
  line-height: 1.15 !important;
}

/* Compact both custom tables. */
.page-debts table.debt-cards-compact-table {
  font-size: 0.92rem !important;
}

.page-debts table.debt-cards-compact-table th,
.page-debts table.debt-cards-compact-table td {
  padding-top: 0.38rem !important;
  padding-bottom: 0.38rem !important;
  padding-left: 0.42rem !important;
  padding-right: 0.42rem !important;
  line-height: 1.08 !important;
}

.page-debts table.debt-cards-compact-table th {
  font-size: 0.84rem !important;
  letter-spacing: 0.015em !important;
}

/* Names remain readable, but not oversized. */
.page-debts table.debt-cards-compact-table .debt-card-name-cell {
  font-weight: 800 !important;
  line-height: 1.08 !important;
}

.page-debts table.debt-cards-compact-table .debt-card-subtext {
  margin-top: 0.06rem !important;
  font-size: 0.72rem !important;
  line-height: 1.05 !important;
}

/* Smaller status/flag pills. */
.page-debts .debt-card-pill {
  min-width: 3.85rem !important;
  padding: 0.12rem 0.42rem !important;
  font-size: 0.7rem !important;
  line-height: 1.05 !important;
}

/* Totals rows should stand out without becoming furniture. */
.page-debts table.debt-cards-table tfoot td {
  padding-top: 0.42rem !important;
  padding-bottom: 0.42rem !important;
}

.page-debts table.debt-cards-table tr.debt-cards-total-row td:first-child small {
  margin-top: 0.08rem !important;
  font-size: 0.72rem !important;
  line-height: 1.05 !important;
}

/* Rebalance compact Debts / Loans columns after ordinal Due change.
   ID | Loan/Debt | Type | Balance | Payment | Paid | Due | APR | Flags */
.page-debts table.debt-accounts-table.debt-cards-compact-table th:nth-child(1),
.page-debts table.debt-accounts-table.debt-cards-compact-table td:nth-child(1) {
  width: 2.6rem !important;
}

.page-debts table.debt-accounts-table.debt-cards-compact-table th:nth-child(2),
.page-debts table.debt-accounts-table.debt-cards-compact-table td:nth-child(2) {
  width: 16.5rem !important;
}

.page-debts table.debt-accounts-table.debt-cards-compact-table th:nth-child(3),
.page-debts table.debt-accounts-table.debt-cards-compact-table td:nth-child(3) {
  width: 6rem !important;
}

.page-debts table.debt-accounts-table.debt-cards-compact-table th:nth-child(4),
.page-debts table.debt-accounts-table.debt-cards-compact-table td:nth-child(4),
.page-debts table.debt-accounts-table.debt-cards-compact-table th:nth-child(5),
.page-debts table.debt-accounts-table.debt-cards-compact-table td:nth-child(5),
.page-debts table.debt-accounts-table.debt-cards-compact-table th:nth-child(6),
.page-debts table.debt-accounts-table.debt-cards-compact-table td:nth-child(6) {
  width: 7.4rem !important;
}

.page-debts table.debt-accounts-table.debt-cards-compact-table th:nth-child(7),
.page-debts table.debt-accounts-table.debt-cards-compact-table td:nth-child(7) {
  width: 4.3rem !important;
}

.page-debts table.debt-accounts-table.debt-cards-compact-table th:nth-child(8),
.page-debts table.debt-accounts-table.debt-cards-compact-table td:nth-child(8) {
  width: 4.6rem !important;
}

.page-debts table.debt-accounts-table.debt-cards-compact-table th:nth-child(9),
.page-debts table.debt-accounts-table.debt-cards-compact-table td:nth-child(9) {
  width: 8.2rem !important;
}

/* Rebalance Credit Cards columns after ordinal Due change.
   ID | Card | Balance | Available | Limit | Min | Manual Planned | Paid | Due | APR */
.page-debts table.credit-cards-table.debt-cards-compact-table th:nth-child(1),
.page-debts table.credit-cards-table.debt-cards-compact-table td:nth-child(1) {
  width: 2.6rem !important;
}

.page-debts table.credit-cards-table.debt-cards-compact-table th:nth-child(2),
.page-debts table.credit-cards-table.debt-cards-compact-table td:nth-child(2) {
  width: 14.2rem !important;
}

.page-debts table.credit-cards-table.debt-cards-compact-table th:nth-child(3),
.page-debts table.credit-cards-table.debt-cards-compact-table td:nth-child(3),
.page-debts table.credit-cards-table.debt-cards-compact-table th:nth-child(4),
.page-debts table.credit-cards-table.debt-cards-compact-table td:nth-child(4),
.page-debts table.credit-cards-table.debt-cards-compact-table th:nth-child(5),
.page-debts table.credit-cards-table.debt-cards-compact-table td:nth-child(5),
.page-debts table.credit-cards-table.debt-cards-compact-table th:nth-child(6),
.page-debts table.credit-cards-table.debt-cards-compact-table td:nth-child(6),
.page-debts table.credit-cards-table.debt-cards-compact-table th:nth-child(7),
.page-debts table.credit-cards-table.debt-cards-compact-table td:nth-child(7),
.page-debts table.credit-cards-table.debt-cards-compact-table th:nth-child(8),
.page-debts table.credit-cards-table.debt-cards-compact-table td:nth-child(8) {
  width: 7.25rem !important;
}

.page-debts table.credit-cards-table.debt-cards-compact-table th:nth-child(9),
.page-debts table.credit-cards-table.debt-cards-compact-table td:nth-child(9) {
  width: 4.3rem !important;
}

.page-debts table.credit-cards-table.debt-cards-compact-table th:nth-child(10),
.page-debts table.credit-cards-table.debt-cards-compact-table td:nth-child(10) {
  width: 4.8rem !important;
}

/* Let the page breathe less between the two money tables. */
.page-debts .debt-accounts-panel {
  margin-bottom: 0.95rem !important;
}

/* Preserve mobile/tablet fallback scrolling. */
@media (max-width: 1150px) {
  .page-debts .debt-cards-table-wrap {
    overflow-x: auto !important;
  }

  .page-debts table.debt-accounts-table.debt-cards-compact-table {
    min-width: 920px !important;
  }

  .page-debts table.credit-cards-table.debt-cards-compact-table {
    min-width: 960px !important;
  }
}


/* ============================================================
   Phase 3L10Q7 Debts Cards ID Links To Edit
   Debt/Card IDs now navigate to full edit screens.
   Rows with notes can still use the row-level notes modal.
   ============================================================ */

.page-debts .debt-card-id-link {
  color: #60a5fa !important;
  font-weight: 900 !important;
  text-decoration: none !important;
  cursor: pointer !important;
}

.page-debts .debt-card-id-link:hover {
  color: #93c5fd !important;
  text-decoration: underline !important;
}


/* ============================================================
   Phase 3L10R1 Safe To Spend Label Clarity
   Label-only clarity pass:
   - Current Main Balance = current main/bank balance
   - Safe-to-Spend = actionable amount after planned future impact
   ============================================================ */

.dashboard-stat-card .stat-label,
.safe-to-spend-card .stat-label,
.month-summary-card .stat-label {
  letter-spacing: 0.005em;
}


/* ============================================================
   Phase 3L10R2 Dashboard Card Order Reserve Diff
   Dashboard card order:
   Current Main Balance | Planned Future Impact | Safe-to-Spend
   Monthly Services Reserve | Annual Bills Reserve
   ============================================================ */

.page-dashboard .dashboard-main-cards {
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)) !important;
  gap: 0.85rem !important;
}

@media (min-width: 1350px) {
  .page-dashboard .dashboard-main-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  .page-dashboard .dashboard-main-cards .card:nth-child(5),
  .page-dashboard .dashboard-main-cards .card:nth-child(6) {
    grid-column: span 2;
  }
}

.page-dashboard .dashboard-main-cards .card,
.page-dashboard .dashboard-main-cards .stat-card {
  min-height: 6.4rem;
}

.page-dashboard .dashboard-main-cards small {
  line-height: 1.2;
}


/* ============================================================
   Phase 3L10R3 Account Balance Check
   Manual USAA actual balance comparison against app expected.
   ============================================================ */

.page-dashboard .account-balance-check-panel {
  margin-top: 1rem;
}

.page-dashboard .account-balance-check-panel .quick-add-header {
  align-items: baseline;
}

.page-dashboard .account-balance-check-wrap {
  overflow-x: visible !important;
}

.page-dashboard .account-balance-check-table {
  width: 100%;
  min-width: 0 !important;
  table-layout: fixed;
}

.page-dashboard .account-balance-check-table th,
.page-dashboard .account-balance-check-table td {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
  vertical-align: middle;
}

.page-dashboard .account-balance-check-table th:nth-child(1),
.page-dashboard .account-balance-check-table td:nth-child(1) {
  width: 30%;
}

.page-dashboard .account-balance-check-table th:nth-child(2),
.page-dashboard .account-balance-check-table td:nth-child(2),
.page-dashboard .account-balance-check-table th:nth-child(3),
.page-dashboard .account-balance-check-table td:nth-child(3),
.page-dashboard .account-balance-check-table th:nth-child(4),
.page-dashboard .account-balance-check-table td:nth-child(4) {
  width: 18%;
  text-align: right;
}

.page-dashboard .account-balance-check-table th:nth-child(5),
.page-dashboard .account-balance-check-table td:nth-child(5) {
  width: 16%;
}

.page-dashboard .account-balance-check-table td small {
  display: block;
  color: var(--muted, #94a3b8);
  font-size: 0.76rem;
  margin-top: 0.1rem;
}

.page-dashboard .balance-check-actual-input {
  width: 9.5rem;
  max-width: 100%;
  text-align: right;
  padding: 0.34rem 0.5rem;
}

.page-dashboard .balance-check-diff-value {
  font-weight: 900;
}

.page-dashboard .balance-diff-ok {
  color: #22c55e;
}

.page-dashboard .balance-diff-mismatch {
  color: #ff5757;
}

.page-dashboard .balance-diff-empty {
  color: var(--muted, #94a3b8);
}

.page-dashboard .account-balance-check-actions {
  margin-top: 0.7rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .page-dashboard .account-balance-check-wrap {
    overflow-x: auto !important;
  }

  .page-dashboard .account-balance-check-table {
    min-width: 760px !important;
  }
}


/* ============================================================
   Phase 3L10R4 Account Balance Check UI Polish
   Better visual hierarchy for manual USAA reconciliation.
   ============================================================ */

.page-dashboard .account-balance-check-panel {
  border-color: rgba(96, 165, 250, 0.22) !important;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.08), transparent 32rem),
    linear-gradient(180deg, rgba(15, 23, 42, 0.55), rgba(15, 23, 42, 0.28)) !important;
}

.page-dashboard .account-balance-check-panel .quick-add-header {
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.page-dashboard .account-balance-check-panel .quick-add-header h2 {
  margin-bottom: 0 !important;
}

.page-dashboard .account-balance-check-panel .quick-add-header .muted {
  border: 1px solid rgba(96, 165, 250, 0.24);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  background: rgba(30, 41, 59, 0.35);
  font-size: 0.82rem;
}

.page-dashboard .account-balance-check-panel > p.muted {
  max-width: 72rem;
  margin-top: 0.8rem !important;
  margin-bottom: 0.9rem !important;
}

.page-dashboard .account-balance-check-table {
  border-collapse: separate !important;
  border-spacing: 0 0.38rem !important;
}

.page-dashboard .account-balance-check-table thead th {
  background: rgba(30, 41, 59, 0.82) !important;
  border-bottom: none !important;
  padding-top: 0.46rem !important;
  padding-bottom: 0.46rem !important;
}

.page-dashboard .account-balance-check-table tbody tr {
  background: rgba(15, 23, 42, 0.28);
}

.page-dashboard .account-balance-check-table tbody tr:hover td {
  background: rgba(59, 130, 246, 0.07) !important;
}

.page-dashboard .account-balance-check-table tbody td {
  border-top: 1px solid rgba(148, 163, 184, 0.10) !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.10) !important;
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
}

.page-dashboard .account-balance-check-table tbody td:first-child {
  border-left: 1px solid rgba(148, 163, 184, 0.10) !important;
  border-top-left-radius: 0.7rem;
  border-bottom-left-radius: 0.7rem;
}

.page-dashboard .account-balance-check-table tbody td:last-child {
  border-right: 1px solid rgba(148, 163, 184, 0.10) !important;
  border-top-right-radius: 0.7rem;
  border-bottom-right-radius: 0.7rem;
}

.page-dashboard .balance-account-cell strong {
  display: block;
  font-size: 0.98rem;
  line-height: 1.1;
}

.page-dashboard .balance-account-cell small {
  color: #93a4b8 !important;
  font-size: 0.76rem !important;
}

.page-dashboard .balance-check-actual-input {
  border: 1px solid rgba(96, 165, 250, 0.28) !important;
  border-radius: 0.55rem !important;
  background: rgba(2, 6, 23, 0.72) !important;
  color: #e5eefb !important;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.page-dashboard .balance-check-actual-input:focus {
  border-color: rgba(96, 165, 250, 0.8) !important;
  outline: none !important;
  box-shadow:
    0 0 0 3px rgba(59, 130, 246, 0.16),
    inset 0 1px 0 rgba(255,255,255,0.04) !important;
}

.page-dashboard .balance-check-diff-cell {
  white-space: nowrap;
}

.page-dashboard .balance-check-diff-value {
  display: inline-block;
  min-width: 5.5rem;
  font-weight: 950 !important;
  font-variant-numeric: tabular-nums;
}

.page-dashboard .balance-check-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.3rem;
  margin-left: 0.55rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.05;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.page-dashboard .balance-status-ok {
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.62);
  background: rgba(22, 101, 52, 0.18);
}

.page-dashboard .balance-status-mismatch {
  color: #ff6b6b;
  border-color: rgba(248, 113, 113, 0.62);
  background: rgba(127, 29, 29, 0.18);
}

.page-dashboard .balance-status-empty {
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(51, 65, 85, 0.18);
}

.page-dashboard .account-balance-check-actions {
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  padding-top: 0.75rem;
}

.page-dashboard .account-balance-check-actions button {
  font-weight: 900;
}


/* ============================================================
   Phase 3L10R5 Dashboard Pie Charts Open Items Polish
   Adds dashboard-native pie charts and fixes giant Open Items header.
   ============================================================ */

:root {
  --dashboard-chart-1: #60a5fa;
  --dashboard-chart-2: #22c55e;
  --dashboard-chart-3: #f59e0b;
  --dashboard-chart-4: #a78bfa;
  --dashboard-chart-5: #fb7185;
  --dashboard-chart-6: #14b8a6;
  --dashboard-chart-7: #e879f9;
  --dashboard-chart-8: #94a3b8;
}

.page-dashboard .dashboard-activity-grid {
  align-items: stretch;
}

.page-dashboard .dashboard-chart-host {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.page-dashboard .dashboard-chart-host > .table-wrap {
  flex: 0 0 auto;
}

.page-dashboard .dashboard-pie-card {
  margin-top: 0.15rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.page-dashboard .dashboard-pie-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  margin-bottom: 0.75rem;
}

.page-dashboard .dashboard-pie-heading h3 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.15;
  letter-spacing: 0.01em;
}

.page-dashboard .dashboard-pie-heading span {
  color: var(--muted, #94a3b8);
  font-size: 0.85rem;
  white-space: nowrap;
}

.page-dashboard .dashboard-pie-layout {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
}

.page-dashboard .dashboard-pie-visual {
  width: 10.5rem;
  height: 10.5rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.08),
    0 0.75rem 1.8rem rgba(0,0,0,0.22);
}

.page-dashboard .dashboard-pie-hole {
  width: 6.15rem;
  height: 6.15rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.1rem;
  text-align: center;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.page-dashboard .dashboard-pie-hole span {
  color: var(--muted, #94a3b8);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.page-dashboard .dashboard-pie-hole strong {
  font-size: 0.92rem;
  line-height: 1.05;
}

.page-dashboard .dashboard-pie-legend {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.34rem;
}

.page-dashboard .dashboard-pie-legend li {
  display: grid;
  grid-template-columns: 0.75rem minmax(0, 1fr) 3.6rem 5.8rem;
  align-items: center;
  gap: 0.48rem;
  min-width: 0;
  padding: 0.28rem 0.35rem;
  border-radius: 0.55rem;
  background: rgba(15, 23, 42, 0.22);
}

.page-dashboard .dashboard-pie-swatch {
  width: 0.68rem;
  height: 0.68rem;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.12);
}

.page-dashboard .dashboard-pie-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-dashboard .dashboard-pie-legend strong,
.page-dashboard .dashboard-pie-legend em {
  text-align: right;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.page-dashboard .dashboard-pie-legend strong {
  color: #e5eefb;
}

.page-dashboard .dashboard-pie-legend em {
  color: var(--muted, #94a3b8);
  font-size: 0.84rem;
}

.page-dashboard .dashboard-chart-empty {
  margin-top: 0.25rem;
}

/* Open Items: stop the shared event table header from becoming a cathedral ceiling. */
.page-dashboard .dashboard-open .table-wrap:has(table.shared-event-status-table) {
  padding-top: 0 !important;
  margin-top: 0.4rem !important;
}

.page-dashboard .dashboard-open table.shared-event-status-table thead,
.page-dashboard .dashboard-open table.shared-event-status-table thead tr,
.page-dashboard .dashboard-open table.shared-event-status-table thead th {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  line-height: 1.1 !important;
  vertical-align: middle !important;
}

.page-dashboard .dashboard-open table.shared-event-status-table thead th {
  padding-top: 0.42rem !important;
  padding-bottom: 0.42rem !important;
}

.page-dashboard .dashboard-open table.shared-event-status-table th,
.page-dashboard .dashboard-open table.shared-event-status-table td {
  padding-left: 0.45rem !important;
  padding-right: 0.45rem !important;
}

@media (max-width: 1250px) {
  .page-dashboard .dashboard-pie-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .page-dashboard .dashboard-pie-legend {
    width: 100%;
  }
}


/* ============================================================
   Phase 3L10R6 Dashboard Chart Realignment
   Three useful dashboard charts:
   - Income Sources
   - Expense Breakdown by top-tier buckets
   - Income vs Outgo
   Also hard-fixes Open Items cathedral-header syndrome.
   ============================================================ */

.page-dashboard .dashboard-chart-stack {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(24rem, 1fr));
  gap: 1rem;
  align-items: stretch;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.page-dashboard .dashboard-chart-stack .dashboard-pie-card {
  margin-top: 0 !important;
  padding: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.13);
  border-radius: 1rem;
  background:
    radial-gradient(circle at top left, rgba(96, 165, 250, 0.07), transparent 18rem),
    rgba(15, 23, 42, 0.20);
}

.page-dashboard .dashboard-chart-stack .dashboard-pie-layout {
  grid-template-columns: 9.25rem minmax(0, 1fr);
}

.page-dashboard .dashboard-chart-stack .dashboard-pie-visual {
  width: 8.9rem;
  height: 8.9rem;
}

.page-dashboard .dashboard-chart-stack .dashboard-pie-hole {
  width: 5.35rem;
  height: 5.35rem;
}

.page-dashboard .dashboard-chart-stack .dashboard-pie-hole strong {
  font-size: 0.78rem;
}

.page-dashboard .dashboard-pie-note {
  color: var(--muted, #94a3b8);
  font-size: 0.84rem;
  line-height: 1.35;
  margin: -0.35rem 0 0.7rem 0;
}

.page-dashboard .dashboard-chart-stack .dashboard-pie-legend li {
  grid-template-columns: 0.75rem minmax(0, 1fr) 3.4rem 5.4rem;
}

.page-dashboard .dashboard-open.dashboard-chart-host {
  display: block !important;
}

/* Open Items: final hard override for the giant table header. */
.page-dashboard .dashboard-open .table-wrap:has(table.shared-event-status-table) {
  padding: 0 !important;
  margin-top: 0.65rem !important;
  overflow-x: auto;
}

.page-dashboard .dashboard-open table.shared-event-status-table {
  margin-top: 0 !important;
  border-collapse: collapse !important;
  table-layout: fixed !important;
}

.page-dashboard .dashboard-open table.shared-event-status-table thead {
  display: table-header-group !important;
  height: 2.35rem !important;
  min-height: 0 !important;
  max-height: 2.35rem !important;
}

.page-dashboard .dashboard-open table.shared-event-status-table thead tr {
  display: table-row !important;
  height: 2.35rem !important;
  min-height: 0 !important;
  max-height: 2.35rem !important;
}

.page-dashboard .dashboard-open table.shared-event-status-table thead th {
  display: table-cell !important;
  height: 2.35rem !important;
  min-height: 0 !important;
  max-height: 2.35rem !important;
  padding: 0.42rem 0.45rem !important;
  line-height: 1.1 !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
}

.page-dashboard .dashboard-open table.shared-event-status-table tbody td {
  padding-top: 0.55rem !important;
  padding-bottom: 0.55rem !important;
}

@media (max-width: 1300px) {
  .page-dashboard .dashboard-chart-stack {
    grid-template-columns: 1fr;
  }

  .page-dashboard .dashboard-chart-stack .dashboard-pie-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .page-dashboard .dashboard-chart-stack .dashboard-pie-legend {
    width: 100%;
  }
}


/* ============================================================
   Phase 3L10R7 Income Vs Outgo Net Display
   Pie slices still compare income/outgo, but the displayed number
   can now be Net instead of the combined pie total.
   ============================================================ */

.page-dashboard .dashboard-pie-heading .dashboard-pie-display-value {
  font-weight: 950;
  margin-left: 0.2rem;
}

.page-dashboard .dashboard-pie-display-positive {
  color: #22c55e;
}

.page-dashboard .dashboard-pie-display-negative {
  color: #ff5757;
}

.page-dashboard .dashboard-pie-display-neutral {
  color: #e5eefb;
}

.page-dashboard .dashboard-pie-hole .dashboard-pie-display-positive,
.page-dashboard .dashboard-pie-hole .dashboard-pie-display-negative,
.page-dashboard .dashboard-pie-hole .dashboard-pie-display-neutral {
  font-weight: 950;
}


/* ============================================================
   Phase 3L10R8 Cash Flow Bridge
   Explains why Safe-to-Spend may differ from monthly income/outgo net.
   ============================================================ */

.page-dashboard .dashboard-cash-flow-bridge {
  grid-column: 1 / -1;
  padding: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.13);
  border-radius: 1rem;
  background:
    radial-gradient(circle at top left, rgba(34, 197, 94, 0.07), transparent 18rem),
    rgba(15, 23, 42, 0.22);
}

.page-dashboard .cash-flow-bridge-equation {
  display: grid;
  grid-template-columns:
    minmax(0, 0.90fr)
    minmax(1.1rem, auto)
    minmax(0, 1.20fr)
    minmax(1.1rem, auto)
    minmax(0, 1.30fr)
    minmax(1.1rem, auto)
    minmax(0, 1fr)
    minmax(1.1rem, auto)
    minmax(0, 0.90fr);
  gap: clamp(0.25rem, 0.45vw, 0.55rem);
  width: 100%;
  max-width: 100%;
  align-items: stretch;
  margin-top: 0.75rem;
}

.page-dashboard .bridge-step {
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.13);
  border-radius: 0.85rem;
  padding: 0.7rem 0.65rem;
  background: rgba(15, 23, 42, 0.36);
}

.page-dashboard .bridge-step span {
  display: block;
  color: var(--muted, #94a3b8);
  font-size: 0.78rem;
  line-height: 1.1;
  margin-bottom: 0.35rem;
  overflow-wrap: anywhere;
}

.page-dashboard .bridge-step strong {
  display: block;
  font-size: clamp(0.9rem, 0.9vw, 1.08rem);
  line-height: 1.05;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.page-dashboard .bridge-operator {
  align-self: center;
  color: #cbd5e1;
  font-size: 1.25rem;
  font-weight: 950;
  text-align: center;
  opacity: 0.82;
}

.page-dashboard .bridge-start strong {
  color: #e5eefb;
}

.page-dashboard .bridge-income strong,
.page-dashboard .bridge-positive strong {
  color: #22c55e;
}

.page-dashboard .bridge-expense strong,
.page-dashboard .bridge-negative strong {
  color: #ff5757;
}

.page-dashboard .bridge-result {
  border-color: rgba(96, 165, 250, 0.34);
  background: rgba(30, 41, 59, 0.45);
}

.page-dashboard .cash-flow-bridge-note {
  margin-top: 0.8rem;
  color: var(--muted, #94a3b8);
  font-size: 0.88rem;
  line-height: 1.35;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  padding-top: 0.65rem;
}

.page-dashboard .cash-flow-bridge-note strong {
  color: #e5eefb;
}

@media (max-width: 1250px) {
  .page-dashboard .cash-flow-bridge-equation {
    grid-template-columns: 1fr;
  }

  .page-dashboard .bridge-operator {
    transform: rotate(90deg);
    line-height: 1;
  }
}


/* ============================================================
   Phase 3L10S1 Credit Card Planned Payment Sync
   Credit-card minimum/planned amounts now drive a planned event.
   ============================================================ */

.page-edit_card .credit-card-skip-current-row,
.debt-card-edit-form .credit-card-skip-current-row {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.25rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 0.75rem;
  background: rgba(120, 53, 15, 0.12);
  color: #facc15;
  font-weight: 800;
}

.debt-card-edit-form .credit-card-skip-current-row input {
  width: auto;
}

.debt-card-edit-form .credit-card-planned-input.credit-card-auto-filled {
  border-color: rgba(34, 197, 94, 0.72) !important;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12) !important;
}


/* ============================================================
   Phase 3L10S2 Dashboard Open Items Compact Renderer
   Dashboard gets a true summary table instead of the full Events table.
   Preserves quick status dropdowns and row notes modal.
   ============================================================ */

.page-dashboard .dashboard-open {
  min-width: 0;
}

.page-dashboard .dashboard-open-items-wrap {
  margin-top: 0.65rem !important;
  padding: 0 !important;
  overflow-x: visible !important;
}

.page-dashboard table.dashboard-open-items-table {
  width: 100%;
  min-width: 0 !important;
  table-layout: fixed;
  border-collapse: separate !important;
  border-spacing: 0 0.38rem !important;
}

.page-dashboard table.dashboard-open-items-table thead th {
  padding: 0.42rem 0.5rem !important;
  line-height: 1.1 !important;
  height: auto !important;
  min-height: 0 !important;
  background: rgba(30, 41, 59, 0.82) !important;
  border-bottom: none !important;
  white-space: nowrap;
}

.page-dashboard table.dashboard-open-items-table tbody tr {
  background: rgba(15, 23, 42, 0.26);
}

.page-dashboard table.dashboard-open-items-table tbody tr:hover td {
  background: rgba(59, 130, 246, 0.07) !important;
}

.page-dashboard table.dashboard-open-items-table td {
  padding: 0.48rem 0.5rem !important;
  vertical-align: middle;
  border-top: 1px solid rgba(148, 163, 184, 0.10) !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.10) !important;
}

.page-dashboard table.dashboard-open-items-table td:first-child {
  border-left: 1px solid rgba(148, 163, 184, 0.10) !important;
  border-top-left-radius: 0.65rem;
  border-bottom-left-radius: 0.65rem;
}

.page-dashboard table.dashboard-open-items-table td:last-child {
  border-right: 1px solid rgba(148, 163, 184, 0.10) !important;
  border-top-right-radius: 0.65rem;
  border-bottom-right-radius: 0.65rem;
}

.page-dashboard table.dashboard-open-items-table th:nth-child(1),
.page-dashboard table.dashboard-open-items-table td:nth-child(1) {
  width: 4.8rem;
}

.page-dashboard table.dashboard-open-items-table th:nth-child(2),
.page-dashboard table.dashboard-open-items-table td:nth-child(2) {
  width: auto;
}

.page-dashboard table.dashboard-open-items-table th:nth-child(3),
.page-dashboard table.dashboard-open-items-table td:nth-child(3) {
  width: 6.7rem;
  text-align: right;
}

.page-dashboard table.dashboard-open-items-table th:nth-child(4),
.page-dashboard table.dashboard-open-items-table td:nth-child(4) {
  width: 8.7rem;
}

.page-dashboard .dashboard-open-date strong {
  display: block;
  font-size: 0.88rem;
  line-height: 1.05;
  white-space: nowrap;
}

.page-dashboard .dashboard-open-date small {
  display: block;
  color: var(--muted, #94a3b8);
  font-size: 0.67rem;
  line-height: 1.1;
  margin-top: 0.15rem;
  white-space: nowrap;
}

.page-dashboard .dashboard-open-mainline {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  min-width: 0;
}

.page-dashboard .dashboard-open-mainline strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
  line-height: 1.1;
}

.page-dashboard .dashboard-open-id-link {
  flex: 0 0 auto;
  font-size: 0.76rem;
  font-weight: 900;
  text-decoration: none;
}

.page-dashboard .dashboard-open-subline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin-top: 0.22rem;
}

.page-dashboard .dashboard-open-subline span {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.1rem 0.38rem;
  border-radius: 999px;
  color: var(--muted, #94a3b8);
  background: rgba(51, 65, 85, 0.26);
  font-size: 0.68rem;
  line-height: 1.05;
  white-space: nowrap;
}

.page-dashboard .dashboard-open-subline .dashboard-open-note-flag {
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, 0.28);
  background: rgba(30, 64, 175, 0.16);
}

.page-dashboard .dashboard-open-amount {
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.page-dashboard .dashboard-open-status-select {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 8rem !important;
  padding-left: 0.48rem !important;
  padding-right: 1.4rem !important;
  font-size: 0.74rem !important;
}

@media (max-width: 900px) {
  .page-dashboard .dashboard-open-items-wrap {
    overflow-x: auto !important;
  }

  .page-dashboard table.dashboard-open-items-table {
    min-width: 680px !important;
  }
}


/* ============================================================
   Phase 3L10S3 Dashboard Open Items Colored Status Dropdowns
   The compact dashboard Open Items renderer uses its own table class,
   so status dropdown colors need their own dashboard-scoped selectors.
   ============================================================ */

.page-dashboard table.dashboard-open-items-table .dashboard-open-status-select.status-pill-select {
  font-weight: 900 !important;
  border-width: 1px !important;
  border-style: solid !important;
  border-radius: 999px !important;
  background-color: rgba(15, 23, 42, 0.78) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.025) !important;
  transition:
    border-color 120ms ease,
    background-color 120ms ease,
    box-shadow 120ms ease,
    color 120ms ease !important;
}

.page-dashboard table.dashboard-open-items-table .dashboard-open-status-select.status-pill-select:hover,
.page-dashboard table.dashboard-open-items-table .dashboard-open-status-select.status-pill-select:focus {
  filter: brightness(1.08);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.05),
    0 0 0 3px rgba(59, 130, 246, 0.13) !important;
}

.page-dashboard table.dashboard-open-items-table .dashboard-open-status-select.status-pill-planned {
  color: #facc15 !important;
  border-color: rgba(245, 158, 11, 0.72) !important;
  background-color: rgba(120, 53, 15, 0.25) !important;
}

.page-dashboard table.dashboard-open-items-table .dashboard-open-status-select.status-pill-committed {
  color: #fb923c !important;
  border-color: rgba(249, 115, 22, 0.72) !important;
  background-color: rgba(124, 45, 18, 0.26) !important;
}

.page-dashboard table.dashboard-open-items-table .dashboard-open-status-select.status-pill-expected_deposit {
  color: #38bdf8 !important;
  border-color: rgba(14, 165, 233, 0.70) !important;
  background-color: rgba(12, 74, 110, 0.28) !important;
}

.page-dashboard table.dashboard-open-items-table .dashboard-open-status-select.status-pill-cleared {
  color: #22c55e !important;
  border-color: rgba(34, 197, 94, 0.72) !important;
  background-color: rgba(20, 83, 45, 0.28) !important;
}

.page-dashboard table.dashboard-open-items-table .dashboard-open-status-select.status-pill-skipped,
.page-dashboard table.dashboard-open-items-table .dashboard-open-status-select.status-pill-cancelled,
.page-dashboard table.dashboard-open-items-table .dashboard-open-status-select.status-pill-canceled {
  color: #cbd5e1 !important;
  border-color: rgba(148, 163, 184, 0.52) !important;
  background-color: rgba(51, 65, 85, 0.34) !important;
}

.page-dashboard table.dashboard-open-items-table .dashboard-open-status-select.status-pill-mitigated {
  color: #c4b5fd !important;
  border-color: rgba(167, 139, 250, 0.72) !important;
  background-color: rgba(76, 29, 149, 0.28) !important;
}

.page-dashboard table.dashboard-open-items-table .dashboard-open-status-select option {
  background: #020617;
  color: #e5eefb;
}


/* ============================================================
   Phase 3L10S4 Reserve Balance Floor
   Reserve Account Balance Check targets include a $5 keep-alive floor.
   Matched/over = green. Short = red.
   ============================================================ */

.page-dashboard .balance-check-expected-cell strong {
  display: block;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.page-dashboard .balance-check-expected-cell small {
  display: block;
  margin-top: 0.12rem;
  color: var(--muted, #94a3b8);
  font-size: 0.72rem;
  line-height: 1.1;
}

.page-dashboard .balance-diff-ok,
.page-dashboard .balance-check-diff-value.balance-diff-ok {
  color: #22c55e !important;
  font-weight: 950;
}

.page-dashboard .balance-diff-mismatch,
.page-dashboard .balance-check-diff-value.balance-diff-mismatch {
  color: #ff5757 !important;
  font-weight: 950;
}

.page-dashboard .balance-diff-empty,
.page-dashboard .balance-check-diff-value.balance-diff-empty {
  color: var(--muted, #94a3b8) !important;
}

.page-dashboard .balance-check-status-pill.balance-status-ok {
  color: #22c55e !important;
  border-color: rgba(34, 197, 94, 0.72) !important;
  background: rgba(20, 83, 45, 0.26) !important;
}

.page-dashboard .balance-check-status-pill.balance-status-mismatch {
  color: #ff7777 !important;
  border-color: rgba(248, 113, 113, 0.72) !important;
  background: rgba(127, 29, 29, 0.26) !important;
}


/* ============================================================
   Phase 3L10S5 Reserve Low Floor Warning
   Reserve balances between $0.00 and $4.99 are warning/orange,
   not full red. Still alerts that the $5 keep-alive floor is not met.
   ============================================================ */


/* ============================================================
   Phase 3L10S5 Reserve Difference Warning Corrected
   A reserve difference from -$0.01 through -$5.00 is warning/orange.
   Worse than -$5.00 remains short/red.
   ============================================================ */

.page-dashboard .balance-diff-warning,
.page-dashboard .balance-check-diff-value.balance-diff-warning {
  color: #f59e0b !important;
  font-weight: 950;
}

.page-dashboard .balance-check-status-pill.balance-status-warning {
  color: #fbbf24 !important;
  border-color: rgba(245, 158, 11, 0.76) !important;
  background: rgba(120, 53, 15, 0.28) !important;
}


/* ============================================================
   Phase 3L10S6 Dashboard Due Overdue Alerts
   Open app items due today or overdue by app status.
   ============================================================ */

.page-dashboard .dashboard-due-alerts {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: 1rem;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 38%),
    rgba(15, 23, 42, 0.54);
}

.page-dashboard .dashboard-due-alerts-clear {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-color: rgba(34, 197, 94, 0.30);
}

.page-dashboard .dashboard-due-alerts h2 {
  margin: 0;
  font-size: 1.12rem;
}

.page-dashboard .dashboard-due-alerts p {
  margin: 0.25rem 0 0;
  color: var(--muted, #94a3b8);
  font-size: 0.88rem;
}

.page-dashboard .dashboard-due-alerts-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.page-dashboard .dashboard-due-alert-totals {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.page-dashboard .dashboard-due-clear-pill,
.page-dashboard .due-total {
  border-radius: 999px;
  padding: 0.25rem 0.62rem;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.page-dashboard .dashboard-due-clear-pill {
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.55);
  background: rgba(20, 83, 45, 0.26);
}

.page-dashboard .due-total.overdue {
  color: #ff7777;
  border: 1px solid rgba(248, 113, 113, 0.55);
  background: rgba(127, 29, 29, 0.24);
}

.page-dashboard .due-total.today {
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.55);
  background: rgba(120, 53, 15, 0.24);
}

.page-dashboard .dashboard-due-alert-list {
  display: grid;
  gap: 0.45rem;
}

.page-dashboard .dashboard-due-alert-item {
  display: grid;
  grid-template-columns: 6.2rem minmax(0, 1fr) 7.4rem;
  align-items: center;
  gap: 0.75rem;
  padding: 0.58rem 0.7rem;
  border: 1px solid rgba(148, 163, 184, 0.13);
  border-radius: 0.85rem;
  background: rgba(15, 23, 42, 0.42);
}

.page-dashboard .dashboard-due-alert-overdue {
  border-color: rgba(248, 113, 113, 0.28);
}

.page-dashboard .dashboard-due-alert-today {
  border-color: rgba(245, 158, 11, 0.22);
}

.page-dashboard .dashboard-due-alert-date strong {
  display: block;
  font-weight: 950;
}

.page-dashboard .dashboard-due-alert-overdue .dashboard-due-alert-date strong {
  color: #ff7777;
}

.page-dashboard .dashboard-due-alert-today .dashboard-due-alert-date strong {
  color: #fbbf24;
}

.page-dashboard .dashboard-due-alert-date small {
  color: var(--muted, #94a3b8);
  font-size: 0.74rem;
}

.page-dashboard .dashboard-due-alert-title {
  display: flex;
  align-items: baseline;
  gap: 0.42rem;
  min-width: 0;
}

.page-dashboard .dashboard-due-alert-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-dashboard .dashboard-due-alert-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin-top: 0.25rem;
}

.page-dashboard .dashboard-due-alert-meta span {
  padding: 0.1rem 0.38rem;
  border-radius: 999px;
  color: var(--muted, #94a3b8);
  background: rgba(51, 65, 85, 0.30);
  font-size: 0.68rem;
}

.page-dashboard .dashboard-due-note-flag {
  color: #93c5fd !important;
  border: 1px solid rgba(96, 165, 250, 0.28);
  background: rgba(30, 64, 175, 0.16) !important;
}

.page-dashboard .dashboard-due-alert-amount {
  text-align: right;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .page-dashboard .dashboard-due-alerts-head {
    display: block;
  }

  .page-dashboard .dashboard-due-alert-totals {
    justify-content: flex-start;
    margin-top: 0.65rem;
  }

  .page-dashboard .dashboard-due-alert-item {
    grid-template-columns: 5.2rem minmax(0, 1fr);
  }

  .page-dashboard .dashboard-due-alert-amount {
    grid-column: 2;
    text-align: left;
  }
}


/* ============================================================
   Phase 3L10S7 Dashboard Open Items Resolved Refresh
   Gives immediate feedback before the dashboard reloads after
   a dashboard Open Items row is resolved.
   ============================================================ */

.page-dashboard .dashboard-open-item-resolving::after {
  content: "";
}


/* ============================================================
   Phase 3L10S8 Dashboard Open Items Status Save
   Reuses resolving feedback for dashboard rows while status save runs.
   ============================================================ */

.page-dashboard .dashboard-open-item-resolving {
  opacity: 0.58;
  filter: saturate(0.75);
  transition: opacity 0.2s ease, filter 0.2s ease;
}


/* ============================================================
   Phase 3L10S8B Dashboard Open Items No Twerk
   Keep status-save feedback subtle so the Open Items card does not
   visually jump/fade before the dashboard reloads.
   ============================================================ */

.page-dashboard .dashboard-open-item-resolving {
  opacity: 1 !important;
  filter: none !important;
  transform: none !important;
  transition: none !important;
  outline: 1px solid rgba(96, 165, 250, 0.35);
  outline-offset: -1px;
}


/* ============================================================
   Phase 3L10S8C Dashboard Reload Only Resolved
   Non-resolved open-status changes stay in place after save.
   ============================================================ */


/* ============================================================
   Phase 3L10S9 Dashboard Recent Events Status Save
   Recent Events now uses the same dashboard status-save handler
   as Open Items.
   ============================================================ */

.page-dashboard .recent-events-panel .dashboard-open-item-resolving,
.page-dashboard .recent-events-panel tr.dashboard-open-item-resolving {
  opacity: 1 !important;
  filter: none !important;
  transform: none !important;
  transition: none !important;
  outline: 1px solid rgba(96, 165, 250, 0.30);
  outline-offset: -1px;
}


/* ============================================================
   Phase 3L10S10 Reserve Account Balance Target Fix
   Reserve App Target is now open reserve charges + $5 floor.
   Funding transfers no longer raise the target.
   ============================================================ */

.page-dashboard .balance-check-expected-cell small {
  max-width: 9rem;
}


/* ============================================================
   Phase 3L10S11A Dashboard Status Clean GET Refresh
   Dashboard status changes now refresh through a clean GET so
   Open Items, Recent Events, Due/Overdue, and totals stay in sync.
   ============================================================ */


/* ============================================================
   Phase 3L10S11B Dashboard POST Redirect GET
   Dashboard Account Balance Check and Quick Add now redirect after
   successful POST so browser refresh does not trigger resubmission.
   ============================================================ */


/* ============================================================
   Phase 3L10S13 App Timezone Fix
   PHP date defaults are forced to America/Chicago so Quick Add
   does not roll one day ahead during Central evening hours.
   ============================================================ */


/* ============================================================
   Phase 3L10S14 Projected Negative Date Alert
   Prominent dashboard warning for the first date Main Checking
   projects below $0.00.
   ============================================================ */

.page-dashboard .dashboard-negative-alert {
  margin: 1rem 0;
  padding: 1rem;
  border-radius: 1.1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: stretch;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.16), transparent 42%),
    rgba(15, 23, 42, 0.62);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}

.page-dashboard .dashboard-negative-alert-danger {
  border-color: rgba(248, 113, 113, 0.48);
  background:
    radial-gradient(circle at top left, rgba(220, 38, 38, 0.28), transparent 42%),
    rgba(30, 20, 24, 0.74);
}

.page-dashboard .dashboard-negative-alert-ok {
  border-color: rgba(34, 197, 94, 0.34);
  background:
    radial-gradient(circle at top left, rgba(22, 163, 74, 0.18), transparent 42%),
    rgba(15, 23, 42, 0.62);
}

.page-dashboard .dashboard-negative-kicker {
  display: inline-block;
  margin-bottom: 0.25rem;
  color: var(--muted, #94a3b8);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.page-dashboard .dashboard-negative-alert h2 {
  margin: 0;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
}

.page-dashboard .dashboard-negative-alert p {
  margin: 0.35rem 0 0;
  color: var(--muted, #94a3b8);
}

.page-dashboard .dashboard-negative-alert-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(8.5rem, 1fr));
  gap: 0.55rem;
  min-width: min(36rem, 100%);
}

.page-dashboard .dashboard-negative-alert-stats > div {
  padding: 0.7rem 0.75rem;
  border-radius: 0.85rem;
  background: rgba(15, 23, 42, 0.42);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.page-dashboard .dashboard-negative-alert-stats span,
.page-dashboard .dashboard-negative-alert-stats small {
  display: block;
  color: var(--muted, #94a3b8);
  font-size: 0.72rem;
}

.page-dashboard .dashboard-negative-alert-stats strong {
  display: block;
  margin: 0.18rem 0;
  font-size: 1.05rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1050px) {
  .page-dashboard .dashboard-negative-alert {
    grid-template-columns: 1fr;
  }

  .page-dashboard .dashboard-negative-alert-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .page-dashboard .dashboard-negative-alert-stats {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   Phase 3L10S14A Main Cash Projection Role Fix
   Projected Negative Date now recognizes main_cash as Main Checking.
   ============================================================ */


/* ============================================================
   Phase 3L10S16C Scheduled Future Amount UI
   Adds a future-only amount change workflow for scheduled items.
   ============================================================ */

.scheduled-future-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0.85rem 0 1rem;
}

.scheduled-future-summary > div {
  padding: 0.75rem;
  border-radius: 0.85rem;
  background: rgba(15, 23, 42, 0.42);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.scheduled-future-summary span {
  display: block;
  color: var(--muted, #94a3b8);
  font-size: 0.72rem;
  margin-bottom: 0.2rem;
}

.scheduled-future-summary strong {
  display: block;
  font-weight: 900;
}

.scheduled-future-amount-form {
  margin-top: 1rem;
}

.scheduled-future-linked-events-table small {
  color: var(--muted, #94a3b8);
}

@media (max-width: 1050px) {
  .scheduled-future-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .scheduled-future-summary {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   Phase 3L10S16D Scheduled Future Amount UI Polish
   Normalizes the future amount editor.
   ============================================================ */

.scheduled-future-summary strong {
  text-transform: none;
}

.scheduled-future-amount-panel .warning-flash {
  border-color: rgba(245, 158, 11, 0.38);
  background: rgba(120, 53, 15, 0.14);
}

/* ============================================================
   Phase 3L10S17 Events Status Date Cursor Fix
   - Events page status dropdown save feedback
   - Event links keep pointer cursor inside note-trigger rows
   - Date fields stay independent on edit/add event forms
   ============================================================ */

.page-events .shared-event-status-select.status-saving,
.page-income .shared-event-status-select.status-saving,
.page-spending .shared-event-status-select.status-saving {
  opacity: 0.72;
  cursor: wait !important;
}

.page-events tr.event-status-saving td,
.page-income tr.event-status-saving td,
.page-spending tr.event-status-saving td {
  box-shadow: inset 0 0 0 9999px rgba(59, 130, 246, 0.055);
}

/* Links inside row-note tables must behave like links, not text-selection zones. */
.event-table a,
.event-notes-table a,
.shared-event-status-table a,
.reserve-events-table a,
.scheduled-future-linked-events-table a,
.month-events-table a,
.related-panel a,
a.mini-link[href*="event_id"],
a.mini-link[href*="page=events"],
a[data-no-row-note="1"] {
  cursor: pointer !important;
}

.event-table tr.has-event-note a,
.event-table-row.has-event-note a,
.shared-event-status-table tr.has-event-note a,
.reserve-events-table tr.has-event-note a {
  cursor: pointer !important;
}

/* Date fields are separate concepts: event date, due date, cleared date. */
.page-edit_event input[name="event_date"],
.page-edit_event input[name="due_date"],
.page-edit_event input[name="cleared_date"],
.page-add_event input[name="event_date"],
.page-add_event input[name="due_date"],
.page-add_event input[name="cleared_date"] {
  cursor: text;
}

.page-edit_event input[type="date"],
.page-add_event input[type="date"] {
  min-width: 11rem;
}


/* ============================================================
   Phase 3L10S17B Event Date Independence Hard Fix
   Event rows keep normal arrow cursor; actual links/buttons get pointer.
   Date fields remain independent on edit/add event pages.
   ============================================================ */

.event-table-row.has-event-note,
.event-notes-table tr.has-event-note,
.event-table tr.has-event-note,
.shared-event-status-table tr.has-event-note,
.reserve-events-table tr.has-event-note,
.related-panel tr.has-event-note {
  cursor: default !important;
}

.event-table-row.has-event-note td,
.event-notes-table tr.has-event-note td,
.event-table tr.has-event-note td,
.shared-event-status-table tr.has-event-note td,
.reserve-events-table tr.has-event-note td,
.related-panel tr.has-event-note td {
  cursor: default !important;
}

.event-table-row.has-event-note a,
.event-notes-table tr.has-event-note a,
.event-table tr.has-event-note a,
.shared-event-status-table tr.has-event-note a,
.reserve-events-table tr.has-event-note a,
.related-panel tr.has-event-note a,
.event-table-row.has-event-note button,
.event-table-row.has-event-note select,
.event-notes-table tr.has-event-note button,
.event-notes-table tr.has-event-note select,
.shared-event-status-table tr.has-event-note button,
.shared-event-status-table tr.has-event-note select {
  cursor: pointer !important;
}

.page-edit_event input[name="event_date"],
.page-edit_event input[name="due_date"],
.page-edit_event input[name="cleared_date"],
.page-add_event input[name="event_date"],
.page-add_event input[name="due_date"],
.page-add_event input[name="cleared_date"],
.page-scenario_edit_event input[name="event_date"],
.page-scenario_edit_event input[name="due_date"],
.page-scenario_edit_event input[name="cleared_date"],
.page-scenario_add_event input[name="event_date"],
.page-scenario_add_event input[name="due_date"],
.page-scenario_add_event input[name="cleared_date"] {
  cursor: text;
}


/* ============================================================
   Phase 3L10S17C Event Detail Date Independence Actual Page Fix
   Date fields are independent wherever an event edit form appears.
   ============================================================ */

form:has(input[name="event_date"]) input[name="event_date"],
form:has(input[name="event_date"]) input[name="due_date"],
form:has(input[name="event_date"]) input[name="cleared_date"] {
  cursor: text;
}


/* ============================================================
   Phase 3L10S17E2 Credit Card Payment Date Independence
   Root fix: credit-card sync preserves manually edited existing
   event_date / due_date / cleared_date on existing payment events.
   ============================================================ */


/* ============================================================
   Phase 3L10S17F Event Date Proxy Fields
   Visible event date fields use proxy names so older JS cannot
   force due/cleared dates to match event date.
   ============================================================ */

input[data-s17f-visible-date-proxy] {
  cursor: text;
}


/* ============================================================
   Phase 3L10S17G Server-Rendered Event Date Proxies
   Visible event date fields use *_display names from initial render.
   Hidden real fields carry event_date / due_date / cleared_date to PHP.
   ============================================================ */


/* ============================================================
   Phase 3L10S17H Common Event Form Date Proxies
   render_event_form_fields() now uses *_display date inputs plus
   hidden real event_date / due_date / cleared_date fields.
   ============================================================ */


/* ============================================================
   Phase 3L10S17I Proxy Date Final Guard
   Final guard for visible *_display event date fields.
   ============================================================ */

input[data-s17g-date-proxy] {
  cursor: text;
}


/* ============================================================
   Phase 3L10S18A Events Sort Dashboard Search
   ============================================================ */

.page-events table.shared-event-status-table th.s18-sortable {
  cursor: pointer !important;
  user-select: none;
  white-space: nowrap;
  position: relative;
  padding-right: 1.4rem;
}

.page-events table.shared-event-status-table th.s18-sortable::after {
  content: "↕";
  position: absolute;
  right: 0.45rem;
  opacity: 0.45;
  font-size: 0.8em;
}

.page-events table.shared-event-status-table th.s18-sort-asc::after {
  content: "▲";
  opacity: 0.9;
}

.page-events table.shared-event-status-table th.s18-sort-desc::after {
  content: "▼";
  opacity: 0.9;
}

.dashboard-transaction-search-panel {
  margin-top: 1rem;
}

.dashboard-transaction-search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.dashboard-transaction-search-form input[type="search"] {
  flex: 1 1 22rem;
  min-width: min(100%, 18rem);
}

.dashboard-transaction-search-help code {
  padding: 0.1rem 0.35rem;
  border-radius: 0.35rem;
  background: rgba(148, 163, 184, 0.16);
}

.dashboard-transaction-search-summary {
  margin-top: 0.75rem;
}

.dashboard-transaction-search-panel .table-wrap {
  margin-top: 0.75rem;
}

@media (max-width: 760px) {
  .dashboard-transaction-search-form {
    align-items: stretch;
  }

  .dashboard-transaction-search-form input[type="search"],
  .dashboard-transaction-search-form button,
  .dashboard-transaction-search-form .button-link {
    width: 100%;
  }
}


/* ============================================================
   Phase 3L10S18D Effective Ledger Date
   Cleared transactions are ledgered by cleared date.
   Open transactions are ordered by due date, then event date.
   ============================================================ */

table.shared-event-status-table th:nth-child(4),
table.shared-event-status-table td:nth-child(4) {
  white-space: nowrap;
  width: 7.5rem;
}

table.shared-event-status-table th:nth-child(10),
table.shared-event-status-table td:nth-child(10) {
  min-width: 16rem;
}

.page-events table.shared-event-status-table th.s18-sortable,
.page-events table.shared-event-status-table th.s18-sortable::after {
  cursor: pointer !important;
}

.dashboard-transaction-search-panel table.shared-event-status-table th:nth-child(4),
.dashboard-transaction-search-panel table.shared-event-status-table td:nth-child(4),
.recent-events-panel table.shared-event-status-table th:nth-child(4),
.recent-events-panel table.shared-event-status-table td:nth-child(4) {
  white-space: nowrap;
}


/* ============================================================
   Phase 3L10S18E Quick Add Cleared Date
   Quick Add represents already-posted real-world activity.
   The selected event date is also the cleared date.
   ============================================================ */

.quick-add-form input[name="cleared_date"].quick-cleared-date {
  display: none !important;
}


/* ============================================================
   Phase 3L10S18F Quick Add Single Cleared Date
   Quick Add uses one cleared_date field; selected event date
   is the actual cleared/posted date.
   ============================================================ */


/* ============================================================
   Phase 3L10S18G Sidebar Toggle UI Cleanup
   One sane control model:
   - Sidebar open: close with X inside sidebar.
   - Sidebar hidden: show compact Menu button near top-left.
   ============================================================ */

.cf-sidebar-toggle.cf-sidebar-reopen,
.cf-sidebar-toggle[data-sidebar-toggle] {
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.25rem;
  border-radius: 999px;
  white-space: nowrap;
  z-index: 70;
}

/* Kill the old far-right header Hide button while the sidebar is open. */
body.cf-sidebar-expanded .cf-sidebar-toggle[data-sidebar-toggle],
body.cf-sidebar-open .cf-sidebar-toggle[data-sidebar-toggle] {
  display: none !important;
}

/* When the sidebar is collapsed, show a compact reopen control in a predictable spot. */
body.cf-sidebar-collapsed .cf-sidebar-toggle[data-sidebar-toggle] {
  display: inline-flex !important;
  position: fixed !important;
  top: 0.85rem !important;
  left: clamp(0.75rem, 1.4vw, 1.35rem) !important;
  margin: 0 !important;
  padding: 0.45rem 0.85rem !important;
  border: 1px solid rgba(148, 163, 184, 0.32) !important;
  background:
    linear-gradient(180deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.96)) !important;
  color: var(--text, #e5eefb) !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

/* Keep the header title row from reserving odd right-side space for the old Hide button. */
body.cf-sidebar-expanded .budget-command-brand-row,
body.cf-sidebar-open .budget-command-brand-row {
  justify-content: space-between;
}

/* Mobile: same idea, but slightly easier to tap. */
@media (max-width: 900px) {
  body.cf-sidebar-collapsed .cf-sidebar-toggle[data-sidebar-toggle] {
    top: 0.75rem !important;
    left: 0.75rem !important;
    min-height: 2.5rem;
    padding: 0.5rem 0.95rem !important;
  }
}


/* ============================================================
   Phase 3L10S18H Sidebar Toggle Polish
   - Close X is centered and cleaner.
   - Collapsed Menu button becomes part of the header row instead
     of floating over the title.
   ============================================================ */

/* Clean, centered sidebar close button. */
.cf-sidebar-close {
  width: 2rem !important;
  height: 2rem !important;
  min-width: 2rem !important;
  min-height: 2rem !important;
  padding: 0 !important;
  display: inline-grid !important;
  place-items: center !important;
  border-radius: 999px !important;
  border: 1px solid rgba(148, 163, 184, 0.34) !important;
  background:
    linear-gradient(180deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.92)) !important;
  color: var(--text, #e5eefb) !important;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  text-align: center !important;
  cursor: pointer !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.cf-sidebar-close:hover,
.cf-sidebar-close:focus-visible {
  border-color: rgba(96, 165, 250, 0.65) !important;
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.34), rgba(15, 23, 42, 0.95)) !important;
}

/* When collapsed, keep the Menu button in the header row instead of overlaying it. */
body.cf-sidebar-collapsed .budget-command-brand-row {
  align-items: center !important;
  justify-content: space-between !important;
  gap: 1rem !important;
}

/* Override S18G's fixed top-left placement. */
body.cf-sidebar-collapsed .budget-command-brand-row .cf-sidebar-toggle[data-sidebar-toggle] {
  position: static !important;
  top: auto !important;
  left: auto !important;
  order: -1 !important;
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 2.35rem !important;
  margin: 0 0.15rem 0 0 !important;
  padding: 0.48rem 0.88rem !important;
  border-radius: 999px !important;
  border: 1px solid rgba(148, 163, 184, 0.34) !important;
  background:
    linear-gradient(180deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.96)) !important;
  color: var(--text, #e5eefb) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
  white-space: nowrap !important;
}

/* Keep title copy as the main flexible item after the Menu button. */
body.cf-sidebar-collapsed .budget-command-brand-row .brand-copy {
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

/* Header timestamp stays right-aligned but no longer fights the Menu button. */
body.cf-sidebar-collapsed .budget-command-brand-row .timestamp {
  flex: 0 0 auto !important;
  margin-left: auto !important;
}

/* Mobile keeps the same inline-header behavior with a slightly tighter button. */
@media (max-width: 900px) {
  body.cf-sidebar-collapsed .budget-command-brand-row {
    gap: 0.65rem !important;
  }

  body.cf-sidebar-collapsed .budget-command-brand-row .cf-sidebar-toggle[data-sidebar-toggle] {
    min-height: 2.25rem !important;
    padding: 0.42rem 0.78rem !important;
  }
}


/* ============================================================
   Phase 3L10S18I Add Debt Card UI v2
   Adds starter create flows for Debts / Loans and Credit Cards,
   then redirects into the existing full edit forms.
   ============================================================ */

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.panel-title-row h2 {
  margin: 0;
}

.debt-card-add-panel {
  max-width: 920px !important;
}

.debt-card-add-form .form-grid {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

@media (max-width: 760px) {
  .panel-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .debt-card-add-form .form-grid {
    grid-template-columns: 1fr;
  }
}


/* =========================================================
   Phase 3L10S18J Column Overlap Fix
   Prevent shared event/dashboard table cell text from
   visually overlapping adjacent columns.
   ========================================================= */

.page-events table.shared-event-status-table,
.page-income table.shared-event-status-table,
.page-spending table.shared-event-status-table,
.page-dashboard table.shared-event-status-table,
.page-dashboard table.dashboard-open-items-table {
  width: 100%;
  table-layout: fixed;
}

.page-events table.shared-event-status-table th,
.page-events table.shared-event-status-table td,
.page-income table.shared-event-status-table th,
.page-income table.shared-event-status-table td,
.page-spending table.shared-event-status-table th,
.page-spending table.shared-event-status-table td,
.page-dashboard table.shared-event-status-table th,
.page-dashboard table.shared-event-status-table td,
.page-dashboard table.dashboard-open-items-table th,
.page-dashboard table.dashboard-open-items-table td {
  vertical-align: middle;
}

.page-events table.shared-event-status-table td,
.page-income table.shared-event-status-table td,
.page-spending table.shared-event-status-table td,
.page-dashboard table.shared-event-status-table td,
.page-dashboard table.dashboard-open-items-table td {
  overflow: hidden;
}

.page-events table.shared-event-status-table th.cf-col-status,
.page-events table.shared-event-status-table td.cf-col-status,
.page-income table.shared-event-status-table th.cf-col-status,
.page-income table.shared-event-status-table td.cf-col-status,
.page-spending table.shared-event-status-table th.cf-col-status,
.page-spending table.shared-event-status-table td.cf-col-status,
.page-dashboard table.shared-event-status-table th.cf-col-status,
.page-dashboard table.shared-event-status-table td.cf-col-status {
  width: 11rem;
  min-width: 11rem;
}

.page-events table.shared-event-status-table th.cf-col-account,
.page-events table.shared-event-status-table td.cf-col-account,
.page-income table.shared-event-status-table th.cf-col-account,
.page-income table.shared-event-status-table td.cf-col-account,
.page-spending table.shared-event-status-table th.cf-col-account,
.page-spending table.shared-event-status-table td.cf-col-account,
.page-dashboard table.shared-event-status-table th.cf-col-account,
.page-dashboard table.shared-event-status-table td.cf-col-account {
  width: 24%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.25;
}

.page-events table.shared-event-status-table th.cf-col-description,
.page-events table.shared-event-status-table td.cf-col-description,
.page-income table.shared-event-status-table th.cf-col-description,
.page-income table.shared-event-status-table td.cf-col-description,
.page-spending table.shared-event-status-table th.cf-col-description,
.page-spending table.shared-event-status-table td.cf-col-description,
.page-dashboard table.shared-event-status-table th.cf-col-description,
.page-dashboard table.shared-event-status-table td.cf-col-description,
.page-dashboard table.dashboard-open-items-table th.cf-col-description,
.page-dashboard table.dashboard-open-items-table td.cf-col-description {
  width: 22%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.25;
}

.page-events table.shared-event-status-table th.cf-col-direction,
.page-events table.shared-event-status-table td.cf-col-direction,
.page-income table.shared-event-status-table th.cf-col-direction,
.page-income table.shared-event-status-table td.cf-col-direction,
.page-spending table.shared-event-status-table th.cf-col-direction,
.page-spending table.shared-event-status-table td.cf-col-direction,
.page-dashboard table.shared-event-status-table th.cf-col-direction,
.page-dashboard table.shared-event-status-table td.cf-col-direction {
  width: 9rem;
  min-width: 9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-events table.shared-event-status-table th.cf-col-amount,
.page-events table.shared-event-status-table td.cf-col-amount,
.page-income table.shared-event-status-table th.cf-col-amount,
.page-income table.shared-event-status-table td.cf-col-amount,
.page-spending table.shared-event-status-table th.cf-col-amount,
.page-spending table.shared-event-status-table td.cf-col-amount,
.page-dashboard table.shared-event-status-table th.cf-col-amount,
.page-dashboard table.shared-event-status-table td.cf-col-amount,
.page-dashboard table.dashboard-open-items-table th.cf-col-amount,
.page-dashboard table.dashboard-open-items-table td.cf-col-amount {
  width: 8.5rem;
  min-width: 8.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-events table.shared-event-status-table th.cf-col-date,
.page-events table.shared-event-status-table td.cf-col-date,
.page-income table.shared-event-status-table th.cf-col-date,
.page-income table.shared-event-status-table td.cf-col-date,
.page-spending table.shared-event-status-table th.cf-col-date,
.page-spending table.shared-event-status-table td.cf-col-date,
.page-dashboard table.shared-event-status-table th.cf-col-date,
.page-dashboard table.shared-event-status-table td.cf-col-date,
.page-dashboard table.dashboard-open-items-table th.cf-col-date,
.page-dashboard table.dashboard-open-items-table td.cf-col-date {
  width: 8.25rem;
  min-width: 8.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-events table.shared-event-status-table td.cf-col-direction,
.page-events table.shared-event-status-table td.cf-col-amount,
.page-income table.shared-event-status-table td.cf-col-direction,
.page-income table.shared-event-status-table td.cf-col-amount,
.page-spending table.shared-event-status-table td.cf-col-direction,
.page-spending table.shared-event-status-table td.cf-col-amount,
.page-dashboard table.shared-event-status-table td.cf-col-direction,
.page-dashboard table.shared-event-status-table td.cf-col-amount,
.page-dashboard table.dashboard-open-items-table td.cf-col-amount {
  position: relative;
  z-index: 1;
}

@media (max-width: 1200px) {
  .page-events table.shared-event-status-table th.cf-col-account,
  .page-events table.shared-event-status-table td.cf-col-account,
  .page-income table.shared-event-status-table th.cf-col-account,
  .page-income table.shared-event-status-table td.cf-col-account,
  .page-spending table.shared-event-status-table th.cf-col-account,
  .page-spending table.shared-event-status-table td.cf-col-account,
  .page-dashboard table.shared-event-status-table th.cf-col-account,
  .page-dashboard table.shared-event-status-table td.cf-col-account {
    width: 20%;
  }

  .page-events table.shared-event-status-table th.cf-col-description,
  .page-events table.shared-event-status-table td.cf-col-description,
  .page-income table.shared-event-status-table th.cf-col-description,
  .page-income table.shared-event-status-table td.cf-col-description,
  .page-spending table.shared-event-status-table th.cf-col-description,
  .page-spending table.shared-event-status-table td.cf-col-description,
  .page-dashboard table.shared-event-status-table th.cf-col-description,
  .page-dashboard table.shared-event-status-table td.cf-col-description,
  .page-dashboard table.dashboard-open-items-table th.cf-col-description,
  .page-dashboard table.dashboard-open-items-table td.cf-col-description {
    width: 18%;
  }
}




/* ============================================================
   Phase 3L10S18J2 Event Table Layout Repair
   S18J's fixed-layout approach prevented overlap but crushed
   Role/Description and created huge rows. This restores the
   ledger-table model: wide table, horizontal scroll if needed,
   clipped text inside cells, no column bleeding.
   ============================================================ */

/* Restore scroll wrappers instead of crushing columns into the panel. */
.page-dashboard .recent-events-panel .table-wrap,
.page-dashboard .dashboard-open-items-panel .table-wrap,
.page-dashboard .panel .table-wrap,
.page-events .table-wrap,
.page-income .table-wrap,
.page-spending .table-wrap {
  overflow-x: auto !important;
  overflow-y: visible !important;
}

/* Shared event ledgers should be wide, not forcibly compressed. */
.page-dashboard table.shared-event-status-table,
.page-dashboard table.dashboard-open-items-table,
.page-events table.shared-event-status-table,
.page-income table.shared-event-status-table,
.page-spending table.shared-event-status-table {
  table-layout: auto !important;
  width: max-content !important;
  min-width: 1420px !important;
}

/* Undo S18J's fixed percentage/min-width squeezing. */
.page-dashboard table.shared-event-status-table th,
.page-dashboard table.shared-event-status-table td,
.page-dashboard table.dashboard-open-items-table th,
.page-dashboard table.dashboard-open-items-table td,
.page-events table.shared-event-status-table th,
.page-events table.shared-event-status-table td,
.page-income table.shared-event-status-table th,
.page-income table.shared-event-status-table td,
.page-spending table.shared-event-status-table th,
.page-spending table.shared-event-status-table td {
  min-width: unset !important;
  max-width: none !important;
  vertical-align: middle !important;
  line-height: 1.25 !important;
}

/* Keep ordinary ledger cells compact. */
.page-dashboard table.shared-event-status-table td,
.page-dashboard table.dashboard-open-items-table td,
.page-events table.shared-event-status-table td,
.page-income table.shared-event-status-table td,
.page-spending table.shared-event-status-table td {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Explicit sane widths for the common event columns:
   ID, Date, Due, Cleared, Status, Account, Direction, Amount, Role, Description */
.page-dashboard table.shared-event-status-table th:nth-child(1),
.page-dashboard table.shared-event-status-table td:nth-child(1),
.page-events table.shared-event-status-table th:nth-child(1),
.page-events table.shared-event-status-table td:nth-child(1),
.page-income table.shared-event-status-table th:nth-child(1),
.page-income table.shared-event-status-table td:nth-child(1),
.page-spending table.shared-event-status-table th:nth-child(1),
.page-spending table.shared-event-status-table td:nth-child(1) {
  width: 4.5rem !important;
}

.page-dashboard table.shared-event-status-table th:nth-child(2),
.page-dashboard table.shared-event-status-table td:nth-child(2),
.page-dashboard table.shared-event-status-table th:nth-child(3),
.page-dashboard table.shared-event-status-table td:nth-child(3),
.page-dashboard table.shared-event-status-table th:nth-child(4),
.page-dashboard table.shared-event-status-table td:nth-child(4),
.page-events table.shared-event-status-table th:nth-child(2),
.page-events table.shared-event-status-table td:nth-child(2),
.page-events table.shared-event-status-table th:nth-child(3),
.page-events table.shared-event-status-table td:nth-child(3),
.page-events table.shared-event-status-table th:nth-child(4),
.page-events table.shared-event-status-table td:nth-child(4),
.page-income table.shared-event-status-table th:nth-child(2),
.page-income table.shared-event-status-table td:nth-child(2),
.page-income table.shared-event-status-table th:nth-child(3),
.page-income table.shared-event-status-table td:nth-child(3),
.page-income table.shared-event-status-table th:nth-child(4),
.page-income table.shared-event-status-table td:nth-child(4),
.page-spending table.shared-event-status-table th:nth-child(2),
.page-spending table.shared-event-status-table td:nth-child(2),
.page-spending table.shared-event-status-table th:nth-child(3),
.page-spending table.shared-event-status-table td:nth-child(3),
.page-spending table.shared-event-status-table th:nth-child(4),
.page-spending table.shared-event-status-table td:nth-child(4) {
  width: 8.25rem !important;
}

.page-dashboard table.shared-event-status-table th:nth-child(5),
.page-dashboard table.shared-event-status-table td:nth-child(5),
.page-events table.shared-event-status-table th:nth-child(5),
.page-events table.shared-event-status-table td:nth-child(5),
.page-income table.shared-event-status-table th:nth-child(5),
.page-income table.shared-event-status-table td:nth-child(5),
.page-spending table.shared-event-status-table th:nth-child(5),
.page-spending table.shared-event-status-table td:nth-child(5) {
  width: 12rem !important;
}

.page-dashboard table.shared-event-status-table th:nth-child(6),
.page-dashboard table.shared-event-status-table td:nth-child(6),
.page-events table.shared-event-status-table th:nth-child(6),
.page-events table.shared-event-status-table td:nth-child(6),
.page-income table.shared-event-status-table th:nth-child(6),
.page-income table.shared-event-status-table td:nth-child(6),
.page-spending table.shared-event-status-table th:nth-child(6),
.page-spending table.shared-event-status-table td:nth-child(6) {
  width: 15rem !important;
  max-width: 15rem !important;
}

.page-dashboard table.shared-event-status-table th:nth-child(7),
.page-dashboard table.shared-event-status-table td:nth-child(7),
.page-events table.shared-event-status-table th:nth-child(7),
.page-events table.shared-event-status-table td:nth-child(7),
.page-income table.shared-event-status-table th:nth-child(7),
.page-income table.shared-event-status-table td:nth-child(7),
.page-spending table.shared-event-status-table th:nth-child(7),
.page-spending table.shared-event-status-table td:nth-child(7) {
  width: 8rem !important;
}

.page-dashboard table.shared-event-status-table th:nth-child(8),
.page-dashboard table.shared-event-status-table td:nth-child(8),
.page-events table.shared-event-status-table th:nth-child(8),
.page-events table.shared-event-status-table td:nth-child(8),
.page-income table.shared-event-status-table th:nth-child(8),
.page-income table.shared-event-status-table td:nth-child(8),
.page-spending table.shared-event-status-table th:nth-child(8),
.page-spending table.shared-event-status-table td:nth-child(8) {
  width: 8.75rem !important;
  text-align: right !important;
}

.page-dashboard table.shared-event-status-table th:nth-child(9),
.page-dashboard table.shared-event-status-table td:nth-child(9),
.page-events table.shared-event-status-table th:nth-child(9),
.page-events table.shared-event-status-table td:nth-child(9),
.page-income table.shared-event-status-table th:nth-child(9),
.page-income table.shared-event-status-table td:nth-child(9),
.page-spending table.shared-event-status-table th:nth-child(9),
.page-spending table.shared-event-status-table td:nth-child(9) {
  width: 8.5rem !important;
  max-width: 8.5rem !important;
}

.page-dashboard table.shared-event-status-table th:nth-child(10),
.page-dashboard table.shared-event-status-table td:nth-child(10),
.page-events table.shared-event-status-table th:nth-child(10),
.page-events table.shared-event-status-table td:nth-child(10),
.page-income table.shared-event-status-table th:nth-child(10),
.page-income table.shared-event-status-table td:nth-child(10),
.page-spending table.shared-event-status-table th:nth-child(10),
.page-spending table.shared-event-status-table td:nth-child(10) {
  width: 20rem !important;
  max-width: 20rem !important;
}

/* Dashboard open-items tables can vary, but keep them sane too. */
.page-dashboard table.dashboard-open-items-table {
  min-width: 1180px !important;
}

.page-dashboard table.dashboard-open-items-table th,
.page-dashboard table.dashboard-open-items-table td {
  white-space: nowrap !important;
}

/* Let note/description cells wrap only when a table is intentionally compact,
   not in the ledger views that caused overlap. */
.page-dashboard .recent-events-panel table.shared-event-status-table .cf-col-description,
.page-events table.shared-event-status-table .cf-col-description,
.page-income table.shared-event-status-table .cf-col-description,
.page-spending table.shared-event-status-table .cf-col-description {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}



/* Phase 3L10S18K Reserve Transfer Corrections */



/* ============================================================
   Phase 3L10S18L Dashboard Compact Event Tables
   Dashboard should be glanceable. Full ledger width belongs on
   Events, Income, Spending, etc. This overrides S18J2 only on
   Dashboard Open Items / Recent Events style tables.
   ============================================================ */

.page-dashboard .dashboard-open-items-panel .table-wrap,
.page-dashboard .recent-events-panel .table-wrap,
.page-dashboard .dashboard-grid .table-wrap {
  overflow-x: visible !important;
  width: 100% !important;
}

.page-dashboard table.shared-event-status-table,
.page-dashboard table.dashboard-open-items-table,
.page-dashboard .recent-events-panel table,
.page-dashboard .dashboard-open-items-panel table {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  table-layout: fixed !important;
}

/* Dashboard event table common columns:
   Shared event table after S18D:
   1 ID, 2 Date, 3 Due, 4 Cleared, 5 Status, 6 Account,
   7 Direction, 8 Amount, 9 Role, 10 Description

   Dashboard compact view keeps:
   Date, Status, Account, Amount, Description
   and hides ID/Due/Cleared/Direction/Role.
*/
.page-dashboard table.shared-event-status-table th:nth-child(1),
.page-dashboard table.shared-event-status-table td:nth-child(1),
.page-dashboard table.shared-event-status-table th:nth-child(3),
.page-dashboard table.shared-event-status-table td:nth-child(3),
.page-dashboard table.shared-event-status-table th:nth-child(4),
.page-dashboard table.shared-event-status-table td:nth-child(4),
.page-dashboard table.shared-event-status-table th:nth-child(7),
.page-dashboard table.shared-event-status-table td:nth-child(7),
.page-dashboard table.shared-event-status-table th:nth-child(9),
.page-dashboard table.shared-event-status-table td:nth-child(9) {
  display: none !important;
}

/* Open Items can have slightly different column counts/classes.
   Hide low-value internal/id/role-ish cells when JS tags them. */
.page-dashboard table.dashboard-open-items-table .cf-col-id,
.page-dashboard table.dashboard-open-items-table .cf-col-due,
.page-dashboard table.dashboard-open-items-table .cf-col-cleared,
.page-dashboard table.dashboard-open-items-table .cf-col-direction,
.page-dashboard table.dashboard-open-items-table .cf-col-role {
  display: none !important;
}

/* Widths for the columns that remain. */
.page-dashboard table.shared-event-status-table th:nth-child(2),
.page-dashboard table.shared-event-status-table td:nth-child(2) {
  width: 7.75rem !important;
  white-space: nowrap !important;
}

.page-dashboard table.shared-event-status-table th:nth-child(5),
.page-dashboard table.shared-event-status-table td:nth-child(5) {
  width: 10.5rem !important;
  white-space: nowrap !important;
}

.page-dashboard table.shared-event-status-table th:nth-child(6),
.page-dashboard table.shared-event-status-table td:nth-child(6) {
  width: 18% !important;
  max-width: none !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
  line-height: 1.25 !important;
}

.page-dashboard table.shared-event-status-table th:nth-child(8),
.page-dashboard table.shared-event-status-table td:nth-child(8) {
  width: 8.5rem !important;
  white-space: nowrap !important;
  text-align: right !important;
}

.page-dashboard table.shared-event-status-table th:nth-child(10),
.page-dashboard table.shared-event-status-table td:nth-child(10) {
  width: auto !important;
  max-width: none !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
  line-height: 1.25 !important;
}

/* Undo the ellipsis-only behavior on Dashboard so text wraps instead of forcing scroll. */
.page-dashboard table.shared-event-status-table td,
.page-dashboard table.dashboard-open-items-table td,
.page-dashboard .recent-events-panel table td,
.page-dashboard .dashboard-open-items-panel table td {
  overflow: hidden !important;
  text-overflow: clip !important;
}

/* Keep status controls from exploding the column. */
.page-dashboard table.shared-event-status-table select,
.page-dashboard table.dashboard-open-items-table select,
.page-dashboard .recent-events-panel table select,
.page-dashboard .dashboard-open-items-panel table select {
  max-width: 100% !important;
}

/* If dashboard tables have JS semantic classes, use them too. */
.page-dashboard table .cf-col-date {
  width: 7.75rem !important;
  white-space: nowrap !important;
}

.page-dashboard table .cf-col-status {
  width: 10.5rem !important;
  white-space: nowrap !important;
}

.page-dashboard table .cf-col-account {
  width: 18% !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

.page-dashboard table .cf-col-amount {
  width: 8.5rem !important;
  white-space: nowrap !important;
  text-align: right !important;
}

.page-dashboard table .cf-col-description {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  max-width: none !important;
}

/* Medium screens: hide Account too if needed; description usually says enough. */
@media (max-width: 1150px) {
  .page-dashboard table.shared-event-status-table th:nth-child(6),
  .page-dashboard table.shared-event-status-table td:nth-child(6),
  .page-dashboard table .cf-col-account {
    display: none !important;
  }

  .page-dashboard table.shared-event-status-table th:nth-child(10),
  .page-dashboard table.shared-event-status-table td:nth-child(10),
  .page-dashboard table .cf-col-description {
    width: auto !important;
  }
}

/* Small screens: status can stack/wrap, but still no horizontal scroll. */
@media (max-width: 760px) {
  .page-dashboard table.shared-event-status-table th:nth-child(5),
  .page-dashboard table.shared-event-status-table td:nth-child(5),
  .page-dashboard table .cf-col-status {
    width: 8.5rem !important;
  }

  .page-dashboard table.shared-event-status-table th:nth-child(8),
  .page-dashboard table.shared-event-status-table td:nth-child(8),
  .page-dashboard table .cf-col-amount {
    width: 7rem !important;
  }
}




/* ============================================================
   Phase 3L10S18M Events Compact No Side-Scroll
   Keep Events as a useful ledger, but stop forcing horizontal
   scroll. Dashboard compacting stays separate from this.
   ============================================================ */

.page-events .table-wrap {
  overflow-x: visible !important;
  width: 100% !important;
}

.page-events table.shared-event-status-table {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}

/* The Events table has:
   1 ID, 2 Date, 3 Due, 4 Cleared, 5 Status, 6 Account,
   7 Direction, 8 Amount, 9 Role, 10 Description.

   ID and Role are useful internally, but they make the visible
   page too crowded. Hide them from the main ledger view.
*/
.page-events table.shared-event-status-table th:nth-child(1),
.page-events table.shared-event-status-table td:nth-child(1),
.page-events table.shared-event-status-table th:nth-child(9),
.page-events table.shared-event-status-table td:nth-child(9) {
  display: none !important;
}

/* Compact padding so dates/status/account/description can coexist. */
.page-events table.shared-event-status-table th,
.page-events table.shared-event-status-table td {
  padding-left: 0.55rem !important;
  padding-right: 0.55rem !important;
  vertical-align: middle !important;
  line-height: 1.25 !important;
  min-width: 0 !important;
  max-width: none !important;
}

/* Date columns. */
.page-events table.shared-event-status-table th:nth-child(2),
.page-events table.shared-event-status-table td:nth-child(2),
.page-events table.shared-event-status-table th:nth-child(3),
.page-events table.shared-event-status-table td:nth-child(3),
.page-events table.shared-event-status-table th:nth-child(4),
.page-events table.shared-event-status-table td:nth-child(4) {
  width: 7.25rem !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: clip !important;
}

/* Status column. Leave enough room for the status select and pair badge/button. */
.page-events table.shared-event-status-table th:nth-child(5),
.page-events table.shared-event-status-table td:nth-child(5) {
  width: 13.75rem !important;
}
/* Account can wrap instead of pushing the whole table sideways. */
.page-events table.shared-event-status-table th:nth-child(6),
.page-events table.shared-event-status-table td:nth-child(6) {
  width: 18% !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
}

/* Direction and Amount stay compact. */
.page-events table.shared-event-status-table th:nth-child(7),
.page-events table.shared-event-status-table td:nth-child(7) {
  width: 7.4rem !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: clip !important;
}

.page-events table.shared-event-status-table th:nth-child(8),
.page-events table.shared-event-status-table td:nth-child(8) {
  width: 7.75rem !important;
  white-space: nowrap !important;
  text-align: right !important;
  overflow: hidden !important;
  text-overflow: clip !important;
}

/* Description gets the remaining space and may wrap. */
.page-events table.shared-event-status-table th:nth-child(10),
.page-events table.shared-event-status-table td:nth-child(10) {
  max-width: none !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
  overflow: hidden !important;
  text-overflow: clip !important;
}
/* Keep selects from forcing the status column wider. */
.page-events table.shared-event-status-table select {
  max-width: 100% !important;
}

/* Smaller desktops: hide Due and keep Cleared.
   Cleared is usually more useful on a ledger once the item is done. */
@media (max-width: 1320px) {
  .page-events table.shared-event-status-table th:nth-child(3),
  .page-events table.shared-event-status-table td:nth-child(3) {
    display: none !important;
  }

  .page-events table.shared-event-status-table th:nth-child(5),
  .page-events table.shared-event-status-table td:nth-child(5) {
    width: 12.75rem !important;
  }

  .page-events table.shared-event-status-table th:nth-child(6),
  .page-events table.shared-event-status-table td:nth-child(6) {
    width: 20% !important;
  }
}

/* Narrower: hide Cleared too and let Date be the main activity date.
   This avoids horizontal scrolling before the layout gets ugly. */
@media (max-width: 1080px) {
  .page-events table.shared-event-status-table th:nth-child(4),
  .page-events table.shared-event-status-table td:nth-child(4) {
    display: none !important;
  }

  .page-events table.shared-event-status-table th:nth-child(7),
  .page-events table.shared-event-status-table td:nth-child(7) {
    width: 6.5rem !important;
  }

  .page-events table.shared-event-status-table th:nth-child(8),
  .page-events table.shared-event-status-table td:nth-child(8) {
    width: 7rem !important;
  }
}

/* Very narrow: hide Direction; amount plus description/status carry the meaning. */
@media (max-width: 860px) {
  .page-events table.shared-event-status-table th:nth-child(7),
  .page-events table.shared-event-status-table td:nth-child(7) {
    display: none !important;
  }

  .page-events table.shared-event-status-table th:nth-child(6),
  .page-events table.shared-event-status-table td:nth-child(6) {
    display: none !important;
  }
}




/* ============================================================
   Phase 3L10S18N Events Status Column Compact
   S18M fit the Events table, but the Status column stayed too
   wide because "Pair Cleared" controls lived beside the status
   dropdown. Compact them into a tiny pair chip.
   ============================================================ */

.page-events table.shared-event-status-table th:nth-child(5),
.page-events table.shared-event-status-table td:nth-child(5) {
  width: 10.25rem !important;
  max-width: 10.25rem !important;
}
.page-events table.shared-event-status-table td:nth-child(5) {
  display: flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
}

.page-events table.shared-event-status-table td:nth-child(5) select {
  width: 8.35rem !important;
  min-width: 0 !important;
  max-width: 8.35rem !important;
  flex: 0 0 8.35rem !important;
}

/* JS tags the Pair Cleared control with this class. */
.page-events .s18n-pair-cleared-chip {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 1.45rem !important;
  height: 1.45rem !important;
  min-width: 1.45rem !important;
  max-width: 1.45rem !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 999px !important;
  font-size: 0.78rem !important;
  line-height: 1 !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  text-indent: 0 !important;
  opacity: 0.72 !important;
}

/* If the pair control is an anchor/button with existing button styling,
   keep it from inheriting huge pill dimensions. */
.page-events table.shared-event-status-table td:nth-child(5) button.s18n-pair-cleared-chip,
.page-events table.shared-event-status-table td:nth-child(5) a.s18n-pair-cleared-chip,
.page-events table.shared-event-status-table td:nth-child(5) span.s18n-pair-cleared-chip {
  box-sizing: border-box !important;
}

/* Hide any leftover text nodes/wrappers around the compact chip when possible. */
.page-events table.shared-event-status-table td:nth-child(5) .s18n-pair-cleared-chip * {
  max-width: 1.45rem !important;
  overflow: hidden !important;
}

/* Slightly give Account/Description the room Status just surrendered. */
/* Keep smaller screens from re-growing the status column. */
@media (max-width: 1320px) {
  .page-events table.shared-event-status-table th:nth-child(5),
  .page-events table.shared-event-status-table td:nth-child(5) {
    width: 10.25rem !important;
    max-width: 10.25rem !important;
  }
}




/* ============================================================
   Phase 3L10S18O Events Status Cleanup
   Undo the weird S18N status-cell barnacles. Status should be
   a normal compact table cell with only the dropdown visible.
   Pair-cleared controls are hidden in compact Events view.
   ============================================================ */

.page-events table.shared-event-status-table th:nth-child(5),
.page-events table.shared-event-status-table td:nth-child(5) {
  width: 9.75rem !important;
  max-width: 9.75rem !important;
  min-width: 9.75rem !important;
  text-overflow: clip !important;
}
.page-events table.shared-event-status-table td:nth-child(5) select {
  width: 9rem !important;
  min-width: 9rem !important;
  max-width: 9rem !important;
  display: inline-block !important;
  vertical-align: middle !important;
}

/* Hide the pair-cleared mini controls from the compact table view.
   They were useful conceptually but visually ugly here. */
.page-events table.shared-event-status-table td:nth-child(5) .s18n-pair-cleared-chip,
.page-events table.shared-event-status-table td:nth-child(5) button.s18n-pair-cleared-chip,
.page-events table.shared-event-status-table td:nth-child(5) a.s18n-pair-cleared-chip,
.page-events table.shared-event-status-table td:nth-child(5) span.s18n-pair-cleared-chip {
  display: none !important;
}

/* Also hide untagged Pair Cleared controls if the JS has not tagged them yet. */
.page-events table.shared-event-status-table td:nth-child(5) button:not(.quick-event-status-select),
.page-events table.shared-event-status-table td:nth-child(5) a:not(.quick-event-status-select) {
  max-width: 0 !important;
  width: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Give the rescued width back to Account / Description. */
.page-events table.shared-event-status-table th:nth-child(6),
.page-events table.shared-event-status-table td:nth-child(6) {
  width: 21% !important;
}




/* ============================================================
   Phase 3L10S18P Paired Transfer Indicator
   Keep Status clean; show a tiny paired-transfer icon in the
   Description cell for rows that have a hidden Pair Cleared control.
   ============================================================ */

.page-events .s18p-paired-indicator,
.page-dashboard .s18p-paired-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  margin-right: 0.45rem;
  vertical-align: text-bottom;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.45);
  background: rgba(59, 130, 246, 0.10);
  color: #93c5fd;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
  flex: 0 0 auto;
}

.page-events .s18p-paired-indicator svg,
.page-dashboard .s18p-paired-indicator svg {
  width: 0.82rem;
  height: 0.82rem;
  display: block;
  fill: currentColor;
}

.page-events .s18p-description-wrap,
.page-dashboard .s18p-description-wrap {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

.page-events .s18p-description-wrap > a,
.page-events .s18p-description-wrap > span,
.page-dashboard .s18p-description-wrap > a,
.page-dashboard .s18p-description-wrap > span {
  min-width: 0;
}

.page-events .s18p-paired-indicator:hover,
.page-events .s18p-paired-indicator:focus-visible,
.page-dashboard .s18p-paired-indicator:hover,
.page-dashboard .s18p-paired-indicator:focus-visible {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(96, 165, 250, 0.70);
  color: #bfdbfe;
}

/* Keep the hidden pair-cleared helper truly hidden after S18O. */
.page-events .s18o-pair-cleared-hidden,
.page-dashboard .s18o-pair-cleared-hidden {
  display: none !important;
}




/* ============================================================
   Phase 3L10S18Q Events Status Polish
   Clean the Events status column after paired-transfer indicator
   moved to Description.
   ============================================================ */

.page-events table.shared-event-status-table th:nth-child(5),
.page-events table.shared-event-status-table td:nth-child(5) {
  display: table-cell !important;
  text-align: center !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  padding-left: 0.35rem !important;
  padding-right: 0.35rem !important;
}
/* Events-page status dropdown: compact pill, not a giant green canoe. */
.page-events table.shared-event-status-table td:nth-child(5) select,
.page-events table.shared-event-status-table select.quick-event-status-select {
  width: 7.7rem !important;
  min-width: 7.7rem !important;
  max-width: 7.7rem !important;
  height: 2.05rem !important;
  min-height: 2.05rem !important;
  padding: 0.25rem 1.55rem 0.25rem 0.75rem !important;
  border-radius: 999px !important;
  font-size: 0.92rem !important;
  line-height: 1.1 !important;
  margin: 0 auto !important;
  display: inline-block !important;
  vertical-align: middle !important;
}

/* Tone down the focus ring so clicking the dropdown does not look like
   the status column has been possessed by a blue neon raccoon. */
.page-events table.shared-event-status-table select.quick-event-status-select:focus,
.page-events table.shared-event-status-table td:nth-child(5) select:focus {
  outline: none !important;
  box-shadow:
    0 0 0 1px rgba(96, 165, 250, 0.45),
    0 0 0 3px rgba(37, 99, 235, 0.16) !important;
}

/* Keep hidden pair controls from taking any layout space in Status. */
.page-events table.shared-event-status-table td:nth-child(5) > :not(select) {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Give the width back to useful columns. */
.page-events table.shared-event-status-table th:nth-child(6),
.page-events table.shared-event-status-table td:nth-child(6) {
  width: 22% !important;
}

.page-events table.shared-event-status-table th:nth-child(10),
.page-events table.shared-event-status-table td:nth-child(10) {
  width: auto !important;
}




/* ============================================================
   Phase 3L10S18R Restore Events ID Column
   S18M hid ID to save width, but the event number is needed for
   editing/debugging. Restore it as a narrow utility column.
   ============================================================ */

.page-events table.shared-event-status-table th:nth-child(1),
.page-events table.shared-event-status-table td:nth-child(1) {
  display: table-cell !important;
  width: 4.25rem !important;
  min-width: 4.25rem !important;
  max-width: 4.25rem !important;
  white-space: nowrap !important;
  text-align: center !important;
  overflow: hidden !important;
  text-overflow: clip !important;
  padding-left: 0.35rem !important;
  padding-right: 0.35rem !important;
}

/* Keep Role hidden; ID comes back, Role stays detail/edit-screen material. */
.page-events table.shared-event-status-table th:nth-child(9),
.page-events table.shared-event-status-table td:nth-child(9) {
  display: none !important;
}

/* Slightly trim Account to make room for restored ID without side-scroll. */
.page-events table.shared-event-status-table th:nth-child(6),
.page-events table.shared-event-status-table td:nth-child(6) {
  width: 20% !important;
}

/* Keep status compact from S18Q. */
.page-events table.shared-event-status-table th:nth-child(5),
.page-events table.shared-event-status-table td:nth-child(5) {
  width: 8.8rem !important;
  min-width: 8.8rem !important;
  max-width: 8.8rem !important;
}



/* Phase 3L10S18T Dashboard Open Item Date Chip */
.dashboard-open-date-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(120, 165, 230, 0.28);
  background: rgba(90, 130, 190, 0.14);
  color: var(--muted, #aeb8c8);
  font-weight: 700;
  white-space: nowrap;
}

.dashboard-open-subline {
  flex-wrap: wrap;
  gap: 0.35rem;
}
/* ============================================================
   Phase 3L10S18V Dashboard Recent Events ID Column
   Recent Events needs a visible clickable event number for quick
   detail/edit lookup, while the Dashboard stays compact.
   ============================================================ */

.page-dashboard .recent-events-panel table.shared-event-status-table th:nth-child(1),
.page-dashboard .recent-events-panel table.shared-event-status-table td:nth-child(1) {
  display: table-cell !important;
  width: 4.25rem !important;
  max-width: 4.25rem !important;
  white-space: nowrap !important;
}

.page-dashboard .recent-events-panel table.shared-event-status-table th:nth-child(1) {
  text-align: left !important;
}

.page-dashboard .recent-events-panel table.shared-event-status-table td:nth-child(1) {
  font-weight: 800 !important;
}

.page-dashboard .recent-events-panel table.shared-event-status-table td:nth-child(1) .mini-link {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 3rem !important;
}

/* With ID restored, trim the flexible columns slightly so no side-scroll returns. */
.page-dashboard .recent-events-panel table.shared-event-status-table th:nth-child(2),
.page-dashboard .recent-events-panel table.shared-event-status-table td:nth-child(2) {
  width: 7.25rem !important;
}

.page-dashboard .recent-events-panel table.shared-event-status-table th:nth-child(6),
.page-dashboard .recent-events-panel table.shared-event-status-table td:nth-child(6) {
  width: 17% !important;
}

.page-dashboard .recent-events-panel table.shared-event-status-table th:nth-child(10),
.page-dashboard .recent-events-panel table.shared-event-status-table td:nth-child(10) {
  width: auto !important;
}


/* ============================================================
   Phase 3L10S19E Private Config App Login
   ============================================================ */

.login-panel {
  max-width: 34rem;
  margin: 2rem auto;
}

.login-form {
  max-width: 28rem;
}

.login-security-note {
  margin-top: 1rem;
}

.nav-logout-form {
  display: inline-flex;
  margin: 0;
  padding: 0;
}

.nav-logout-button {
  border: 0;
  cursor: pointer;
  font: inherit;
}


/* ============================================================
   Phase 3L10S19F Header Logout
   Keep app logout visible in the topbar instead of clipped in sidebar nav.
   ============================================================ */

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.header-logout-form {
  margin: 0;
  padding: 0;
}

.header-logout-button {
  border: 1px solid rgba(96, 165, 250, 0.45);
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.16);
  color: var(--text);
  font: inherit;
  font-weight: 800;
  padding: 0.48rem 0.85rem;
  cursor: pointer;
}

.header-logout-button:hover,
.header-logout-button:focus {
  background: rgba(37, 99, 235, 0.28);
  border-color: rgba(147, 197, 253, 0.7);
}

.budget-command-header .timestamp {
  white-space: nowrap;
}


/* ============================================================
   Phase 3L10S20A Add Bill Service Shell Bridge
   ============================================================ */

.add-bill-service-shell-panel {
  padding: 1rem;
}

.embedded-tool-frame {
  display: block;
  width: 100%;
  min-height: 1120px;
  border: 0;
  border-radius: 1rem;
  background: transparent;
}

.add-bill-service-frame {
  margin-top: 1rem;
}

.embedded-standalone {
  background: transparent;
}

.embedded-standalone .add-bill-service-page {
  padding: 0;
  margin: 0;
  max-width: none;
}

.embedded-standalone .standalone-page-title {
  margin-top: 0;
}


/* ============================================================
   Phase 3L10S20B Add Bill Service Shell Polish
   Hide duplicate embedded title and tighten iframe presentation.
   ============================================================ */

.embedded-standalone .standalone-page-title {
  display: none;
}

.embedded-standalone .add-bill-service-page {
  padding-top: 0;
}

.add-bill-service-shell-panel .quick-add-header {
  margin-bottom: 0.35rem;
}

.add-bill-service-shell-panel .embedded-tool-frame {
  min-height: 980px;
}


/* ============================================================
   Phase 3L10S20D Late Adjust Shell Bridge
   ============================================================ */

.late-adjust-shell-panel {
  padding: 1rem;
}

.late-adjust-shell-panel .quick-add-header {
  margin-bottom: 0.35rem;
}

.late-adjust-frame {
  margin-top: 1rem;
  min-height: 1460px;
}


/* ============================================================
   Phase 3L10S20F Navigation Active Redirect Stabilizer
   CSS fallback active states for app-shell tool pages.
   ============================================================ */

body.page-add_bill_service .cf-sidebar a.cf-sidebar-link[href="/?page=add_bill_service"],
body.page-late_adjust .cf-sidebar a.cf-sidebar-link[href="/?page=late_adjust"] {
  background: linear-gradient(180deg, var(--nav-pill-active-1), var(--nav-pill-active-2)) !important;
  border-color: rgba(147, 197, 253, 0.82) !important;
  color: #ffffff !important;
  box-shadow:
    0 0 0 2px rgba(59, 130, 246, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 4px 14px rgba(37, 99, 235, 0.22) !important;
}


/* ============================================================
   Phase 3L10S20H Sidebar Logout Move
   ============================================================ */

.cf-sidebar {
  display: flex;
  flex-direction: column;
}

.cf-sidebar-account-section {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.cf-sidebar-logout-form {
  margin: 0;
}

.cf-sidebar-logout-button {
  width: 100%;
  display: block;
  appearance: none;
  border: 1px solid rgba(248, 113, 113, 0.42);
  border-radius: 0.85rem;
  background: linear-gradient(180deg, rgba(127, 29, 29, 0.72), rgba(69, 10, 10, 0.72));
  color: #fee2e2;
  font-weight: 800;
  letter-spacing: 0.01em;
  padding: 0.72rem 0.85rem;
  cursor: pointer;
  text-align: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 8px 18px rgba(127, 29, 29, 0.18);
}

.cf-sidebar-logout-button:hover,
.cf-sidebar-logout-button:focus-visible {
  border-color: rgba(252, 165, 165, 0.78);
  background: linear-gradient(180deg, rgba(153, 27, 27, 0.82), rgba(127, 29, 29, 0.82));
  color: #ffffff;
  outline: none;
}


/* ============================================================
   Phase 3L10S20I Sidebar Density Balance
   Tighten the PHP-rendered sidebar so Account/Logout stays visible.
   ============================================================ */

.cf-sidebar {
  padding-top: 0.72rem !important;
  padding-bottom: 0.72rem !important;
}

.cf-sidebar-top {
  padding-bottom: 0.58rem !important;
  margin-bottom: 0.5rem !important;
}

.cf-sidebar-section {
  margin-top: 0.52rem !important;
}

.cf-sidebar-section h2 {
  margin: 0 0 0.32rem !important;
  font-size: 0.66rem !important;
  line-height: 1.05 !important;
  letter-spacing: 0.145em !important;
}

body .cf-sidebar a.cf-sidebar-link,
body .cf-sidebar a.cf-sidebar-link:link,
body .cf-sidebar a.cf-sidebar-link:visited {
  min-height: unset !important;
  padding: 0.48rem 0.62rem !important;
  border-radius: 0.72rem !important;
  font-size: 0.88rem !important;
  line-height: 1.12 !important;
}

.cf-sidebar-account-section {
  margin-top: 0.62rem !important;
  padding-top: 0.62rem !important;
}

.cf-sidebar-logout-button {
  padding: 0.52rem 0.7rem !important;
  border-radius: 0.76rem !important;
  font-size: 0.9rem !important;
  line-height: 1.05 !important;
  min-height: unset !important;
}

/* On taller screens, let Account settle near the bottom.
   On shorter screens, keep it in normal flow so no scrolling is needed. */
@media (min-height: 900px) {
  .cf-sidebar-account-section {
    margin-top: auto !important;
  }
}

@media (max-height: 780px) {
  .cf-sidebar {
    padding-top: 0.58rem !important;
    padding-bottom: 0.58rem !important;
  }

  .cf-sidebar-top {
    margin-bottom: 0.38rem !important;
  }

  .cf-sidebar-section {
    margin-top: 0.42rem !important;
  }

  body .cf-sidebar a.cf-sidebar-link,
  body .cf-sidebar a.cf-sidebar-link:link,
  body .cf-sidebar a.cf-sidebar-link:visited {
    padding-top: 0.42rem !important;
    padding-bottom: 0.42rem !important;
    font-size: 0.84rem !important;
  }

  .cf-sidebar-logout-button {
    padding-top: 0.45rem !important;
    padding-bottom: 0.45rem !important;
    font-size: 0.86rem !important;
  }
}


/* ============================================================
   Phase 3L10S21A Profile Admin Page
   ============================================================ */

.profile-admin-page {
  display: grid;
  gap: 1rem;
}

.profile-admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.profile-admin-card {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 1rem;
  background: rgba(15, 23, 42, 0.38);
  padding: 0.9rem;
}

.profile-admin-card span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 0.35rem;
}

.profile-admin-card strong {
  display: block;
  font-size: 1.05rem;
  color: var(--text);
}

.profile-admin-card small {
  display: block;
  margin-top: 0.28rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.profile-admin-subpanel {
  margin: 0;
}

.profile-admin-subpanel h3 {
  margin-top: 0;
}

.profile-admin-list {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  color: var(--muted);
}

.profile-admin-list li + li {
  margin-top: 0.25rem;
}

@media (max-width: 900px) {
  .profile-admin-grid {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   Phase 3L10S21B Password Change Helper
   ============================================================ */

.profile-password-form {
  display: grid;
  gap: 0.8rem;
  max-width: 44rem;
}

.profile-password-form label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-weight: 700;
}

.profile-password-form input[type="password"] {
  width: 100%;
}

.profile-password-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.profile-admin-message {
  margin: 0;
}


/* ============================================================
   Phase 3L10S21C Flash Anchor Polish
   Make post-save dashboard redirects land on the visible success
   message instead of below it.
   ============================================================ */

#dashboard-flash {
  scroll-margin-top: 1.25rem;
}

body.cf-sidebar-ready #dashboard-flash {
  scroll-margin-top: 1.5rem;
}


/* ============================================================
   Phase 3L10S21D2 Dedicated Event Detail Table
   Keep Event Detail amount visible and money-like.
   ============================================================ */

.event-detail-kv-table td.event-detail-amount-value {
  color: var(--good, #3fb950) !important;
  font-weight: 800 !important;
}

/* ============================================================
   Phase 3L10S21D3 Event Detail Amount Attribute Fallback
   Render Event Detail amount from data-money so old JS/text polish
   cannot blank the visible amount cell.
   ============================================================ */

.event-detail-kv-table td.event-detail-amount-value {
  color: #3fb950 !important;
  font-weight: 900 !important;
  text-align: left !important;
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums !important;
}

.event-detail-kv-table td.event-detail-amount-value .event-detail-money-text {
  display: none !important;
}

.event-detail-kv-table td.event-detail-amount-value::before {
  content: attr(data-money) !important;
  display: inline !important;
  color: #3fb950 !important;
  font-weight: 900 !important;
  visibility: visible !important;
  opacity: 1 !important;
  font-size: 1rem !important;
  line-height: 1.35 !important;
  white-space: nowrap !important;
}

.event-detail-kv-table td.event-detail-amount-value[data-money=""]::before {
  content: "—" !important;
  color: var(--muted, #94a3b8) !important;
}


/* ============================================================
   Phase 3L10S22A Accounts Reference Page
   Private reference page for bank accounts, cards, debts, last-four
   digits, and purpose notes. No budget math changes.
   ============================================================ */

.accounts-reference-page {
  display: block;
}

.accounts-reference-warning {
  margin-bottom: 1rem;
}

.accounts-reference-form {
  display: grid;
  gap: 1rem;
}

.accounts-reference-section h3 {
  margin-top: 0;
  margin-bottom: 0.35rem;
}

.accounts-reference-table-wrap {
  overflow-x: auto !important;
}

.accounts-reference-table {
  width: 100% !important;
  min-width: 1180px !important;
  table-layout: fixed !important;
  font-variant-numeric: tabular-nums;
}

.accounts-reference-table th,
.accounts-reference-table td {
  vertical-align: middle !important;
}

.accounts-reference-table th:nth-child(1),
.accounts-reference-table td:nth-child(1) {
  width: 18rem !important;
}

.accounts-reference-table th:nth-child(2),
.accounts-reference-table td:nth-child(2) {
  width: 7rem !important;
}

.accounts-reference-table th:nth-child(3),
.accounts-reference-table td:nth-child(3) {
  width: 22rem !important;
}

.accounts-reference-table th:nth-child(4),
.accounts-reference-table td:nth-child(4) {
  width: 15rem !important;
}

.accounts-reference-table th:nth-child(5),
.accounts-reference-table td:nth-child(5) {
  width: auto !important;
  min-width: 20rem !important;
}

.accounts-reference-table th:nth-child(6),
.accounts-reference-table td:nth-child(6) {
  width: 7rem !important;
  text-align: center !important;
}

.accounts-reference-name-cell strong {
  display: block;
  font-weight: 850;
  line-height: 1.15;
}

.accounts-reference-name-cell small {
  display: block;
  margin-top: 0.18rem;
  color: var(--muted, #94a3b8);
  line-height: 1.15;
}

.accounts-reference-current-info {
  color: #cbd5e1;
  line-height: 1.35;
  white-space: normal !important;
}

.accounts-reference-table input[type="text"],
.accounts-reference-table textarea {
  width: 100% !important;
  min-width: 0 !important;
  color: var(--text, #e5eefb) !important;
  background: #050a0f !important;
  border: 1px solid rgba(148, 163, 184, 0.28) !important;
  border-radius: 0.65rem !important;
  padding: 0.48rem 0.6rem !important;
  font: inherit !important;
}

.accounts-reference-table textarea {
  resize: vertical;
  min-height: 2.45rem;
}

.accounts-reference-last-four-cell input {
  text-align: center;
  font-weight: 850 !important;
  letter-spacing: 0.08em;
}

.accounts-reference-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  padding: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 1rem;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.90));
  backdrop-filter: blur(8px);
}

@media (max-width: 900px) {
  .accounts-reference-table {
    min-width: 1060px !important;
  }

  .accounts-reference-actions {
    position: static;
  }
}


/* ============================================================
   Phase 3L10S22B Accounts Reference Filter Cash Accounts
   Bank/Reserve section is now limited to true cash/reserve rows.
   ============================================================ */

.accounts-reference-section > h3 {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.accounts-reference-section > h3::before {
  content: "▸";
  color: var(--accent, #58a6ff);
  font-size: 0.9rem;
}


/* ============================================================
   Phase 3L10S22C Read-Only Accounts Reference
   Read-only cards by default; edit one reference item at a time.
   ============================================================ */

.accounts-reference-readonly-section {
  margin-top: 1rem;
}

.accounts-reference-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.accounts-reference-section-header h3 {
  margin: 0 0 0.25rem;
}

.accounts-reference-section-header p {
  margin: 0;
}

.accounts-reference-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  min-height: 2.2rem;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.42);
  background: rgba(37, 99, 235, 0.16);
  color: #bfdbfe;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.accounts-reference-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(24rem, 1fr));
  gap: 0.9rem;
}

.accounts-reference-card {
  display: flex;
  flex-direction: column;
  min-height: 22rem;
  border: 1px solid rgba(148, 163, 184, 0.20);
  border-radius: 1rem;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.006)),
    rgba(5, 10, 15, 0.34);
  overflow: hidden;
}

.accounts-reference-card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.9rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(15, 23, 42, 0.35);
}

.accounts-reference-card-top h4 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.15;
}

.accounts-reference-card-top p {
  margin: 0.25rem 0 0;
  color: var(--muted, #94a3b8);
  font-size: 0.9rem;
  line-height: 1.2;
}

.accounts-reference-card-body {
  display: grid;
  gap: 0.75rem;
  padding: 0.9rem;
  flex: 1;
}

.accounts-reference-fact,
.accounts-reference-current-box,
.accounts-reference-notes-box {
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 0.8rem;
  padding: 0.7rem;
  background: rgba(2, 6, 23, 0.28);
}

.accounts-reference-fact span,
.accounts-reference-notes-box > span,
.accounts-reference-current-box span {
  display: block;
  color: var(--muted, #94a3b8);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.055em;
  margin-bottom: 0.24rem;
}

.accounts-reference-fact strong,
.accounts-reference-current-box strong {
  display: block;
  color: var(--text, #e5eefb);
  font-size: 0.96rem;
  line-height: 1.25;
}

.accounts-reference-current-box {
  display: grid;
  gap: 0.35rem;
}

.accounts-reference-current-box div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.14);
  padding-bottom: 0.28rem;
}

.accounts-reference-current-box div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.accounts-reference-current-box strong {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.accounts-reference-notes-box div {
  color: #cbd5e1;
  line-height: 1.35;
  white-space: normal;
}

.accounts-reference-empty {
  color: var(--muted, #94a3b8);
  font-weight: 650;
}

.accounts-reference-last-four-display {
  color: #86efac;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.accounts-reference-card-actions {
  padding: 0.85rem 0.9rem;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(15, 23, 42, 0.28);
}

.accounts-reference-card-actions .button-link {
  width: 100%;
  text-align: center;
  justify-content: center;
}

.accounts-reference-edit-summary {
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: 1rem;
  padding: 0.9rem;
  margin-bottom: 1rem;
  background: rgba(37, 99, 235, 0.08);
}

.accounts-reference-edit-summary h3 {
  margin: 0;
}

.accounts-reference-edit-summary p {
  margin: 0.3rem 0 0;
  color: var(--muted, #94a3b8);
}

.accounts-reference-single-edit-form {
  margin-top: 1rem;
}

.accounts-reference-single-edit-form textarea {
  min-height: 9rem;
}

@media (max-width: 700px) {
  .accounts-reference-card-grid {
    grid-template-columns: 1fr;
  }

  .accounts-reference-card {
    min-height: 0;
  }

  .accounts-reference-current-box div {
    display: block;
  }

  .accounts-reference-current-box strong {
    text-align: left;
  }
}


/* ============================================================
   Phase 3L10S22D Accounts Reference Tighten and Seed
   Smaller edit action, less beefy cards, safer read-only glance.
   ============================================================ */

.accounts-reference-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(21rem, 1fr)) !important;
  gap: 0.75rem !important;
}

.accounts-reference-card {
  min-height: 0 !important;
}

.accounts-reference-card-top {
  align-items: flex-start !important;
  padding: 0.72rem 0.78rem !important;
}

.accounts-reference-card-title {
  min-width: 0;
}

.accounts-reference-card-title h4 {
  overflow-wrap: anywhere;
}

.accounts-reference-card-top-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.42rem;
  flex: 0 0 auto;
}

.accounts-reference-mini-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.7rem;
  padding: 0.22rem 0.58rem;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.48);
  background: rgba(37, 99, 235, 0.14);
  color: #bfdbfe !important;
  text-decoration: none !important;
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.accounts-reference-mini-edit:hover {
  border-color: rgba(147, 197, 253, 0.78);
  background: rgba(37, 99, 235, 0.30);
  color: #ffffff !important;
  text-decoration: none !important;
}

.accounts-reference-card-body {
  gap: 0.58rem !important;
  padding: 0.72rem !important;
}

.accounts-reference-fact,
.accounts-reference-current-box,
.accounts-reference-notes-box {
  padding: 0.58rem 0.62rem !important;
}

.accounts-reference-current-box div {
  gap: 0.65rem !important;
}

.accounts-reference-card-actions {
  display: none !important;
}

@media (min-width: 1450px) {
  .accounts-reference-card-grid {
    grid-template-columns: repeat(auto-fit, minmax(23rem, 1fr)) !important;
  }
}

@media (max-width: 700px) {
  .accounts-reference-card-top-actions {
    align-items: flex-start;
  }
}


/* ============================================================
   Phase 3L10S22E Account and Card Last Four
   Separate actual account number ending from debit/credit card ending.
   ============================================================ */

.accounts-reference-last-four-pair {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.accounts-reference-last-four-pair > div {
  min-width: 0;
}

.accounts-reference-last-four-pair span {
  display: block;
  color: var(--muted, #94a3b8);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.055em;
  margin-bottom: 0.24rem;
}

.accounts-reference-last-four-pair strong {
  display: block;
}

@media (max-width: 700px) {
  .accounts-reference-last-four-pair {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   Phase 3L10S22F External Accounts and Routing
   Routing-number section and external non-cash-flow accounts.
   ============================================================ */

.accounts-reference-routing-section {
  border-color: rgba(96, 165, 250, 0.28);
}

.accounts-reference-routing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 0.75rem;
}

.accounts-reference-routing-card {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 1rem;
  padding: 0.85rem;
  background:
    linear-gradient(180deg, rgba(59, 130, 246, 0.08), rgba(59, 130, 246, 0.02)),
    rgba(2, 6, 23, 0.28);
}

.accounts-reference-routing-card h4 {
  margin: 0 0 0.65rem;
}

.accounts-reference-routing-card p {
  margin: 0.65rem 0 0;
  color: #cbd5e1;
  line-height: 1.35;
}

.accounts-reference-routing-number {
  border: 1px solid rgba(96, 165, 250, 0.30);
  border-radius: 0.8rem;
  padding: 0.65rem;
  background: rgba(15, 23, 42, 0.45);
}

.accounts-reference-routing-number span {
  display: block;
  color: var(--muted, #94a3b8);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.055em;
  margin-bottom: 0.24rem;
}

.accounts-reference-routing-number strong {
  display: block;
  color: #bfdbfe;
  font-size: 1.15rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}


/* ============================================================
   Phase 3L10S22G No Card Field For Loans
   Loan/debt cards show account last-four only; no phantom card field.
   ============================================================ */

.accounts-reference-last-four-pair:has(> div:only-child) {
  grid-template-columns: 1fr !important;
}


/* ============================================================
   Phase 3L10S23A Action Pages Out Of Nav
   Parent-page action buttons for Events, Scheduled, Debts & Cards.
   ============================================================ */

.phase3-context-action-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0 0 0.85rem;
}

.phase3-context-action {
  min-height: 2.25rem;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .phase3-context-action-bar {
    justify-content: stretch;
  }

  .phase3-context-action-bar .phase3-context-action {
    flex: 1 1 100%;
    text-align: center;
    justify-content: center;
  }
}


/* ============================================================
   Phase 3L10S23B Events Button Late Adjust Nav Cleanup
   Direct Add Event action on Events page; Late Adjust parent-page only.
   ============================================================ */

.phase3-events-page-action-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0 0 0.85rem;
}

@media (max-width: 700px) {
  .phase3-events-page-action-bar {
    justify-content: stretch;
  }

  .phase3-events-page-action-bar .phase3-context-action {
    flex: 1 1 100%;
    text-align: center;
    justify-content: center;
  }
}


/* ============================================================
   Phase 3L10S23C Pretty Events Add Button
   Make Events page Add Event action render as a real app button.
   ============================================================ */

.phase3-events-page-action-bar {
  justify-content: flex-end !important;
  margin: -0.25rem 0 1rem !important;
}

.phase3-events-add-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: 0.48rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.62);
  background:
    linear-gradient(180deg, rgba(59, 130, 246, 0.96), rgba(37, 99, 235, 0.88));
  color: #ffffff !important;
  text-decoration: none !important;
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1;
  box-shadow:
    0 0.35rem 1rem rgba(37, 99, 235, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  white-space: nowrap;
}

.phase3-events-add-button:hover {
  border-color: rgba(147, 197, 253, 0.9);
  background:
    linear-gradient(180deg, rgba(96, 165, 250, 1), rgba(37, 99, 235, 0.94));
  color: #ffffff !important;
  text-decoration: none !important;
  transform: translateY(-1px);
}

.phase3-events-add-button:active {
  transform: translateY(0);
}

@media (max-width: 700px) {
  .phase3-events-page-action-bar {
    justify-content: stretch !important;
  }

  .phase3-events-add-button {
    width: 100%;
  }
}


/* ============================================================
   Phase 3L10S23D Income Hide Due Column
   Income table does not need a due-date column.
   Keep event date and cleared date visible.
   ============================================================ */

/* Fast path for the current table layout: ID, Date, Due, Cleared... */
body.page-income table th:nth-child(3),
body.page-income table td:nth-child(3) {
  display: none !important;
}

/* JS-assisted path if the Due column is discovered by header text. */
.phase3-income-due-col-hidden {
  display: none !important;
}


/* ============================================================
   Phase 3L10S23E Spending Hide Due Column
   Spending table does not need a due-date column.
   Keep event date and cleared date visible.
   ============================================================ */

/* Fast path for the current table layout: ID, Date, Due, Cleared... */
body.page-spending table th:nth-child(3),
body.page-spending table td:nth-child(3) {
  display: none !important;
}

/* JS-assisted path if the Due column is discovered by header text. */
.phase3-spending-due-col-hidden {
  display: none !important;
}


/* ============================================================
   Phase 3L10S23F Spending Hide Role Column
   Spending page is already role-filtered, so Role is visual noise.
   ============================================================ */

.phase3-spending-role-col-hidden {
  display: none !important;
}


/* ============================================================
   Phase 3L10S23G Spending Hide Date Status Columns
   Spending entries are entered after the fact, so Cleared date is enough.
   ============================================================ */

.phase3-spending-date-col-hidden,
.phase3-spending-status-col-hidden {
  display: none !important;
}


/* ============================================================
   Phase 3L10S23H Spending Hide Direction Account
   Spending page is a compact cleared-spending ledger.
   Full direction/account detail remains available on Events/Edit.
   ============================================================ */

.phase3-spending-direction-col-hidden,
.phase3-spending-account-col-hidden {
  display: none !important;
}


/* ============================================================
   Phase 3L10S23J Spending Page Redesign
   Summary cards + category bars + compact cleared-spending ledger.
   ============================================================ */

.spending-redesign-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.spending-redesign-header h2 {
  margin-bottom: 0.25rem;
}

.spending-redesign-header p {
  margin: 0;
}

.spending-redesign-add {
  white-space: nowrap;
}

.spending-snapshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.75rem;
}

.spending-snapshot-card {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 1rem;
  padding: 0.85rem;
  background:
    linear-gradient(180deg, rgba(59, 130, 246, 0.08), rgba(59, 130, 246, 0.02)),
    rgba(2, 6, 23, 0.28);
}

.spending-snapshot-card span,
.spending-category-row-top strong,
.spending-ledger-description span {
  color: var(--muted, #94a3b8);
}

.spending-snapshot-card span {
  display: block;
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.055em;
  margin-bottom: 0.3rem;
}

.spending-snapshot-card strong {
  display: block;
  font-size: 1.35rem;
  line-height: 1.1;
  color: var(--text, #e5eefb);
  font-variant-numeric: tabular-nums;
}

.spending-snapshot-card small {
  display: block;
  margin-top: 0.3rem;
  color: #cbd5e1;
  line-height: 1.25;
}

.spending-snapshot-wide {
  grid-column: span 2;
}

.spending-category-list {
  display: grid;
  gap: 0.7rem;
}

.spending-category-row {
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 0.85rem;
  padding: 0.72rem;
  background: rgba(2, 6, 23, 0.24);
}

.spending-category-row-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.spending-category-row-top span {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.spending-category-bar {
  height: 0.55rem;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.70);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.spending-category-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.88), rgba(34, 197, 94, 0.72));
}

.spending-redesign-table-wrap {
  overflow-x: auto;
}

body.page-spending table.spending-redesign-ledger {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

body.page-spending table.spending-redesign-ledger th,
body.page-spending table.spending-redesign-ledger td {
  display: table-cell !important;
}

body.page-spending table.spending-redesign-ledger th:nth-child(3),
body.page-spending table.spending-redesign-ledger td:nth-child(3) {
  display: table-cell !important;
}

.spending-redesign-ledger th {
  color: var(--muted, #94a3b8);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.055em;
}

.spending-redesign-ledger td,
.spending-redesign-ledger th {
  padding: 0.65rem 0.7rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  vertical-align: top;
}

.spending-ledger-date {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.spending-ledger-description strong {
  display: block;
  color: var(--text, #e5eefb);
}

.spending-ledger-description span {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.82rem;
}

.spending-ledger-amount {
  white-space: nowrap;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.spending-ledger-actions {
  white-space: nowrap;
}

.spending-ledger-actions .mini-link {
  margin-right: 0.35rem;
}

@media (max-width: 760px) {
  .spending-redesign-header {
    display: block;
  }

  .spending-redesign-add,
  .spending-ledger-header .button-link {
    display: flex;
    justify-content: center;
    margin-top: 0.75rem;
    width: 100%;
  }

  .spending-snapshot-wide {
    grid-column: auto;
  }

  .spending-redesign-ledger th:nth-child(4),
  .spending-redesign-ledger td:nth-child(4) {
    display: none !important;
  }
}


/* ============================================================
   Phase 3L10S23K Spending Ledger Category Icons
   Cleaner Spending ledger: Category column, plain description, icon actions.
   ============================================================ */

body.page-spending table.spending-redesign-ledger th,
body.page-spending table.spending-redesign-ledger td,
body.page-spending table.spending-redesign-ledger th:nth-child(2),
body.page-spending table.spending-redesign-ledger td:nth-child(2),
body.page-spending table.spending-redesign-ledger th:nth-child(3),
body.page-spending table.spending-redesign-ledger td:nth-child(3),
body.page-spending table.spending-redesign-ledger th:nth-child(4),
body.page-spending table.spending-redesign-ledger td:nth-child(4),
body.page-spending table.spending-redesign-ledger th:nth-child(5),
body.page-spending table.spending-redesign-ledger td:nth-child(5) {
  display: table-cell !important;
}

.spending-redesign-ledger th.spending-ledger-action-heading {
  text-align: center;
}

.spending-ledger-category {
  white-space: nowrap;
  color: #cbd5e1;
  font-weight: 850;
}

.spending-ledger-description {
  min-width: 18rem;
  max-width: 42rem;
}

.spending-ledger-description strong {
  overflow-wrap: anywhere;
  word-break: normal;
}

.spending-ledger-note {
  display: inline-flex !important;
  width: fit-content;
  margin-top: 0.28rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.55);
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.045em;
}

.spending-ledger-actions {
  text-align: center;
}

.spending-icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.05rem;
  height: 2.05rem;
  margin: 0 0.12rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(15, 23, 42, 0.62);
  color: #e5eefb !important;
  text-decoration: none !important;
  font-size: 1rem;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.spending-icon-action:hover {
  border-color: rgba(96, 165, 250, 0.72);
  background: rgba(30, 64, 175, 0.55);
  color: #ffffff !important;
  transform: translateY(-1px);
}

.spending-icon-action:active {
  transform: translateY(0);
}

@media (max-width: 760px) {
  .spending-redesign-ledger th:nth-child(5),
  .spending-redesign-ledger td:nth-child(5) {
    display: table-cell !important;
  }

  .spending-ledger-category {
    white-space: normal;
  }

  .spending-ledger-description {
    min-width: 12rem;
  }
}


/* ============================================================
   Phase 3L10S23L Money Flow Colors
   Semantic cash-flow coloring:
   - Inflows / positive deltas: green
   - Outflows / negative deltas: red
   - Neutral balances/facts: normal unless context says otherwise
   ============================================================ */

.cf-money-in,
.money-flow-in,
.money-flow-positive {
  color: #34d399 !important;
  font-weight: 950;
}

.cf-money-out,
.money-flow-out,
.money-flow-negative {
  color: #fb7185 !important;
  font-weight: 950;
}

td.cf-money-in,
td.cf-money-out,
td.money-flow-positive,
td.money-flow-negative {
  font-variant-numeric: tabular-nums;
}

.cf-money-in small,
.cf-money-out small {
  color: inherit !important;
}


/* ============================================================
   Phase 3L10S23M Global Money Flow Color Expansion
   Stronger semantic cash-flow colors across the app.
   ============================================================ */

:root {
  --cf-flow-out: #ef2626;
}
td.cf-money-in,
td.cf-money-out,
td.money-flow-positive,
td.money-flow-negative,
td.cashflow-positive,
td.cashflow-negative,
td.cashflow-inflow,
td.cashflow-outflow,
.cf-money-in strong,
.cf-money-out strong,
.cf-money-in small,
.cf-money-out small {
  color: inherit !important;
  font-variant-numeric: tabular-nums;
}

.cf-money-out,
.cashflow-negative,
.cashflow-outflow {
  text-shadow: 0 0 0.01px currentColor;
}

.cf-money-in,
.cashflow-positive,
.cashflow-inflow {
  text-shadow: 0 0 0.01px currentColor;
}


/* ============================================================
   Phase 3L10S23N Safe Money Flow Colors
   Stronger red + targeted flow classes.
   ============================================================ */

.cf-money-in,
.money-flow-in,
.money-flow-positive,
.cashflow-positive,
.cashflow-inflow {
  font-weight: 950 !important;
}
.cf-money-out,
.money-flow-out,
.money-flow-negative,
.cashflow-negative,
.cashflow-outflow {
  font-weight: 950 !important;
}
.cf-money-neutral,
.money-flow-neutral {
  color: var(--cf-flow-neutral) !important;
}


/* ============================================================
   Phase 3L10S23O Refined Money Flow Context Weight
   Preserve red/green signal without making money cells too chunky.
   ============================================================ */

:root {
  --cf-flow-weight: 725;
}
.spending-snapshot-card strong.cf-money-out,
.spending-snapshot-card small.cf-money-out,
.spending-ledger-amount.cf-money-out,
.spending-category-row-top span.cf-money-out {
  font-weight: var(--cf-flow-weight) !important;
}


/* ============================================================
   Phase 3L10S23P Money Flow Single Safe Engine
   Final readable red/green flow styling.
   ============================================================ */

:root {
  --cf-flow-out: #ff3333;
  --cf-flow-weight: 650;
}
.cf-money-in,
.money-flow-in,
.money-flow-positive,
.cashflow-positive,
.cashflow-inflow {
  color: var(--cf-flow-in) !important;
  font-weight: var(--cf-flow-weight) !important;
}

.cf-money-out,
.money-flow-out,
.money-flow-negative,
.cashflow-negative,
.cashflow-outflow {
  color: var(--cf-flow-out) !important;
  font-weight: var(--cf-flow-weight) !important;
}

.cf-money-neutral,
.money-flow-neutral {
  color: #cbd5e1 !important;
  font-weight: inherit !important;
}

td.cf-money-in,
td.cf-money-out,
td.money-flow-positive,
td.money-flow-negative,
td.cashflow-positive,
td.cashflow-negative,
td.cashflow-inflow,
td.cashflow-outflow {
  font-variant-numeric: tabular-nums;
}

td[data-money-flow],
span[data-money-flow],
strong[data-money-flow],
small[data-money-flow] {
  text-shadow: none !important;
}


/* ============================================================
   Phase 3L10S23R Final Money Flow Engine
   Last-word money-flow colors.
   ============================================================ */

:root {
  --cf-flow-in: #22c55e;
  --cf-flow-out: #ff4040;
  --cf-flow-weight: 600;
  --cf-flow-neutral: #cbd5e1;
}

body table td.cf-money-in,
body td.cf-money-in,
body span.cf-money-in,
body strong.cf-money-in,
body small.cf-money-in,
body .spending-snapshot-card strong.cf-money-in,
body .spending-snapshot-card small.cf-money-in,
body .spending-category-row-top span.cf-money-in,
body .spending-ledger-amount.cf-money-in,
body .reserve-events-panel table td.cf-money-in,
body .reserve-events-panel table td:nth-child(7).cf-money-in {
  color: var(--cf-flow-in) !important;
  font-weight: var(--cf-flow-weight) !important;
  text-shadow: none !important;
  font-variant-numeric: tabular-nums;
}

body table td.cf-money-out,
body td.cf-money-out,
body span.cf-money-out,
body strong.cf-money-out,
body small.cf-money-out,
body .spending-snapshot-card strong.cf-money-out,
body .spending-snapshot-card small.cf-money-out,
body .spending-category-row-top span.cf-money-out,
body .spending-ledger-amount.cf-money-out,
body .reserve-events-panel table td.cf-money-out,
body .reserve-events-panel table td:nth-child(7).cf-money-out {
  color: var(--cf-flow-out) !important;
  font-weight: var(--cf-flow-weight) !important;
  text-shadow: none !important;
  font-variant-numeric: tabular-nums;
}

body table td.cf-money-neutral,
body table td.cf-money-rate-neutral,
body td.cf-money-neutral,
body td.cf-money-rate-neutral,
body span.cf-money-neutral,
body span.cf-money-rate-neutral,
body strong.cf-money-neutral,
body strong.cf-money-rate-neutral,
body small.cf-money-neutral,
body small.cf-money-rate-neutral {
  color: var(--cf-flow-neutral) !important;
  font-weight: 500 !important;
  text-shadow: none !important;
}

/* Neutralize APR/rate/percent cells even if old positive/negative classes remain. */
body table td.cf-money-rate-neutral.positive,
body table td.cf-money-rate-neutral.negative,
body table td.cf-money-rate-neutral[data-money-flow],
body table td.cf-money-rate-neutral * {
  color: var(--cf-flow-neutral) !important;
  font-weight: 500 !important;
  text-shadow: none !important;
}

body td.cf-money-in span:not(.badge):not(.status-pill),
body td.cf-money-in strong,
body td.cf-money-in small,
body td.cf-money-out span:not(.badge):not(.status-pill),
body td.cf-money-out strong,
body td.cf-money-out small {
  color: inherit !important;
  font-weight: inherit !important;
}


/* ============================================================
   Phase 3L10S24A Table Tools Compact Actions
   Scoped search/sort UI and compact action icons.
   ============================================================ */

.s24-table-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.75rem 0 0.85rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 0.9rem;
  background: rgba(5, 10, 15, 0.28);
}

.s24-search-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted, #94a3b8);
  font-weight: 750;
}

.s24-table-search {
  min-width: min(32rem, 70vw);
  color: var(--text, #e5eefb) !important;
  background: #050a0f !important;
  border: 1px solid rgba(96, 165, 250, 0.35) !important;
  border-radius: 999px !important;
  padding: 0.52rem 0.85rem !important;
  font: inherit;
}

.s24-table-search:focus {
  border-color: rgba(96, 165, 250, 0.88) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18) !important;
  outline: none;
}

.s24-search-count {
  color: var(--muted, #94a3b8);
  font-size: 0.9rem;
  white-space: nowrap;
}

tr.s24-row-hidden {
  display: none !important;
}

.s24-sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 1.25rem !important;
}

.s24-sortable::after {
  content: "↕";
  position: absolute;
  right: 0.4rem;
  opacity: 0.42;
  font-size: 0.8rem;
}

.s24-sortable.s24-sort-asc::after {
  content: "↑";
  opacity: 0.95;
  color: var(--accent, #58a6ff);
}

.s24-sortable.s24-sort-desc::after {
  content: "↓";
  opacity: 0.95;
  color: var(--accent, #58a6ff);
}

.s24-icon-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.32rem;
  white-space: nowrap;
}

.s24-icon-action,
.spending-icon-action {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 2rem !important;
  min-width: 2rem !important;
  height: 2rem !important;
  min-height: 2rem !important;
  padding: 0 !important;
  border-radius: 999px !important;
  border: 1px solid rgba(96, 165, 250, 0.42) !important;
  background: rgba(15, 23, 42, 0.78) !important;
  color: #bfdbfe !important;
  text-decoration: none !important;
  font-size: 0.92rem !important;
  font-weight: 800 !important;
  line-height: 1 !important;
}

.s24-icon-action:hover,
.spending-icon-action:hover {
  border-color: rgba(96, 165, 250, 0.82) !important;
  background: rgba(37, 99, 235, 0.30) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

.s24-scheduled-action-cell {
  text-align: right !important;
  white-space: nowrap !important;
}

.s24-scheduled-action-cell {
  width: 5.8rem !important;
  min-width: 5.8rem !important;
}

.s24-future-amount-action {
  width: 2.25rem !important;
  min-width: 2.25rem !important;
  font-size: 0.78rem !important;
}

@media (max-width: 760px) {
  .s24-table-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .s24-search-label {
    align-items: stretch;
    flex-direction: column;
  }

  .s24-table-search {
    width: 100%;
    min-width: 0;
  }
}


/* ============================================================
   Phase 3L10S24A2 IDless Event Actions
   Compact View/Edit actions and hide redundant ID columns.
   ============================================================ */

table.s24a2-idless-actions-table th:first-child,
table.s24a2-idless-actions-table td:first-child,
table.s24a2-hide-id-only th:first-child,
table.s24a2-hide-id-only td:first-child {
  display: none !important;
}

table.s24a2-idless-actions-table th.s24a2-action-heading,
table.s24a2-idless-actions-table td.s24a2-actions {
  width: 5.8rem !important;
  min-width: 5.8rem !important;
  max-width: 5.8rem !important;
  text-align: right !important;
  white-space: nowrap !important;
}

.s24a2-actions {
  text-align: right !important;
  white-space: nowrap !important;
}

.s24a2-actions .s24-icon-action,
.s24a2-icon-action {
  margin-left: 0.25rem;
}

/* After hiding ID, let event-like tables breathe a little better. */
table.s24a2-events-actions-table,
table.s24a2-reserve-actions-table {
  min-width: 980px !important;
}

table.s24a2-reserve-actions-table th.s24a2-action-heading,
table.s24a2-reserve-actions-table td.s24a2-actions {
  width: 5.6rem !important;
  min-width: 5.6rem !important;
}

/* Scheduled looks cleaner when the hidden ID leaves Actions as the last compact control. */
table.s24a2-hide-id-only th:first-child + th,
table.s24a2-hide-id-only td:first-child + td {
  padding-left: 0.75rem !important;
}


/* ============================================================
   Phase 3L10S24A3 Event Table Polish Sort Fix
   Last-word cleanup after S24A2 actions.
   ============================================================ */

/* Hard-hide redundant ID columns. */
body.page-events table.s24a2-idless-actions-table > thead > tr > th:first-child,
body.page-events table.s24a2-idless-actions-table > tbody > tr > td:first-child,
body.page-reserves table.s24a2-idless-actions-table > thead > tr > th:first-child,
body.page-reserves table.s24a2-idless-actions-table > tbody > tr > td:first-child,
body.page-scheduled table.s24a2-hide-id-only > thead > tr > th:first-child,
body.page-scheduled table.s24a2-hide-id-only > tbody > tr > td:first-child {
  display: none !important;
  visibility: collapse !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

/* Shared event tables should fit the remaining visible columns better. */
body.page-events table.shared-event-status-table.s24a2-idless-actions-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}

/* Original shared event columns after ID is hidden:
   2 Date | 3 Due | 4 Cleared | 5 Status | 6 Account | 7 Direction
   8 Amount | 9 Role | 10 Description | 11 Actions
*/
body.page-events table.shared-event-status-table.s24a2-idless-actions-table th:nth-child(2),
body.page-events table.shared-event-status-table.s24a2-idless-actions-table td:nth-child(2) {
  width: 7.2rem !important;
  white-space: nowrap !important;
}

body.page-events table.shared-event-status-table.s24a2-idless-actions-table th:nth-child(3),
body.page-events table.shared-event-status-table.s24a2-idless-actions-table td:nth-child(3),
body.page-events table.shared-event-status-table.s24a2-idless-actions-table th:nth-child(4),
body.page-events table.shared-event-status-table.s24a2-idless-actions-table td:nth-child(4) {
  width: 6.8rem !important;
  white-space: nowrap !important;
}

body.page-events table.shared-event-status-table.s24a2-idless-actions-table th:nth-child(5),
body.page-events table.shared-event-status-table.s24a2-idless-actions-table td:nth-child(5) {
  width: 9.4rem !important;
  white-space: nowrap !important;
}

body.page-events table.shared-event-status-table.s24a2-idless-actions-table th:nth-child(6),
body.page-events table.shared-event-status-table.s24a2-idless-actions-table td:nth-child(6) {
  width: 13rem !important;
  min-width: 0 !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

body.page-events table.shared-event-status-table.s24a2-idless-actions-table th:nth-child(7),
body.page-events table.shared-event-status-table.s24a2-idless-actions-table td:nth-child(7) {
  width: 6.4rem !important;
  text-align: center !important;
  white-space: nowrap !important;
}

body.page-events table.shared-event-status-table.s24a2-idless-actions-table th:nth-child(8),
body.page-events table.shared-event-status-table.s24a2-idless-actions-table td:nth-child(8) {
  width: 7.6rem !important;
  text-align: right !important;
  white-space: nowrap !important;
}

body.page-events table.shared-event-status-table.s24a2-idless-actions-table th:nth-child(9),
body.page-events table.shared-event-status-table.s24a2-idless-actions-table td:nth-child(9) {
  width: 9rem !important;
  min-width: 0 !important;
  white-space: normal !important;
}

body.page-events table.shared-event-status-table.s24a2-idless-actions-table th:nth-child(10),
body.page-events table.shared-event-status-table.s24a2-idless-actions-table td:nth-child(10) {
  width: auto !important;
  min-width: 10rem !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

body.page-events table.shared-event-status-table.s24a2-idless-actions-table th:nth-child(11),
body.page-events table.shared-event-status-table.s24a2-idless-actions-table td:nth-child(11) {
  width: 5.8rem !important;
  min-width: 5.8rem !important;
  text-align: center !important;
  white-space: nowrap !important;
}

/* Reserve Events fit after ID hidden:
   2 Date | 3 Due | 4 Status | 5 Reserve | 6 Direction | 7 Amount | 8 Description | 9 Actions
*/
body.page-reserves table.reserve-events-table.s24a2-idless-actions-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}

body.page-reserves table.reserve-events-table.s24a2-idless-actions-table th:nth-child(2),
body.page-reserves table.reserve-events-table.s24a2-idless-actions-table td:nth-child(2),
body.page-reserves table.reserve-events-table.s24a2-idless-actions-table th:nth-child(3),
body.page-reserves table.reserve-events-table.s24a2-idless-actions-table td:nth-child(3) {
  width: 7.4rem !important;
  white-space: nowrap !important;
}

body.page-reserves table.reserve-events-table.s24a2-idless-actions-table th:nth-child(4),
body.page-reserves table.reserve-events-table.s24a2-idless-actions-table td:nth-child(4) {
  width: 8.8rem !important;
  white-space: nowrap !important;
}

body.page-reserves table.reserve-events-table.s24a2-idless-actions-table th:nth-child(5),
body.page-reserves table.reserve-events-table.s24a2-idless-actions-table td:nth-child(5) {
  width: 12rem !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

body.page-reserves table.reserve-events-table.s24a2-idless-actions-table th:nth-child(6),
body.page-reserves table.reserve-events-table.s24a2-idless-actions-table td:nth-child(6) {
  width: 7rem !important;
  text-align: center !important;
  white-space: nowrap !important;
}

body.page-reserves table.reserve-events-table.s24a2-idless-actions-table th:nth-child(7),
body.page-reserves table.reserve-events-table.s24a2-idless-actions-table td:nth-child(7) {
  width: 7.6rem !important;
  text-align: right !important;
  white-space: nowrap !important;
}

body.page-reserves table.reserve-events-table.s24a2-idless-actions-table th:nth-child(8),
body.page-reserves table.reserve-events-table.s24a2-idless-actions-table td:nth-child(8) {
  width: auto !important;
  min-width: 12rem !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

body.page-reserves table.reserve-events-table.s24a2-idless-actions-table th:nth-child(9),
body.page-reserves table.reserve-events-table.s24a2-idless-actions-table td:nth-child(9) {
  width: 5.8rem !important;
  min-width: 5.8rem !important;
  text-align: center !important;
  white-space: nowrap !important;
}

/* Stop notes underline from hitting action icons. */
table.s24a2-idless-actions-table tr.has-event-note:hover td.s24a2-actions,
table.s24a2-idless-actions-table tr.has-event-note:hover td.s24a2-actions a,
table.s24a2-idless-actions-table td.s24a2-actions,
table.s24a2-idless-actions-table td.s24a2-actions a {
  text-decoration: none !important;
}

/* Restore note underline to description column, not action column. */
body.page-events table.shared-event-status-table.s24a2-idless-actions-table tr.has-event-note:hover td:nth-child(10),
body.page-reserves table.reserve-events-table.s24a2-idless-actions-table tr.has-event-note:hover td:nth-child(8) {
  text-decoration: underline !important;
  text-decoration-style: dotted !important;
  text-decoration-thickness: 1px !important;
  text-underline-offset: 0.18em !important;
}

/* Scheduled action heading/cells centered. */
body.page-scheduled table.s24a2-hide-id-only th:last-child,
body.page-scheduled table.s24a2-hide-id-only td.s24-scheduled-action-cell,
body.page-scheduled table.s24a2-hide-id-only td:last-child {
  text-align: center !important;
}

body.page-scheduled table.s24a2-hide-id-only td.s24-scheduled-action-cell .s24-icon-actions,
body.page-scheduled table.s24a2-hide-id-only td:last-child .s24-icon-actions {
  justify-content: center !important;
}

/* Late sorter indicators. */
.s24a3-sortable {
  cursor: pointer !important;
  user-select: none !important;
  position: relative !important;
  padding-right: 1.25rem !important;
}

.s24a3-sortable::after {
  content: "↕";
  position: absolute;
  right: 0.4rem;
  opacity: 0.42;
  font-size: 0.8rem;
}

.s24a3-sortable.s24a3-sort-asc::after {
  content: "↑";
  opacity: 0.95;
  color: var(--accent, #58a6ff);
}

.s24a3-sortable.s24a3-sort-desc::after {
  content: "↓";
  opacity: 0.95;
  color: var(--accent, #58a6ff);
}


/* ============================================================
   Reserve Events Column Alignment
   ============================================================ */

/* Center the Reserve column after Status so the table feels less squeezed. */
body.page-reserves table.reserve-events-table.s24a2-idless-actions-table th:nth-child(5),
body.page-reserves table.reserve-events-table.s24a2-idless-actions-table td:nth-child(5) {
  text-align: center !important;
  vertical-align: middle !important;
}

body.page-reserves table.reserve-events-table.s24a2-idless-actions-table td:nth-child(5) {
  overflow-wrap: normal !important;
  word-break: normal !important;
}


/* ============================================================
   Phase 3L10S24A6 Neutral Table Headers
   Money-flow colors belong on row values, not column headers.
   ============================================================ */

body table th,
body table th.cf-money-in,
body table th.cf-money-out,
body table th.cf-money-neutral,
body table th.cf-money-rate-neutral,
body table th.s24-sortable,
body table th.s24a3-sortable,
body.page-reserves table.reserve-events-table th,
body.page-reserves table.reserve-events-table th:nth-child(7),
body.page-reserves table.reserve-events-table.s24a2-idless-actions-table th:nth-child(7) {
  color: var(--table-head-text, #b8c4d6) !important;
  font-weight: 800 !important;
  text-shadow: none !important;
}

/* Keep active sorter arrows blue while the header label itself stays neutral. */
body table th.s24-sort-asc::after,
body table th.s24-sort-desc::after,
body table th.s24a3-sort-asc::after,
body table th.s24a3-sort-desc::after {
  color: var(--accent, #58a6ff) !important;
}


/* ============================================================
   Phase 3L10S24A10 Income Native Ledger
   Clean PHP-rendered Income table: no hidden ID/Due columns,
   no JS-added action cells, no border raccoons.
   ============================================================ */

body.page-income table.income-native-ledger thead th {
  border-bottom: 1px solid rgba(148, 163, 184, 0.22) !important;
}

body.page-income table.income-native-ledger th:nth-child(1),
body.page-income table.income-native-ledger td:nth-child(1),
body.page-income table.income-native-ledger th:nth-child(2),
body.page-income table.income-native-ledger td:nth-child(2) {
  width: 7.1rem !important;
  white-space: nowrap !important;
}

body.page-income table.income-native-ledger th:nth-child(4),
body.page-income table.income-native-ledger td:nth-child(4) {
  width: 13rem !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

body.page-income table.income-native-ledger th:nth-child(5),
body.page-income table.income-native-ledger td:nth-child(5) {
  width: 7rem !important;
  text-align: center !important;
  white-space: nowrap !important;
}

body.page-income table.income-native-ledger th:nth-child(6),
body.page-income table.income-native-ledger td:nth-child(6) {
  width: 7.6rem !important;
  text-align: right !important;
  white-space: nowrap !important;
}

body.page-income table.income-native-ledger th:nth-child(7),
body.page-income table.income-native-ledger td:nth-child(7) {
  width: 8.4rem !important;
  white-space: normal !important;
}

body.page-income table.income-native-ledger th:nth-child(8),
body.page-income table.income-native-ledger td:nth-child(8) {
  width: auto !important;
  min-width: 12rem !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

body.page-income table.income-native-ledger th:nth-child(9),
body.page-income table.income-native-ledger td:nth-child(9) {
  width: 5.8rem !important;
  min-width: 5.8rem !important;
  text-align: center !important;
  white-space: nowrap !important;
}

body.page-income table.income-native-ledger td.income-native-actions .s24-icon-action {
  width: 1.9rem !important;
  min-width: 1.9rem !important;
  height: 1.9rem !important;
  min-height: 1.9rem !important;
  margin: 0 0.12rem !important;
}

body.page-income table.income-native-ledger th.s24a10-sortable {
  cursor: pointer !important;
  user-select: none !important;
  position: relative !important;
  padding-right: 1.25rem !important;
}

body.page-income table.income-native-ledger th.s24a10-sortable::after {
  content: "↕";
  position: absolute;
  right: 0.4rem;
  opacity: 0.42;
  font-size: 0.8rem;
}

body.page-income table.income-native-ledger th.s24a10-sortable.s24a10-sort-asc::after {
  content: "↑";
  opacity: 0.95;
  color: var(--accent, #58a6ff);
}

body.page-income table.income-native-ledger th.s24a10-sortable.s24a10-sort-desc::after {
  content: "↓";
  opacity: 0.95;
  color: var(--accent, #58a6ff);
}


/* ============================================================
   Phase 3L10S24A11 Income Native Isolation
   Native Income ledger owns its own columns. Legacy ID/Due-hiding
   rules must not hide Date or Status here.
   ============================================================ */

body.page-income table.income-native-ledger th,
body.page-income table.income-native-ledger td,
body.page-income table.income-native-ledger th:first-child,
body.page-income table.income-native-ledger td:first-child,
body.page-income table.income-native-ledger th:nth-child(2),
body.page-income table.income-native-ledger td:nth-child(2),
body.page-income table.income-native-ledger th:nth-child(3),
body.page-income table.income-native-ledger td:nth-child(3),
body.page-income table.income-native-ledger th:nth-child(4),
body.page-income table.income-native-ledger td:nth-child(4),
body.page-income table.income-native-ledger th:nth-child(5),
body.page-income table.income-native-ledger td:nth-child(5),
body.page-income table.income-native-ledger th:nth-child(6),
body.page-income table.income-native-ledger td:nth-child(6),
body.page-income table.income-native-ledger th:nth-child(7),
body.page-income table.income-native-ledger td:nth-child(7),
body.page-income table.income-native-ledger th:nth-child(8),
body.page-income table.income-native-ledger td:nth-child(8),
body.page-income table.income-native-ledger th:nth-child(9),
body.page-income table.income-native-ledger td:nth-child(9) {
  display: table-cell !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Native Income table should not inherit old hidden-ID/action table sizing. */
body.page-income table.income-native-ledger {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
  border-spacing: 0 !important;
}

body.page-income table.income-native-ledger th,
body.page-income table.income-native-ledger td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.16) !important;
  box-shadow: none !important;
  vertical-align: middle !important;
}

/* Native Income status column. */
body.page-income table.income-native-ledger th:nth-child(3),
body.page-income table.income-native-ledger td:nth-child(3) {
  width: 11.4rem !important;
  min-width: 11.4rem !important;
  max-width: 11.4rem !important;
  white-space: nowrap !important;
  overflow: visible !important;
}

body.page-income table.income-native-ledger td:nth-child(3) select {
  width: 100% !important;
  min-width: 10.4rem !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Native Income actions stay one compact column. */
body.page-income table.income-native-ledger th:nth-child(9),
body.page-income table.income-native-ledger td:nth-child(9),
body.page-income table.income-native-ledger td.income-native-actions {
  width: 5.8rem !important;
  min-width: 5.8rem !important;
  max-width: 5.8rem !important;
  text-align: center !important;
  white-space: nowrap !important;
}

body.page-income table.income-native-ledger td.income-native-actions,
body.page-income table.income-native-ledger td.income-native-actions *,
body.page-income table.income-native-ledger tr.has-event-note:hover td.income-native-actions,
body.page-income table.income-native-ledger tr.has-event-note:hover td.income-native-actions * {
  text-decoration: none !important;
}


/* ============================================================
   Phase 3L10S24A12 Income Status Account Polish
   Restore native Income status pill colors and center Account.
   ============================================================ */

/* Center Account column in the native Income ledger. */
body.page-income table.income-native-ledger th:nth-child(4),
body.page-income table.income-native-ledger td:nth-child(4) {
  text-align: center !important;
  vertical-align: middle !important;
}

body.page-income table.income-native-ledger td:nth-child(4) {
  line-height: 1.18 !important;
}

/* Keep Status column centered and pill-sized. */
body.page-income table.income-native-ledger th:nth-child(3),
body.page-income table.income-native-ledger td:nth-child(3) {
  text-align: center !important;
  vertical-align: middle !important;
}

body.page-income table.income-native-ledger select.status-pill-select {
  display: inline-block !important;
  width: 100% !important;
  min-width: 10.4rem !important;
  max-width: 100% !important;
  border-radius: 999px !important;
  padding: 0.42rem 0.8rem !important;
  font-weight: 800 !important;
  line-height: 1.1 !important;
  box-sizing: border-box !important;
  background-color: rgba(15, 23, 42, 0.88) !important;
  border: 1px solid rgba(96, 165, 250, 0.36) !important;
  color: #dbeafe !important;
}

/* Native Income status colors. */
body.page-income table.income-native-ledger select.status-pill-planned {
  background-color: rgba(30, 41, 59, 0.92) !important;
  border-color: rgba(148, 163, 184, 0.46) !important;
  color: #cbd5e1 !important;
}

body.page-income table.income-native-ledger select.status-pill-committed {
  background-color: rgba(120, 53, 15, 0.42) !important;
  border-color: rgba(245, 158, 11, 0.82) !important;
  color: #fbbf24 !important;
}

body.page-income table.income-native-ledger select.status-pill-expected_deposit {
  background-color: rgba(6, 78, 59, 0.42) !important;
  border-color: rgba(16, 185, 129, 0.78) !important;
  color: #34d399 !important;
}

body.page-income table.income-native-ledger select.status-pill-cleared {
  background-color: rgba(20, 83, 45, 0.44) !important;
  border-color: rgba(34, 197, 94, 0.86) !important;
  color: #4ade80 !important;
}

body.page-income table.income-native-ledger select.status-pill-skipped {
  background-color: rgba(63, 63, 70, 0.50) !important;
  border-color: rgba(161, 161, 170, 0.70) !important;
  color: #d4d4d8 !important;
}

body.page-income table.income-native-ledger select.status-pill-mitigated {
  background-color: rgba(88, 28, 135, 0.42) !important;
  border-color: rgba(168, 85, 247, 0.78) !important;
  color: #d8b4fe !important;
}

body.page-income table.income-native-ledger select.status-pill-cancelled {
  background-color: rgba(127, 29, 29, 0.44) !important;
  border-color: rgba(248, 113, 113, 0.82) !important;
  color: #fca5a5 !important;
}

body.page-income table.income-native-ledger select.status-pill-select:focus {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.22) !important;
}


/* ============================================================
   Phase 3L10S24B Review Reason Clarity
   Plain-English reason cards inside Review Needed tables.
   ============================================================ */

.page-review .review-explained-table {
  table-layout: fixed !important;
  width: 100% !important;
}

.page-review .review-reason-cell {
  color: var(--text, #e5eefb) !important;
  font-size: 0.9rem !important;
  line-height: 1.25 !important;
}

.page-review .review-reason-list {
  display: grid;
  gap: 0.38rem;
  min-width: 0;
}

.page-review .review-reason {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-left-width: 4px;
  border-radius: 0.65rem;
  background: rgba(15, 23, 42, 0.42);
}
.page-review .review-reason-title {
  font-weight: 850;
  line-height: 1.15;
}

.page-review .review-reason-detail {
  margin-top: 0.16rem;
  color: var(--muted, #94a3b8);
  font-size: 0.84rem;
  line-height: 1.25;
}

.page-review .review-reason-alert {
  border-left-color: #ff4040;
  background: rgba(127, 29, 29, 0.22);
}

.page-review .review-reason-alert .review-reason-title {
  color: #fca5a5;
}

.page-review .review-reason-warning {
  border-left-color: #f59e0b;
  background: rgba(120, 53, 15, 0.20);
}

.page-review .review-reason-warning .review-reason-title {
  color: #fbbf24;
}

.page-review .review-reason-info {
  border-left-color: #58a6ff;
  background: rgba(30, 64, 175, 0.18);
}

.page-review .review-reason-info .review-reason-title {
  color: #bfdbfe;
}

.page-review .review-reason-note {
  border-left-color: #a78bfa;
  background: rgba(88, 28, 135, 0.18);
}

.page-review .review-reason-note .review-reason-title {
  color: #ddd6fe;
}

/* Wider reason columns now that they contain useful explanations. */
.page-review .review-scheduled-table {
  min-width: 1320px !important;
}

.page-review .review-scheduled-table th:nth-child(8),
.page-review .review-scheduled-table td:nth-child(8) {
  width: 24rem !important;
}

.page-review .review-scheduled-table th:nth-child(2),
.page-review .review-scheduled-table td:nth-child(2) {
  width: 18rem !important;
}

.page-review .review-scheduled-table th:nth-child(9),
.page-review .review-scheduled-table td:nth-child(9) {
  width: 12rem !important;
}

.page-review .review-cards-table {
  min-width: 1240px !important;
}

.page-review .review-cards-table th:nth-child(9),
.page-review .review-cards-table td:nth-child(9) {
  width: 24rem !important;
}

.page-review .review-debts-table {
  min-width: 1180px !important;
}

.page-review .review-debts-table th:nth-child(9),
.page-review .review-debts-table td:nth-child(9) {
  width: 24rem !important;
}

.page-review .review-explained-table td,
.page-review .review-explained-table th {
  vertical-align: top !important;
}

.page-review .review-explained-table td.num,
.page-review .review-explained-table td.id,
.page-review .review-explained-table td:has(.review-pill),
.page-review .review-explained-table td:has(.review-status-pill) {
  vertical-align: middle !important;
}

@media (max-width: 900px) {
  .page-review .review-reason {
    padding: 0.38rem 0.48rem;
  }

  .page-review .review-reason-detail {
    font-size: 0.8rem;
  }
}


/* ============================================================
   Phase 3L10S24B2 Review Compact Layout
   Compact Review Needed tables so explanations fit.
   ============================================================ */

.page-review .review-compact-wrap {
  overflow-x: auto;
  max-width: 100%;
}

.page-review .review-compact-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}

.page-review .review-compact-table th,
.page-review .review-compact-table td {
  vertical-align: top !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

.page-review .review-compact-table .num,
.page-review .review-compact-table td.num {
  white-space: nowrap !important;
  text-align: right !important;
  vertical-align: middle !important;
}

.page-review .review-compact-table .review-main-text {
  font-weight: 800;
  color: var(--text, #e5eefb);
}

.page-review .review-subtext {
  color: var(--muted, #94a3b8);
  font-size: 0.82rem;
  line-height: 1.25;
  margin-top: 0.18rem;
}

.page-review .review-label {
  color: var(--muted, #94a3b8);
  font-size: 0.82rem;
  font-weight: 800;
}

.page-review .review-stacked-cell {
  line-height: 1.28;
}

.page-review .review-alert-text,
.page-review .review-alert-money {
  color: #fca5a5 !important;
  font-weight: 850 !important;
}

/* Scheduled compact table: Item | Type | Amount | Timing | Status | Why */
.page-review .review-scheduled-compact-table {
  min-width: 980px !important;
}

.page-review .review-scheduled-compact-table th:nth-child(1),
.page-review .review-scheduled-compact-table td:nth-child(1) {
  width: 22% !important;
}

.page-review .review-scheduled-compact-table th:nth-child(2),
.page-review .review-scheduled-compact-table td:nth-child(2) {
  width: 12% !important;
}

.page-review .review-scheduled-compact-table th:nth-child(3),
.page-review .review-scheduled-compact-table td:nth-child(3) {
  width: 8.5rem !important;
}

.page-review .review-scheduled-compact-table th:nth-child(4),
.page-review .review-scheduled-compact-table td:nth-child(4) {
  width: 9.5rem !important;
}

.page-review .review-scheduled-compact-table th:nth-child(5),
.page-review .review-scheduled-compact-table td:nth-child(5) {
  width: 8rem !important;
  text-align: center !important;
  vertical-align: middle !important;
}

.page-review .review-scheduled-compact-table th:nth-child(6),
.page-review .review-scheduled-compact-table td:nth-child(6) {
  width: auto !important;
}

/* Cards compact table: Card | Balance | Credit Room | Payment / Timing | Why */
.page-review .review-cards-compact-table {
  min-width: 900px !important;
}

.page-review .review-cards-compact-table th:nth-child(1),
.page-review .review-cards-compact-table td:nth-child(1) {
  width: 22% !important;
}

.page-review .review-cards-compact-table th:nth-child(2),
.page-review .review-cards-compact-table td:nth-child(2) {
  width: 8.8rem !important;
}

.page-review .review-cards-compact-table th:nth-child(3),
.page-review .review-cards-compact-table td:nth-child(3),
.page-review .review-cards-compact-table th:nth-child(4),
.page-review .review-cards-compact-table td:nth-child(4) {
  width: 12rem !important;
}

.page-review .review-cards-compact-table th:nth-child(5),
.page-review .review-cards-compact-table td:nth-child(5) {
  width: auto !important;
}

/* Debts compact table: Debt | Balance | Payment / Timing | Priority | Why */
.page-review .review-debts-compact-table {
  min-width: 900px !important;
}

.page-review .review-debts-compact-table th:nth-child(1),
.page-review .review-debts-compact-table td:nth-child(1) {
  width: 24% !important;
}

.page-review .review-debts-compact-table th:nth-child(2),
.page-review .review-debts-compact-table td:nth-child(2) {
  width: 9rem !important;
}

.page-review .review-debts-compact-table th:nth-child(3),
.page-review .review-debts-compact-table td:nth-child(3) {
  width: 13rem !important;
}

.page-review .review-debts-compact-table th:nth-child(4),
.page-review .review-debts-compact-table td:nth-child(4) {
  width: 7.5rem !important;
  text-align: center !important;
  vertical-align: middle !important;
}

.page-review .review-debts-compact-table th:nth-child(5),
.page-review .review-debts-compact-table td:nth-child(5) {
  width: auto !important;
}

/* Reason cards should wrap instead of clipping. */
.page-review .review-reason,
.page-review .review-reason-title,
.page-review .review-reason-detail {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
}

.page-review .review-reason {
  padding: 0.42rem 0.55rem;
}

.page-review .review-reason-detail {
  white-space: normal;
}

/* Old S24B wide-table rules lose to this compact layout. */
.page-review .review-scheduled-table.review-compact-table,
.page-review .review-cards-table.review-compact-table,
.page-review .review-debts-table.review-compact-table {
  max-width: 100% !important;
}


/* ============================================================
   Phase 3L10S24C Diagnostics Health Dashboard
   ============================================================ */

.page-diagnostics .diagnostics-health-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.page-diagnostics .diagnostics-health-header h2 {
  margin-bottom: 0.25rem;
}

.page-diagnostics .diagnostics-health-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 8.5rem;
  border-radius: 999px;
  padding: 0.42rem 0.8rem;
  font-weight: 900;
  border: 1px solid rgba(148, 163, 184, 0.28);
  white-space: nowrap;
}

.page-diagnostics .diagnostics-health-ok {
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.75);
  background: rgba(20, 83, 45, 0.25);
}

.page-diagnostics .diagnostics-health-warning {
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.82);
  background: rgba(120, 53, 15, 0.24);
}

.page-diagnostics .diagnostics-health-alert {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.85);
  background: rgba(127, 29, 29, 0.28);
}

.page-diagnostics .diagnostics-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr));
  gap: 0.75rem;
}

.page-diagnostics .diagnostics-card {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 1rem;
  padding: 0.82rem 0.9rem;
  background: rgba(15, 23, 42, 0.42);
}

.page-diagnostics .diagnostics-card span {
  display: block;
  color: var(--muted, #94a3b8);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.page-diagnostics .diagnostics-card strong {
  display: block;
  margin-top: 0.28rem;
  font-size: 1.45rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.page-diagnostics .diagnostics-card small {
  display: block;
  margin-top: 0.24rem;
  color: var(--muted, #94a3b8);
}

.page-diagnostics .diagnostics-card-ok strong {
  color: #4ade80;
}

.page-diagnostics .diagnostics-card-warning strong {
  color: #fbbf24;
}

.page-diagnostics .diagnostics-card-alert strong {
  color: #fca5a5;
}

.page-diagnostics .diagnostics-card-info strong {
  color: #bfdbfe;
}

.page-diagnostics .diagnostics-kv-table {
  width: 100%;
  table-layout: fixed;
}

.page-diagnostics .diagnostics-kv-table th,
.page-diagnostics .diagnostics-kv-table td {
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
}

.page-diagnostics .diagnostics-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.6rem;
  border-radius: 999px;
  padding: 0.24rem 0.62rem;
  font-weight: 900;
  border: 1px solid rgba(148, 163, 184, 0.32);
}

.page-diagnostics .diagnostics-pill-alert {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.85);
  background: rgba(127, 29, 29, 0.28);
}

.page-diagnostics .diagnostics-pill-warning {
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.82);
  background: rgba(120, 53, 15, 0.24);
}

.page-diagnostics .diagnostics-pill-info {
  color: #bfdbfe;
  border-color: rgba(96, 165, 250, 0.72);
  background: rgba(30, 64, 175, 0.20);
}

.page-diagnostics .diagnostics-all-clear {
  border: 1px solid rgba(34, 197, 94, 0.38);
  border-left: 4px solid #22c55e;
  border-radius: 0.9rem;
  padding: 0.85rem 1rem;
  background: rgba(20, 83, 45, 0.18);
}

.page-diagnostics .diagnostics-all-clear strong {
  color: #4ade80;
}

.page-diagnostics .diagnostics-all-clear p {
  color: var(--muted, #94a3b8);
  margin: 0.3rem 0 0;
}

.page-diagnostics .diagnostics-two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
}

.page-diagnostics .diagnostics-two-col h3 {
  margin-top: 0;
  margin-bottom: 0.55rem;
  color: var(--text, #e5eefb);
}

.page-diagnostics .diagnostics-view-table th:nth-child(1),
.page-diagnostics .diagnostics-view-table td:nth-child(1) {
  width: auto;
}

.page-diagnostics .diagnostics-view-table th:nth-child(3),
.page-diagnostics .diagnostics-view-table td:nth-child(3),
.page-diagnostics .diagnostics-count-table th:nth-child(2),
.page-diagnostics .diagnostics-count-table td:nth-child(2) {
  width: 6rem;
  text-align: right;
  white-space: nowrap;
}

.page-diagnostics .diagnostics-workflow-panel table.shared-event-status-table {
  min-width: 980px;
}

@media (max-width: 980px) {
  .page-diagnostics .diagnostics-health-header {
    flex-direction: column;
  }

  .page-diagnostics .diagnostics-two-col {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   Phase 3L10S24C2 Diagnostics False Alert Cleanup
   ============================================================ */

.page-diagnostics .diagnostics-direction-counts th:last-child,
.page-diagnostics .diagnostics-direction-counts td:last-child,
.page-diagnostics .diagnostics-dupe-table th:nth-child(2),
.page-diagnostics .diagnostics-dupe-table td:nth-child(2) {
  text-align: right !important;
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums;
}

.page-diagnostics .diagnostics-view-table td:last-child {
  font-weight: 850;
}

.page-diagnostics .diagnostics-view-table td:last-child:not(:empty) {
  text-transform: lowercase;
}


/* ============================================================
   Table Settings Shared Layout
   ============================================================ */

.s24e-table-settings-wrap {
  position: relative;
}

/* Default geometry; the controller positions the panel when it opens. */
.s24e-table-settings-panel {
  top: 2.35rem;
  width: min(23.75rem, calc(100vw - 1.5rem));
  max-height: min(26.25rem, calc(100vh - 1.5rem));
}

.s24e-column-hidden {
  display: none !important;
}

.s24e-table-settings-list {
  padding-right: 0.15rem;
}

.s24e-table-settings-wrap,
.table-wrap.s24e-table-settings-wrap {
  overflow: visible;
}

.s24e-table-settings-wrap > table {
  overflow: auto;
}

@media (max-width: 760px) {
  .s24e-table-settings-panel {
    left: 0.75rem !important;
    width: calc(100vw - 1.5rem) !important;
  }
}


/* ============================================================
   Phase 3L10S24E1D Table Settings Authoritative Live Fix
   ============================================================ */

.s24e-table-settings-panel .s24e-table-settings-refresh {
  display: none !important;
}


/* ============================================================
   Phase 3L10S24E1I Table Settings Clean Controller
   Last-word styling for the single S24E controller.
   ============================================================ */

.s24e-table-settings-toolbar[data-s24e1i="1"] {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 0.45rem !important;
  margin: 0 0 0.45rem !important;
  min-height: 1.9rem !important;
  position: relative !important;
  z-index: 55 !important;
}

.s24e-table-settings-title {
  color: var(--muted, #94a3b8) !important;
  font-size: 0.78rem !important;
  font-weight: 850 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.045em !important;
}

.s24e-table-settings-button[data-s24e1i="1"] {
  width: 2rem !important;
  height: 2rem !important;
  border-radius: 999px !important;
  border: 1px solid rgba(148, 163, 184, 0.34) !important;
  background: rgba(15, 23, 42, 0.82) !important;
  color: var(--text, #e5eefb) !important;
  font-size: 1rem !important;
  line-height: 1 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
}

.s24e-table-settings-button[data-s24e1i="1"]:hover,
.s24e-table-settings-button[data-s24e1i="1"][aria-expanded="true"] {
  border-color: rgba(96, 165, 250, 0.82) !important;
  background: rgba(30, 64, 175, 0.38) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16) !important;
}

.s24e-table-settings-panel[data-s24e1i="1"] {
  display: none !important;
  position: fixed !important;
  right: auto !important;
  bottom: auto !important;
  overflow: auto !important;
  border: 1px solid rgba(148, 163, 184, 0.34) !important;
  border-radius: 0.95rem !important;
  background: rgba(15, 23, 42, 0.985) !important;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.48) !important;
  padding: 0.75rem !important;
  z-index: 10000 !important;
  overscroll-behavior: contain !important;
}

.s24e-table-settings-panel[data-s24e1i="1"].is-open {
  display: block !important;
}

.s24e-table-settings-panel[data-s24e1i="1"] .s24e-table-settings-panel-heading {
  color: var(--text, #e5eefb) !important;
  font-weight: 950 !important;
  margin-bottom: 0.55rem !important;
}

.s24e-table-settings-panel[data-s24e1i="1"] .s24e-table-settings-list {
  display: grid !important;
  gap: 0.35rem !important;
}

.s24e-table-settings-panel[data-s24e1i="1"] .s24e-table-settings-option {
  display: flex !important;
  align-items: center !important;
  gap: 0.55rem !important;
  color: var(--text, #e5eefb) !important;
  font-size: 0.88rem !important;
  line-height: 1.25 !important;
  padding: 0.34rem 0.38rem !important;
  border-radius: 0.55rem !important;
  cursor: pointer !important;
}

.s24e-table-settings-panel[data-s24e1i="1"] .s24e-table-settings-option:hover {
  background: rgba(148, 163, 184, 0.10) !important;
}

.s24e-table-settings-panel[data-s24e1i="1"] .s24e-table-settings-option input {
  width: 1rem !important;
  height: 1rem !important;
  accent-color: #60a5fa !important;
  flex: 0 0 auto !important;
}

.s24e-table-settings-panel[data-s24e1i="1"] .s24e-table-settings-actions {
  display: flex !important;
  justify-content: flex-end !important;
  gap: 0.5rem !important;
  margin-top: 0.75rem !important;
  padding-top: 0.65rem !important;
  border-top: 1px solid rgba(148, 163, 184, 0.18) !important;
  position: sticky !important;
  bottom: -0.75rem !important;
  background: rgba(15, 23, 42, 0.985) !important;
  padding-bottom: 0.15rem !important;
}

.s24e-table-settings-panel[data-s24e1i="1"] .s24e-table-settings-action {
  border: 1px solid rgba(148, 163, 184, 0.30) !important;
  border-radius: 999px !important;
  background: rgba(15, 23, 42, 0.86) !important;
  color: var(--text, #e5eefb) !important;
  padding: 0.34rem 0.68rem !important;
  font-size: 0.82rem !important;
  font-weight: 850 !important;
  cursor: pointer !important;
}

.s24e-table-settings-panel[data-s24e1i="1"] .s24e-table-settings-action:hover {
  border-color: rgba(96, 165, 250, 0.78) !important;
  background: rgba(30, 64, 175, 0.34) !important;
}

th.s24e-column-hidden,
td.s24e-column-hidden {
  display: none !important;
  visibility: collapse !important;
}

th.s24e-column-forced-visible,
td.s24e-column-forced-visible {
  display: table-cell !important;
  visibility: visible !important;
  min-width: 0 !important;
  max-width: none !important;
}

.table-wrap.s24e-table-settings-wrap {
  overflow-x: auto !important;
  overflow-y: visible !important;
}

table.s24e-has-hidden-columns {
  outline: 1px solid rgba(96, 165, 250, 0.16) !important;
  outline-offset: -1px !important;
}


/* ============================================================
   Phase 3L10S24E1O Table Settings Server ID Columns
   Hidden-by-default ID columns for Income/Spending plus tighter
   visible debug/ID width.
   ============================================================ */

/* Server-rendered debug columns should start hidden so the cog
   sees them as unchecked defaults. Inline S24E show rules win when
   the user checks the column. */
html body table th.s24e-debug-column,
html body table td.s24e-debug-column,
html body.page-income table.income-native-ledger th.s24e-debug-column,
html body.page-income table.income-native-ledger td.s24e-debug-column,
html body.page-spending table.spending-redesign-ledger th.s24e-debug-column,
html body.page-spending table.spending-redesign-ledger td.s24e-debug-column {
  display: none !important;
  visibility: collapse !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  border-left: 0 !important;
  border-right: 0 !important;
}

/* Last-word compact width for shown ID/debug columns. */
html body table.s24e1n-compact-id-column th:first-child,
html body table.s24e1n-compact-id-column td:first-child,
html body.page-debts table.debt-cards-compact-table th:first-child,
html body.page-debts table.debt-cards-compact-table td:first-child {
  width: 3.2rem !important;
  min-width: 3.2rem !important;
  max-width: 3.2rem !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}


/* ============================================================
   Phase 3L10S24E1P Table Settings ID Link Alignment
   ============================================================ */

html body.page-debts table.debt-cards-compact-table th:first-child,
html body.page-debts table.debt-cards-compact-table td:first-child,
html body.page-debts table.debt-accounts-table.debt-cards-compact-table th:first-child,
html body.page-debts table.debt-accounts-table.debt-cards-compact-table td:first-child,
html body.page-debts table.credit-cards-table.debt-cards-compact-table th:first-child,
html body.page-debts table.credit-cards-table.debt-cards-compact-table td:first-child {
  text-align: center !important;
}

html body.page-debts table.debt-cards-compact-table td:first-child a,
html body.page-debts table.debt-accounts-table.debt-cards-compact-table td:first-child a,
html body.page-debts table.credit-cards-table.debt-cards-compact-table td:first-child a {
  display: inline-flex !important;
  justify-content: center !important;
  width: 100% !important;
}


/* ============================================================
   Phase 3L10S24E1R Income ID Cleanup
   ============================================================ */

html body table td.s24e-id-column,
html body table th.s24e-id-column {
  text-align: center !important;
}

.s24e-debug-id-link,
.page-income .income-native-id-link,
.page-spending .spending-ledger-id-link {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 0 !important;
  width: 100% !important;
  text-align: center !important;
  font-weight: 900 !important;
  text-decoration: none !important;
}

.s24e-debug-id-link:hover,
.page-income .income-native-id-link:hover,
.page-spending .spending-ledger-id-link:hover {
  text-decoration: underline !important;
}


/* ============================================================
   Phase 3L10S24E1U Income Front Event ID Isolated
   Keeps Event ID as column 1 while isolating Income from older
   9-column native Income nth-child rules.
   ============================================================ */

html body.page-income table.income-native-ledger.income-native-ledger-front-id {
  width: 100% !important;
  min-width: 1120px !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
  border-spacing: 0 !important;
}

html body.page-income table.income-native-ledger.income-native-ledger-front-id th,
html body.page-income table.income-native-ledger.income-native-ledger-front-id td {
  vertical-align: middle !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16) !important;
  box-shadow: none !important;
}

/* Override old S24A11 force-show rules for the new front Event ID debug column. */
html body.page-income table.income-native-ledger.income-native-ledger-front-id th.income-event-id-debug-col:not(.s24e-column-forced-visible),
html body.page-income table.income-native-ledger.income-native-ledger-front-id td.income-event-id-debug-col:not(.s24e-column-forced-visible) {
  display: none !important;
  visibility: collapse !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  border-left: 0 !important;
  border-right: 0 !important;
}

/* 2 Date, 3 Cleared */
html body.page-income table.income-native-ledger.income-native-ledger-front-id th:nth-child(2),
html body.page-income table.income-native-ledger.income-native-ledger-front-id td:nth-child(2),
html body.page-income table.income-native-ledger.income-native-ledger-front-id th:nth-child(3),
html body.page-income table.income-native-ledger.income-native-ledger-front-id td:nth-child(3) {
  width: 7.1rem !important;
  min-width: 7.1rem !important;
  max-width: 7.1rem !important;
  white-space: nowrap !important;
  text-align: left !important;
}

/* 4 Status */
html body.page-income table.income-native-ledger.income-native-ledger-front-id th:nth-child(4),
html body.page-income table.income-native-ledger.income-native-ledger-front-id td:nth-child(4) {
  width: 11.4rem !important;
  min-width: 11.4rem !important;
  max-width: 11.4rem !important;
  text-align: center !important;
  white-space: nowrap !important;
  overflow: visible !important;
}

html body.page-income table.income-native-ledger.income-native-ledger-front-id td:nth-child(4) select,
html body.page-income table.income-native-ledger.income-native-ledger-front-id select.status-pill-select {
  width: 100% !important;
  min-width: 10.4rem !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* 5 Account */
html body.page-income table.income-native-ledger.income-native-ledger-front-id th:nth-child(5),
html body.page-income table.income-native-ledger.income-native-ledger-front-id td:nth-child(5) {
  width: 13rem !important;
  text-align: center !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

/* 6 Direction */
html body.page-income table.income-native-ledger.income-native-ledger-front-id th:nth-child(6),
html body.page-income table.income-native-ledger.income-native-ledger-front-id td:nth-child(6) {
  width: 7rem !important;
  text-align: center !important;
  white-space: nowrap !important;
}

/* 7 Amount */
html body.page-income table.income-native-ledger.income-native-ledger-front-id th:nth-child(7),
html body.page-income table.income-native-ledger.income-native-ledger-front-id td:nth-child(7) {
  width: 7.6rem !important;
  text-align: right !important;
  white-space: nowrap !important;
}

/* 8 Role */
html body.page-income table.income-native-ledger.income-native-ledger-front-id th:nth-child(8),
html body.page-income table.income-native-ledger.income-native-ledger-front-id td:nth-child(8) {
  width: 8.8rem !important;
  white-space: normal !important;
}

/* 9 Description */
html body.page-income table.income-native-ledger.income-native-ledger-front-id th:nth-child(9),
html body.page-income table.income-native-ledger.income-native-ledger-front-id td:nth-child(9) {
  width: auto !important;
  min-width: 12rem !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

/* 10 Actions */
html body.page-income table.income-native-ledger.income-native-ledger-front-id th:nth-child(10),
html body.page-income table.income-native-ledger.income-native-ledger-front-id td:nth-child(10),
html body.page-income table.income-native-ledger.income-native-ledger-front-id td.income-native-actions {
  width: 5.8rem !important;
  min-width: 5.8rem !important;
  max-width: 5.8rem !important;
  text-align: center !important;
  white-space: nowrap !important;
}

html body.page-income table.income-native-ledger.income-native-ledger-front-id .income-native-id-link {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  text-align: center !important;
  font-weight: 900 !important;
  text-decoration: none !important;
}

html body.page-income table.income-native-ledger.income-native-ledger-front-id .income-native-id-link:hover {
  text-decoration: underline !important;
}

/* Never underline action icons because of note-row hover. */
html body.page-income table.income-native-ledger.income-native-ledger-front-id td.income-native-actions,
html body.page-income table.income-native-ledger.income-native-ledger-front-id td.income-native-actions *,
html body.page-income table.income-native-ledger.income-native-ledger-front-id tr.has-event-note:hover td.income-native-actions,
html body.page-income table.income-native-ledger.income-native-ledger-front-id tr.has-event-note:hover td.income-native-actions * {
  text-decoration: none !important;
}


/* ============================================================
   Phase 3L10S24E1V Income Event ID Width Polish
   Wider only for Income's front Event ID column.
   ============================================================ */

html body.page-income table.income-native-ledger.income-native-ledger-front-id th:nth-child(1),
html body.page-income table.income-native-ledger.income-native-ledger-front-id td:nth-child(1),
html body.page-income table.income-native-ledger.income-native-ledger-front-id th.income-event-id-debug-col.s24e-column-forced-visible,
html body.page-income table.income-native-ledger.income-native-ledger-front-id td.income-event-id-debug-col.s24e-column-forced-visible {
  width: 5.6rem !important;
  min-width: 5.6rem !important;
  max-width: 5.6rem !important;
  text-align: center !important;
  white-space: nowrap !important;
}

html body.page-income table.income-native-ledger.income-native-ledger-front-id th.income-event-id-debug-col {
  font-size: 0.82rem !important;
  letter-spacing: 0.025em !important;
  text-transform: uppercase !important;
}


/* ============================================================
   Phase 3L10S24E2B Scheduled Debug Columns
   Scheduled gets a native table with hidden debug columns:
   pay account ID, category ID/name, raw type/status/role,
   billing interval, accrual/annualized amounts, flags, login URL.
   ============================================================ */

.page-scheduled .scheduled-items-panel .scheduled-confidence-actions {
  margin-bottom: 0.85rem !important;
}

.page-scheduled table.scheduled-items-debug-table {
  width: 100% !important;
  border-collapse: collapse !important;
  font-variant-numeric: tabular-nums !important;
}

.page-scheduled table.scheduled-items-debug-table th,
.page-scheduled table.scheduled-items-debug-table td {
  vertical-align: middle !important;
  line-height: 1.2 !important;
}

.page-scheduled table.scheduled-items-debug-table th:nth-child(1),
.page-scheduled table.scheduled-items-debug-table td:nth-child(1) {
  width: 4.8rem !important;
  min-width: 4.8rem !important;
  max-width: 4.8rem !important;
  text-align: center !important;
  white-space: nowrap !important;
}

.page-scheduled table.scheduled-items-debug-table th:nth-child(2),
.page-scheduled table.scheduled-items-debug-table td:nth-child(2) {
  width: 16rem !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

.page-scheduled table.scheduled-items-debug-table th:nth-child(3),
.page-scheduled table.scheduled-items-debug-table td:nth-child(3) {
  width: 10rem !important;
  white-space: nowrap !important;
}

.page-scheduled table.scheduled-items-debug-table th:nth-child(4),
.page-scheduled table.scheduled-items-debug-table td:nth-child(4) {
  width: 8rem !important;
  text-align: right !important;
  white-space: nowrap !important;
}

.page-scheduled table.scheduled-items-debug-table th:nth-child(5),
.page-scheduled table.scheduled-items-debug-table td:nth-child(5),
.page-scheduled table.scheduled-items-debug-table th:nth-child(6),
.page-scheduled table.scheduled-items-debug-table td:nth-child(6),
.page-scheduled table.scheduled-items-debug-table th:nth-child(10),
.page-scheduled table.scheduled-items-debug-table td:nth-child(10) {
  width: 6.2rem !important;
  text-align: center !important;
  white-space: nowrap !important;
}

.page-scheduled table.scheduled-items-debug-table th:nth-child(7),
.page-scheduled table.scheduled-items-debug-table td:nth-child(7),
.page-scheduled table.scheduled-items-debug-table th:nth-child(8),
.page-scheduled table.scheduled-items-debug-table td:nth-child(8),
.page-scheduled table.scheduled-items-debug-table th:nth-child(9),
.page-scheduled table.scheduled-items-debug-table td:nth-child(9) {
  width: 8rem !important;
  text-align: center !important;
  white-space: nowrap !important;
}

.page-scheduled table.scheduled-items-debug-table th:nth-child(11),
.page-scheduled table.scheduled-items-debug-table td:nth-child(11) {
  width: 13rem !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

.page-scheduled table.scheduled-items-debug-table th:nth-child(12),
.page-scheduled table.scheduled-items-debug-table td:nth-child(12),
.page-scheduled table.scheduled-items-debug-table td.scheduled-actions {
  width: 5.8rem !important;
  min-width: 5.8rem !important;
  max-width: 5.8rem !important;
  text-align: center !important;
  white-space: nowrap !important;
}

/* Scheduled debug columns remain hidden until the cog shows them. */
html body.page-scheduled table.scheduled-items-debug-table th.scheduled-debug-col:not(.s24e-column-forced-visible),
html body.page-scheduled table.scheduled-items-debug-table td.scheduled-debug-col:not(.s24e-column-forced-visible) {
  display: none !important;
  visibility: collapse !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  border-left: 0 !important;
  border-right: 0 !important;
}

/* Wrapping defaults retained alongside the final debug layout below. */
html body.page-scheduled table.scheduled-items-debug-table th.scheduled-debug-id-col.s24e-column-forced-visible,
html body.page-scheduled table.scheduled-items-debug-table td.scheduled-debug-id-col.s24e-column-forced-visible {
  white-space: nowrap !important;
}

html body.page-scheduled table.scheduled-items-debug-table th.scheduled-debug-col.s24e-column-forced-visible,
html body.page-scheduled table.scheduled-items-debug-table td.scheduled-debug-col.s24e-column-forced-visible {
  overflow-wrap: anywhere !important;
}

html body.page-scheduled table.scheduled-items-debug-table th.scheduled-debug-url-col.s24e-column-forced-visible,
html body.page-scheduled table.scheduled-items-debug-table td.scheduled-debug-url-col.s24e-column-forced-visible {
  overflow-wrap: anywhere !important;
}

.page-scheduled table.scheduled-items-debug-table .scheduled-actions a {
  text-decoration: none !important;
}


/* ============================================================
   Phase 3L10S24E2C Scheduled Debug Layout Polish
   Debug columns should reveal as a wide, scrollable ledger —
   not wrap into a skyscraper header or crush normal columns.
   ============================================================ */

.page-scheduled .scheduled-items-debug-wrap,
.page-scheduled .scheduled-items-debug-wrap.s24e-table-settings-wrap {
  overflow-x: auto !important;
  overflow-y: visible !important;
  max-width: 100% !important;
}

.page-scheduled table.scheduled-items-debug-table {
  table-layout: fixed !important;
  min-width: 1380px !important;
}

/* When any debug column is visible, switch to a deliberately wider debug canvas. */
.page-scheduled table.scheduled-items-debug-table.scheduled-debug-active,
.page-scheduled table.scheduled-items-debug-table:has(th.scheduled-debug-col.s24e-column-forced-visible),
.page-scheduled table.scheduled-items-debug-table:has(td.scheduled-debug-col.s24e-column-forced-visible) {
  min-width: 2650px !important;
}

/* Kill the tall blank-header effect. */
.page-scheduled table.scheduled-items-debug-table thead,
.page-scheduled table.scheduled-items-debug-table thead tr,
.page-scheduled table.scheduled-items-debug-table thead th {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  vertical-align: middle !important;
}

.page-scheduled table.scheduled-items-debug-table th {
  padding-top: 0.58rem !important;
  padding-bottom: 0.58rem !important;
  line-height: 1.12 !important;
  white-space: nowrap !important;
}

/* Normal visible columns keep their intended shape. */
.page-scheduled table.scheduled-items-debug-table td {
  padding-top: 0.56rem !important;
  padding-bottom: 0.56rem !important;
}

/* Shown debug columns are compact, single-line, and clipped instead of row-wrecking. */
html body.page-scheduled table.scheduled-items-debug-table th.scheduled-debug-col.s24e-column-forced-visible,
html body.page-scheduled table.scheduled-items-debug-table td.scheduled-debug-col.s24e-column-forced-visible {
  width: 9.5rem !important;
  min-width: 9.5rem !important;
  max-width: 9.5rem !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  line-height: 1.18 !important;
  vertical-align: middle !important;
}

/* ID-ish debug fields get enough room for title + value, but not a whole zip code. */
html body.page-scheduled table.scheduled-items-debug-table th.scheduled-debug-id-col.s24e-column-forced-visible,
html body.page-scheduled table.scheduled-items-debug-table td.scheduled-debug-id-col.s24e-column-forced-visible {
  width: 7.2rem !important;
  min-width: 7.2rem !important;
  max-width: 7.2rem !important;
  text-align: center !important;
}

/* Money debug fields. */
html body.page-scheduled table.scheduled-items-debug-table th:nth-child(20).s24e-column-forced-visible,
html body.page-scheduled table.scheduled-items-debug-table td:nth-child(20).s24e-column-forced-visible,
html body.page-scheduled table.scheduled-items-debug-table th:nth-child(21).s24e-column-forced-visible,
html body.page-scheduled table.scheduled-items-debug-table td:nth-child(21).s24e-column-forced-visible {
  width: 8.8rem !important;
  min-width: 8.8rem !important;
  max-width: 8.8rem !important;
  text-align: right !important;
}

/* Login URL gets a little more room, but stays one line. */
html body.page-scheduled table.scheduled-items-debug-table th.scheduled-debug-url-col.s24e-column-forced-visible,
html body.page-scheduled table.scheduled-items-debug-table td.scheduled-debug-url-col.s24e-column-forced-visible {
  width: 13rem !important;
  min-width: 13rem !important;
  max-width: 13rem !important;
  white-space: nowrap !important;
}

/* Do not let small role helper text create a two-story row in debug mode. */
.page-scheduled table.scheduled-items-debug-table td.scheduled-debug-col small {
  display: none !important;
}

/* Keep bool badges centered inside compact debug cells. */
.page-scheduled table.scheduled-items-debug-table td.scheduled-debug-col .bool-badge {
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Helpful visual cue: when debugging, the table is intentionally wide-scroll. */
.page-scheduled table.scheduled-items-debug-table.scheduled-debug-active {
  outline-color: rgba(96, 165, 250, 0.28) !important;
}


/* ============================================================
   Phase 3L10S24E2E Shared Event Debug Columns
   Shared render_event_table() now has hidden-by-default debug
   columns. The visible 10-column table gets an authoritative map:
   ID | Date | Due | Cleared | Status | Account | Direction |
   Amount | Role | Description.
   ============================================================ */

html body table.shared-event-status-table.shared-event-debug-table {
  min-width: 1320px !important;
}

html body table.shared-event-status-table.shared-event-debug-table th,
html body table.shared-event-status-table.shared-event-debug-table td {
  vertical-align: middle !important;
  box-sizing: border-box !important;
}

html body table.shared-event-status-table.shared-event-debug-table th:nth-child(1),
html body table.shared-event-status-table.shared-event-debug-table td:nth-child(1) {
  width: 5rem !important;
  text-align: right !important;
  white-space: nowrap !important;
}

html body table.shared-event-status-table.shared-event-debug-table th:nth-child(2),
html body table.shared-event-status-table.shared-event-debug-table td:nth-child(2),
html body table.shared-event-status-table.shared-event-debug-table th:nth-child(3),
html body table.shared-event-status-table.shared-event-debug-table td:nth-child(3),
html body table.shared-event-status-table.shared-event-debug-table th:nth-child(4),
html body table.shared-event-status-table.shared-event-debug-table td:nth-child(4) {
  width: 7.7rem !important;
  white-space: nowrap !important;
}

html body table.shared-event-status-table.shared-event-debug-table th:nth-child(5),
html body table.shared-event-status-table.shared-event-debug-table td:nth-child(5) {
  width: 10.4rem !important;
  min-width: 10.4rem !important;
  white-space: nowrap !important;
  overflow: visible !important;
}

html body table.shared-event-status-table.shared-event-debug-table .shared-event-status-select.status-pill-select {
  width: 8.8rem !important;
  min-width: 8.8rem !important;
  max-width: 8.8rem !important;
  display: inline-block !important;
}

html body table.shared-event-status-table.shared-event-debug-table th:nth-child(6),
html body table.shared-event-status-table.shared-event-debug-table td:nth-child(6) {
  width: 15rem !important;
  min-width: 15rem !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

html body table.shared-event-status-table.shared-event-debug-table th:nth-child(7),
html body table.shared-event-status-table.shared-event-debug-table td:nth-child(7) {
  width: 7rem !important;
  white-space: nowrap !important;
  text-align: center !important;
}

html body table.shared-event-status-table.shared-event-debug-table th:nth-child(8),
html body table.shared-event-status-table.shared-event-debug-table td:nth-child(8) {
  width: 8.5rem !important;
  white-space: nowrap !important;
  text-align: right !important;
}

html body table.shared-event-status-table.shared-event-debug-table th:nth-child(9),
html body table.shared-event-status-table.shared-event-debug-table td:nth-child(9) {
  width: 10.5rem !important;
  white-space: normal !important;
}

html body table.shared-event-status-table.shared-event-debug-table th:nth-child(10),
html body table.shared-event-status-table.shared-event-debug-table td:nth-child(10) {
  width: auto !important;
  min-width: 18rem !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

/* Row-note underline follows the real Description column, not debug cells. */
html body table.shared-event-status-table.shared-event-debug-table tr.has-event-note:hover td:nth-child(10) {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

html body table.shared-event-status-table.shared-event-debug-table tr.has-event-note:hover td.shared-event-debug-col {
  text-decoration: none !important;
}


/* ============================================================
   Phase 3L10S24E2H Shared Event Stabilizer
   Shared event renderer is back to the stable visible 10-column
   shape used by older Dashboard/Events CSS:
   ID | Date | Due | Cleared | Status | Account | Direction |
   Amount | Role | Description | hidden debug columns...
   ============================================================ */

/* Fresh v3 shared debug tables should not inherit E2G stale layout behavior. */
html body table.shared-event-status-table.shared-event-debug-table {
  width: 100% !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
  font-variant-numeric: tabular-nums !important;
}

/* Keep debug columns out until the cog reveals them. */
html body table.shared-event-status-table.shared-event-debug-table th.shared-event-debug-col:not(.s24e-column-forced-visible),
html body table.shared-event-status-table.shared-event-debug-table td.shared-event-debug-col:not(.s24e-column-forced-visible) {
  display: none !important;
  visibility: collapse !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  border-left: 0 !important;
  border-right: 0 !important;
}

html body table.shared-event-status-table.shared-event-debug-table th.shared-event-debug-col.s24e-column-forced-visible,
html body table.shared-event-status-table.shared-event-debug-table td.shared-event-debug-col.s24e-column-forced-visible {
  display: table-cell !important;
  visibility: visible !important;
  width: 9.2rem !important;
  min-width: 9.2rem !important;
  max-width: 9.2rem !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

html body table.shared-event-status-table.shared-event-debug-table th.shared-event-debug-id-col.s24e-column-forced-visible,
html body table.shared-event-status-table.shared-event-debug-table td.shared-event-debug-id-col.s24e-column-forced-visible {
  width: 7.4rem !important;
  min-width: 7.4rem !important;
  max-width: 7.4rem !important;
  text-align: center !important;
}

html body table.shared-event-status-table.shared-event-debug-table th.shared-event-debug-flag-col.s24e-column-forced-visible,
html body table.shared-event-status-table.shared-event-debug-table td.shared-event-debug-flag-col.s24e-column-forced-visible {
  width: 6.4rem !important;
  min-width: 6.4rem !important;
  max-width: 6.4rem !important;
  text-align: center !important;
}

html body table.shared-event-status-table.shared-event-debug-table.shared-event-debug-active {
  min-width: 1900px !important;
}

/* Dashboard / Transaction Search compact view:
   keep Date, Status, Account, Amount, Description by default.
   Hidden compact columns can still be shown from the cog. */
html body.page-dashboard table.shared-event-status-table.shared-event-debug-table {
  min-width: 0 !important;
  max-width: 100% !important;
}

html body.page-dashboard table.shared-event-status-table.shared-event-debug-table th:nth-child(1):not(.s24e-column-forced-visible),
html body.page-dashboard table.shared-event-status-table.shared-event-debug-table td:nth-child(1):not(.s24e-column-forced-visible),
html body.page-dashboard table.shared-event-status-table.shared-event-debug-table th:nth-child(3):not(.s24e-column-forced-visible),
html body.page-dashboard table.shared-event-status-table.shared-event-debug-table td:nth-child(3):not(.s24e-column-forced-visible),
html body.page-dashboard table.shared-event-status-table.shared-event-debug-table th:nth-child(4):not(.s24e-column-forced-visible),
html body.page-dashboard table.shared-event-status-table.shared-event-debug-table td:nth-child(4):not(.s24e-column-forced-visible),
html body.page-dashboard table.shared-event-status-table.shared-event-debug-table th:nth-child(7):not(.s24e-column-forced-visible),
html body.page-dashboard table.shared-event-status-table.shared-event-debug-table td:nth-child(7):not(.s24e-column-forced-visible),
html body.page-dashboard table.shared-event-status-table.shared-event-debug-table th:nth-child(9):not(.s24e-column-forced-visible),
html body.page-dashboard table.shared-event-status-table.shared-event-debug-table td:nth-child(9):not(.s24e-column-forced-visible) {
  display: none !important;
  visibility: collapse !important;
}

html body.page-dashboard table.shared-event-status-table.shared-event-debug-table th:nth-child(2),
html body.page-dashboard table.shared-event-status-table.shared-event-debug-table td:nth-child(2) {
  width: 8rem !important;
  min-width: 8rem !important;
  white-space: nowrap !important;
}

html body.page-dashboard table.shared-event-status-table.shared-event-debug-table th:nth-child(5),
html body.page-dashboard table.shared-event-status-table.shared-event-debug-table td:nth-child(5) {
  width: 10.5rem !important;
  min-width: 10.5rem !important;
  white-space: nowrap !important;
}

html body.page-dashboard table.shared-event-status-table.shared-event-debug-table th:nth-child(6),
html body.page-dashboard table.shared-event-status-table.shared-event-debug-table td:nth-child(6) {
  width: 26% !important;
  min-width: 11rem !important;
  white-space: normal !important;
}

html body.page-dashboard table.shared-event-status-table.shared-event-debug-table th:nth-child(8),
html body.page-dashboard table.shared-event-status-table.shared-event-debug-table td:nth-child(8) {
  width: 8.5rem !important;
  min-width: 8.5rem !important;
  text-align: right !important;
  white-space: nowrap !important;
}

html body.page-dashboard table.shared-event-status-table.shared-event-debug-table th:nth-child(10),
html body.page-dashboard table.shared-event-status-table.shared-event-debug-table td:nth-child(10) {
  width: auto !important;
  min-width: 14rem !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

/* Events ledger: keep old compact intent, but on the correct 10-column map. */
html body.page-events table.shared-event-status-table.shared-event-debug-table {
  min-width: 1180px !important;
}

html body.page-events table.shared-event-status-table.shared-event-debug-table th:nth-child(1):not(.s24e-column-forced-visible),
html body.page-events table.shared-event-status-table.shared-event-debug-table td:nth-child(1):not(.s24e-column-forced-visible),
html body.page-events table.shared-event-status-table.shared-event-debug-table th:nth-child(9):not(.s24e-column-forced-visible),
html body.page-events table.shared-event-status-table.shared-event-debug-table td:nth-child(9):not(.s24e-column-forced-visible) {
  display: none !important;
  visibility: collapse !important;
}

/* Event Detail: force sane grid order and make related events a small side card. */
html body.page-events .detail-grid {
  display: grid !important;
  grid-template-columns: minmax(0, 1.35fr) minmax(24rem, 0.65fr) !important;
  gap: 1rem !important;
  align-items: start !important;
}

html body.page-events .detail-panel {
  grid-column: 1 !important;
  grid-row: 1 !important;
  min-width: 0 !important;
}

html body.page-events .related-panel {
  grid-column: 2 !important;
  grid-row: 1 !important;
}
html body.page-events .detail-panel .table-wrap,
html body.page-events .related-panel .table-wrap {
  overflow-x: auto !important;
  overflow-y: visible !important;
}

html body.page-events .related-panel table.shared-event-debug-table {
  min-width: 38rem !important;
  table-layout: fixed !important;
}

html body.page-events .related-panel table.shared-event-debug-table th:nth-child(3):not(.s24e-column-forced-visible),
html body.page-events .related-panel table.shared-event-debug-table td:nth-child(3):not(.s24e-column-forced-visible),
html body.page-events .related-panel table.shared-event-debug-table th:nth-child(4):not(.s24e-column-forced-visible),
html body.page-events .related-panel table.shared-event-debug-table td:nth-child(4):not(.s24e-column-forced-visible),
html body.page-events .related-panel table.shared-event-debug-table th:nth-child(6):not(.s24e-column-forced-visible),
html body.page-events .related-panel table.shared-event-debug-table td:nth-child(6):not(.s24e-column-forced-visible),
html body.page-events .related-panel table.shared-event-debug-table th:nth-child(7):not(.s24e-column-forced-visible),
html body.page-events .related-panel table.shared-event-debug-table td:nth-child(7):not(.s24e-column-forced-visible),
html body.page-events .related-panel table.shared-event-debug-table th:nth-child(9):not(.s24e-column-forced-visible),
html body.page-events .related-panel table.shared-event-debug-table td:nth-child(9):not(.s24e-column-forced-visible),
html body.page-events .related-panel table.shared-event-debug-table th:nth-child(10):not(.s24e-column-forced-visible),
html body.page-events .related-panel table.shared-event-debug-table td:nth-child(10):not(.s24e-column-forced-visible) {
  display: none !important;
  visibility: collapse !important;
}

html body.page-events .related-panel table.shared-event-debug-table th:nth-child(1),
html body.page-events .related-panel table.shared-event-debug-table td:nth-child(1) {
  width: 4.4rem !important;
}

html body.page-events .related-panel table.shared-event-debug-table th:nth-child(2),
html body.page-events .related-panel table.shared-event-debug-table td:nth-child(2) {
  width: 7.2rem !important;
}

html body.page-events .related-panel table.shared-event-debug-table th:nth-child(5),
html body.page-events .related-panel table.shared-event-debug-table td:nth-child(5) {
  width: 10rem !important;
}

html body.page-events .related-panel table.shared-event-debug-table th:nth-child(8),
html body.page-events .related-panel table.shared-event-debug-table td:nth-child(8) {
  width: 8rem !important;
  text-align: right !important;
}

@media (max-width: 1250px) {
  html body.page-events .detail-grid {
    grid-template-columns: 1fr !important;
  }

  html body.page-events .detail-panel,
  html body.page-events .related-panel {
    grid-column: 1 !important;
    grid-row: auto !important;
  }
}

/* Diagnostics: no more ellipsis soup in the tiny summary tables. */
html body.page-diagnostics .diagnostics-two-col {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  gap: 1rem !important;
  align-items: start !important;
}

html body.page-diagnostics .diagnostics-two-col .table-wrap {
  overflow-x: auto !important;
  overflow-y: visible !important;
}

html body.page-diagnostics .diagnostics-kv-table {
  table-layout: fixed !important;
  width: 100% !important;
  min-width: 0 !important;
}

html body.page-diagnostics .diagnostics-view-table,
html body.page-diagnostics .diagnostics-count-table,
html body.page-diagnostics .diagnostics-status-counts,
html body.page-diagnostics .diagnostics-direction-counts {
  min-width: 0 !important;
}

html body.page-diagnostics .diagnostics-kv-table th,
html body.page-diagnostics .diagnostics-kv-table td {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
}

html body.page-diagnostics .diagnostics-status-counts td:first-child,
html body.page-diagnostics .diagnostics-direction-counts td:first-child {
  font-weight: 700 !important;
}

@media (max-width: 980px) {
  html body.page-diagnostics .diagnostics-two-col {
    grid-template-columns: 1fr !important;
  }
}


/* ============================================================
   Phase 3L10S24E2I Shared Event Class Layout
   Class-based final layout layer for Dashboard Recent Events,
   Transaction Search, Events, and Event Detail related tables.
   Stops nth-child drift when hidden/debug columns are toggled.
   ============================================================ */

html body .shared-event-debug-wrap {
  overflow-x: auto !important;
  overflow-y: visible !important;
}

/* Hidden debug columns stay out until checked. */
html body table.shared-event-debug-table th.shared-event-debug-col:not(.s24e-column-forced-visible),
html body table.shared-event-debug-table td.shared-event-debug-col:not(.s24e-column-forced-visible) {
  display: none !important;
  visibility: collapse !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Dashboard/Transaction Search default: intentional five-column compact view. */
html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) .shared-event-col-id:not(.s24e-column-forced-visible),
html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) .shared-event-col-due:not(.s24e-column-forced-visible),
html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) .shared-event-col-cleared:not(.s24e-column-forced-visible),
html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) .shared-event-col-direction:not(.s24e-column-forced-visible),
html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) .shared-event-col-role:not(.s24e-column-forced-visible) {
  display: none !important;
  visibility: collapse !important;
}

html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) .shared-event-col-date {
  width: 9rem !important;
  min-width: 9rem !important;
  white-space: nowrap !important;
}

html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) .shared-event-col-status {
  width: 11rem !important;
  min-width: 11rem !important;
  white-space: nowrap !important;
  overflow: visible !important;
}

html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) .shared-event-col-account {
  width: 33% !important;
  white-space: normal !important;
}

html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) .shared-event-col-amount {
  width: 9rem !important;
  min-width: 9rem !important;
  text-align: right !important;
  white-space: nowrap !important;
}

html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) .shared-event-col-description {
  width: auto !important;
  min-width: 14rem !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

/* Expanded/Show all: do not crush; make it a horizontal ledger. */
html body table.shared-event-debug-table.s24e-shared-expanded {
  width: 100% !important;
  min-width: 1720px !important;
  table-layout: fixed !important;
}

html body table.shared-event-debug-table.s24e-shared-expanded th,
html body table.shared-event-debug-table.s24e-shared-expanded td {
  vertical-align: middle !important;
  box-sizing: border-box !important;
}

html body table.shared-event-debug-table.s24e-shared-expanded .shared-event-col-id {
  width: 5rem !important;
  min-width: 5rem !important;
  max-width: 5rem !important;
  text-align: right !important;
}

html body table.shared-event-debug-table.s24e-shared-expanded .shared-event-col-date,
html body table.shared-event-debug-table.s24e-shared-expanded .shared-event-col-due,
html body table.shared-event-debug-table.s24e-shared-expanded .shared-event-col-cleared {
  width: 7.8rem !important;
  min-width: 7.8rem !important;
  max-width: 7.8rem !important;
  white-space: nowrap !important;
}

html body table.shared-event-debug-table.s24e-shared-expanded .shared-event-col-status {
  width: 10.6rem !important;
  min-width: 10.6rem !important;
  max-width: 10.6rem !important;
  overflow: visible !important;
}

html body table.shared-event-debug-table.s24e-shared-expanded .shared-event-col-account {
  width: 15rem !important;
  min-width: 15rem !important;
  max-width: 15rem !important;
  white-space: normal !important;
}

html body table.shared-event-debug-table.s24e-shared-expanded .shared-event-col-direction {
  width: 7rem !important;
  min-width: 7rem !important;
  max-width: 7rem !important;
  text-align: center !important;
}

html body table.shared-event-debug-table.s24e-shared-expanded .shared-event-col-amount {
  width: 8.5rem !important;
  min-width: 8.5rem !important;
  max-width: 8.5rem !important;
  text-align: right !important;
}

html body table.shared-event-debug-table.s24e-shared-expanded .shared-event-col-role {
  width: 10rem !important;
  min-width: 10rem !important;
  max-width: 10rem !important;
  white-space: normal !important;
}

html body table.shared-event-debug-table.s24e-shared-expanded .shared-event-col-description {
  width: 18rem !important;
  min-width: 18rem !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

/* Status select should not create the mystery dark block / clipped pill. */
html body table.shared-event-debug-table .shared-event-status-cell {
  white-space: nowrap !important;
  overflow: visible !important;
}

html body table.shared-event-debug-table .shared-event-status-select.status-pill-select {
  display: inline-block !important;
  width: 8.8rem !important;
  min-width: 8.8rem !important;
  max-width: 8.8rem !important;
}

/* Event Detail related side card: compact, not a full ledger stuffed into a lunchbox. */
html body.page-events .related-panel {
  min-width: 0 !important;
  overflow: hidden !important;
}

html body.page-events .related-panel .shared-event-debug-wrap {
  overflow-x: auto !important;
}

html body.page-events .related-panel table.shared-event-debug-table,
html body.page-events .related-panel table.shared-event-debug-table.s24e-related-compact {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}

html body.page-events .related-panel table.shared-event-debug-table .shared-event-col-id {
  width: 4.2rem !important;
  min-width: 4.2rem !important;
  max-width: 4.2rem !important;
}

html body.page-events .related-panel table.shared-event-debug-table .shared-event-col-date {
  width: 7.4rem !important;
  min-width: 7.4rem !important;
  max-width: 7.4rem !important;
}

html body.page-events .related-panel table.shared-event-debug-table .shared-event-col-status {
  width: 9.2rem !important;
  min-width: 9.2rem !important;
  max-width: 9.2rem !important;
}

html body.page-events .related-panel table.shared-event-debug-table .shared-event-col-amount {
  width: 7.2rem !important;
  min-width: 7.2rem !important;
  max-width: 7.2rem !important;
  text-align: right !important;
}

html body.page-events .related-panel table.shared-event-debug-table .shared-event-status-select.status-pill-select {
  width: 7.8rem !important;
  min-width: 7.8rem !important;
  max-width: 7.8rem !important;
}

/* Diagnostics pill defaults retained by the current Health Checks grid. */
html body.page-diagnostics .diagnostics-pill {
  min-width: 6.2rem !important;
  white-space: nowrap !important;
  overflow: visible !important;
}


/* ============================================================
   Phase 3L10S24E2J Dashboard Status Diagnostics Pin
   Final scoped overrides:
   - Dashboard shared event compact mode is truly 5-column.
   - Show-all/debug mode scrolls instead of crushing.
   - Diagnostics Health Checks no longer clips Severity/Issue.
   ============================================================ */

/* ---------- Dashboard shared event compact tables ---------- */

html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  table-layout: fixed !important;
}

html body.page-dashboard .shared-event-debug-wrap:has(table.shared-event-debug-table:not(.s24e-shared-expanded)) {
  /* Keep checked compact columns readable below their combined minimum. */
  overflow-x: auto !important;
  overflow-y: visible !important;
}

/* Default compact view: hide noisy core/debug columns unless user explicitly forced one visible. */
html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) .shared-event-col-id:not(.s24e-column-forced-visible),
html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) .shared-event-col-due:not(.s24e-column-forced-visible),
html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) .shared-event-col-cleared:not(.s24e-column-forced-visible),
html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) .shared-event-col-direction:not(.s24e-column-forced-visible),
html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) .shared-event-col-role:not(.s24e-column-forced-visible),
html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) .shared-event-debug-col:not(.s24e-column-forced-visible) {
  display: none !important;
  visibility: collapse !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* The five visible compact columns. */
html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) .shared-event-col-date:not(.s24e-column-hidden) {
  display: table-cell !important;
  visibility: visible !important;
  width: 8.8rem !important;
  min-width: 8.8rem !important;
  max-width: 8.8rem !important;
  white-space: nowrap !important;
}

html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) .shared-event-col-status:not(.s24e-column-hidden) {
  display: table-cell !important;
  visibility: visible !important;
  width: 11.4rem !important;
  min-width: 11.4rem !important;
  max-width: 11.4rem !important;
  white-space: nowrap !important;
  overflow: visible !important;
  padding-right: 0.7rem !important;
}

html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) .shared-event-col-account:not(.s24e-column-hidden) {
  display: table-cell !important;
  visibility: visible !important;
  width: 32% !important;
  min-width: 0 !important;
  max-width: none !important;
  text-align: left !important;
  white-space: normal !important;
  overflow-wrap: normal !important;
}

html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) .shared-event-col-amount:not(.s24e-column-hidden) {
  display: table-cell !important;
  visibility: visible !important;
  width: 8.6rem !important;
  min-width: 8.6rem !important;
  max-width: 8.6rem !important;
  text-align: right !important;
  white-space: nowrap !important;
}

html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) .shared-event-col-description:not(.s24e-column-hidden) {
  display: table-cell !important;
  visibility: visible !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  white-space: normal !important;
  overflow-wrap: normal !important;
}

/* Status select stays pill-sized and does not create the mystery dark slab. */
html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) .shared-event-status-cell {
  overflow: visible !important;
}

html body.page-dashboard table.shared-event-debug-table:not(.s24e-shared-expanded) .shared-event-status-select.status-pill-select {
  display: inline-block !important;
  width: 8.8rem !important;
  min-width: 8.8rem !important;
  max-width: 8.8rem !important;
  margin-left: 0 !important;
}

/* Expanded/show-all/debug mode: horizontal ledger, never crushed. */
html body.page-dashboard table.shared-event-debug-table.s24e-shared-expanded {
  width: 100% !important;
  min-width: 1900px !important;
  table-layout: fixed !important;
}

html body.page-dashboard .shared-event-debug-wrap:has(table.shared-event-debug-table.s24e-shared-expanded) {
  overflow-x: auto !important;
  overflow-y: visible !important;
}


/* ============================================================
   Phase 3L10S24E2K Diagnostics Health Grid
   Health Checks is intentionally not a table anymore. This keeps it
   clear of stacked legacy table-settings and nth-child rules.
   ============================================================ */

html body.page-diagnostics .diagnostics-issues-panel {
  overflow: hidden !important;
}

html body.page-diagnostics .diagnostics-health-grid-wrap {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
  border-radius: 0.85rem !important;
  scrollbar-width: thin !important;
}

html body.page-diagnostics .diagnostics-health-grid {
  min-width: 1180px !important;
  width: 100% !important;
  display: grid !important;
  gap: 0 !important;
  font-size: 0.94rem !important;
  font-variant-numeric: tabular-nums !important;
}

html body.page-diagnostics .diagnostics-health-grid-row {
  display: grid !important;
  grid-template-columns:
    8.8rem
    9rem
    minmax(17rem, 1.05fr)
    5.2rem
    minmax(24rem, 1.45fr)
    minmax(24rem, 1.35fr) !important;
  align-items: center !important;
  min-width: 0 !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18) !important;
}

html body.page-diagnostics .diagnostics-health-grid-head {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.005)),
    #242b34 !important;
  color: #aeb9c8 !important;
  font-weight: 850 !important;
  letter-spacing: 0.01em !important;
}

html body.page-diagnostics .diagnostics-health-grid-cell {
  min-width: 0 !important;
  box-sizing: border-box !important;
  padding: 0.62rem 0.72rem !important;
  line-height: 1.25 !important;
  color: var(--text, #e5eefb) !important;
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
}

html body.page-diagnostics .diagnostics-health-grid-head .diagnostics-health-grid-cell {
  color: #bfcbdd !important;
  white-space: nowrap !important;
}

html body.page-diagnostics .diagnostics-health-grid-body-row:hover {
  background: rgba(96, 165, 250, 0.07) !important;
}

html body.page-diagnostics .diagnostics-health-severity-cell {
  white-space: nowrap !important;
  overflow: visible !important;
}

html body.page-diagnostics .diagnostics-health-area-cell {
  white-space: nowrap !important;
}

html body.page-diagnostics .diagnostics-health-issue-cell {
  font-weight: 850 !important;
  color: var(--text, #e5eefb) !important;
}

html body.page-diagnostics .diagnostics-health-count-cell {
  text-align: right !important;
  white-space: nowrap !important;
}

html body.page-diagnostics .diagnostics-health-means-cell,
html body.page-diagnostics .diagnostics-health-action-cell {
  color: rgba(226, 232, 240, 0.94) !important;
}

html body.page-diagnostics .diagnostics-health-grid .diagnostics-pill {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 6.7rem !important;
  width: auto !important;
  max-width: none !important;
  min-height: 1.55rem !important;
  padding: 0.2rem 0.72rem !important;
  border-radius: 999px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
}

/* Keep the rest of Diagnostics summary tables calm and readable. */
html body.page-diagnostics .diagnostics-schema-panel .diagnostics-two-col,
html body.page-diagnostics .diagnostics-stats-panel .diagnostics-two-col {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  gap: 1rem !important;
  align-items: start !important;
}

html body.page-diagnostics .diagnostics-schema-panel .table-wrap,
html body.page-diagnostics .diagnostics-stats-panel .table-wrap {
  overflow-x: auto !important;
  overflow-y: visible !important;
}

html body.page-diagnostics .diagnostics-schema-panel table.diagnostics-kv-table,
html body.page-diagnostics .diagnostics-stats-panel table.diagnostics-kv-table {
  min-width: 0 !important;
  width: 100% !important;
  table-layout: fixed !important;
}

html body.page-diagnostics .diagnostics-schema-panel table.diagnostics-kv-table th,
html body.page-diagnostics .diagnostics-schema-panel table.diagnostics-kv-table td,
html body.page-diagnostics .diagnostics-stats-panel table.diagnostics-kv-table th,
html body.page-diagnostics .diagnostics-stats-panel table.diagnostics-kv-table td {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
}

html body.page-diagnostics .diagnostics-view-table th:nth-child(1),
html body.page-diagnostics .diagnostics-view-table td:nth-child(1) {
  width: 58% !important;
}

html body.page-diagnostics .diagnostics-view-table th:nth-child(2),
html body.page-diagnostics .diagnostics-view-table td:nth-child(2) {
  width: 18% !important;
}

html body.page-diagnostics .diagnostics-view-table th:nth-child(3),
html body.page-diagnostics .diagnostics-view-table td:nth-child(3) {
  width: 24% !important;
  text-align: right !important;
}

html body.page-diagnostics .diagnostics-count-table th:nth-child(1),
html body.page-diagnostics .diagnostics-count-table td:nth-child(1) {
  width: 70% !important;
}

html body.page-diagnostics .diagnostics-count-table th:nth-child(2),
html body.page-diagnostics .diagnostics-count-table td:nth-child(2) {
  width: 30% !important;
  text-align: right !important;
}

html body.page-diagnostics .diagnostics-status-counts th:nth-child(1),
html body.page-diagnostics .diagnostics-status-counts td:nth-child(1) {
  width: 70% !important;
}

html body.page-diagnostics .diagnostics-status-counts th:nth-child(2),
html body.page-diagnostics .diagnostics-status-counts td:nth-child(2) {
  width: 30% !important;
  text-align: right !important;
}

html body.page-diagnostics .diagnostics-direction-counts th:nth-child(1),
html body.page-diagnostics .diagnostics-direction-counts td:nth-child(1) {
  width: 38% !important;
}

html body.page-diagnostics .diagnostics-direction-counts th:nth-child(2),
html body.page-diagnostics .diagnostics-direction-counts td:nth-child(2) {
  width: 26% !important;
  text-align: right !important;
}

html body.page-diagnostics .diagnostics-direction-counts th:nth-child(3),
html body.page-diagnostics .diagnostics-direction-counts td:nth-child(3) {
  width: 36% !important;
  text-align: right !important;
}

@media (max-width: 1050px) {
  html body.page-diagnostics .diagnostics-schema-panel .diagnostics-two-col,
  html body.page-diagnostics .diagnostics-stats-panel .diagnostics-two-col {
    grid-template-columns: 1fr !important;
  }
}


/* ============================================================
   Phase 3L10S26A Month Rollover Wizard
   Dedicated rollover entrypoint and clearer reserve language.
   ============================================================ */

.page-rollover .rollover-wizard-panel {
  border-color: rgba(96, 165, 250, 0.35);
}

.rollover-step-cards {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  margin-top: 1rem;
}

.rollover-inner-panel {
  margin-top: 1rem;
  background:
    linear-gradient(180deg, rgba(59, 130, 246, 0.035), rgba(59, 130, 246, 0.01)),
    #0d1117;
}

.rollover-inner-panel h3 {
  margin-bottom: 0.35rem;
}

.rollover-wizard-form .form-grid {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.rollover-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.rollover-primary-button,
.rollover-primary-link {
  border-color: rgba(34, 197, 94, 0.72);
  background: rgba(34, 197, 94, 0.18);
  color: #bbf7d0;
  font-weight: 800;
}

.rollover-primary-button:hover,
.rollover-primary-link:hover {
  background: rgba(34, 197, 94, 0.28);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.14);
}

.secondary-button {
  background: rgba(15, 23, 42, 0.78);
  border-color: rgba(148, 163, 184, 0.34);
  color: #dbeafe;
}

.reserve-summary-help {
  margin-top: -0.35rem;
}

@media (max-width: 1000px) {
  .rollover-step-cards,
  .rollover-wizard-form .form-grid {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   Phase 3L10S26B Calculators Hub
   ============================================================ */

.calculators-hub-panel {
  border-color: rgba(125, 211, 252, 0.28);
}

.calculator-portal-cards {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  margin-top: 1rem;
}

.calculator-portal-card .stat-value {
  font-size: 1.35rem;
}

.calculator-placeholder-card {
  opacity: 0.78;
}

.calculator-tool-panel {
  margin-top: 1rem;
}

.calculator-context-note {
  margin: 0.85rem 0 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 0.85rem;
  background: rgba(15, 23, 42, 0.62);
  color: #cbd5e1;
}

.calculator-grid {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.calculator-results-cards {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  margin-top: 1rem;
}

.calculator-small-note {
  margin-top: 1rem;
}

@media (max-width: 1150px) {
  .calculator-portal-cards {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .calculator-grid,
  .calculator-results-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .calculator-portal-cards {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   Phase 3L10S26C COLA Chart Dependent Scenarios
   ============================================================ */

.va-cola-calculator-panel .calculator-results-cards {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

@media (min-width: 1350px) {
  .va-cola-calculator-panel .calculator-results-cards {
    grid-template-columns: repeat(6, minmax(180px, 1fr));
  }
}


/* ============================================================
   Phase 3L10S26D VA Rate Chart Link
   ============================================================ */

.calculator-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.calculator-heading-row h3 {
  margin-bottom: 0.35rem;
}

.calculator-official-link {
  white-space: nowrap;
  text-decoration: none;
}

.calculator-chart-help {
  margin: 0.75rem 0 1rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid rgba(251, 191, 36, 0.32);
  border-radius: 0.85rem;
  background: rgba(251, 191, 36, 0.08);
  color: #fde68a;
}

.calculator-chart-help em {
  color: #fef3c7;
}

@media (max-width: 800px) {
  .calculator-heading-row {
    flex-direction: column;
  }

  .calculator-official-link {
    width: 100%;
    text-align: center;
  }
}


/* ============================================================
   Phase 3L10S26H COLA Scenario Table
   ============================================================ */

.calculator-scenario-table-wrap {
  margin-top: 1rem;
  overflow-x: auto;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 0.9rem;
}

.calculator-scenario-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.calculator-scenario-table th,
.calculator-scenario-table td {
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  text-align: right;
  white-space: nowrap;
}

.calculator-scenario-table th:first-child,
.calculator-scenario-table td:first-child {
  text-align: left;
}

.calculator-scenario-table thead th {
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.74);
  font-weight: 700;
}

.calculator-scenario-table tbody th {
  color: #e5e7eb;
  font-weight: 650;
}

.calculator-scenario-table tbody tr:last-child th,
.calculator-scenario-table tbody tr:last-child td {
  border-bottom: 0;
}


/* ============================================================
   Phase 3L10S26I Calculator + Input Polish
   ============================================================ */

.calculators-hub-panel {
  padding: 1.25rem;
}

.calculator-portal-cards {
  gap: 1rem;
}

.calculator-portal-card {
  padding: 1rem 1.1rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.12), transparent 38%),
    rgba(15, 23, 42, 0.58);
}

.calculator-portal-card .stat-label {
  font-size: 0.98rem;
  color: #e5e7eb;
}

.calculator-portal-card .stat-value {
  margin-top: 0.35rem;
  font-size: 1.1rem;
  color: #93c5fd;
}

.calculator-portal-card .stat-sub {
  margin-top: 0.35rem;
  line-height: 1.35;
}

.va-cola-calculator-panel {
  padding: 1.2rem;
  border-color: rgba(96, 165, 250, 0.28);
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.72), rgba(15, 23, 42, 0.48)),
    rgba(2, 6, 23, 0.22);
}

.va-cola-calculator-panel .calculator-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 1rem 1.25rem;
  align-items: end;
  margin-top: 1rem;
}

.va-cola-calculator-panel .calculator-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  min-width: 0;
  color: #cbd5e1;
  font-size: 0.94rem;
  font-weight: 650;
}

.va-cola-calculator-panel input[type="text"],
.va-cola-calculator-panel input[type="number"],
.va-cola-calculator-panel input[inputmode="decimal"] {
  width: 100%;
  min-height: 2.85rem;
  padding: 0.68rem 0.82rem;
  border-radius: 0.72rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(2, 6, 23, 0.72);
  color: #e5e7eb;
  font-size: 1rem;
  line-height: 1.2;
  box-sizing: border-box;
}

.va-cola-calculator-panel input:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.82);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.24);
}

.va-cola-calculator-panel .calculator-results-cards {
  gap: 1rem;
  margin-top: 1.25rem;
}

.va-cola-calculator-panel .calculator-results-cards .stat-card {
  padding: 1rem;
  min-height: 8.1rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.62);
}

.va-cola-calculator-panel .calculator-results-cards .stat-label {
  color: #cbd5e1;
  font-size: 0.92rem;
  line-height: 1.25;
}

.va-cola-calculator-panel .calculator-results-cards .stat-value {
  margin-top: 0.45rem;
  font-size: 1.42rem;
  line-height: 1.15;
  color: #f8fafc;
}

.va-cola-calculator-panel .calculator-results-cards .stat-sub {
  margin-top: 0.4rem;
  line-height: 1.35;
  color: #94a3b8;
}

.calculator-chart-help {
  line-height: 1.45;
}

.calculator-scenario-table-wrap {
  margin-top: 1.25rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.calculator-scenario-table {
  font-size: 0.96rem;
}

.calculator-scenario-table th,
.calculator-scenario-table td {
  padding: 0.86rem 0.9rem;
}

.calculator-scenario-table tbody tr:nth-child(odd) {
  background: rgba(15, 23, 42, 0.35);
}

.calculator-scenario-table tbody tr:hover {
  background: rgba(30, 41, 59, 0.52);
}

/* Make small search inputs match the Quick Add feel. */
.transaction-search input[type="text"],
.transaction-search input[type="search"],
.search-panel input[type="text"],
.search-panel input[type="search"],
form[action*="search"] input[type="text"],
form[action*="search"] input[type="search"] {
  min-height: 2.85rem;
  padding: 0.68rem 0.85rem;
  border-radius: 0.72rem;
  font-size: 1rem;
  box-sizing: border-box;
}

/* Fallback for the Dashboard transaction search, which may not have a stable class. */
.panel input[placeholder*="Search amount"],
.panel input[placeholder*="description"],
.panel input[placeholder*="event ID"] {
  min-height: 2.85rem;
  padding: 0.68rem 0.85rem;
  border-radius: 0.72rem;
  font-size: 1rem;
  box-sizing: border-box;
}

@media (max-width: 1100px) {
  .va-cola-calculator-panel .calculator-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }
}

@media (max-width: 720px) {
  .va-cola-calculator-panel .calculator-grid {
    grid-template-columns: 1fr;
  }

  .va-cola-calculator-panel .calculator-results-cards {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   Phase 3L10S26J Force Input Polish + Cache Bust
   ============================================================ */

/* Calculator portal/cards: stronger override */
.calculators-hub-panel .calculator-portal-cards {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(190px, 1fr)) !important;
  gap: 1rem !important;
  margin-top: 1rem !important;
}

.calculators-hub-panel .calculator-portal-card {
  display: block !important;
  padding: 1rem 1.1rem !important;
  border: 1px solid rgba(148, 163, 184, 0.24) !important;
  border-radius: 1rem !important;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.14), transparent 42%),
    rgba(15, 23, 42, 0.68) !important;
}

/* COLA calculator: force the labels/inputs into roomy card-like form fields */
.va-cola-calculator-panel .calculator-grid,
.va-cola-calculator-panel.form-grid,
.va-cola-calculator-panel .form-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(260px, 1fr)) !important;
  gap: 1rem 1.25rem !important;
  align-items: end !important;
}

.va-cola-calculator-panel .calculator-grid label,
.va-cola-calculator-panel .form-grid label {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.4rem !important;
  width: 100% !important;
  min-width: 0 !important;
  color: #cbd5e1 !important;
  font-size: 0.95rem !important;
  font-weight: 650 !important;
  white-space: normal !important;
}

.va-cola-calculator-panel .calculator-grid input,
.va-cola-calculator-panel .form-grid input {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  min-height: 2.9rem !important;
  padding: 0.7rem 0.85rem !important;
  border-radius: 0.75rem !important;
  border: 1px solid rgba(148, 163, 184, 0.34) !important;
  background: rgba(2, 6, 23, 0.76) !important;
  color: #e5e7eb !important;
  font-size: 1rem !important;
  line-height: 1.2 !important;
  box-sizing: border-box !important;
}

.va-cola-calculator-panel .calculator-results-cards {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(220px, 1fr)) !important;
  gap: 1rem !important;
  margin-top: 1.25rem !important;
}

.va-cola-calculator-panel .calculator-results-cards .stat-card {
  padding: 1rem !important;
  min-height: 8rem !important;
  border-radius: 1rem !important;
  border: 1px solid rgba(148, 163, 184, 0.22) !important;
  background: rgba(15, 23, 42, 0.68) !important;
}

/* Dashboard transaction search: make the skinny field Quick-Add sized. */
.panel input[placeholder*="Search amount"],
.panel input[placeholder*="description"],
.panel input[placeholder*="event ID"],
.panel input[type="search"] {
  min-height: 2.9rem !important;
  padding: 0.7rem 0.85rem !important;
  border-radius: 0.75rem !important;
  font-size: 1rem !important;
  line-height: 1.2 !important;
  box-sizing: border-box !important;
}

@media (max-width: 1100px) {
  .calculators-hub-panel .calculator-portal-cards,
  .va-cola-calculator-panel .calculator-results-cards {
    grid-template-columns: repeat(2, minmax(220px, 1fr)) !important;
  }

  .va-cola-calculator-panel .calculator-grid,
  .va-cola-calculator-panel .form-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr)) !important;
  }
}

@media (max-width: 720px) {
  .calculators-hub-panel .calculator-portal-cards,
  .va-cola-calculator-panel .calculator-grid,
  .va-cola-calculator-panel .form-grid,
  .va-cola-calculator-panel .calculator-results-cards {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================================
   Phase 3L10S26K COLA Note Spacing
   ============================================================ */

.va-cola-calculator-panel .calculator-scenario-table-wrap {
  margin-bottom: 1.15rem !important;
}

.va-cola-calculator-panel .calculator-small-note {
  display: block;
  margin-top: 1.2rem !important;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  line-height: 1.45;
}


/* ============================================================
   Phase 3L10S27A Rollover Commit Flow
   ============================================================ */

.rollover-commit-panel {
  border-color: rgba(96, 165, 250, 0.32);
}

.rollover-preview-cards {
  grid-template-columns: repeat(5, minmax(170px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.rollover-preview-notes,
.rollover-preview-essentials,
.rollover-finalize-panel {
  margin-top: 1rem;
}

.rollover-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.rollover-preview-essentials .table-wrap {
  overflow-x: auto;
}

.rollover-preview-essentials table {
  min-width: 980px;
}

.rollover-finalize-panel {
  border-color: rgba(248, 113, 113, 0.28);
}

.rollover-finalize-button {
  font-size: 1.05rem;
  padding: 0.85rem 1.25rem;
}

.rollover-preview-links {
  margin-top: 1rem;
}

@media (max-width: 1100px) {
  .rollover-preview-cards {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .rollover-section-heading {
    flex-direction: column;
  }
}

@media (max-width: 700px) {
  .rollover-preview-cards {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Phase 3L10S27B Rollover Finalize Polish
   ============================================================ */

.rollover-finalize-panel {
  padding: 1.15rem 1.25rem !important;
}

.rollover-finalize-panel h3 {
  margin-bottom: 0.85rem;
}

.rollover-finalize-panel .warn-flash {
  margin: 0 0 1rem 0 !important;
  padding: 0.85rem 1rem !important;
  border-radius: 0.9rem !important;
  line-height: 1.4;
  max-width: 100%;
}

.rollover-finalize-form {
  margin: 0.25rem 0 0.75rem 0 !important;
}

.rollover-finalize-button {
  border-radius: 999px !important;
  padding: 0.78rem 1.2rem !important;
  font-size: 1rem !important;
  font-weight: 750 !important;
  box-shadow: none !important;
}

.rollover-preview-links {
  margin-top: 0.75rem !important;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  font-size: 0.95rem;
  line-height: 1.45;
}

.rollover-preview-links a {
  display: inline-block;
  margin-right: 0.35rem;
}

@media (max-width: 700px) {
  .rollover-finalize-button {
    width: 100%;
  }

  .rollover-preview-links a {
    display: block;
    margin: 0.25rem 0;
  }
}


/* ============================================================
   Phase 3L10S27E Delete Rollover Preview
   ============================================================ */

.rollover-delete-preview-form {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.rollover-delete-preview-button {
  border-radius: 999px !important;
  padding: 0.62rem 1rem !important;
  font-size: 0.92rem !important;
  opacity: 0.9;
}

.rollover-delete-preview-button:hover {
  opacity: 1;
}


/* ============================================================
   Phase 3L10S28A COLA Rollover Prompt
   ============================================================ */

.rollover-cola-review-panel,
.closeout-cola-review-panel {
  border-color: rgba(251, 191, 36, 0.38) !important;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.10), rgba(15, 23, 42, 0.18));
}

.rollover-cola-review-panel.is-hidden {
  display: none !important;
}

.rollover-cola-review-panel h3,
.closeout-cola-review-panel h2 {
  margin-bottom: 0.65rem;
}

.rollover-cola-confirm-label {
  display: flex !important;
  align-items: flex-start;
  gap: 0.7rem;
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(251, 191, 36, 0.28);
  border-radius: 0.9rem;
  background: rgba(15, 23, 42, 0.20);
  font-weight: 650;
  line-height: 1.4;
}

.rollover-cola-confirm-label input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.08rem;
  flex: 0 0 auto;
}

@media (max-width: 700px) {
  .rollover-cola-confirm-label {
    padding: 0.8rem;
  }
}


/* ============================================================
   Phase 3L10S28B Loan Amortization Calculator
   ============================================================ */

.calculator-anchor-card {
  text-decoration: none;
  color: inherit;
  display: block;
}

.calculator-anchor-card:hover {
  transform: translateY(-1px);
}

.loan-amortization-calculator-panel {
  margin-top: 1.25rem;
  border-color: rgba(96, 165, 250, 0.28);
}

.loan-calculator-grid {
  margin-top: 1rem;
}

.loan-amortization-calculator-panel .calculator-grid label {
  min-height: 6.25rem;
}

.loan-amortization-calculator-panel .calculator-grid input {
  width: 100%;
  min-height: 2.65rem;
  font-size: 1rem;
}

.loan-results-cards {
  margin-top: 1.15rem;
}

.loan-amortization-error {
  margin-top: 1rem;
}

.loan-amortization-table {
  min-width: 880px;
}

.loan-amortization-table td:nth-child(3),
.loan-amortization-table td:nth-child(4),
.loan-amortization-table td:nth-child(5),
.loan-amortization-table td:nth-child(6) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.loan-table-ellipsis td {
  text-align: center !important;
  color: var(--muted);
  letter-spacing: 0.2rem;
}

@media (max-width: 900px) {
  .loan-amortization-calculator-panel .calculator-grid {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   Phase 3L10S28C Loan Full Timeline
   ============================================================ */

.loan-balance-chart-card {
  margin-top: 1.15rem;
  padding: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 1rem;
  background: rgba(15, 23, 42, 0.16);
}

.loan-balance-chart-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.loan-balance-chart {
  width: 100%;
  overflow-x: auto;
}

.loan-balance-chart svg {
  width: 100%;
  min-width: 720px;
  height: auto;
  display: block;
}

.loan-chart-axis {
  stroke: rgba(148, 163, 184, 0.35);
  stroke-width: 1;
}

.loan-chart-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  opacity: 0.78;
}

.loan-chart-current-line {
  stroke: rgba(251, 191, 36, 0.75);
  stroke-width: 2;
  stroke-dasharray: 6 6;
}

.loan-chart-current-dot {
  fill: currentColor;
  stroke: rgba(251, 191, 36, 0.95);
  stroke-width: 3;
}

.loan-chart-label {
  fill: currentColor;
  opacity: 0.72;
  font-size: 13px;
}

.loan-table-current-row th,
.loan-table-current-row td {
  background: rgba(251, 191, 36, 0.10) !important;
  font-weight: 750;
}

@media (max-width: 700px) {
  .loan-balance-chart-header {
    flex-direction: column;
  }
}


/* ============================================================
   Phase 3L10S28D Loan Principal Interest Chart
   ============================================================ */

.loan-payment-split-chart-card {
  margin-top: 1rem;
}

.loan-chart-principal-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  opacity: 0.9;
}

.loan-chart-interest-line {
  fill: none;
  stroke: rgba(251, 191, 36, 0.92);
  stroke-width: 3;
  opacity: 0.95;
}

.loan-chart-crossover-line {
  stroke: rgba(34, 197, 94, 0.85);
  stroke-width: 2;
  stroke-dasharray: 5 5;
}

.loan-chart-crossover-dot {
  fill: rgba(34, 197, 94, 0.95);
  stroke: rgba(15, 23, 42, 0.85);
  stroke-width: 2;
}

.loan-chart-legend-principal {
  font-weight: 750;
}

.loan-chart-legend-interest {
  fill: rgba(251, 191, 36, 0.95);
  font-weight: 750;
}


/* ============================================================
   Phase 3L10S28F Loan Interest Savings Full Schedule
   ============================================================ */

.loan-full-schedule-toggle {
  display: inline-flex !important;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.16);
  font-weight: 700;
}

.loan-full-schedule-toggle input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
}

.loan-amortization-table tbody tr.loan-table-current-row td {
  border-top: 1px solid rgba(251, 191, 36, 0.28);
  border-bottom: 1px solid rgba(251, 191, 36, 0.28);
}


/* ============================================================
   Phase 3L10S28G Loan Interest Paid Spacing
   ============================================================ */

.loan-amortization-calculator-panel .calculator-small-note {
  margin-top: 1.45rem;
  padding-top: 0.95rem;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.loan-payment-split-chart-card {
  margin-bottom: 1.15rem;
}

.loan-full-schedule-toggle {
  margin-top: 1.3rem;
  margin-bottom: 0.95rem;
}

.loan-amortization-table-wrap {
  margin-top: 1.15rem;
}


/* ============================================================
   Phase 3L10S29A Home Equity Cash Invested
   ============================================================ */

.home-equity-calculator-panel {
  margin-top: 1.25rem;
  border-color: rgba(34, 197, 94, 0.24);
}

.home-equity-grid {
  margin-top: 1rem;
}

.home-equity-calculator-panel .calculator-grid label {
  min-height: 6.25rem;
}

.home-equity-calculator-panel .calculator-grid input {
  width: 100%;
  min-height: 2.65rem;
  font-size: 1rem;
}

.home-equity-results-cards {
  margin-top: 1.15rem;
}

.home-equity-table-wrap {
  margin-top: 1.2rem;
}

.home-equity-source-table {
  min-width: 820px;
}

.home-equity-source-table td:nth-child(2) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.home-equity-calculator-panel .calculator-small-note {
  margin-top: 1.45rem;
  padding-top: 0.95rem;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

@media (max-width: 900px) {
  .home-equity-calculator-panel .calculator-grid {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   Phase 3L10S29D1 Home Escrow Markup
   ============================================================ */

.home-equity-results-cards .stat-card {
  min-height: 8.2rem;
}

.home-equity-source-table tr th,
.home-equity-source-table tr td {
  vertical-align: top;
}


/* ============================================================
   Phase 3L10S31 Credit Card Payoff Calculator
   ============================================================ */

.credit-card-payoff-calculator-panel {
  margin-top: 1.25rem;
  border-color: rgba(248, 113, 113, 0.28);
}

.credit-card-payoff-controls {
  margin-top: 1rem;
}

.credit-card-payoff-controls label {
  min-height: 6.25rem;
}

.credit-card-payoff-controls input,
.credit-card-payoff-controls select,
.credit-card-payoff-input-table input {
  width: 100%;
  min-height: 2.45rem;
  font-size: 1rem;
}

.credit-card-payoff-results {
  margin-top: 1.15rem;
}

.credit-card-payoff-error {
  margin-top: 1rem;
}

.credit-card-payoff-table-wrap {
  margin-top: 1.15rem;
}

.credit-card-payoff-input-table {
  min-width: 1060px;
  table-layout: fixed;
}

.credit-card-payoff-input-table th:nth-child(1),
.credit-card-payoff-input-table td:nth-child(1) {
  width: 4.5rem;
  text-align: center;
}

.credit-card-payoff-input-table th:nth-child(2),
.credit-card-payoff-input-table td:nth-child(2) {
  width: 5.5rem;
}

.credit-card-payoff-input-table th:nth-child(3),
.credit-card-payoff-input-table td:nth-child(3) {
  width: 18rem;
}

.credit-card-payoff-input-table th:nth-child(4),
.credit-card-payoff-input-table td:nth-child(4),
.credit-card-payoff-input-table th:nth-child(5),
.credit-card-payoff-input-table td:nth-child(5),
.credit-card-payoff-input-table th:nth-child(6),
.credit-card-payoff-input-table td:nth-child(6),
.credit-card-payoff-input-table th:nth-child(7),
.credit-card-payoff-input-table td:nth-child(7) {
  width: 8.5rem;
}

.credit-card-payoff-input-table th:nth-child(8),
.credit-card-payoff-input-table td:nth-child(8) {
  width: 9rem;
}

.credit-card-payoff-grid {
  margin-top: 1rem;
}

.credit-card-payoff-mini-panel {
  margin-bottom: 0;
}

.credit-card-payoff-order-table {
  min-width: 720px;
}

.credit-card-payoff-schedule-table {
  min-width: 760px;
}

.credit-card-payoff-order-table td.num,
.credit-card-payoff-order-table th.num,
.credit-card-payoff-schedule-table td.num,
.credit-card-payoff-schedule-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
  .credit-card-payoff-controls {
    grid-template-columns: 1fr;
  }

  .credit-card-payoff-grid {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   Phase 3L10S31B Uber Payoff Planner
   ============================================================ */

.cc-uber-planner-panel {
  margin-top: 1.15rem;
  border-color: rgba(34, 197, 94, 0.28);
  background:
    radial-gradient(circle at top left, rgba(34, 197, 94, 0.08), transparent 28rem),
    var(--panel);
}

.cc-uber-controls {
  margin-top: 1rem;
  grid-template-columns: repeat(5, minmax(11rem, 1fr));
}

.cc-uber-controls label {
  min-height: 6.1rem;
}

.cc-uber-controls input {
  width: 100%;
  min-height: 2.45rem;
  font-size: 1rem;
}

.cc-uber-results {
  margin-top: 1rem;
}

.cc-uber-summary {
  margin-top: 1rem;
  border-color: rgba(34, 197, 94, 0.28);
  line-height: 1.45;
}

@media (max-width: 1300px) {
  .cc-uber-controls {
    grid-template-columns: repeat(2, minmax(11rem, 1fr));
  }
}

@media (max-width: 700px) {
  .cc-uber-controls {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   Phase 3L10S31C Uber Planner Clarity
   ============================================================ */

.cc-uber-mode-note {
  margin-top: 0.85rem;
  border-color: rgba(59, 130, 246, 0.25);
  line-height: 1.45;
}

.cc-uber-results .stat-card {
  min-height: 9.2rem;
}

.cc-uber-summary {
  font-size: 1rem;
}

.cc-uber-summary::before {
  content: "Plan explanation";
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}


/* ============================================================
   Phase 3L10S32 Uber Income Calculator Split
   ============================================================ */

.uber-income-calculator-panel {
  margin-top: 1.25rem;
  border-color: rgba(34, 197, 94, 0.28);
  background:
    radial-gradient(circle at top left, rgba(34, 197, 94, 0.08), transparent 28rem),
    var(--panel);
}

.uber-income-controls {
  margin-top: 1rem;
  grid-template-columns: repeat(3, minmax(12rem, 1fr));
}

.uber-income-controls label {
  min-height: 6.15rem;
}

.uber-income-controls input {
  width: 100%;
  min-height: 2.45rem;
  font-size: 1rem;
}

.uber-income-results {
  margin-top: 1.15rem;
}

.uber-income-results .stat-card {
  min-height: 9rem;
}

.uber-income-summary {
  margin-top: 1rem;
  border-color: rgba(34, 197, 94, 0.28);
  font-size: 1rem;
  line-height: 1.45;
}

.uber-income-summary::before {
  content: "Income goal explanation";
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 1000px) {
  .uber-income-controls {
    grid-template-columns: repeat(2, minmax(12rem, 1fr));
  }
}

@media (max-width: 700px) {
  .uber-income-controls {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   Phase 3L10S33 Credit Card Payoff Clarity
   ============================================================ */

.cc-payoff-quick-note {
  margin-top: 1rem;
  line-height: 1.45;
}

.cc-payoff-quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.cc-payoff-quick-buttons .button-link {
  min-height: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.8rem;
}

.cc-payoff-summary {
  margin-top: 1rem;
  border-color: rgba(59, 130, 246, 0.25);
  font-size: 1rem;
  line-height: 1.45;
}

.cc-payoff-summary::before {
  content: "Payoff summary";
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.credit-card-payoff-results .stat-card {
  min-height: 9.25rem;
}


/* ============================================================
   Phase 3L10S34 Dashboard Recent Events Column Guard
   ============================================================ */

.page-dashboard .recent-events-panel table.dashboard-recent-column-guarded {
  table-layout: auto !important;
  width: 100% !important;
  min-width: 68rem !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-column-guarded th.s24e-column-hidden,
.page-dashboard .recent-events-panel table.dashboard-recent-column-guarded td.s24e-column-hidden {
  display: none !important;
  visibility: collapse !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-column-guarded th.s24e-column-forced-visible,
.page-dashboard .recent-events-panel table.dashboard-recent-column-guarded td.s24e-column-forced-visible {
  display: table-cell !important;
  visibility: visible !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-column-guarded th,
.page-dashboard .recent-events-panel table.dashboard-recent-column-guarded td {
  vertical-align: middle !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-column-guarded td .quick-event-status-select,
.page-dashboard .recent-events-panel table.dashboard-recent-column-guarded td .shared-event-status-select {
  max-width: 11rem;
}

.page-dashboard .recent-events-panel table.dashboard-recent-column-guarded td.num,
.page-dashboard .recent-events-panel table.dashboard-recent-column-guarded th.num {
  text-align: right !important;
  white-space: nowrap !important;
}


/* ============================================================
   Phase 3L10S34B Dashboard Recent Events No Dance
   ============================================================ */

.page-dashboard .recent-events-panel .table-wrap {
  overflow-x: auto !important;
  width: 100% !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-column-stable {
  table-layout: auto !important;
  width: 100% !important;
  min-width: 68rem !important;
  max-width: none !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-column-stable th.s24e-column-hidden,
.page-dashboard .recent-events-panel table.dashboard-recent-column-stable td.s24e-column-hidden {
  display: none !important;
  visibility: collapse !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-column-stable th.s24e-column-forced-visible,
.page-dashboard .recent-events-panel table.dashboard-recent-column-stable td.s24e-column-forced-visible {
  display: table-cell !important;
  visibility: visible !important;
}

/* Physical shared-event columns:
   1 ID, 2 Date, 3 Due, 4 Cleared, 5 Status, 6 Account,
   7 Direction, 8 Amount, 9 Role, 10 Description, 11 Actions if present.
*/
.page-dashboard .recent-events-panel table.dashboard-recent-column-stable th:nth-child(1),
.page-dashboard .recent-events-panel table.dashboard-recent-column-stable td:nth-child(1) {
  width: 5.25rem !important;
  min-width: 5.25rem !important;
  max-width: 5.25rem !important;
  white-space: nowrap !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-column-stable th:nth-child(2),
.page-dashboard .recent-events-panel table.dashboard-recent-column-stable td:nth-child(2),
.page-dashboard .recent-events-panel table.dashboard-recent-column-stable th:nth-child(3),
.page-dashboard .recent-events-panel table.dashboard-recent-column-stable td:nth-child(3),
.page-dashboard .recent-events-panel table.dashboard-recent-column-stable th:nth-child(4),
.page-dashboard .recent-events-panel table.dashboard-recent-column-stable td:nth-child(4) {
  width: 8.5rem !important;
  min-width: 8.5rem !important;
  white-space: nowrap !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-column-stable th:nth-child(5),
.page-dashboard .recent-events-panel table.dashboard-recent-column-stable td:nth-child(5) {
  width: 12rem !important;
  min-width: 12rem !important;
  white-space: nowrap !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-column-stable th:nth-child(6),
.page-dashboard .recent-events-panel table.dashboard-recent-column-stable td:nth-child(6) {
  width: 16rem !important;
  min-width: 16rem !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-column-stable th:nth-child(7),
.page-dashboard .recent-events-panel table.dashboard-recent-column-stable td:nth-child(7) {
  width: 8.5rem !important;
  min-width: 8.5rem !important;
  white-space: nowrap !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-column-stable th:nth-child(8),
.page-dashboard .recent-events-panel table.dashboard-recent-column-stable td:nth-child(8) {
  width: 8.75rem !important;
  min-width: 8.75rem !important;
  text-align: right !important;
  white-space: nowrap !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-column-stable th:nth-child(9),
.page-dashboard .recent-events-panel table.dashboard-recent-column-stable td:nth-child(9) {
  width: 11rem !important;
  min-width: 11rem !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-column-stable th:nth-child(10),
.page-dashboard .recent-events-panel table.dashboard-recent-column-stable td:nth-child(10) {
  min-width: 24rem !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-column-stable th:nth-child(11),
.page-dashboard .recent-events-panel table.dashboard-recent-column-stable td:nth-child(11) {
  width: 9rem !important;
  min-width: 9rem !important;
  white-space: nowrap !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-column-stable th,
.page-dashboard .recent-events-panel table.dashboard-recent-column-stable td {
  vertical-align: middle !important;
}

.page-dashboard .recent-events-panel .s24e-table-settings-panel {
  z-index: 2000 !important;
}


/* ============================================================
   Phase 3L10S34C Dashboard Recent Events Actions View
   ============================================================ */

.page-dashboard .recent-events-panel [class*="table-settings"],
.page-dashboard .recent-events-panel [data-s24e-table-settings],
.page-dashboard .recent-events-panel [data-table-settings-trigger] {
  display: none !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions {
  table-layout: fixed !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  font-variant-numeric: tabular-nums !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions th,
.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions td {
  vertical-align: middle !important;
}

/* Hide everything except physical columns:
   2 Date, 5 Status, 6 Account, 8 Amount, 10 Description, 11 Actions.
*/
.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions th,
.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions td {
  display: none !important;
  visibility: collapse !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions th:nth-child(2),
.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions td:nth-child(2),
.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions th:nth-child(5),
.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions td:nth-child(5),
.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions th:nth-child(6),
.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions td:nth-child(6),
.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions th:nth-child(8),
.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions td:nth-child(8),
.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions th:nth-child(10),
.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions td:nth-child(10),
.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions th:nth-child(11),
.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions td:nth-child(11) {
  display: table-cell !important;
  visibility: visible !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions th:nth-child(2),
.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions td:nth-child(2) {
  width: 9rem !important;
  white-space: nowrap !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions th:nth-child(5),
.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions td:nth-child(5) {
  width: 12rem !important;
  white-space: nowrap !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions th:nth-child(6),
.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions td:nth-child(6) {
  width: 19rem !important;
  white-space: normal !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions th:nth-child(8),
.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions td:nth-child(8) {
  width: 9rem !important;
  text-align: right !important;
  white-space: nowrap !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions th:nth-child(10),
.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions td:nth-child(10) {
  width: auto !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions th:nth-child(11),
.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions td:nth-child(11) {
  width: 7.25rem !important;
  min-width: 7.25rem !important;
  white-space: nowrap !important;
  text-align: center !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions .s24-icon-actions,
.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions .income-native-actions {
  display: table-cell !important;
  text-align: center !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions .s24-icon-action,
.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions .income-native-action {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 2.05rem !important;
  min-height: 2.05rem !important;
  margin: 0 0.1rem !important;
  border-radius: 999px !important;
  border: 1px solid rgba(96, 165, 250, 0.38) !important;
  background: rgba(15, 23, 42, 0.72) !important;
  color: #bfdbfe !important;
  text-decoration: none !important;
  font-weight: 900 !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions .s24-icon-action:hover,
.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions .income-native-action:hover {
  border-color: rgba(96, 165, 250, 0.78) !important;
  background: rgba(37, 99, 235, 0.28) !important;
  color: #ffffff !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-fixed-actions select {
  max-width: 11rem !important;
}


/* ============================================================
   Phase 3L10S34D Dashboard Recent Native Table
   Dashboard Recent Events is now native:
   Date | Status | Account | Amount | Description | Actions
   ============================================================ */

.page-dashboard .recent-events-panel .dashboard-recent-events-wrap {
  overflow-x: auto !important;
  width: 100% !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-events-table {
  width: 100% !important;
  min-width: 64rem !important;
  table-layout: fixed !important;
  font-variant-numeric: tabular-nums !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-events-table th,
.page-dashboard .recent-events-panel table.dashboard-recent-events-table td {
  display: table-cell !important;
  visibility: visible !important;
  vertical-align: middle !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-events-table th:nth-child(1),
.page-dashboard .recent-events-panel table.dashboard-recent-events-table td:nth-child(1) {
  width: 9.5rem !important;
  white-space: nowrap !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-events-table th:nth-child(2),
.page-dashboard .recent-events-panel table.dashboard-recent-events-table td:nth-child(2) {
  width: 12rem !important;
  white-space: nowrap !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-events-table th:nth-child(3),
.page-dashboard .recent-events-panel table.dashboard-recent-events-table td:nth-child(3) {
  width: 20rem !important;
  white-space: normal !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-events-table th:nth-child(4),
.page-dashboard .recent-events-panel table.dashboard-recent-events-table td:nth-child(4) {
  width: 9rem !important;
  text-align: right !important;
  white-space: nowrap !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-events-table th:nth-child(5),
.page-dashboard .recent-events-panel table.dashboard-recent-events-table td:nth-child(5) {
  width: auto !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-events-table th:nth-child(6),
.page-dashboard .recent-events-panel table.dashboard-recent-events-table td:nth-child(6) {
  width: 7.5rem !important;
  text-align: center !important;
  white-space: nowrap !important;
}

.page-dashboard .recent-events-panel .dashboard-recent-date strong {
  display: block;
  font-weight: 800;
}

.page-dashboard .recent-events-panel .dashboard-recent-date-label {
  margin-top: 0.15rem;
  font-size: 0.78rem;
}

.page-dashboard .recent-events-panel .dashboard-recent-status-select {
  width: 10.7rem !important;
  min-width: 10.7rem !important;
  max-width: 10.7rem !important;
}

.page-dashboard .recent-events-panel .dashboard-recent-actions {
  text-align: center !important;
}

.page-dashboard .recent-events-panel .dashboard-recent-action {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 2.05rem !important;
  min-height: 2.05rem !important;
  margin: 0 0.1rem !important;
  border-radius: 999px !important;
  border: 1px solid rgba(96, 165, 250, 0.38) !important;
  background: rgba(15, 23, 42, 0.72) !important;
  color: #bfdbfe !important;
  text-decoration: none !important;
  font-weight: 900 !important;
}

.page-dashboard .recent-events-panel .dashboard-recent-action:hover {
  border-color: rgba(96, 165, 250, 0.78) !important;
  background: rgba(37, 99, 235, 0.28) !important;
  color: #ffffff !important;
}


/* ============================================================
   Phase 3L10S34E Dashboard Recent Native Unhide
   The old S34C rule hid anything with "table-settings" inside
   Dashboard Recent Events. Generic column settings adds that class
   to table wrappers, so the whole native table disappeared.
   ============================================================ */

.page-dashboard .recent-events-panel .dashboard-recent-events-wrap,
.page-dashboard .recent-events-panel .dashboard-recent-events-wrap.s24e-table-settings-wrap,
.page-dashboard .recent-events-panel .table-wrap.dashboard-recent-events-wrap {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  max-height: none !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
}

/* Dashboard Recent Events is fixed/native now. Hide only the controls,
   never the table wrapper. */
.page-dashboard .recent-events-panel .s24e-table-settings-toolbar,
.page-dashboard .recent-events-panel .s24e-table-settings-panel,
.page-dashboard .recent-events-panel .s24e-table-settings-button {
  display: none !important;
  visibility: hidden !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-events-table {
  display: table !important;
  visibility: visible !important;
}


/* ============================================================
   Phase 3L10S34F Dashboard Recent Colors
   Native Recent Events table:
   - signed outflows should be red/negative
   - status dropdowns should use the same pill colors as Open Items
   ============================================================ */

.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-amount {
  font-weight: 800 !important;
  font-variant-numeric: tabular-nums !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-amount.negative,
.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-amount.cf-money-out,
.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-amount.cashflow-negative,
.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-amount.money-flow-negative {
  color: var(--cf-flow-out, #ff3333) !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-amount.positive,
.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-amount.cf-money-in,
.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-amount.cashflow-positive,
.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-amount.money-flow-positive {
  color: var(--cf-flow-in, #22c55e) !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-status-select.status-pill-select {
  width: 10.7rem !important;
  min-width: 10.7rem !important;
  max-width: 10.7rem !important;
  padding: 0.34rem 1.65rem 0.34rem 0.72rem !important;
  border-radius: 999px !important;
  border-width: 1px !important;
  border-style: solid !important;
  font-size: 0.9rem !important;
  font-weight: 900 !important;
  line-height: 1.1 !important;
  background-color: rgba(15, 23, 42, 0.78) !important;
  color: var(--text, #e5eefb) !important;
  border-color: rgba(96, 165, 250, 0.42) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.025) !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-status-select.status-pill-select:hover,
.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-status-select.status-pill-select:focus {
  filter: brightness(1.08);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.05),
    0 0 0 3px rgba(59, 130, 246, 0.13) !important;
}

/* Class-based colors from PHP-rendered status. */
.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-status-select.status-pill-planned,
.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-status-select:has(option[value="planned"]:checked) {
  color: #facc15 !important;
  border-color: rgba(202, 138, 4, 0.82) !important;
  background-color: rgba(113, 63, 18, 0.20) !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-status-select.status-pill-committed,
.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-status-select:has(option[value="committed"]:checked) {
  color: #fb923c !important;
  border-color: rgba(249, 115, 22, 0.78) !important;
  background-color: rgba(124, 45, 18, 0.22) !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-status-select.status-pill-expected-deposit,
.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-status-select.status-pill-expected_deposit,
.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-status-select:has(option[value="expected_deposit"]:checked) {
  color: #93c5fd !important;
  border-color: rgba(59, 130, 246, 0.70) !important;
  background-color: rgba(30, 64, 175, 0.22) !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-status-select.status-pill-cleared,
.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-status-select:has(option[value="cleared"]:checked) {
  color: #4ade80 !important;
  border-color: rgba(34, 197, 94, 0.82) !important;
  background-color: rgba(20, 83, 45, 0.24) !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-status-select.status-pill-skipped,
.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-status-select:has(option[value="skipped"]:checked),
.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-status-select.status-pill-cancelled,
.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-status-select:has(option[value="cancelled"]:checked) {
  color: #cbd5e1 !important;
  border-color: rgba(148, 163, 184, 0.58) !important;
  background-color: rgba(51, 65, 85, 0.26) !important;
}

.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-status-select.status-pill-mitigated,
.page-dashboard .recent-events-panel table.dashboard-recent-events-table .dashboard-recent-status-select:has(option[value="mitigated"]:checked) {
  color: #93c5fd !important;
  border-color: rgba(59, 130, 246, 0.70) !important;
  background-color: rgba(30, 64, 175, 0.22) !important;
}

/* Phase 3L10S36 Main Balance Check Bank Target: Main Checking help text now reflects expected bank balance. */


/* ============================================================
   Phase 3L10S37 Credit Card Auto Available
   Available Credit = Credit Limit - Current Balance.
   ============================================================ */

.debt-card-edit-form input.credit-card-available-input[readonly],
.debt-card-edit-form input[name="available_credit"][readonly] {
  cursor: not-allowed !important;
  opacity: 0.78 !important;
  background: rgba(15, 23, 42, 0.72) !important;
  border-style: dashed !important;
}

.debt-card-edit-form input.credit-card-available-input.credit-card-available-negative {
  color: #fecaca !important;
  border-color: rgba(248, 113, 113, 0.72) !important;
}

/* Phase 3L10S38 Scheduled Nav Dedupe: Scheduled page action row deduplicated. */

/* Phase 3L10S38B Scheduled Guidance Restore: Scheduled guidance cards restored without duplicate action buttons. */


/* ============================================================
   Phase 3L10S39 Scheduled Table Compact Fit
   Default Scheduled Items view fits the panel.
   Optional/debug columns can still expand via the table settings cog.
   ============================================================ */

html body.page-scheduled .scheduled-items-debug-wrap,
html body.page-scheduled .scheduled-items-debug-wrap.s24e-table-settings-wrap {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
}

html body.page-scheduled table.scheduled-items-compact-fit-table {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  table-layout: fixed !important;
  border-collapse: separate !important;
  border-spacing: 0 0.34rem !important;
}

html body.page-scheduled table.scheduled-items-compact-fit-table th,
html body.page-scheduled table.scheduled-items-compact-fit-table td {
  min-width: 0 !important;
  max-width: none !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  vertical-align: middle !important;
}

/* Hide low-value default columns unless the cog explicitly forces them visible. */
html body.page-scheduled table.scheduled-items-compact-fit-table th:nth-child(1):not(.s24e-column-forced-visible),
html body.page-scheduled table.scheduled-items-compact-fit-table td:nth-child(1):not(.s24e-column-forced-visible),
html body.page-scheduled table.scheduled-items-compact-fit-table th:nth-child(5):not(.s24e-column-forced-visible),
html body.page-scheduled table.scheduled-items-compact-fit-table td:nth-child(5):not(.s24e-column-forced-visible),
html body.page-scheduled table.scheduled-items-compact-fit-table th:nth-child(10):not(.s24e-column-forced-visible),
html body.page-scheduled table.scheduled-items-compact-fit-table td:nth-child(10):not(.s24e-column-forced-visible) {
  display: none !important;
  visibility: hidden !important;
}

/* Default visible columns:
   Name | Type | Amount | Due Day | Due Date | Frequency | Status | Payment Account | Actions
*/
html body.page-scheduled table.scheduled-items-compact-fit-table th:nth-child(2),
html body.page-scheduled table.scheduled-items-compact-fit-table td:nth-child(2) {
  width: 23% !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

html body.page-scheduled table.scheduled-items-compact-fit-table th:nth-child(3),
html body.page-scheduled table.scheduled-items-compact-fit-table td:nth-child(3) {
  width: 10% !important;
}

html body.page-scheduled table.scheduled-items-compact-fit-table th:nth-child(4),
html body.page-scheduled table.scheduled-items-compact-fit-table td:nth-child(4) {
  width: 8.5% !important;
  text-align: right !important;
  white-space: nowrap !important;
}

html body.page-scheduled table.scheduled-items-compact-fit-table th:nth-child(6),
html body.page-scheduled table.scheduled-items-compact-fit-table td:nth-child(6) {
  width: 7% !important;
  text-align: center !important;
  white-space: nowrap !important;
}

html body.page-scheduled table.scheduled-items-compact-fit-table th:nth-child(7),
html body.page-scheduled table.scheduled-items-compact-fit-table td:nth-child(7) {
  width: 10% !important;
  text-align: center !important;
  white-space: nowrap !important;
}

html body.page-scheduled table.scheduled-items-compact-fit-table th:nth-child(8),
html body.page-scheduled table.scheduled-items-compact-fit-table td:nth-child(8) {
  width: 10% !important;
  text-align: center !important;
}

html body.page-scheduled table.scheduled-items-compact-fit-table th:nth-child(9),
html body.page-scheduled table.scheduled-items-compact-fit-table td:nth-child(9) {
  width: 8.5% !important;
  text-align: center !important;
}

html body.page-scheduled table.scheduled-items-compact-fit-table th:nth-child(11),
html body.page-scheduled table.scheduled-items-compact-fit-table td:nth-child(11) {
  width: 17% !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

html body.page-scheduled table.scheduled-items-compact-fit-table th:nth-child(12),
html body.page-scheduled table.scheduled-items-compact-fit-table td:nth-child(12),
html body.page-scheduled table.scheduled-items-compact-fit-table td.scheduled-actions {
  width: 6.5rem !important;
  min-width: 6.5rem !important;
  max-width: 6.5rem !important;
  text-align: center !important;
  white-space: nowrap !important;
  overflow: visible !important;
}

/* If optional/debug columns are turned on, allow the table to grow and scroll intentionally. */
html body.page-scheduled .scheduled-items-debug-wrap:has(table.scheduled-debug-active),
html body.page-scheduled .scheduled-items-debug-wrap:has(table.scheduled-items-compact-fit-table th.s24e-column-forced-visible),
html body.page-scheduled .scheduled-items-debug-wrap:has(table.scheduled-items-compact-fit-table td.s24e-column-forced-visible) {
  overflow-x: auto !important;
}

html body.page-scheduled table.scheduled-items-compact-fit-table.scheduled-debug-active,
html body.page-scheduled table.scheduled-items-compact-fit-table:has(th.scheduled-debug-col.s24e-column-forced-visible),
html body.page-scheduled table.scheduled-items-compact-fit-table:has(td.scheduled-debug-col.s24e-column-forced-visible) {
  min-width: 82rem !important;
  max-width: none !important;
}

@media (max-width: 1150px) {
  html body.page-scheduled .scheduled-items-debug-wrap,
  html body.page-scheduled .scheduled-items-debug-wrap.s24e-table-settings-wrap {
    overflow-x: auto !important;
  }

  html body.page-scheduled table.scheduled-items-compact-fit-table {
    min-width: 64rem !important;
    max-width: none !important;
  }
}

/* ============================================================
   Phase 3L10S44E Debt Record Payment Workflow
   ============================================================ */

.debt-record-payment-panel {
  margin-top: 1.25rem;
  border-color: rgba(34, 197, 94, 0.34);
  background:
    linear-gradient(
      180deg,
      rgba(34, 197, 94, 0.045),
      rgba(34, 197, 94, 0.012)
    ),
    rgba(15, 23, 42, 0.64);
}

.debt-record-payment-panel h3 {
  margin-top: 0;
}

.debt-record-payment-panel input[readonly] {
  cursor: not-allowed;
  opacity: 0.78;
}


/* Phase 3L10S45B Debt Payment History */
.debt-payment-history-panel {
  margin-top: 1rem;
}

.debt-payment-history-panel .panel-title-row {
  align-items: baseline;
  gap: 1rem;
}

.debt-payment-history-wrap {
  margin-top: 0.75rem;
}

.debt-payment-history-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.debt-payment-history-table th,
.debt-payment-history-table td {
  vertical-align: top;
}

.debt-payment-history-table th.num,
.debt-payment-history-table td.num {
  text-align: right;
  white-space: nowrap;
}

.debt-payment-history-table .debt-history-balance {
  font-weight: 700;
}

.debt-payment-history-table .debt-history-notes {
  min-width: 320px;
  white-space: normal;
  line-height: 1.45;
}


/* Phase 3L10S45C Payment History Display Cleanup */
html body .debt-payment-history-table th:nth-child(1),
html body .debt-payment-history-table td:nth-child(1) {
  width: 8.75rem;
  min-width: 8.75rem;
  white-space: nowrap;
}

html body .debt-payment-history-table th:nth-child(2),
html body .debt-payment-history-table td:nth-child(2) {
  width: 7.5rem;
  min-width: 7.5rem;
  white-space: nowrap;
  text-align: right;
}

html body .debt-payment-history-table th:nth-child(3),
html body .debt-payment-history-table td:nth-child(3) {
  width: 11rem;
  min-width: 11rem;
  white-space: nowrap;
  text-align: right;
}

html body .debt-payment-history-table th:nth-child(4),
html body .debt-payment-history-table td:nth-child(4) {
  width: auto;
  min-width: 24rem;
  white-space: normal;
}


/* Phase 3L10S45D Income to Debt Workflow */
.income-debt-offset-panel {
  margin-top: 1rem;
}

.income-debt-offset-panel h3,
.income-debt-offset-panel h4 {
  margin-top: 0;
}

.income-debt-offset-panel h4 {
  margin-top: 1.25rem;
  margin-bottom: 0.65rem;
}

.income-debt-offset-form {
  margin-top: 0.9rem;
}

.income-debt-offset-history-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.income-debt-offset-history-table th,
.income-debt-offset-history-table td {
  vertical-align: top;
}

.income-debt-offset-history-table th.num,
.income-debt-offset-history-table td.num {
  text-align: right;
  white-space: nowrap;
}

.income-offset-record-links {
  white-space: nowrap;
}


/* Phase 3L10S46 Annual Reserve Runway */
.annual-reserve-runway-panel {
  margin-top: 1rem;
}

.annual-runway-metrics {
  display: grid;
  grid-template-columns:
    repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.annual-runway-metrics > div {
  min-width: 0;
  padding: 0.8rem;
  border: 1px solid var(
    --panel-border,
    rgba(255, 255, 255, 0.1)
  );
  border-radius: 0.65rem;
  background: rgba(0, 0, 0, 0.12);
}

.annual-runway-metrics span,
.annual-runway-metrics small {
  display: block;
}

.annual-runway-metrics span {
  color: var(--muted);
  font-size: 0.82rem;
}

.annual-runway-metrics strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.15rem;
}

.annual-runway-metrics small {
  margin-top: 0.3rem;
  color: var(--muted);
  line-height: 1.35;
}

.annual-runway-details {
  margin-top: 1rem;
}

.annual-runway-details summary {
  cursor: pointer;
  font-weight: 700;
}

.annual-runway-table {
  width: 100%;
  min-width: 850px;
  border-collapse: collapse;
}

.annual-runway-table th,
.annual-runway-table td {
  vertical-align: top;
}

.annual-runway-table th.num,
.annual-runway-table td.num {
  text-align: right;
  white-space: nowrap;
}

.annual-runway-table th:first-child,
.annual-runway-table td:first-child {
  min-width: 7.5rem;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .annual-runway-metrics {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .annual-runway-metrics {
    grid-template-columns: 1fr;
  }
}


/* Phase 3L10S47 Reserves Command Center */
.dashboard-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.dashboard-section-header h2,
.dashboard-section-header p {
  margin-top: 0;
}

.page-dashboard .dashboard-main-cards {
  grid-template-columns:
    repeat(4, minmax(0, 1fr));
}

.dashboard-reserve-health-panel {
  margin-top: 1rem;
}

.dashboard-reserve-health-grid {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.dashboard-reserve-health-card {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr) auto;
  gap: 0.25rem 1rem;
  padding: 0.9rem;
  border: 1px solid
    rgba(255, 255, 255, 0.1);
  border-radius: 0.65rem;
  background: rgba(0, 0, 0, 0.12);
  color: inherit;
  text-decoration: none;
}

.dashboard-reserve-health-card:hover {
  border-color:
    rgba(77, 157, 255, 0.65);
  background:
    rgba(38, 91, 170, 0.12);
}

.dashboard-reserve-health-card span,
.dashboard-reserve-health-card small {
  min-width: 0;
}

.dashboard-reserve-health-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

.dashboard-reserve-health-card strong {
  grid-column: 1;
  font-size: 1.15rem;
}

.dashboard-reserve-health-card small {
  grid-column: 1;
  color: var(--muted);
  line-height: 1.35;
}

.dashboard-reserve-health-card em {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
  font-style: normal;
  font-weight: 700;
  text-align: right;
}

.dashboard-analysis-details {
  margin-top: 1rem;
}

.dashboard-analysis-details > summary {
  cursor: pointer;
  padding: 0.75rem;
  border: 1px solid
    rgba(255, 255, 255, 0.1);
  border-radius: 0.55rem;
  font-weight: 700;
}

.dashboard-analysis-details[open]
  > summary {
  margin-bottom: 0.85rem;
}

.dashboard-cash-in-summary {
  margin-top: 1rem;
}

.reserve-command-header {
  margin-bottom: 1rem;
}

.reserve-analysis-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
}

.reserve-analysis-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 2.35rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid
    rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: inherit;
  text-decoration: none;
}

.reserve-analysis-tabs a:hover,
.reserve-analysis-tabs a.active {
  border-color:
    rgba(77, 157, 255, 0.8);
  background:
    rgba(38, 104, 220, 0.3);
}

.reserves-page > .panel,
.reserves-page
  > .annual-reserve-runway-panel {
  margin-top: 1rem;
}

.reserve-analysis-metrics {
  display: grid;
  grid-template-columns:
    repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.reserve-analysis-metrics article {
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid
    rgba(255, 255, 255, 0.1);
  border-radius: 0.65rem;
  background: rgba(0, 0, 0, 0.12);
}

.reserve-analysis-metrics span,
.reserve-analysis-metrics small {
  display: block;
}

.reserve-analysis-metrics span {
  color: var(--muted);
  font-size: 0.82rem;
}

.reserve-analysis-metrics strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.15rem;
}

.reserve-analysis-metrics small {
  margin-top: 0.3rem;
  color: var(--muted);
  line-height: 1.35;
}

.reserve-analysis-table-wrap,
.account-balance-check-wrap,
.reserve-events-panel .table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.reserve-analysis-table,
.reserve-events-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

.account-balance-check-table {
  min-width: 860px;
}
.reserve-analysis-table th,
.reserve-analysis-table td,
.account-balance-check-table th,
.account-balance-check-table td {
  vertical-align: top;
}

.reserve-analysis-table th,
.account-balance-check-table th {
  white-space: nowrap;
}

.reserve-analysis-table th.num,
.reserve-analysis-table td.num {
  text-align: right;
  white-space: nowrap;
}

.reserve-scheduled-items-table
  th:first-child,
.reserve-scheduled-items-table
  td:first-child {
  min-width: 15rem;
}

@media (max-width: 1050px) {
  .page-dashboard .dashboard-main-cards {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

  .reserve-analysis-metrics {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .dashboard-section-header {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-reserve-health-grid,
  .reserve-analysis-metrics,
  .page-dashboard .dashboard-main-cards {
    grid-template-columns: 1fr;
  }

  .dashboard-reserve-health-card {
    grid-template-columns:
      minmax(0, 1fr);
  }

  .dashboard-reserve-health-card em {
    grid-column: 1;
    grid-row: auto;
    text-align: left;
  }
}


/* Phase 3L10S47B Reserve Layout Cleanup */

/*
 * Do not stretch the collapsed chart panel to the full height of
 * the Open Items panel.
 */
.page-dashboard .dashboard-activity-grid {
  align-items: start;
}

.page-dashboard .dashboard-spending,
.page-dashboard .dashboard-open {
  align-self: start;
}


/*
 * Account Balance Check:
 * preserve readable headings and allow horizontal scrolling
 * instead of compressing every column.
 */
.account-balance-check-wrap {
  overflow-x: auto;
}

.account-balance-check-table {
  width: 100%;
  min-width: 980px;
  table-layout: fixed;
}

.account-balance-check-table th,
.account-balance-check-table td {
  vertical-align: top;
}

.account-balance-check-table th {
  white-space: nowrap;
}

.account-balance-check-table th:nth-child(1),
.account-balance-check-table td:nth-child(1) {
  width: 24%;
}

.account-balance-check-table th:nth-child(2),
.account-balance-check-table td:nth-child(2) {
  width: 21%;
}

.account-balance-check-table th:nth-child(3),
.account-balance-check-table td:nth-child(3) {
  width: 20%;
}

.account-balance-check-table th:nth-child(4),
.account-balance-check-table td:nth-child(4) {
  width: 17%;
}

.account-balance-check-table th:nth-child(5),
.account-balance-check-table td:nth-child(5) {
  width: 18%;
}

.account-balance-check-table .balance-account-cell,
.account-balance-check-table .balance-check-expected-cell {
  white-space: normal;
  overflow-wrap: anywhere;
}

.account-balance-check-table .balance-account-cell strong,
.account-balance-check-table .balance-account-cell small,
.account-balance-check-table .balance-check-expected-cell strong,
.account-balance-check-table .balance-check-expected-cell small {
  display: block;
}

.account-balance-check-table .balance-check-actual-input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}

.account-balance-check-table .balance-check-diff-cell {
  white-space: normal;
}

.account-balance-check-table .balance-check-status-pill {
  display: inline-flex;
  margin-top: 0.3rem;
}


/*
 * Scheduled reserve items:
 * long annual-obligation names must remain inside their own column.
 */
.reserve-scheduled-items-table {
  width: 100%;
  min-width: 1180px;
  table-layout: auto;
}

.reserve-scheduled-items-table th {
  white-space: nowrap;
}

.reserve-scheduled-items-table th:nth-child(1),
.reserve-scheduled-items-table td:nth-child(1) {
  width: 32%;
  min-width: 22rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

.reserve-scheduled-items-table td:nth-child(1) a {
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.reserve-scheduled-items-table th:nth-child(2),
.reserve-scheduled-items-table td:nth-child(2) {
  width: 9rem;
  min-width: 9rem;
  white-space: nowrap;
}

.reserve-scheduled-items-table th:nth-child(3),
.reserve-scheduled-items-table td:nth-child(3),
.reserve-scheduled-items-table th:nth-child(4),
.reserve-scheduled-items-table td:nth-child(4) {
  width: 9rem;
  min-width: 9rem;
  white-space: nowrap;
  text-align: right;
}

.reserve-scheduled-items-table th:nth-child(5),
.reserve-scheduled-items-table td:nth-child(5) {
  width: 8rem;
  min-width: 8rem;
  white-space: nowrap;
}

.reserve-scheduled-items-table th:nth-child(6),
.reserve-scheduled-items-table td:nth-child(6) {
  width: 13rem;
  min-width: 13rem;
  white-space: nowrap;
}

.reserve-scheduled-items-table th:nth-child(7),
.reserve-scheduled-items-table td:nth-child(7) {
  width: 7rem;
  min-width: 7rem;
  white-space: nowrap;
}


/* Phase 3L10S48 Loan Activity Ledger */
.debt-loan-activity-panel {
  margin-top: 1rem;
}

.debt-loan-activity-panel .panel-title-row {
  align-items: flex-start;
  gap: 1rem;
}

.debt-loan-activity-panel .panel-title-row h3,
.debt-loan-activity-panel .panel-title-row p {
  margin-top: 0;
}

.debt-loan-summary-grid {
  display: grid;
  grid-template-columns:
    repeat(5, minmax(0, 1fr));
  gap: 0.7rem;
  margin: 0.9rem 0 1rem;
}

.debt-loan-summary-grid article {
  min-width: 0;
  padding: 0.8rem;
  border: 1px solid
    rgba(255, 255, 255, 0.1);
  border-radius: 0.65rem;
  background: rgba(0, 0, 0, 0.12);
}

.debt-loan-summary-grid span,
.debt-loan-summary-grid small {
  display: block;
}

.debt-loan-summary-grid span {
  color: var(--muted);
  font-size: 0.8rem;
}

.debt-loan-summary-grid strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.1rem;
}

.debt-loan-summary-grid small {
  margin-top: 0.3rem;
  color: var(--muted);
  line-height: 1.3;
}

.debt-loan-activity-wrap {
  overflow-x: auto;
}

.debt-loan-activity-table {
  width: 100%;
  min-width: 930px;
  border-collapse: collapse;
}

.debt-loan-activity-table th,
.debt-loan-activity-table td {
  vertical-align: top;
}

.debt-loan-activity-table th {
  white-space: nowrap;
}

.debt-loan-activity-table th:nth-child(1),
.debt-loan-activity-table td:nth-child(1) {
  width: 8rem;
  min-width: 8rem;
  white-space: nowrap;
}

.debt-loan-activity-table th:nth-child(2),
.debt-loan-activity-table td:nth-child(2) {
  width: 9rem;
  min-width: 9rem;
  white-space: nowrap;
}

.debt-loan-activity-table th:nth-child(3),
.debt-loan-activity-table td:nth-child(3),
.debt-loan-activity-table th:nth-child(4),
.debt-loan-activity-table td:nth-child(4) {
  width: 10rem;
  min-width: 10rem;
  text-align: right;
  white-space: nowrap;
}

.debt-loan-activity-table th:nth-child(5),
.debt-loan-activity-table td:nth-child(5) {
  min-width: 22rem;
}

.debt-loan-activity-table th:nth-child(6),
.debt-loan-activity-table td:nth-child(6) {
  width: 5rem;
  min-width: 5rem;
  white-space: nowrap;
}

.debt-loan-activity-notes strong,
.debt-loan-activity-notes small {
  display: block;
}

.debt-loan-activity-notes small {
  margin-top: 0.25rem;
  color: var(--muted);
  line-height: 1.4;
}

@media (max-width: 1100px) {
  .debt-loan-summary-grid {
    grid-template-columns:
      repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .debt-loan-summary-grid {
    grid-template-columns: 1fr;
  }
}


/* Phase 3L10S49 Balance Check Placement */
.page-dashboard .main-balance-check-panel {
  margin-top: 1rem;
}

.page-dashboard
  .main-balance-check-panel
  .account-balance-check-table {
  min-width: 760px;
}

.page-dashboard
  .main-balance-check-panel
  .account-balance-check-table
  th:nth-child(1),
.page-dashboard
  .main-balance-check-panel
  .account-balance-check-table
  td:nth-child(1) {
  width: 26%;
}

.page-dashboard
  .main-balance-check-panel
  .account-balance-check-table
  th:nth-child(2),
.page-dashboard
  .main-balance-check-panel
  .account-balance-check-table
  td:nth-child(2) {
  width: 20%;
}

.page-dashboard
  .main-balance-check-panel
  .account-balance-check-table
  th:nth-child(3),
.page-dashboard
  .main-balance-check-panel
  .account-balance-check-table
  td:nth-child(3) {
  width: 20%;
}

.page-dashboard
  .main-balance-check-panel
  .account-balance-check-table
  th:nth-child(4),
.page-dashboard
  .main-balance-check-panel
  .account-balance-check-table
  td:nth-child(4) {
  width: 17%;
}

.page-dashboard
  .main-balance-check-panel
  .account-balance-check-table
  th:nth-child(5),
.page-dashboard
  .main-balance-check-panel
  .account-balance-check-table
  td:nth-child(5) {
  width: 17%;
}

.reserves-page .reserve-balance-check-panel {
  margin-top: 1rem;
}


/* Phase 3L10S50 Top Dashboard Pie Strip */

/*
 * This strip sits directly below the budget-month header and
 * above the four primary balance cards.
 */
.page-dashboard .dashboard-top-chart-strip {
  display: grid;
  grid-template-columns:
    repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 0.75rem 0 1rem;
  align-items: stretch;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-card {
  min-width: 0;
  min-height: 11.5rem;
  margin: 0;
  padding: 0.8rem 0.9rem;
  overflow: visible;
  border: 1px solid
    rgba(148, 163, 184, 0.16);
  background:
    radial-gradient(
      circle at top left,
      rgba(96, 165, 250, 0.07),
      transparent 14rem
    ),
    rgba(15, 23, 42, 0.2);
}
.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-heading {
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-heading h3 {
  min-width: 0;
  font-size: 0.94rem;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-heading span {
  font-size: 0.78rem;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-note {
  min-height: 2em;
  margin: 0.2rem 0 0.25rem;
  font-size: 0.7rem;
  line-height: 1.25;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-layout {
  display: block;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-visual {
  position: relative;
  display: grid;
  place-items: center;
  width: 7.6rem;
  height: 7.6rem;
  margin: 0.15rem auto 0;
  overflow: visible;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
}

.page-dashboard .dashboard-pie-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.page-dashboard .dashboard-pie-track {
  fill: none;
  stroke: rgba(148, 163, 184, 0.13);
  stroke-width: 20;
}

.page-dashboard .dashboard-pie-slice {
  fill: none;
  stroke-width: 20;
  cursor: help;
  transition:
    opacity 140ms ease,
    stroke-width 140ms ease,
    filter 140ms ease;
}

.page-dashboard
  .dashboard-pie-visual.has-active-slice
  .dashboard-pie-slice:not(.is-active) {
  opacity: 0.3;
}

.page-dashboard
  .dashboard-pie-slice:hover,
.page-dashboard
  .dashboard-pie-slice:focus,
.page-dashboard
  .dashboard-pie-slice.is-active {
  stroke-width: 24;
  filter:
    drop-shadow(
      0 0 3px rgba(255, 255, 255, 0.25)
    );
  outline: none;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-hole {
  position: absolute;
  inset: 27%;
  width: auto;
  height: auto;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid
    rgba(148, 163, 184, 0.18);
  box-shadow: none;
  pointer-events: none;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-hole span {
  font-size: 0.57rem;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-hole strong {
  max-width: 4.2rem;
  font-size: 0.7rem;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.page-dashboard .dashboard-pie-tooltip {
  position: absolute;
  z-index: 30;
  min-width: 9.5rem;
  max-width: 14rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid
    rgba(148, 163, 184, 0.3);
  border-radius: 0.55rem;
  background: rgba(5, 12, 24, 0.97);
  box-shadow:
    0 0.6rem 1.4rem rgba(0, 0, 0, 0.38);
  color: #e5eefb;
  pointer-events: none;
  transform:
    translate(
      -50%,
      calc(-100% - 0.75rem)
    );
  text-align: left;
}

.page-dashboard
  .dashboard-pie-tooltip[hidden] {
  display: none;
}

.page-dashboard
  .dashboard-pie-tooltip strong {
  display: block;
  margin-bottom: 0.25rem;
  overflow-wrap: anywhere;
}

.page-dashboard
  .dashboard-pie-tooltip span {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.page-dashboard
  .dashboard-pie-tooltip em {
  color: var(--muted, #94a3b8);
  font-style: normal;
}

.page-dashboard
  .dashboard-pie-hover-hint {
  color: var(--muted, #94a3b8);
  font-size: 0.64rem;
}
.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-legend {
  display: none;
}

/* The lower disclosure now contains only the bridge. */
.page-dashboard
  .dashboard-bridge-details-body {
  margin-top: 0.85rem;
}

.page-dashboard
  .dashboard-bridge-details
  .dashboard-cash-flow-bridge {
  margin: 0;
}

@media (max-width: 1100px) {
  .page-dashboard
    .dashboard-top-chart-strip {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

  .page-dashboard
    .dashboard-top-chart-strip
    .dashboard-pie-card:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .page-dashboard
    .dashboard-top-chart-strip {
    grid-template-columns: 1fr;
  }

  .page-dashboard
    .dashboard-top-chart-strip
    .dashboard-pie-card:last-child {
    grid-column: auto;
  }
}


/* Phase 3L10S50B Dashboard Compaction */

/* Permanent bridge replaces the former four-card row. */
.page-dashboard
  .dashboard-top-cash-flow-bridge {
  margin: 0 0 1rem;
  padding: 0.9rem;
}

.page-dashboard
  .dashboard-bridge-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.page-dashboard
  .dashboard-bridge-title h2,
.page-dashboard
  .dashboard-bridge-title p {
  margin-top: 0;
}

.page-dashboard
  .dashboard-bridge-title p {
  margin-bottom: 0;
}

.page-dashboard
  .dashboard-bridge-live-metrics {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(9rem, 1fr));
  gap: 0.55rem;
}

.page-dashboard
  .dashboard-bridge-live-metrics article {
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid
    rgba(148, 163, 184, 0.17);
  border-radius: 0.6rem;
  background: rgba(0, 0, 0, 0.13);
}

.page-dashboard
  .dashboard-bridge-live-metrics span,
.page-dashboard
  .dashboard-bridge-live-metrics strong {
  display: block;
}

.page-dashboard
  .dashboard-bridge-live-metrics span {
  color: var(--muted);
  font-size: 0.72rem;
}

.page-dashboard
  .dashboard-bridge-live-metrics strong {
  margin-top: 0.2rem;
  font-size: 1rem;
  white-space: nowrap;
}

.page-dashboard
  .bridge-live-positive {
  color: var(--good);
}

.page-dashboard
  .bridge-live-negative {
  color: var(--bad);
}

.page-dashboard
  .dashboard-top-cash-flow-bridge
  .cash-flow-bridge-equation {
  margin-top: 0;
}

.page-dashboard
  .dashboard-top-cash-flow-bridge
  .cash-flow-bridge-note {
  margin-top: 0.65rem;
  font-size: 0.72rem;
  line-height: 1.35;
}


/*
 * Compact utility row:
 * search gets more space, Cash In Totals stays small.
 */
.page-dashboard
  .dashboard-utility-grid {
  display: grid;
  grid-template-columns:
    minmax(0, 1.45fr)
    minmax(18rem, 0.75fr);
  gap: 0.8rem;
  margin-top: 1rem;
  align-items: start;
}

.page-dashboard
  .dashboard-utility-grid
  > .panel {
  min-width: 0;
  margin-top: 0;
}

.page-dashboard
  .dashboard-transaction-search-panel.has-results {
  grid-column: 1 / -1;
}

.page-dashboard
  .dashboard-transaction-search-panel h2,
.page-dashboard
  .dashboard-cash-in-summary h2 {
  font-size: 1rem;
}

.page-dashboard
  .dashboard-transaction-search-help {
  margin-bottom: 0;
  font-size: 0.7rem;
}

.page-dashboard
  .dashboard-cash-in-summary
  table {
  margin-bottom: 0;
}

.page-dashboard
  .dashboard-cash-in-summary
  th,
.page-dashboard
  .dashboard-cash-in-summary
  td {
  padding-top: 0.42rem;
  padding-bottom: 0.42rem;
}


/* Spending only exists when the query returned actual rows. */
.page-dashboard
  .dashboard-spending {
  margin-top: 1rem;
}


/*
 * Open Items now receives the full Dashboard width.
 * Show up to two readable lines and retain a native title
 * tooltip containing the complete event name.
 */
.page-dashboard
  .dashboard-open {
  width: 100%;
  margin-top: 1rem;
}

.page-dashboard
  .dashboard-open-mainline {
  min-width: 0;
}

.page-dashboard
  .dashboard-open-mainline strong {
  display: -webkit-box !important;
  max-width: 100% !important;
  max-height: 2.5em;
  overflow: hidden !important;
  white-space: normal !important;
  text-overflow: ellipsis !important;
  overflow-wrap: anywhere;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}


/* The old disclosure is no longer rendered. */
.page-dashboard
  .dashboard-bridge-details {
  display: none !important;
}


@media (max-width: 1050px) {
  .page-dashboard
    .dashboard-utility-grid {
    grid-template-columns: 1fr;
  }

  .page-dashboard
    .dashboard-transaction-search-panel.has-results {
    grid-column: auto;
  }
}

@media (max-width: 760px) {
  .page-dashboard
    .dashboard-bridge-header {
    flex-direction: column;
  }

  .page-dashboard
    .dashboard-bridge-live-metrics {
    width: 100%;
    grid-template-columns: 1fr;
  }
}


/* Phase 3L10S50C Dashboard Chart Polish */

.page-dashboard
  .dashboard-top-chart-strip {
  align-items: stretch;
  gap: 0.9rem;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-card {
  display: grid;
  grid-template-rows:
    auto minmax(9.75rem, 1fr) auto;
  min-height: 13.5rem;
  padding: 1rem 1.05rem 0.85rem;
  border-color:
    rgba(148, 163, 184, 0.2);
  background:
    radial-gradient(
      circle at 50% 64%,
      rgba(96, 165, 250, 0.055),
      transparent 8.5rem
    ),
    linear-gradient(
      145deg,
      rgba(30, 41, 59, 0.34),
      rgba(15, 23, 42, 0.2)
    );
  box-shadow:
    inset 0 1px 0
      rgba(255, 255, 255, 0.025),
    0 0.25rem 0.85rem
      rgba(0, 0, 0, 0.09);
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-heading {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.75rem;
  min-height: 2rem;
  margin: 0;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-heading h3 {
  margin: 0;
  font-size: 1.04rem;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-heading span {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-heading
  .dashboard-pie-display-value {
  font-size: 0.93rem;
  font-weight: 750;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-note {
  display: none;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-layout {
  display: grid;
  place-items: center;
  min-height: 9.75rem;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-visual {
  width: 9rem;
  height: 9rem;
  margin: 0;
  filter:
    drop-shadow(
      0 0.35rem 0.55rem
      rgba(0, 0, 0, 0.18)
    );
}

.page-dashboard
  .dashboard-pie-track {
  stroke:
    rgba(148, 163, 184, 0.11);
  stroke-width: 17;
}

.page-dashboard
  .dashboard-pie-slice {
  stroke-width: 17;
}
.page-dashboard
  .dashboard-pie-slice:hover,
.page-dashboard
  .dashboard-pie-slice:focus,
.page-dashboard
  .dashboard-pie-slice.is-active {
  stroke-width: 21;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-hole {
  inset: 29%;
  background:
    radial-gradient(
      circle at 40% 35%,
      rgba(30, 41, 59, 0.98),
      rgba(10, 17, 30, 0.98)
    );
  border:
    1px solid
    rgba(148, 163, 184, 0.13);
  box-shadow:
    inset 0 0 1.25rem
      rgba(0, 0, 0, 0.22);
}

.page-dashboard
  .dashboard-pie-hover-hint {
  align-self: end;
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.2;
  text-align: center;
}

.page-dashboard
  .dashboard-pie-tooltip {
  min-width: 10.5rem;
  padding: 0.65rem 0.75rem;
  border-color:
    rgba(148, 163, 184, 0.4);
  border-radius: 0.65rem;
  font-size: 0.82rem;
}

.page-dashboard
  .dashboard-pie-tooltip strong {
  font-size: 0.87rem;
}

.page-dashboard
  .dashboard-pie-tooltip span {
  margin-top: 0.15rem;
  font-size: 0.78rem;
}


/*
 * Full-width Open Items makes the previous custom hover-title
 * helper unnecessary. Names remain readable across two lines.
 */
.page-dashboard
  .dashboard-open-mainline strong {
  cursor: inherit;
}


@media (max-width: 1100px) {
  .page-dashboard
    .dashboard-top-chart-strip
    .dashboard-pie-card:last-child {
    min-height: 12.75rem;
  }
}

@media (max-width: 700px) {
  .page-dashboard
    .dashboard-top-chart-strip
    .dashboard-pie-card {
    min-height: 12.75rem;
  }
}


/* Phase 3L10S50D Professional Dashboard Charts */

.page-dashboard
  .dashboard-top-chart-strip {
  gap: 1rem;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-card {
  --chart-card-accent: #4f8cff;

  position: relative;
  isolation: isolate;
  grid-template-rows:
    auto minmax(10.75rem, 1fr) auto;
  min-height: 14.75rem;
  padding: 1.05rem 1.1rem 0.95rem;
  overflow: hidden;
  border:
    1px solid
    rgba(143, 166, 199, 0.18);
  border-radius: 0.9rem;
  background:
    radial-gradient(
      circle at 50% 60%,
      color-mix(
        in srgb,
        var(--chart-card-accent) 7%,
        transparent
      ),
      transparent 9rem
    ),
    linear-gradient(
      145deg,
      rgba(25, 35, 51, 0.76),
      rgba(13, 21, 34, 0.88)
    );
  box-shadow:
    inset 0 1px 0
      rgba(255, 255, 255, 0.035),
    0 0.35rem 1.25rem
      rgba(0, 0, 0, 0.12);
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-card::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  right: 1rem;
  left: 1rem;
  height: 2px;
  background:
    linear-gradient(
      90deg,
      transparent,
      var(--chart-card-accent),
      transparent
    );
  opacity: 0.68;
}

.page-dashboard
  .dashboard-pie-card-income {
  --chart-card-accent: #4f8cff;
}

.page-dashboard
  .dashboard-pie-card-expense {
  --chart-card-accent: #e9a23b;
}

.page-dashboard
  .dashboard-pie-card-net {
  --chart-card-accent: #22a06b;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-heading {
  min-height: 2.15rem;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-heading h3 {
  font-size: 1.08rem;
  font-weight: 720;
  letter-spacing: 0.008em;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-heading span {
  font-size: 0.8rem;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-heading
  .dashboard-pie-display-value {
  font-size: 0.98rem;
  font-weight: 760;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-layout {
  min-height: 10.75rem;
}

.page-dashboard
  .dashboard-top-chart-strip
  .dashboard-pie-visual {
  width: 10.25rem;
  height: 10.25rem;
  filter:
    drop-shadow(
      0 0.5rem 0.65rem
      rgba(0, 0, 0, 0.22)
    );
}

.page-dashboard
  .dashboard-pie-outline {
  fill: none;
  stroke:
    rgba(148, 163, 184, 0.12);
  stroke-width: 1;
}

.page-dashboard
  .dashboard-pie-track {
  fill: none;
  stroke:
    rgba(148, 163, 184, 0.095);
  stroke-width: 12.5;
}

.page-dashboard
  .dashboard-pie-inner-disc {
  fill:
    rgba(11, 19, 31, 0.64);
  stroke:
    rgba(148, 163, 184, 0.105);
  stroke-width: 1;
}

.page-dashboard
  .dashboard-pie-slice {
  fill: none;
  stroke-width: 12.5;
  stroke-linecap: butt;
  cursor: help;
  filter:
    drop-shadow(
      0 0.16rem 0.2rem
      rgba(0, 0, 0, 0.18)
    );
  transition:
    opacity 150ms ease,
    stroke-width 150ms ease,
    filter 150ms ease;
}

.page-dashboard
  .dashboard-pie-visual.has-active-slice
  .dashboard-pie-slice:not(.is-active) {
  opacity: 0.16;
}

.page-dashboard
  .dashboard-pie-slice:hover,
.page-dashboard
  .dashboard-pie-slice:focus,
.page-dashboard
  .dashboard-pie-slice.is-active {
  stroke-width: 15;
  filter:
    drop-shadow(
      0 0 0.3rem
      var(
        --pie-active-accent,
        rgba(79, 140, 255, 0.7)
      )
    )
    drop-shadow(
      0 0.25rem 0.25rem
      rgba(0, 0, 0, 0.22)
    );
}

.page-dashboard
  .dashboard-pie-tooltip {
  border:
    1px solid
    rgba(148, 163, 184, 0.32);
  border-left:
    3px solid
    var(
      --pie-tooltip-accent,
      #4f8cff
    );
  background:
    linear-gradient(
      145deg,
      rgba(11, 18, 30, 0.985),
      rgba(19, 28, 43, 0.985)
    );
  box-shadow:
    0 0.75rem 1.8rem
      rgba(0, 0, 0, 0.42);
}

.page-dashboard
  .dashboard-pie-summary {
  display: grid;
  grid-template-columns:
    auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.65rem;
  padding: 0.48rem 0.6rem;
  border:
    1px solid
    rgba(148, 163, 184, 0.12);
  border-radius: 0.65rem;
  background:
    rgba(3, 9, 18, 0.2);
}

.page-dashboard
  .dashboard-pie-summary-dot {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 999px;
  box-shadow:
    0 0 0 3px
      rgba(255, 255, 255, 0.035);
}

.page-dashboard
  .dashboard-pie-summary > span {
  min-width: 0;
}

.page-dashboard
  .dashboard-pie-summary small,
.page-dashboard
  .dashboard-pie-summary strong {
  display: block;
}

.page-dashboard
  .dashboard-pie-summary small {
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.1;
}

.page-dashboard
  .dashboard-pie-summary strong {
  margin-top: 0.13rem;
  overflow: hidden;
  font-size: 0.78rem;
  line-height: 1.15;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.page-dashboard
  .dashboard-pie-summary > b {
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.page-dashboard
  .dashboard-pie-hover-hint,
.page-dashboard
  .dashboard-pie-hole {
  display: none;
}

@media (max-width: 1100px) {
  .page-dashboard
    .dashboard-top-chart-strip
    .dashboard-pie-card,
  .page-dashboard
    .dashboard-top-chart-strip
    .dashboard-pie-card:last-child {
    min-height: 14rem;
  }
}

@media (max-width: 700px) {
  .page-dashboard
    .dashboard-top-chart-strip
    .dashboard-pie-card {
    min-height: 13.75rem;
  }

  .page-dashboard
    .dashboard-top-chart-strip
    .dashboard-pie-visual {
    width: 9.5rem;
    height: 9.5rem;
  }
}


/* ============================================================
   Phase 3L10S56A2 Dashboard Tooltip Portal
   ============================================================ */

body.page-dashboard
  .dashboard-pie-tooltip.dashboard-pie-tooltip-portal {
  position: fixed !important;
  z-index: 100000 !important;
  left: 0;
  top: 0;
  right: auto !important;
  bottom: auto !important;
  margin: 0 !important;
  transform: none !important;
  pointer-events: none !important;
}

body.page-dashboard
  .dashboard-pie-tooltip.dashboard-pie-tooltip-portal[hidden] {
  display: none !important;
}
