/* ==========================================================================
   Import / export (modules/features/import-export.js)
   One dialog for companies and people: Import and Export tabs; importing
   goes choose a file → review → progress → summary.
   ========================================================================== */

.ie-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.ie-overlay {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-modal) + 5);
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 17, 23, 0.4);
  animation: ie-fade 0.15s ease both;
}

@keyframes ie-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ie-dialog {
  display: flex;
  flex-direction: column;
  width: min(640px, 100%);
  max-height: min(760px, calc(100dvh - 32px));
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--bg-secondary);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
}

/* ── Header: title, close, tabs ────────────────────────────────────────── */

.ie-head {
  flex-shrink: 0;
  padding: 14px 16px 0 20px;
  border-bottom: 1px solid var(--border-color);
}

.ie-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ie-title {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  color: var(--text-primary);
}

.ie-icon-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.ie-icon-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.ie-tabs {
  display: flex;
  gap: 18px;
  margin-top: 10px;
}

.ie-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  margin-bottom: -1px;
  padding: 0 2px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  color: var(--text-muted);
  cursor: pointer;
}

.ie-tab:hover {
  color: var(--text-primary);
}

.ie-tab.is-active {
  border-bottom-color: var(--text-primary);
  color: var(--text-primary);
}

/* ── Body ──────────────────────────────────────────────────────────────── */

.ie-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
}

.ie-muted {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

.ie-note {
  margin-top: 12px;
}

.ie-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.ie-section-title {
  margin: 24px 0 8px;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--text-primary);
}

.ie-section-head .ie-section-title {
  margin: 0;
}

.ie-section-head + .ie-muted {
  margin-top: 4px;
  margin-bottom: 10px;
}

.ie-link,
.ie-link-btn {
  font-weight: 600;
  color: var(--color-primary);
}

.ie-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.ie-link-btn:hover {
  background: var(--color-primary-bg);
}

/* Drop zone */
.ie-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 28px 16px;
  border: 1.5px dashed var(--border-color);
  border-radius: 12px;
  background: var(--bg-primary);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.ie-drop:hover,
.ie-drop.is-over,
.ie-drop:focus-within {
  border-color: var(--color-primary);
  background: var(--color-primary-bg);
}

.ie-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.ie-drop-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 6px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.ie-drop-icon .ie-icon {
  width: 20px;
  height: 20px;
}

.ie-drop-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.ie-drop-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.ie-error {
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 550;
  color: #d14343;
}

.ie-error[hidden] {
  display: none;
}

/* Columns guide */
.ie-columns {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ie-columns th {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 550;
  text-align: left;
  color: var(--text-muted);
}

.ie-columns td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
  color: var(--text-primary);
}

.ie-columns tr:last-child td {
  border-bottom: 0;
}

.ie-columns code,
.ie-callout code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-tertiary);
  font-family: 'SF Mono', ui-monospace, monospace;
  font-size: 12px;
}

.ie-req {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(209, 67, 67, 0.08);
  font-size: 11.5px;
  font-weight: 600;
  color: #c03a3a;
}

.ie-col-note {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-muted);
}

.ie-example {
  color: var(--text-muted) !important;
  word-break: break-word;
}

/* Review */
.ie-file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.ie-file-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.ie-file-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.ie-file-name {
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ie-callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-primary);
}

.ie-callout > .ie-icon {
  margin-top: 2px;
}

.ie-callout--good {
  background: rgba(16, 185, 129, 0.08);
}

.ie-callout--good > .ie-icon {
  color: #0e8a62;
}

.ie-callout--warn {
  background: rgba(245, 158, 11, 0.1);
}

.ie-callout--warn > .ie-icon {
  color: #b7740a;
}

.ie-callout--bad {
  background: rgba(209, 67, 67, 0.08);
}

.ie-callout--bad > .ie-icon {
  color: #c03a3a;
}

.ie-callout .ie-muted {
  display: block;
  margin-top: 2px;
}

.ie-issues {
  margin-top: 8px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.ie-issues summary {
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 550;
  color: var(--text-secondary);
  cursor: pointer;
}

.ie-issues ul {
  max-height: 180px;
  overflow-y: auto;
  margin: 0;
  padding: 0 12px 10px;
  list-style: none;
}

.ie-issues li {
  display: flex;
  gap: 10px;
  padding: 3px 0;
  font-size: 13px;
  color: var(--text-primary);
}

.ie-line {
  flex-shrink: 0;
  min-width: 56px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.ie-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ie-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: 'SF Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--text-muted);
}

.ie-chip--ok {
  color: var(--text-primary);
}

.ie-chip--ok .ie-icon {
  width: 13px;
  height: 13px;
  color: #0e8a62;
}

.ie-preview {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.ie-preview table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.ie-preview th,
.ie-preview td {
  max-width: 200px;
  overflow: hidden;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ie-preview th {
  background: var(--bg-primary);
  font-family: 'SF Mono', ui-monospace, monospace;
  font-size: 11.5px;
  font-weight: 550;
  color: var(--text-muted);
}

.ie-preview tr:last-child td {
  border-bottom: 0;
}

/* Importing */
.ie-progress-wrap {
  padding: 36px 8px;
  text-align: center;
}

.ie-progress-label {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.ie-progress {
  height: 6px;
  margin-bottom: 12px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--bg-tertiary);
}

.ie-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--color-primary);
  transition: width 0.2s ease;
}

/* Done */
.ie-done {
  padding: 16px 0 4px;
  text-align: center;
}

.ie-done-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  color: #0e8a62;
}

.ie-done-icon.is-bad {
  background: rgba(209, 67, 67, 0.1);
  color: #c03a3a;
}

.ie-done-icon .ie-icon {
  width: 22px;
  height: 22px;
}

.ie-done-title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 650;
  color: var(--text-primary);
}

/* Export */
.ie-export {
  padding: 8px 0 0;
  text-align: center;
}

.ie-export .ie-drop-icon {
  margin: 0 auto 10px;
}

.ie-export-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 650;
  color: var(--text-primary);
}

.ie-export .ie-muted {
  max-width: 420px;
  margin: 0 auto;
}

/* ── Footer ────────────────────────────────────────────────────────────── */

.ie-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
}

.ie-foot-space {
  flex: 1;
}

.ie-foot .btn .ie-icon {
  margin-right: 2px;
}

.ie-dialog :is(.ie-icon-btn, .ie-tab, .ie-link-btn):focus-visible,
.ie-drop:focus-within {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .ie-overlay {
    padding: 0;
    place-items: end stretch;
  }

  .ie-dialog {
    max-height: calc(100dvh - 24px);
    border-radius: 14px 14px 0 0;
  }

  .ie-body {
    padding: 16px;
  }

  .ie-columns td:last-child,
  .ie-columns th:last-child {
    display: none;
  }
}
