/* Data area: /import and /export. Owned by the data agent. Built on base.css (tokens, cards, rows, choices, counts,
   status chips, callouts, the action bar); only what is particular to these two screens is here. */

/* ---------- Page: heading, one sentence on what the page is for, the Import / Export tabs ---------- */
.data-head { align-items: flex-start; }
.data-head-text { flex: 1 1 420px; min-width: 0; }
.data-head .lede { max-width: 62ch; }
@media (min-width: 960px) { .data-head .lede { font-size: var(--fs-18); } }
@media (max-width: 959px) { .imp-page:not(:has(.imp-drop)) .data-head .lede { display: none; } }
/* Sections on these screens sit in a stack: its gap spaces them, not the cards' own margins. */
.imp .card, .exp-page .card { margin-bottom: 0; }
.imp > .stack, .imp .imp-review, .exp-page > .stack { gap: var(--space-4); }
@media (min-width: 960px) { .imp > .stack, .imp .imp-review, .exp-page > .stack { gap: var(--space-5); } }
/* A flush panel has no padding of its own: its rows and headings bring theirs. */
.imp-page .card.card-flush, .imp-batch-dialog .card.card-flush, .exp-page .card.card-flush { padding: 0; }
.imp .card h2, .exp-page .card h2 { margin: 0; }

/* ---------- Steps: drop the files, (check columns,) review, import ---------- */
.imp-progress { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.imp-progress > li { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px 0 6px; border-radius: var(--radius-full);
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-2); font-size: var(--fs-15); font-weight: 600; white-space: nowrap; }
.imp-progress-mark { display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--ink-3);
  font-family: var(--font-num); font-size: var(--fs-15); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.imp-progress > li.is-done { color: var(--ink); }
