/* Data imports (2026-10 redesign): source cards, import history and the upload drawer. */
#panel-import { gap: 20px; }
.view-actions-group .primary-button svg, .import-source-card .chip svg, .import-drop-zone svg, .import-check svg { flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.view-actions-group .primary-button { min-height: 44px; padding: 0 20px; }
.view-actions-group .primary-button svg { width: 18px; height: 18px; }

.import-source-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); gap: 20px; min-width: 0; }
.import-source-grid:empty { display: none; }
.import-source-card { display: flex; flex-direction: column; gap: 16px; min-width: 0; padding: 22px 24px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.import-source-card.needs-action { border-color: var(--warn-fg); }
.import-source-head { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.import-source-head .chip { max-width: 100%; height: auto; min-height: 24px; padding-block: 3px; white-space: normal; line-height: 18px; }
.import-source-card .chip svg { width: 14px; height: 14px; }
.import-source-head h2 { margin: 6px 0 0; font-size: 18px; line-height: 24px; overflow-wrap: anywhere; }
.import-source-head p { margin: 0; color: var(--text); font-size: 14px; line-height: 20px; }
.import-source-facts { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 14px; line-height: 20px; }
.import-source-facts dt { color: var(--text); }
.import-source-facts dd { min-width: 0; margin: 0; color: var(--strong); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.import-source-note { margin: auto 0 0; color: var(--text); font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.import-source-action { width: 100%; min-height: 40px; margin-top: auto; font-size: 14px; }
.import-source-action:hover { border-color: var(--accent); background: var(--surface); }
.import-source-sync { display: grid; gap: 8px; margin-top: auto; }
.import-source-sync .import-source-note { margin: 0; }
.import-source-note.is-error { color: var(--error-fg); }
/* "Sync now" (0.4.193) sits above the upload action, styled like it but with its own class for focus return. */
.import-source-sync-button { width: 100%; min-height: 44px; font-size: 14px; }
.import-source-sync-button:not(:disabled):hover { border-color: var(--accent); background: var(--surface); }
.import-source-sync-button:disabled { cursor: default; }
.import-source-sync + .import-source-action { margin-top: 0; }

.import-history .section-bar { align-items: center; flex-wrap: wrap; }
.import-history .section-bar > button { white-space: nowrap; }
.import-history-filter select { width: auto; min-width: 180px; min-height: 40px; height: 40px; padding: 0 32px 0 12px; border-color: var(--border-strong); border-radius: 8px; font-size: 15px; font-weight: 500; }
.import-history > .notice { margin: 0 24px 16px; }
.import-history > #import-history-retry { margin: 0 24px 16px; }
.import-history table { min-width: 900px; }
.import-history th, .import-history td { padding-inline: 24px; }
/* 0.4.170: column headers such as "Report date" stay on one line. */
.import-history th { white-space: nowrap; }
.import-history td { height: 56px; padding-block: 6px; }
.import-history-source strong { display: block; color: var(--strong); font-weight: 600; }
.import-history-note { display: block; font-size: 13px; line-height: 18px; }
.import-history-note.is-error { color: var(--error-fg); }
.import-history-note.is-warning { color: var(--warn-fg); }
.import-history-time { color: var(--text); white-space: nowrap; }

.import-drawer { overflow: hidden; }
.import-form { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; }
.import-form .drawer-body { flex: 1 1 auto; min-height: 0; }
.import-drawer-footer { display: flex; flex: none; flex-wrap: wrap; gap: 12px; padding: 16px 28px; border-top: 1px solid var(--border); background: var(--surface); }
.import-drawer-footer button { min-height: 44px; }
.import-source-options { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.import-source-options legend { margin-bottom: 10px; padding: 0; color: var(--strong); font-size: 16px; font-weight: 600; line-height: 24px; }
.import-source-option { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 14px 16px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); cursor: pointer; }
.import-source-option:has(> input[hidden]) { display: none; }
.import-source-option:has(> input:checked) { padding: 13px 15px; border: 2px solid var(--accent); background: var(--tint); }
.import-source-option:has(> input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 3px; }
.import-source-option > input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--brand-green); }
.import-source-option > input:focus-visible { outline: none; }
.import-source-option > span { display: grid; flex: 1; gap: 2px; min-width: 0; }
.import-source-option strong { color: var(--strong); font-size: 15px; font-weight: 600; line-height: 22px; }
.import-source-option > span > span { color: var(--text); font-size: 13px; line-height: 18px; }
.import-source-option:has(> input:checked) > span > span { color: var(--tint-text); }

.import-drop-zone { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 32px 24px; border: 2px dashed var(--border-strong); border-radius: 8px; background: var(--bg); color: var(--text); text-align: center; cursor: pointer; }
.import-drop-zone svg { width: 28px; height: 28px; }
.import-drop-zone strong { max-width: 100%; color: var(--strong); font-size: 15px; font-weight: 600; line-height: 22px; overflow-wrap: anywhere; }
.import-drop-zone > span:not(.sr-only) { font-size: 13px; line-height: 18px; }
.import-drop-zone.has-file, .import-drop-zone.is-dragging { border-color: var(--accent); background: var(--tint); }
.import-drop-zone input[type="file"] { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; margin: 0; overflow: hidden; opacity: 0; }
.import-drop-zone:has(input[type="file"]:focus-visible) { outline: 3px solid var(--accent); outline-offset: 3px; }
.import-drop-zone select { width: min(320px, 100%); margin-top: 4px; }
.import-form .date-fields label, .import-field { display: grid; gap: 6px; color: var(--strong); font-size: 14px; font-weight: 600; line-height: 20px; }
.import-form .date-fields input, .import-field input { min-height: 44px; border-color: var(--border-strong); border-radius: 8px; font-weight: 400; }
.import-help { margin: -8px 0 0; color: var(--text); font-size: 13px; line-height: 18px; }
.import-form .notice { margin: 0; }
.import-result { display: grid; gap: 12px; }
.import-result h3 { margin: 0; font-size: 20px; line-height: 28px; }
.import-checks { margin: 0; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; list-style: none; }
.import-check { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 16px; border-bottom: 1px solid var(--border); color: var(--strong); font-size: 15px; line-height: 22px; }
.import-check:last-child { border-bottom: 0; }
.import-check svg { width: 18px; height: 18px; color: var(--accent); }
.import-check.is-warning svg { color: var(--warn-fg); }
.import-check.is-error svg { color: var(--error-fg); }
#import-status.notice.is-warning { border-color: transparent; color: var(--warn-fg); background: var(--warn-bg); }
.import-check > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.import-check > strong { flex: none; color: var(--text); font-weight: 400; font-variant-numeric: tabular-nums; }

@media (max-width: 660px) {
  .import-source-card { padding: 18px; }
  .import-history .section-bar { align-items: stretch; }
  .import-history-filter select { width: 100%; }
  .import-history > .notice, .import-history > #import-history-retry { margin-inline: 18px; }
  .import-drawer-footer { padding: 14px 16px; }
  .import-drawer-footer button { flex: 1 1 140px; }
  .import-check { align-items: flex-start; flex-wrap: wrap; }
  /* The history table stacks into one card per import. The column headers carry the sort buttons
     (TableSort), so they stay visible as a wrapping row of 44 px sort targets above the cards. */
  .import-history table { min-width: 0; }
  .import-history thead { display: block; }
  .import-history thead tr { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
  .import-history thead th { display: block; height: auto; padding: 0; border: 0; white-space: normal; }
  .import-history thead .sort-button { width: auto; min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; }
  .import-history tbody, .import-history tr, .import-history td { display: block; }
  .import-history tr { padding: 12px 18px; border-bottom: 1px solid var(--border); }
  .import-history td { display: flex; justify-content: space-between; gap: 12px; height: auto; padding: 4px 0; border: 0; text-align: right; }
  .import-history td::before { content: attr(data-label); flex: none; color: var(--text); text-align: left; }
  .import-history td.import-history-source { display: block; text-align: left; }
  .import-history td.import-history-source::before { content: none; }
}
