/* cash-flow-split - Split Transaction modal (SplitTransactionWebModal).
   Figma: 18835:144275 / 145094 / 145400 / 145901 / 146306. */

.split-overlay {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(1.5px);
  -webkit-backdrop-filter: blur(1.5px);
}

.split-picker-overlay {
  z-index: 960;
}

.split-modal {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  width: 650px;
  max-width: 100%;
  margin: auto;
  padding: 24px 40px 40px;
  background: var(--navy-mid);
  border: 2px solid var(--navy-border);
  border-radius: 24px;
  box-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
  color: var(--white);
}

.split-modal p,
.split-picker p {
  margin: 0;
}

.split-modal button,
.split-picker button {
  font-family: inherit;
  color: inherit;
  cursor: pointer;
}

.split-mask-icon {
  display: inline-block;
  flex-shrink: 0;
  background-color: var(--white);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-position: center;
  mask-position: center;
}

/* Header */
.split-top {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.split-x-row {
  display: flex;
  justify-content: flex-end;
  width: 100%;
}

.split-x {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 40px;
  background: transparent;
}

.split-title {
  width: 100%;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.2;
}

/* Content */
.split-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

.split-intro {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
}

.split-divider {
  width: 100%;
  height: 1px;
  flex-shrink: 0;
  background: var(--navy-border);
}

.split-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

/* Split By */
.split-by {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.split-by-label {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
}

.split-by-toggles {
  display: flex;
  align-items: center;
  gap: 8px;
}

.split-toggle {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 40px;
  padding: 8px 16px;
  background: var(--navy-card-secondary);
  border: 1px solid var(--navy-border);
  border-radius: 40px;
}

.split-toggle .split-toggle-icon {
  background-color: var(--white);
}

.split-toggle.selected {
  background: var(--gold);
}

.split-toggle.selected .split-toggle-icon {
  background-color: var(--navy-mid);
}

/* Card */
.split-card {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
  padding: 24px;
  background: var(--navy-card);
  border-radius: 12px;
}

.split-card-top {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.split-txn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 0;
  border-bottom: 1px solid var(--navy-border);
}

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

.split-logo {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  overflow: hidden;
  background: var(--white);
  border: 1.333px solid var(--white);
  border-radius: 50%;
}

.split-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

.split-logo.fallback {
  background: var(--navy-card-secondary);
  border: none;
}

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

.split-txn-name {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.split-txn-date {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--light-gray);
}

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

.split-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.split-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 60px;
  width: 100%;
}

.split-base-amount {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  white-space: nowrap;
}

/* Category dropdown pill */
.split-pill {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 149px;
  max-width: 240px;
  padding: 6px 16px;
  overflow: hidden;
  background: var(--navy-card-secondary);
  border: 1px solid var(--navy-border);
  border-radius: 40px;
}

.split-pill.empty {
  border-color: #C96B67;
}

.split-pill-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.split-pill-text {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Amount input */
.split-input {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  width: 120px;
  height: 40px;
  padding: 8px;
  background: var(--navy-card-secondary);
  border: 1px solid var(--control-border);
  border-radius: 8px;
}

.split-input.error {
  border-color: #C96B67;
}

.split-input:focus-within {
  border-color: var(--light-gray);
}

.split-input.error:focus-within {
  border-color: #C96B67;
}

.split-input img {
  flex-shrink: 0;
}

.split-input input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
  line-height: 25px;
  color: var(--white);
}

.split-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
}

.split-error {
  width: 100%;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  color: #D1817E;
}

.split-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 0 8px;
  border: none;
  border-radius: 12px;
  background: transparent;
  font-size: 16px;
  font-weight: 600;
  line-height: 25px;
}

.split-modal .split-add {
  color: var(--gold);
}

/* Save and exit */
.split-save {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 342px;
  max-width: 100%;
  height: 40px;
  padding: 8px 24px;
  background: var(--white);
  border: 1px solid var(--navy-border);
  border-radius: 40px;
  font-size: 16px;
  font-weight: 500;
  line-height: 25px;
  text-transform: capitalize;
}

.split-modal .split-save {
  color: var(--navy-mid);
}

.split-modal .split-save:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Category picker */
.split-picker {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 650px;
  max-width: 100%;
  max-height: calc(100vh - 48px);
  margin: auto;
  overflow: hidden;
  background: var(--navy-mid);
  border: 2px solid var(--navy-border);
  border-radius: 24px;
  box-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
  color: var(--white);
}

.split-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  height: 60px;
  padding: 0 16px;
  border-bottom: 1px solid var(--navy-border);
}

.split-picker-title {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
}

.split-picker-spacer {
  width: 40px;
}

.split-picker-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  overflow-y: auto;
}

.split-picker-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.split-picker-label {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--gold);
}

.split-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.split-picker-item {
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: var(--navy-card-secondary);
  border: 1px solid var(--navy-border);
  border-radius: 8px;
}

.split-picker-item.selected {
  border: 2px solid var(--green);
}

.split-picker-item.unavailable {
  opacity: 0.4;
  cursor: default;
}

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

.split-picker-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

.split-picker-check {
  position: absolute;
  top: -6px;
  right: -6px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: var(--green);
  border: 2px solid var(--navy-mid);
  border-radius: 50%;
}

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

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

  .split-modal {
    gap: 24px;
    padding: 16px 16px 24px;
  }

  .split-card {
    padding: 16px;
  }

  .split-by {
    flex-wrap: wrap;
    gap: 8px;
  }

  .split-line {
    flex-wrap: wrap;
    height: auto;
    min-height: 60px;
    padding: 8px 0;
  }

  .split-pill {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
  }

  .split-txn {
    flex-wrap: wrap;
  }

  .split-txn-name,
  .split-base-amount {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .split-picker-header {
    height: auto;
    min-height: 60px;
  }

  .split-picker-body {
    padding: 16px;
  }

  .split-picker-grid {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  }

  .split-picker-item {
    min-width: 0;
  }

  .split-picker-name {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
}