.imp-progress > li.is-done .imp-progress-mark { background: var(--done); color: #fff; box-shadow: none; }
.imp-progress > li.is-current { background: var(--blue); color: var(--blue-ink); box-shadow: none; }
.imp-progress > li.is-current .imp-progress-mark { background: var(--surface); color: var(--blue); box-shadow: none; }
@media (max-width: 559px) {
  .imp-progress { gap: 4px; }
  .imp-progress > li { min-height: 32px; gap: 6px; padding: 0 10px 0 4px; }
  .imp-progress-mark { width: 22px; height: 22px; }
}

/* ---------- Two columns on a desktop: the main panel and its companion ---------- */
.imp-cols { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 960px) {
  .imp-cols { gap: var(--space-5); }
  .imp-cols-drop { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
  .imp-cols-review { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
}

/* ---------- 1. Drop: the whole box is the file picker's label, so a tap anywhere opens it ---------- */
.imp-drop-wrap { display: grid; gap: var(--space-3); }
.imp-drop { position: relative; display: grid; justify-items: center; gap: 8px; padding: 40px 24px; text-align: center; cursor: pointer;
  background: var(--surface); border: 2px dashed var(--line-control); border-radius: var(--radius-ticket); transition: border-color .12s, background-color .12s; }
.imp-drop:hover, .imp-drop.is-over { border-color: var(--blue); background: var(--blue-soft); }
.imp-drop:focus-within { border-color: var(--blue); box-shadow: var(--ring); }
.imp-drop-icon { color: var(--ink); }
.imp-drop-title { font-size: var(--fs-22); font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.imp-drop-sub { color: var(--ink-2); max-width: 46ch; }
.imp-drop-btn { margin-top: 8px; pointer-events: none; }
.imp-file { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
/* A phone cannot drag a file: there the box says what a tap does. */
.imp-for-touch { display: none; }
@media (hover: none) and (pointer: coarse) { .imp-for-mouse { display: none; } .imp-for-touch { display: inline; } }
.imp-safe { display: flex; gap: 10px; align-items: flex-start; margin: 0; color: var(--ink-2); font-size: var(--fs-15); }
.imp-safe svg { flex: none; margin-top: 1px; color: var(--ink-3); }
@media (max-width: 559px) { .imp-drop { padding: 28px 16px; } }
.imp-steps { margin: 0 0 12px; padding-left: 22px; display: grid; gap: 8px; }
.imp-paste { font: var(--fs-15)/1.4 var(--mono) !important; min-height: 132px; resize: vertical; }

/* ---------- Disclosures: one per line in a flush panel, a chevron, the title with its count, a line on what it holds ---------- */
.imp-section > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 2px 8px; align-items: start;
  min-height: 56px; padding: 14px 16px; }
.imp-section > summary::-webkit-details-marker { display: none; }
.imp-section > summary::before { content: ''; grid-row: 1; width: 8px; height: 8px; margin: 8px 0 0 3px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2);
  transform: rotate(-45deg); transition: transform .15s; }
.imp-section[open] > summary::before { transform: rotate(45deg); margin-top: 6px; }
.imp-section > summary:hover { background: var(--surface-sunk); }
.imp-section > summary:focus-visible { outline-offset: -3px; }
.imp-sum-title { grid-column: 2; font-weight: 600; }
.imp-sum-title > .count { margin-left: 4px; vertical-align: 1px; height: 22px; min-width: 22px; font-size: var(--fs-13); }
.imp-sum-text { grid-column: 2; color: var(--ink-2); font-size: var(--fs-15); }
.imp-section-body { padding: 0 16px 16px 44px; }
ul.imp-section-body { padding-left: 62px; }
.card-flush > .imp-section + .imp-section, .imp-more-head + .imp-section { border-top: 1px solid var(--line); }
.imp-section:last-child > summary { border-radius: 0 0 var(--radius) var(--radius); }
.imp-section:first-child > summary { border-radius: var(--radius) var(--radius) 0 0; }
.imp-more-head { padding: 16px 16px 12px; }
.imp-more-head h2 { font-size: var(--fs-18); }
@media (min-width: 960px) {
  .imp-section > summary { padding: 14px 20px; }
  .imp-section-body { padding: 0 20px 20px 48px; }
  ul.imp-section-body { padding-left: 66px; }
  .imp-more-head { padding: 18px 20px 12px; }
}
@media (max-width: 559px) { .imp-section-body { padding-left: 16px; } ul.imp-section-body { padding-left: 34px; } }
.imp-group h4 { margin: 16px 0 8px; font-size: var(--fs-15); }
.imp-group:first-child h4 { margin-top: 0; }
.imp-needs-time { color: var(--warn); font-weight: 600; }
.imp-plain-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

/* ---------- 2. Columns ---------- */
.imp-map-intro { display: grid; gap: 8px; }
.imp-map-intro > p { margin: 0; }
.imp-map-head h3 { display: flex; gap: 8px; align-items: center; margin: 0; font-size: var(--fs-18); overflow-wrap: anywhere; min-width: 0; }
.imp-map-head h3 svg { flex: none; color: var(--ink-3); }
.imp-kind { max-width: 360px; margin-bottom: 8px; }
.imp-map-list { display: grid; }
.imp-map-row { display: grid; gap: 6px; padding: 14px 0; border-top: 1px solid var(--line); }
.imp-map-field label { display: block; font-weight: 600; }
.imp-map-field .hint { margin: 2px 0 0; }
.imp-map-pick { display: grid; gap: 6px; min-width: 0; }
.imp-map-pick select[aria-invalid] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
/* The first values in the chosen column, each in its own box. */
.imp-sample { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; min-width: 0; font-size: var(--fs-15); color: var(--ink-2); }
.imp-sample:empty { display: none; }
.imp-sample-val { max-width: 100%; padding: 0 7px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-sunk); color: var(--ink); overflow-wrap: anywhere; }
.imp-more { margin-top: 4px; }
.imp-more > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: var(--blue); font-weight: 600; }
.imp-more > summary::-webkit-details-marker { display: none; }
.imp-more > summary::before { content: ''; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.imp-more[open] > summary::before { transform: rotate(45deg); }
.imp-map .callout { margin-bottom: 12px; }
.imp-map-wait { margin: 0; }
@media (min-width: 720px) { .imp-map-row { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 16px; align-items: start; } }

/* ---------- 3. Review: the headline, what comes over, the choices ---------- */
.imp-summary { display: grid; gap: var(--space-4); align-content: start; }
.imp-headline { font-size: var(--fs-22); line-height: 1.25; max-width: 38ch; }
.imp-tally { width: 100%; border-collapse: collapse; }
.imp-tally thead th { padding: 0 0 8px; font-size: var(--fs-13); font-weight: 600; color: var(--ink-2); text-align: left; }
.imp-tally tbody tr { border-top: 1px solid var(--line); }
.imp-tally tbody tr:last-child { border-bottom: 1px solid var(--line); }
.imp-tally tbody th, .imp-tally tbody td { padding: 12px 0; text-align: left; font-weight: 400; vertical-align: middle; }
.imp-tally .imp-tally-n { text-align: right; padding-left: 16px; white-space: nowrap; width: 1%; }
.imp-tally-label { display: block; font-weight: 600; }
.imp-tally-sub { display: block; font-size: var(--fs-15); color: var(--ink-2); }
.imp-tally-in { font-family: var(--font-num); font-size: var(--fs-28); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.imp-count-held { background: var(--warn-soft); color: var(--warn); }
.imp-none { color: var(--ink-2); font-size: var(--fs-15); }
.imp-tally-foot { margin: -4px 0 0; color: var(--ink-2); font-size: var(--fs-15); }
.imp-note strong { color: var(--ink); font-weight: 600; }
.imp-note > svg { color: var(--ink-2); }
.imp-option .hint { font-size: var(--fs-15); }
.imp-dates { max-width: 420px; }
.imp-dates.is-asking select { border-color: var(--warn); box-shadow: 0 0 0 1px var(--warn); }
.imp-dates .hint { margin: 2px 0 6px; }
@media (max-width: 359px) { .imp-tally-in { font-size: var(--fs-22); } }

/* Your files */
.imp-files-card h2 { font-size: var(--fs-18); margin-bottom: 4px; }
.imp-files { list-style: none; margin: 0; padding: 0; }
.imp-file-line { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.imp-file-line:first-child { border-top: 0; }
.imp-file-line > svg { margin-top: 1px; color: var(--done); }
.imp-file-line.is-bad > svg { color: var(--danger); }
.imp-file-line.is-skip > svg, .imp-file-line.is-copy > svg { color: var(--ink-3); }
.imp-file-main { min-width: 0; }
.imp-file-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 12px; }
.imp-file-name { font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.imp-file-meta { margin: 2px 0 0; color: var(--ink-2); font-size: var(--fs-15); overflow-wrap: anywhere; }
.imp-file-line.is-bad .imp-file-meta { color: var(--danger); font-weight: 600; }
.imp-file-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0 14px; margin-top: 2px; font-size: var(--fs-15); }
.imp-file-change.btn-link { min-height: 32px; padding: 0; font-size: var(--fs-15); }
.imp-unused[open] { flex-basis: 100%; }
.imp-unused > summary { cursor: pointer; display: inline-flex; align-items: center; min-height: 32px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-firm); }
.imp-unused > summary:hover { color: var(--ink); }
.imp-unused-body { padding: 4px 0 4px; }
.imp-unused-body > p { margin: 0 0 6px; }
.imp-unused-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; overflow-wrap: anywhere; }
@media (max-width: 959px), (pointer: coarse) { .imp-unused > summary, .imp-file-change.btn-link { min-height: 44px; } }

/* The main action. Phones: base.css fixes .action-bar above the tabs. Desktop: it floats at the bottom of the window
   until the page scrolls to its place under the summary. */
.imp-bar-note { margin: 0; color: var(--ink-2); font-size: var(--fs-15); }
@media (min-width: 960px) {
  .imp-bar { position: sticky; bottom: 16px; z-index: 5; align-items: center; gap: 12px 16px; padding: 14px 20px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-ticket); box-shadow: var(--shadow-float); }
  .imp-bar > .btn { flex: none; }
  .imp-bar > .btn-primary { min-width: 220px; }
  .imp-bar-note { flex: 1 1 260px; }
}
@media (max-width: 959px) {
  .imp-bar-note { display: none; }
  .imp-bar > .btn, .exp-bar > .btn { flex: 1 1 auto; padding: 0 14px; font-size: var(--fs-16); }
  .imp-bar > .btn-primary { flex-grow: 2; }
  /* Room under the page for the bar, and toasts above it. */
  .has-tabbar .main:has(.imp-bar), .has-tabbar .main:has(.exp-bar) { padding-bottom: calc(var(--tabbar-h) + 84px + var(--safe-bottom)); }
  .has-tabbar:has(.imp-bar) #toasts, .has-tabbar:has(.exp-bar) #toasts { bottom: calc(var(--tabbar-h) + 88px + var(--safe-bottom)); }
}

