/* --------------------------------------------------------------------------
   Excel import panel

   The shared four-step panel every master list opens from its Import button:
   get the template, choose the file, the preview, the result. It is a wide
   drawer because the preview is a table; below the card breakpoint the table
   stacks like every other list, so a phone reads each row as a block.
   -------------------------------------------------------------------------- */

.import-steps {
  display: grid;
  gap: var(--sp-6);
  margin: 0 0 var(--sp-4);
  padding: 0;
  list-style: none;
}

.import-step__title {
  margin-bottom: var(--sp-2);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--txt);
}

.import-step__text {
  margin-bottom: var(--sp-3);
  font-size: var(--fs-md);
  color: var(--txt-2);
  max-width: 70ch;
}

/* The native file picker, widened to the panel and given a button that looks
   like the app's own, so it reads as the thing to press. */
.import-file {
  display: block;
  width: 100%;
  max-width: 520px;
  padding: 6px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: var(--fs-md);
  color: var(--txt-2);
}
.import-file::file-selector-button {
  height: 34px;
  margin-right: var(--sp-3);
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--txt);
  font: inherit;
  font-weight: var(--fw-semibold);
  cursor: pointer;
}
.import-file:disabled { opacity: 0.6; }

.import-progress {
  margin-top: var(--sp-3);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  color: var(--txt);
}

.import-alert { margin-bottom: var(--sp-4); }

.import-keep { margin-top: var(--sp-2); }

.import-file-name {
  margin-bottom: var(--sp-3);
  font-weight: var(--fw-semibold);
  overflow-wrap: anywhere;
}

/* The four counts read as one line on a desktop and wrap on a phone. */
.import-counts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-5);
  margin: 0 0 var(--sp-4);
  padding: 0;
  list-style: none;
  font-size: var(--fs-md);
}
.import-counts li { display: inline-flex; align-items: center; gap: 7px; }

.import-hint { display: inline-block; margin-left: var(--sp-2); font-size: var(--fs-sm); color: var(--txt-3); }

/* Four tabs, wrapping onto a second line on a phone rather than scrolling
   sideways inside the panel, where the last one was cut off at 320 and 375. */
.import-tabs {
  flex-wrap: wrap;
  overflow-x: visible;
  margin-bottom: var(--sp-2);
}

/* The message is the cell that says what to do, so it takes the width and
   wraps rather than being cut short. */
.import-table td.import-message {
  min-width: 24ch;
  white-space: normal;
  overflow-wrap: anywhere;
}

.import-more { display: flex; justify-content: center; padding: var(--sp-3) 0; }

/* What a change does beyond itself, as the form would warn before saving:
   under the change, on a line of its own, in the warning colour. */
.import-caution {
  display: block;
  margin-top: var(--sp-1);
  font-size: var(--fs-sm);
  color: var(--warn-fg);
}

.import-updates { display: flex; align-items: center; margin-top: var(--sp-4); }

/* Two long labels ("Import the 155 good rows, skip 4", "Fix the file and
   upload again") have to be able to share a line or take one each. */
.import-panel .drawer__foot { flex-wrap: wrap; }

/* On a phone each button takes the width, the primary one last and nearest
   the thumb. */
@container content (max-width: 560px) {
  .import-panel .drawer__foot .btn { flex: 1 1 100%; }
  .import-hint { display: block; margin: var(--sp-2) 0 0; }
}

/* Under a finger: the panel's own small buttons (Download template, the file
   with problems marked, Show more) and the tick to include updates are 42px
   like every other target. The page head's Export and Import keep the size of
   the Add button beside them. */
@media (pointer: coarse) {
  .import-panel .tab { min-height: 42px; }
  .import-panel .drawer__body .btn--sm { height: 42px; }
  .import-panel .import-updates { min-height: 42px; }
  .import-file::file-selector-button { height: 42px; }
}

/* The chosen filter tab's words. The shared tab colours them with --primary,
   which in the dark theme is 3.88:1 on the panel's surface; the lighter step
   reads at 6.87:1. Only the import panel's tabs, and only in the dark theme:
   the light theme's 10.66:1 needs nothing. The underline keeps --primary. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .import-tabs .tab[aria-selected="true"] { color: var(--primary-hover); }
}

:root[data-theme="dark"] .import-tabs .tab[aria-selected="true"] { color: var(--primary-hover); }
