﻿/* ===== FINANCE TABS ===== */
.fin-tab-bar {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 20px;
  width: fit-content;
  flex-wrap: wrap
}

.fin-tab-btn {
  padding: 9px 20px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: var(--font-body);
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--g3);
  cursor: pointer;
  transition: var(--tr);
  white-space: nowrap;
  flex: 1;
  min-width: 100px
}

.fin-tab-btn.active {
  background: var(--card);
  color: var(--navy);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(var(--ws-black-rgb), .09)
}

.fin-tab-btn:hover:not(.active) {
  color: var(--dark);
  background: rgba(var(--ws-white-rgb), .6)
}

.fin-panel {
  display: none
}

.fin-panel.active {
  display: block
}

.fin-cmp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px
}

.fin-prog-row {
  margin-bottom: 12px
}

.fin-prog-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 5px
}

.fin-prog-track {
  height: 8px;
  background: var(--glass-border);
  border-radius: var(--radius-sm);
  overflow: hidden
}

.fin-prog-fill {
  height: 100%;
  border-radius: 10px;
  transition: width .5s ease
}

.fin-tbl th {
  text-align: left;
  padding: 7px 10px;
  color: var(--g3);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .4px
}

.fin-tbl td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px
}

.fin-tbl tr:last-child td {
  border-bottom: none
}

.fin-tbl td.num {
  text-align: right;
  white-space: nowrap;
  font-weight: 600
}

.fin-tbl td.num.red {
  color: var(--red)
}

.fin-tbl td.num.grn {
  color: var(--green)
}

.rab-footer {
  margin-top: 24px;
  padding: 20px;
  background: var(--glass-bg);
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--ws-border);
}

.rab-drag-handle {
  cursor: grab;
  color: var(--g3);
  font-size: 16px;
  user-select: none;
  padding: 0 4px;
  letter-spacing: 1px;
}

#fin-panel-rab .tw table th:first-child,
#fin-panel-rab .tw table td:first-child {
  width: 32px;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center;
}

.rab-drag-handle:active {
  cursor: grabbing
}

tr.rab-dragging {
  opacity: 0.4;
}

tr.rab-drag-over td {
  border-top: 2.5px solid var(--teal-d) !important;
}

.rab-footer .rf-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  font-size: var(--font-base);
  border-bottom: 1px solid var(--ws-border);
  color: var(--dark);
}

.rab-footer .rf-row:last-child {
  border-bottom: none;
}

.rab-footer .rf-row span:last-child {
  font-weight: 700;
  text-align: right;
}

.rab-footer .rf-row.total {
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
  padding: 15px 0;
  margin-top: 10px;
  border-top: 2px dashed var(--ws-border-strong);
  border-bottom: none;
}

.rab-footer .rf-row.total span:last-child {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 18px;
  color: var(--teal);   /* light mode: lagoon; dark mode flips to Sunset Gold */
}

@media(max-width:768px) {
  .fin-cmp-grid {
    grid-template-columns: 1fr
  }

  .fin-tab-btn {
    padding: 8px 14px;
    font-size: 12px
  }

  /* Match Calculator card header style */
  #fin-panel-rab .card-hd {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start !important;
  }

  #fin-panel-rab .card-hd>div {
    width: 100%;
    flex-wrap: wrap;
  }

  #fin-panel-rab .card-hd select,
  #fin-panel-rab .card-hd button {
    width: 100%;
  }

  .rab-drag-handle {
    display: none !important;
  }

  #fin-panel-rab .tw table th:first-child,
  #fin-panel-rab .tw table td:first-child,
  #fin-panel-rab .tw table th:nth-child(2),
  #fin-panel-rab .tw table td:nth-child(2) {
    display: none !important;
  }

  #fin-panel-transaction .card:first-child table th:nth-child(4),
  #fin-panel-transaction .card:first-child table td:nth-child(4),
  #fin-panel-transaction .card:first-child table th:nth-child(5),
  #fin-panel-transaction .card:first-child table td:nth-child(5) {
    display: none;
  }
}

.fin-tbl-planned-mobile {
  display: none;
}

@media(max-width:520px) {
  .fin-sum-tbl .col-planned {
    display: none
  }

  .fin-sum-tbl td,
  .fin-sum-tbl th {
    padding: 6px 6px;
    font-size: 11px
  }

  .fin-prog-label {
    font-size: 11px
  }

  /* Planned column is hidden above — surface it back as a sub-line under
     the item name so mobile users don't lose the planned-vs-actual context. */
  .fin-tbl-planned-mobile {
    display: block;
    font-size: 10px;
    font-weight: 500;
    color: var(--g3);
    margin-top: 2px;
    white-space: nowrap;
  }
}