/* Money, in plain words */
.imp-money h2 { font-size: var(--fs-18); margin-bottom: 12px; }
.imp-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.imp-notes li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; align-items: start; }
.imp-notes svg { margin-top: 2px; color: var(--ink-3); }

/* Held back: a tidy list. Where the row is, what it is and why, and "Fix and import". */
.imp-held-head { padding: 16px 16px 14px; border-bottom: 1px solid var(--line); }
.imp-held-head h2 { font-size: var(--fs-22); }
.imp-held-head h3 { margin: 0; font-size: var(--fs-18); }
.imp-held-head p { margin: 4px 0 0; font-size: var(--fs-15); max-width: 70ch; }
.imp-held-list { list-style: none; margin: 0; padding: 0; }
.imp-held-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px 20px; padding: 14px 16px; }
.imp-held-row + .imp-held-row { border-top: 1px solid var(--line); }
.imp-held-row:focus { outline: none; }
.imp-held-where { display: flex; flex-wrap: wrap; gap: 0 8px; font-size: var(--fs-15); }
.imp-held-kind { font-weight: 600; }
.imp-held-line { color: var(--ink-2); overflow-wrap: anywhere; }
.imp-held-what { display: grid; gap: 2px; min-width: 0; }
.imp-held-label { font-weight: 600; overflow-wrap: anywhere; }
.imp-held-why { overflow-wrap: anywhere; }
.imp-held-act { display: flex; align-items: flex-start; padding-top: 2px; }
.imp-held-file { color: var(--ink-2); font-size: var(--fs-15); }
.imp-fix { white-space: nowrap; }
.imp-held-foot { display: grid; justify-items: start; gap: 4px; padding: 4px 16px 12px; border-top: 1px solid var(--line); }
.imp-held-foot > p { margin: 0; }
@media (min-width: 720px) {
  .imp-held-row { grid-template-columns: 180px minmax(0, 1fr) minmax(140px, auto); align-items: start; }
  .imp-held-where { flex-direction: column; }
  .imp-held-act { justify-content: flex-end; }
}
@media (min-width: 960px) {
  .imp-held-head { padding: 20px 20px 16px; }
  .imp-held-row { padding: 16px 20px; }
  .imp-held-foot { padding: 4px 20px 14px; }
}
.imp-fix-where { margin: 0; color: var(--ink-2); font-size: var(--fs-15); font-weight: 600; }
.imp-fix-dialog .form-actions { flex-wrap: wrap; }

