/* ============================================================
   The Import contacts page only (/import; TKT-0834): bring in a list, match its columns, review what the
   import will do, and see what was saved. import.html loads this right after site.css, where the tokens and
   the shared parts (cards, buttons, fields, the number tiles) are. Built for a phone first: every list here
   is rows that wrap, never a table that runs off the side.
   ============================================================ */

.import-step { margin-top: var(--space-4); }
.import-step > h2 { margin-bottom: var(--space-3); }
.import-step h3 { margin: 0 0 var(--space-1); }
.import-buttons { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }

/* ---- step 1: three ways in, side by side on a wide window, one under another on a narrow one ---- */
.import-ways { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.import-way { padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--raise); }
.import-way.over { border-color: var(--ink); border-style: dashed; }   /* a file held over it */
.import-way textarea { margin-top: var(--space-2); resize: vertical; }
.import-reads { margin-top: var(--space-5); }
.import-reads ul { margin: var(--space-2) 0 0; padding-left: 1.2em; color: var(--muted); font-size: calc(var(--type-2) * var(--text-scale)); }
.import-reads li { margin: 2px 0; }
@media (max-width: 900px) { .import-ways { grid-template-columns: minmax(0, 1fr); } }

/* ---- step 2: each of our columns with the file's column it is read from ---- */
.column-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 var(--space-4); margin: var(--space-2) 0 var(--space-5); }
.column-grid label span { display: block; }
.column-grid .sub { color: var(--muted); font-weight: 400; font-size: calc(var(--type-1) * var(--text-scale)); }
.column-preview { list-style: none; margin: var(--space-2) 0 0; padding: 0; }
.column-preview li { padding: var(--space-2) 0; border-top: 1px solid var(--line-soft); overflow-wrap: anywhere; }
.column-preview .sub { display: block; color: var(--muted); font-size: calc(var(--type-2) * var(--text-scale)); }

/* ---- step 3: the counts, then a card for each kind of row ---- */
.import-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.import-stats .stat.attention { border-color: var(--tag-amber); }
@media (max-width: 900px) { .import-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); } }
@media (max-width: 520px) { .import-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .import-stats .stat { padding: var(--space-3); } }
.import-options fieldset.answer { margin: 0; border: 0; padding: 0; }
.import-options legend { padding: 0; margin-bottom: var(--space-1); }
#review-sections > .card { margin-top: var(--space-4); }
.imp-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-2); }
.imp-head .hint { flex: 1 1 100%; margin: 0; }

/* A company, then its rows. Each row: a tick box, who it is, and what the import does with it. */
.imp-list, .imp-rows { list-style: none; margin: 0; padding: 0; }
.imp-group { padding: var(--space-3) 0; border-top: 1px solid var(--line); }
.imp-list > .imp-group:first-child { border-top: 0; padding-top: 0; }
.imp-company { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); }
.imp-company b { overflow-wrap: anywhere; }
.imp-tick { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--control-h-small); margin: 0; font-weight: 400; font-size: inherit; cursor: pointer; }
.imp-sub { flex: 1 1 100%; color: var(--muted); font-size: calc(var(--type-2) * var(--text-scale)); overflow-wrap: anywhere; }
.imp-rows { margin: var(--space-1) 0 0; padding-left: var(--space-5); }
.imp-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-3); padding: var(--space-1) 0; border-top: 1px solid var(--line-soft); overflow-wrap: anywhere; }
.imp-rows > .imp-row:first-child { border-top: 0; }
.imp-row .imp-what { flex: 1 1 260px; min-width: 0; color: var(--muted); font-size: calc(var(--type-2) * var(--text-scale)); }
.imp-row .imp-what b { color: var(--ink); font-weight: 600; }
.imp-change { display: block; }
.imp-change .to { color: var(--ink); font-weight: 600; }
.imp-warn { display: block; color: var(--tag-amber); }
.imp-more { margin-top: var(--space-2); }
/* On a phone the rows sit under their company without the indent, so a long email has the whole width. */
@media (max-width: 520px) { .imp-rows { padding-left: 0; } }

/* A likely match: the company as the file writes it, and the list to pick from. */
.imp-choice { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: center; gap: var(--space-2) var(--space-4); padding: var(--space-3) 0; border-top: 1px solid var(--line); }
.imp-list > .imp-choice:first-child { border-top: 0; padding-top: 0; }
.imp-choice .imp-sub { display: block; }
.imp-choice.undecided select, .imp-choice.undecided input { border-color: var(--tag-amber); }
.imp-choice .imp-typed { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.imp-choice .imp-typed input { flex: 1 1 180px; min-width: 0; }
@media (max-width: 700px) { .imp-choice { grid-template-columns: minmax(0, 1fr); } }

/* The bar the Import button sits in, and the bar that fills while the batches are saved. */
.import-bar { margin-top: var(--space-4); }
.import-bar p { margin: 0; }
.import-progress { width: 100%; height: 8px; margin-top: var(--space-3); border-radius: var(--radius-pill); background: var(--raise); overflow: hidden; }
.import-progress span { display: block; height: 100%; background: var(--ink); transition: width var(--dur-enter) var(--ease); }
@media (prefers-reduced-motion: reduce) { .import-progress span { transition: none; } }

/* ---- step 4: what was saved ---- */
.done-list { margin: var(--space-3) 0 0; padding-left: 1.2em; }
.done-list li { margin: var(--space-1) 0; overflow-wrap: anywhere; }
.done-links { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }

/* A tick box or a choice beside words that wrap keeps its size: on a 320 px phone the words gave way to it before. */
.import-step input[type="checkbox"], .import-step input[type="radio"] { flex: none; }
