/* Bank Transactions -- Manage portal page (manage/bank_transactions.html).
   Colours come from the portal theme tokens (manage_theme.css). The page opts
   into dark content with .mp-main--dark-content, so in Dark the same tokens
   resolve to the dark set. Card status colours use the shared status palette
   via data-status-key: In Progress = "manager" (amber), Complete = "ready"
   (green). Header switcher + round refresh match the JSA page. */

.mct-root {
  color: var(--text-primary);
  padding: 0;
  max-width: 1180px;
  margin: 0 auto;
  box-sizing: border-box;
}

.mct-page * { box-sizing: border-box; }

/* -- Header: title + round refresh ----------------------------------------- */
.mct-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 16px;
}

.mct-title {
  margin: 0;
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
}

.mct-icon-btn {
  display: inline-flex;
  flex: 0 0 36px;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}
.mct-icon-btn:hover { background: var(--surface-hover); color: var(--text-primary); }
.mct-icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mct-icon-btn svg { width: 16px; height: 16px; }
.mct-icon-btn.is-refreshing svg { animation: mct-spin 800ms linear infinite; }
@keyframes mct-spin { to { transform: rotate(360deg); } }

.mct-error {
  display: none;
  background: var(--st-rejected-bg);
  border: 1px solid var(--st-rejected-border);
  color: var(--st-rejected-text);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}
.mct-link { color: inherit; font-weight: 700; text-decoration: underline; }