/* ---------- 4. Done ---------- */
.imp-done { display: grid; gap: var(--space-3); }
.imp-done-head { display: flex; gap: 14px; align-items: center; }
.imp-done-icon { flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--done); color: #fff; }
.imp-done h2 { font-size: var(--fs-22); line-height: 1.25; }
.imp-done-text { margin: 0; color: var(--ink-2); max-width: 72ch; }
.imp-done-text:empty { display: none; }
.imp-done-links { margin-top: 4px; }
.imp-numbering h3 { margin: 0 0 8px; font-size: var(--fs-18); }
.imp-numbering p { margin: 0 0 8px; }
.imp-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
@media (max-width: 559px) {
  .imp-done-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .imp-done-links .btn { flex: 1 1 auto; }
  .imp-done-links .btn-primary { flex-basis: 100%; }
}

/* ---------- Past imports ---------- */
.imp-hist-empty { padding: 0 16px 16px; margin: 0; }
.imp-hist-row { width: 100%; border: 0; border-radius: 0; background: none; font: inherit; text-align: left; cursor: pointer; min-height: 56px; }
.imp-hist-row:hover { background: var(--surface-sunk); }
.imp-history .list-flush > li:last-child .imp-hist-row { border-radius: 0 0 var(--radius) var(--radius); }
.imp-hist-held { margin-top: 4px; }
@media (min-width: 960px) { .imp-hist-empty { padding: 0 20px 20px; } .imp-history .row { padding-left: 20px; padding-right: 16px; } }
.imp-batch-summary { margin: 0; font-weight: 600; }
.imp-batch > div > .small { margin: 2px 0 0; }

/* ---------- Export ---------- */
.exp-cols { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 960px) { .exp-cols { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--space-5); } }
.exp-all { display: grid; gap: var(--space-4); }
.exp-all > p { margin: 0; }
.exp-status:empty { display: none; }
@media (min-width: 960px) { .exp-bar > .btn { flex: none; } }
.exp-what-card h3 { margin: 16px 0 8px; font-size: var(--fs-15); color: var(--ink-2); }
.exp-what { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.exp-what li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; align-items: start; }
.exp-what svg { margin-top: 2px; color: var(--done); }
.exp-what.is-out svg { color: var(--ink-3); }
.exp-one-head { padding: 16px 16px 14px; border-bottom: 1px solid var(--line); }
.exp-one-head p { margin: 2px 0 0; font-size: var(--fs-15); }
.exp-file { margin-left: 4px; color: var(--ink-2); font-size: var(--fs-15); font-weight: 400; }
@media (min-width: 960px) { .exp-one-head { padding: 20px 20px 16px; } .exp-list .row { padding-left: 20px; padding-right: 20px; } }
@media (max-width: 559px) { .exp-row { align-items: flex-start; } .exp-row .btn { flex: none; margin-top: 2px; } }

/* Tables of rows to import: the reason column reads as a paragraph on phones. */
@media (max-width: 639px) {
  .table-collapse td.imp-why { display: block; text-align: left; }
  .table-collapse td.imp-why::before { display: block; max-width: none; margin-bottom: 2px; }
}
