/* ===========================================================================
   Merchant statement mapping modal (generic Stripe/Etsy/Square/… import)
   Warm CodeIQ palette: maroon #c4576a/#9a4054, cream/ivory, ok-green #3f7d63.
   =========================================================================== */

.stmt-map-overlay {
    position: fixed; inset: 0; z-index: 10001;
    background: rgba(40, 30, 28, 0.46); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center; padding: 24px;
    animation: stmtFade 0.18s ease-out;
}
@keyframes stmtFade { from { opacity: 0; } to { opacity: 1; } }

.stmt-map {
    width: 100%; max-width: 760px; max-height: 88vh; overflow: hidden;
    display: flex; flex-direction: column;
    background: #fffdfa; border: 1px solid #ece4d8; border-radius: 18px;
    box-shadow: 0 30px 80px -28px rgba(60, 30, 20, 0.45), 0 2px 6px rgba(60, 30, 20, 0.08);
    animation: stmtRise 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes stmtRise { from { opacity: 0; transform: translateY(12px) scale(0.99); } to { opacity: 1; transform: none; } }

/* header */
.stmt-map-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 18px 20px; border-bottom: 1px solid #f0e9df;
    background: linear-gradient(180deg, #fdf6ee, #fffdfa);
}
.stmt-map-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.stmt-map-riq { width: 40px; height: 40px; object-fit: contain; flex-shrink: 0;
    filter: drop-shadow(0 6px 10px rgba(150, 90, 30, 0.22)); }
.stmt-map-title { font-weight: 700; font-size: 16px; color: #1a1a1a; }
.stmt-map-sub { font-size: 12.5px; color: #8a7f70; margin-top: 1px; }
.stmt-map-x { border: 0; background: none; font-size: 24px; line-height: 1; color: #b3a899;
    cursor: pointer; width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0; transition: all 0.15s ease; }
.stmt-map-x:hover { background: #f3ece2; color: #9a4054; }

/* body */
.stmt-map-body { padding: 18px 20px 20px; overflow-y: auto; }
.stmt-map-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.stmt-platform-l { font-size: 12px; font-weight: 600; color: #6f675e; display: flex; flex-direction: column; gap: 5px; }
.stmt-platform-i { font-size: 14px; font-weight: 600; color: #1a1a1a; padding: 9px 12px; width: 240px;
    border: 1px solid #d8cfc1; border-radius: 8px; background: #fff; transition: all 0.15s ease; }
.stmt-platform-i:focus { outline: none; border-color: #c4576a; box-shadow: 0 0 0 3px rgba(196, 87, 106, 0.12); }

/* AI status chip */
.stmt-ai-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600;
    padding: 6px 12px; border-radius: 9999px; white-space: nowrap; }
.stmt-ai-chip.is-loading { background: #f0e6f0; color: #7e4f76; }
.stmt-ai-chip.is-ready { background: #eef3ee; color: #3f7d63; }
.stmt-ai-chip.is-fallback { background: #fbeede; color: #a5631a; }
.stmt-spin { width: 12px; height: 12px; border: 2px solid rgba(126, 79, 118, 0.3); border-top-color: #7e4f76;
    border-radius: 50%; animation: stmtSpin 0.7s linear infinite; }
@keyframes stmtSpin { to { transform: rotate(360deg); } }

/* mode banner */
.stmt-mode { display: flex; align-items: flex-start; gap: 10px; font-size: 12.5px; line-height: 1.45;
    padding: 11px 14px; border-radius: 10px; margin-bottom: 16px; }
.stmt-mode strong { font-weight: 700; }
.stmt-mode-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.stmt-mode.is-rec { background: #eef3ee; color: #356b53; border: 1px solid #cfe0d2; }
.stmt-mode.is-rec .stmt-mode-dot { background: #3f7d63; box-shadow: 0 0 0 3px rgba(63, 125, 99, 0.18); }
.stmt-mode.is-sum { background: #fbf2e6; color: #8a5a17; border: 1px solid #eccfa6; }
.stmt-mode.is-sum .stmt-mode-dot { background: #c2710c; box-shadow: 0 0 0 3px rgba(194, 113, 12, 0.18); }
.stmt-mode.is-warn { background: #fbe9e4; color: #9a3a26; border: 1px solid #e7b9ab; }
.stmt-mode.is-warn .stmt-mode-dot { background: #b5543f; box-shadow: 0 0 0 3px rgba(181, 84, 63, 0.2); }
.stmt-mode em { font-style: italic; }

/* opt-in: derive gross sales from payouts */
.stmt-derive { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.08); font-weight: 600; cursor: pointer; line-height: 1.4; }
.stmt-derive input { margin-top: 2px; flex-shrink: 0; accent-color: #9a4054; width: 15px; height: 15px; cursor: pointer; }

/* mixed-currency note */
.stmt-ccy { display: flex; align-items: flex-start; gap: 9px; font-size: 12px; line-height: 1.45;
    padding: 9px 12px; border-radius: 9px; margin: -8px 0 16px; background: #eef2f6; color: #3b5566; border: 1px solid #d3e0e8; }
.stmt-ccy-i { font-weight: 700; color: #4a7088; }

/* two columns: mapping rows | preview */
.stmt-cols { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; }
@media (max-width: 680px) { .stmt-cols { grid-template-columns: 1fr; } }

.stmt-map-rows { display: flex; flex-direction: column; gap: 8px; }
.stmt-row { display: grid; grid-template-columns: 1fr 150px; align-items: center; gap: 10px; }
.stmt-row-field { font-size: 13px; font-weight: 600; color: #3d3d3d; display: flex; flex-direction: column; gap: 2px; }
.stmt-row-hint { font-size: 10.5px; font-weight: 400; color: #a08a6a; line-height: 1.3; }
.stmt-row-select { width: 150px; font-size: 12.5px; padding: 7px 9px; border: 1px solid #d8cfc1;
    border-radius: 7px; background: #fff; color: #3d3d3d; transition: all 0.15s ease; }
.stmt-row-select:focus { outline: none; border-color: #c4576a; box-shadow: 0 0 0 3px rgba(196, 87, 106, 0.1); }
.stmt-row-select:not([data-empty]):valid { }

/* preview */
.stmt-preview-wrap { background: #faf6f0; border: 1px solid #f0e9df; border-radius: 10px; padding: 10px 12px; min-width: 0; }
.stmt-preview-cap { font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #b3a899; margin-bottom: 8px; }
.stmt-preview-scroll { overflow-x: auto; }
.stmt-preview { border-collapse: collapse; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stmt-preview th { text-align: left; font-weight: 700; color: #8a7f70; padding: 4px 10px 4px 0; border-bottom: 1px solid #e7ded2; }
.stmt-preview td { color: #5f5a53; padding: 4px 10px 4px 0; border-bottom: 1px solid #f2ece2; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }

/* footer */
.stmt-map-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid #f0e9df; }
.stmt-btn-ghost { border: 1px solid #d8cfc1; background: #fff; color: #6b6b6b; font-weight: 600; font-size: 13px;
    padding: 10px 18px; border-radius: 9px; cursor: pointer; transition: all 0.15s ease; }
.stmt-btn-ghost:hover { border-color: #9a4054; color: #9a4054; }
.stmt-btn-primary { border: 0; background: linear-gradient(135deg, #c4576a, #9a4054); color: #fff; font-weight: 700; font-size: 13px;
    padding: 10px 20px; border-radius: 9px; cursor: pointer; transition: all 0.15s ease;
    box-shadow: 0 8px 18px -8px rgba(154, 64, 84, 0.6); }
.stmt-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -8px rgba(154, 64, 84, 0.7); }
.stmt-btn-primary:disabled { opacity: 0.6; cursor: default; transform: none; box-shadow: none; }

@media (prefers-reduced-motion: reduce) {
    .stmt-map-overlay, .stmt-map { animation: none; }
    .stmt-spin { animation-duration: 1.4s; }
    .stmt-btn-primary:hover { transform: none; }
}