/* -- Filter: segmented pill switcher (same as JSA) --------------------------- */
.mct-seg {
  display: inline-flex;
  max-width: 100%;
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
  scrollbar-width: none;
}
.mct-seg::-webkit-scrollbar { display: none; }
.mct-seg__option {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 200ms ease, color 200ms ease, box-shadow 200ms ease;
}
.mct-seg__option:hover:not(.is-active) { background: var(--surface-hover); color: var(--text-primary); }
.mct-seg__option.is-active { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(238, 122, 59, 0.35); }
.mct-seg__option:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mct-seg__count { color: var(--text-muted); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mct-seg__option.is-active .mct-seg__count { color: rgba(255, 255, 255, 0.85); }
html[data-portal="manage"][data-theme="dark"] .mp-main--dark-content .mct-seg { border-color: rgba(255, 255, 255, 0.08); background: #1f1c21; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04); }
html[data-portal="manage"][data-theme="dark"] .mp-main--dark-content .mct-seg__option.is-active { box-shadow: 0 4px 12px rgba(238, 122, 59, 0.3); }

/* -- Loading / empty --------------------------------------------------------- */
.mct-loading, .mct-empty {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 40px 0;
}
.mct-empty p { margin: 0; font-weight: 600; }
.mct-empty__icon { display: block; margin: 0 auto 10px; color: var(--text-muted); }

/* -- Cards ------------------------------------------------------------------- */
.mct-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.mct-card {
  border-radius: 14px;
  border: 1px solid var(--st-border, var(--border));
  padding: 14px 16px;
  background: var(--st-bg, var(--surface-raised));
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 150ms ease, border-color 150ms ease;
}
.mct-card:hover { box-shadow: var(--shadow-md); }
html[data-portal="manage"][data-theme="dark"] .mp-main--dark-content .mct-card,
html[data-portal="manage"][data-theme="dark"] .mp-main--dark-content .mct-card:hover { box-shadow: none; }

.mct-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.mct-card-date { font-size: 13px; color: var(--text-secondary); font-weight: 600; }

.mct-card-from-to {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

/* Neutral, not red: red is reserved for errors / rejected in the portal. */
.mct-card-amount {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.mct-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
  background: var(--st-chip, var(--surface-hover));
  color: var(--st-text, var(--text-secondary));
}

.mct-card-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  font-size: 12.5px;
  color: var(--text-primary);
}
.mct-card-meta > div { min-width: 0; overflow-wrap: anywhere; }
.mct-card-meta div span { color: var(--text-secondary); margin-right: 4px; }
.mct-meta-empty { color: var(--text-muted); font-style: normal; }

.mct-card-description {
  font-size: 13px;
  color: var(--text-primary);
}

.mct-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mct-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.mct-field-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* -- Form controls: input surface, border-strong, accent focus ---------------- */
.mct-root {
  --mct-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%238e8882' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='5 7.5 10 12.5 15 7.5'/%3E%3C/svg%3E");
}
html[data-portal="manage"][data-theme="dark"] .mp-main--dark-content .mct-root {
  --mct-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23b3aca5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='5 7.5 10 12.5 15 7.5'/%3E%3C/svg%3E");
}

.mct-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  font-family: inherit;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 8px 30px 8px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  background-color: var(--surface-input);
  background-image: var(--mct-chevron);
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  width: 100%;
  height: 36px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.mct-select option { background-color: var(--surface-input); color: var(--text-primary); }
.mct-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
.mct-select:disabled { opacity: 0.6; cursor: default; }
.mct-select::-ms-expand { display: none; }

.mct-textarea {
  font-family: inherit;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text-primary);
  background-color: var(--surface-input);
  width: 100%;
  min-height: 84px;
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.mct-textarea::placeholder { color: var(--text-muted); font-weight: 400; }
.mct-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
.mct-textarea:disabled { opacity: 0.6; cursor: default; }

.mct-save-indicator {
  font-size: 11px;
  font-weight: 600;
  min-height: 14px;
}
.mct-save-indicator--saving { color: var(--text-muted); }
.mct-save-indicator--saved { color: var(--st-ready-for-payment-text); }
.mct-save-indicator--error { color: var(--st-rejected-text); }

/* -- Receipt: dashed dropzone + neutral file chips --------------------------- */
.mct-card-files {
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mct-file-chip {
  max-width: 100%;
  background: var(--surface-hover);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 2px 8px;
  overflow-wrap: anywhere;
}

.mct-card-actions { margin-top: 4px; }

.mct-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  border: 1px dashed var(--border-strong);
  background: transparent;
  border-radius: 10px;
  padding: 9px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.mct-upload-btn svg { flex: 0 0 16px; }
.mct-upload-btn:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
}
.mct-upload-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mct-upload-btn:disabled { opacity: 0.6; cursor: default; }

/* -- Footer: status badge + Submit, pinned to the card bottom ----------------- */
.mct-card-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mct-submit-btn {
  position: relative;
  border: none;
  border-radius: 10px;
  padding: 8px 18px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-on-accent, #fff);
  background: var(--accent);
  white-space: nowrap;
  transition: background-color 150ms ease;
}
.mct-submit-btn:hover:not(:disabled) { background: var(--accent-hover); }
.mct-submit-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mct-submit-btn:disabled,
.mct-submit-btn--complete {
  background: var(--surface-input-disabled);
  color: var(--text-muted);
  cursor: not-allowed;
}
/* Submitting: label kept (transparent) so the width does not change. */
.mct-submit-btn.is-loading,
.mct-submit-btn.is-loading:disabled {
  background: var(--accent);
  color: transparent;
  cursor: progress;
}
.mct-submit-btn.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: mct-spin 700ms linear infinite;
}

.mct-submit-message {
  font-size: 12px;
  font-weight: 600;
  color: var(--st-manager-approval-text);
  margin-top: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .mct-seg__option, .mct-card, .mct-icon-btn, .mct-upload-btn, .mct-submit-btn { transition: none; }
  .mct-icon-btn.is-refreshing svg { animation: none; }
  .mct-submit-btn.is-loading::after { animation: none; border-color: #fff; border-right-color: transparent; }
}

@media (max-width: 480px) {
  .mct-root { padding: 10px; }
  .mct-grid { grid-template-columns: 1fr; }
}
