/* cash-flow-transactions
   Cash Flow page > Transactions tab (list, filter, export, detail, modals).
   Values from Figma frames 18622:399389 (list), 18622:402130 (detail),
   18622:402429/402565 (edit name / note), 18622:402889/403544 (change
   category), 18799:133088-135836 (options / export). All classes are
   prefixed `cft-` to stay out of the other Cash Flow stylesheets. */

.cft-tab {
  display: flex;
  flex-direction: column;
  gap: 40px;
  width: 100%;
  max-width: 782px;
}

/* --- Recolorable mask icon --- */

.cft-mask {
  display: inline-block;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

/* --- Search row --- */

.cft-search-row {
  display: flex;
  gap: 16px;
  align-items: stretch;
  width: 100%;
}

.cft-search {
  flex: 1 0 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #203658;
  border: 1px solid var(--control-border);
  border-radius: 8px;
}

.cft-search input {
  flex: 1 0 0;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: #FFFFFF;
  font-family: "Geist", sans-serif;
  font-size: 16px;
  line-height: 25px;
  padding: 0;
}

.cft-search input::placeholder {
  color: var(--light-gray);
}

.cft-filter-btn {
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 7px;
  border-radius: 40px;
  background: #203658;
  border: 1px solid #3D5678;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cft-filter-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 10px;
  background: #E3AD45;
  color: #16294A;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

/* --- Transaction list --- */

.cft-list-wrap {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

.cft-list {
  display: flex;
  flex-direction: column;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
}

.cft-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: #203658;
  border-bottom: 1px solid #3D5678;
}

.cft-list-header p,
.cft-list-header h2 {
  margin: 0;
  color: #E3AD45;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
}

.cft-menu-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cft-menu-btn img {
  transform: rotate(90deg);
}

.cft-empty {
  padding: 16px 24px;
  background: #2B4468;
  color: #A3B3C8;
  font-size: 14px;
  line-height: 1.4;
}

.cft-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 24px;
  margin: 0;
  background: #2B4468;
  border: 0;
  border-bottom: 1px solid #3D5678;
  color: #FFFFFF;
  text-align: left;
  font-family: inherit;
}

/* The rows' list (WCAG 1.3.1) - laid out as if the rows sat directly in
   `.cft-list`. */
.cft-rows {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cft-rows > li:last-child > .cft-row {
  border-bottom: 0;
}

.cft-row:hover {
  background: #31507A;
}

.cft-row-info {
  flex: 1 0 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 16px;
}

.cft-row-text {
  flex: 1 0 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cft-row-name {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cft-row-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #A3B3C8;
  font-size: 12px;
  line-height: 1.4;
}

.cft-row-amount {
  margin: 0;
  flex-shrink: 0;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

.cft-row-amount.credit,
.cft-detail-amount.credit {
  color: var(--green-light);
}

/* Logos: merchant image in a white circle, or category icon on a colored square. */

.cft-logo-img {
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.333px solid #FFFFFF;
  background: #FFFFFF;
  overflow: hidden;
}

.cft-logo-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cft-logo-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Pagination --- */

.cft-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.cft-page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid #3D5678;
  background: #203658;
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cft-page-btn.active {
  background: #FFFFFF;
  color: #16294A;
}

.cft-page-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.cft-page-gap {
  color: #A3B3C8;
}

/* --- Detail --- */

.cft-detail {
  display: flex;
  flex-direction: column;
  gap: 40px;
  align-items: flex-start;
}

.cft-back {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
}

.cft-back-circle {
  width: 40px;
  height: 40px;
  border-radius: 40px;
  background: #203658;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cft-detail-card {
  width: 531px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 35px;
  padding: 40px;
  border-radius: 12px;
  background: #203658;
}

.cft-detail-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.cft-detail-name {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  word-break: break-word;
}

.cft-detail-amount {
  margin: 0;
  font-size: 32px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
}

.cft-detail-sections {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cft-detail-box {
  display: flex;
  flex-direction: column;
  padding: 16px 24px;
  border-radius: 12px;
  background: #2B4468;
  overflow: hidden;
}

.cft-detail-info {
  gap: 8px;
}

.cft-detail-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
  line-height: 1.4;
}

.cft-detail-line .value {
  font-weight: 500;
  line-height: 1.2;
  text-align: right;
}

.cft-category-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 149px;
  padding: 6px 16px;
  border-radius: 40px;
  border: 1px solid #3D5678;
  background: #2B4468;
  color: #FFFFFF;
  font-size: 14px;
  line-height: 1.4;
}

.cft-category-pill.locked {
  cursor: default;
}

.cft-category-pill-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cft-detail-actions {
  padding: 0;
}

.cft-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 16px 24px;
  border: 0;
  border-top: 1px solid #3D5678;
  background: transparent;
  color: #FFFFFF;
  text-align: left;
}

.cft-action-row:first-child {
  border-top: 0;
}

.cft-action-row.danger {
  color: #ED0000;
}

.cft-action-main {
  flex: 1 0 0;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.cft-action-text {
  flex: 1 0 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cft-action-label {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
}

.cft-action-sub {
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

/* --- Modal chrome --- */

.cft-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.cft-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(1.5px);
  -webkit-backdrop-filter: blur(1.5px);
  cursor: default;
}

.cft-modal {
  position: relative;
  max-width: 100%;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 40px;
  padding: 24px 40px 40px;
  border-radius: 24px;
  border: 2px solid #3D5678;
  background: #16294A;
  box-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
  color: #FFFFFF;
}

.cft-modal-top {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cft-modal-x-row {
  display: flex;
  justify-content: flex-end;
}

.cft-modal-title {
  margin: 0;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.2;
}

.cft-modal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cft-modal-bar-title {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
}

.cft-modal-spacer {
  width: 40px;
  height: 40px;
}

.cft-icon-btn {
  width: 40px;
  height: 40px;
  padding: 8px;
  border: 0;
  border-radius: 40px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cft-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cft-full {
  width: 100%;
  padding-left: 24px;
  padding-right: 24px;
}

.cft-danger-pill {
  background: #ED0000;
  border-color: #ED0000;
}

/* --- Form fields --- */

.cft-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cft-field-label {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 17px;
}

.cft-input {
  width: 100%;
  height: 40px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--control-border);
  background: #2B4468;
  color: #FFFFFF;
  font-family: "Geist", sans-serif;
  font-size: 16px;
  line-height: 25px;
  outline: none;
  color-scheme: dark;
}

.cft-input:focus {
  border-color: #A3B3C8;
}

.cft-textarea {
  height: 89px;
  resize: vertical;
}

.cft-field-hint {
  margin: 0;
  color: #A3B3C8;
  font-size: 14px;
  line-height: 20px;
}

.cft-delete-text {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
}

/* --- Change category --- */

.cft-modal.center > .cft-cat-bottom {
  align-self: center;
  width: 279px;
}

.cft-cat-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cft-cat-group-title {
  margin: 0;
  color: #E3AD45;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
}

.cft-cat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.cft-cat-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #3D5678;
  background: #2B4468;
  color: #FFFFFF;
}

.cft-cat-tile.selected {
  border: 2px solid #FFFFFF;
  padding: 7px;
}

.cft-cat-tile-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cft-cat-tile-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

.cft-cat-tile-check {
  position: absolute;
  top: 6px;
  right: 6px;
}

/* --- Apply-to-all confirm --- */

.cft-apply {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: left;
}

.cft-apply-title {
  margin: 0;
  align-self: stretch;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.2;
}

.cft-apply-body {
  margin: 0 0 24px;
  align-self: stretch;
  color: #A3B3C8;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

.cft-apply-visual {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #FFFFFF;
}

.cft-apply-old {
  position: relative;
}

.cft-apply-repeat {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 24px;
  height: 24px;
  border-radius: 20px;
  border: 1px solid #3D5678;
  background: #2B4468;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cft-apply-new {
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background: #2B4468;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cft-apply-count {
  margin: 0;
  color: #A3B3C8;
  font-size: 14px;
  font-style: italic;
  font-weight: 500;
  line-height: 1.5;
}

/* --- Filter modal --- */

.cft-filter {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cft-filter-clear-row {
  display: flex;
  justify-content: flex-end;
  margin-top: -24px;
}

.cft-filter-clear {
  border: 0;
  padding: 0;
  background: transparent;
  color: #E3AD45;
  font-size: 16px;
  font-weight: 700;
}

.cft-filter-row,
.cft-radio-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #3D5678;
  background: #2B4468;
  color: #FFFFFF;
  font-size: 16px;
  text-align: left;
}

.cft-filter-row-label {
  font-weight: 500;
}

.cft-filter-row-value {
  flex: 1 0 0;
  min-width: 0;
  color: #A3B3C8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cft-filter-row-value.set {
  color: #E3AD45;
}

.cft-filter-scroll {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
}

.cft-radio-row.selected {
  border: 1.5px solid #12A566;
}

.cft-radio {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--control-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cft-radio-row.selected .cft-radio {
  border-color: #12A566;
}

.cft-radio-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #12A566;
}

.cft-radio-label {
  flex: 1 0 0;
  min-width: 0;
  line-height: 1.5;
}

.cft-filter-range {
  margin: -24px 0 8px;
  color: #A3B3C8;
  font-size: 14px;
  text-align: center;
}

.cft-date-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.cft-filter .cft-modal-actions {
  margin-top: 32px;
}

/* --- Transaction options --- */

.cft-options {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 0;
}

.cft-option-row {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 40px;
  padding: 0 24px;
  border: 0;
  background: transparent;
  color: #FFFFFF;
  text-align: left;
}

div.cft-option-row {
  cursor: default;
}

a.cft-option-row {
  text-decoration: none;
}

.cft-option-row.disabled {
  opacity: 0.5;
}

.cft-option-text {
  flex: 1 0 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cft-option-label {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
}

.cft-option-sub {
  margin: 0;
  color: #A3B3C8;
  font-size: 14px;
  line-height: 1.4;
}

.cft-option-sub.white {
  color: #FFFFFF;
}

.cft-divider {
  height: 1px;
  width: 100%;
  background: #3D5678;
}

/* --- Export --- */

.cft-export {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  padding: 40px 16px;
}

.cft-export-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.cft-export-head.sent {
  gap: 24px;
}

.cft-export-badge {
  padding: 8px;
  border-radius: 12px;
  background: #12A566;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cft-export-lead {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
  text-align: center;
}

.cft-export-lead strong {
  font-weight: 700;
}

.cft-export-summary-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.cft-export-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  padding: 16px;
  border-radius: 8px;
  background: #203658;
}

.cft-export-eyebrow {
  margin: 0;
  color: #E3AD45;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
}

.cft-export-count {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.2;
}

.cft-export-filters {
  margin: 0;
  padding: 0 0 0 21px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #A3B3C8;
  font-size: 14px;
  line-height: 1.4;
  list-style: disc;
}

.cft-adjust-filters {
  align-self: flex-end;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #A3B3C8;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

.cft-export-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 358px;
  max-width: 100%;
}

.cft-export-btn {
  width: 342px;
  max-width: 100%;
  padding-left: 24px;
  padding-right: 24px;
}

.cft-export-warning {
  margin: 0;
  color: #FFFFFF;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
}

.cft-export-warning span {
  color: #A3B3C8;
}

.cft-export-warning strong {
  font-weight: 700;
}

.cft-export-sent-text {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  text-align: center;
}

.cft-export-sent-title {
  margin: 0;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.2;
}

.cft-export-sent-body {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
}

/* --- Toast --- */

.cft-toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: calc(100vw - 32px);
  padding: 8px 8px 8px 16px;
  border-radius: 12px;
  background: var(--green-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  color: #FFFFFF;
}

.cft-toast p {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  padding: 8px 0;
}

.cft-toast-undo {
  width: 78px;
  height: 40px;
  border-radius: 40px;
  border: 1px solid #FFFFFF;
  background: transparent;
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 700;
}

/* --- Narrow viewports --- */

@media (max-width: 640px) {
  .cft-modal {
    padding: 16px 16px 24px;
    gap: 24px;
  }

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

  .cft-detail-card {
    padding: 24px 16px;
  }

  .cft-date-fields {
    grid-template-columns: 1fr;
  }
}

/* --- Reflow (WCAG 1.4.10 / 1.4.4) --- desktop unchanged. */

.cft-modal.center > .cft-cat-bottom {
  max-width: 100%;
}

@media (max-width: 767.98px) {
  .cft-overlay {
    padding: 16px;
  }

  .cft-modal {
    max-height: calc(100vh - 32px);
  }

  .cft-list-header,
  .cft-row,
  .cft-action-row,
  .cft-detail-box {
    padding-left: 16px;
    padding-right: 16px;
  }

  .cft-option-row {
    padding: 0 8px;
  }

  .cft-detail-line {
    flex-wrap: wrap;
  }

  .cft-row-name {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .cft-cat-tile {
    min-width: 0;
  }

  .cft-cat-tile-name {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .cft-category-pill {
    min-width: 0;
    max-width: 100%;
  }

  .cft-toast {
    width: calc(100vw - 32px);
  }

  .cft-toast-undo {
    flex-shrink: 0;
  }
}
