/* Email import (v1.3a): the Email inbox, its cards, the Open email page and the unsorted notes. Tokens only, so dark
   mode follows (UI spec §2.1). Flat cards with hairlines; status is never colour alone (icons and words). */

.tl-email {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 820px;
}

.tl-email__section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tl-email__heading {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
}

.tl-email__count {
  font: 500 13px/18px var(--tl-font);
  color: var(--tl-text-muted);
}

.tl-email__hint {
  margin: -4px 0 0;
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
}

/* The upload: the TripIt import's dashed drop zone. */
.tl-email-drop {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border: 1px dashed var(--tl-border-strong);
  border-radius: var(--tl-radius-card);
  background: var(--tl-surface);
  transition: border-color var(--tl-fast) ease-out, background-color var(--tl-fast) ease-out;
}

.tl-email-drop.is-over {
  border-color: var(--tl-primary);
  background: var(--tl-primary-soft);
}

.tl-email-drop__icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tl-surface-muted);
  color: var(--tl-text-muted);
}

.tl-email-drop__text {
  flex: 1;
  min-width: 0;
}

.tl-email-drop__title {
  margin: 0;
  font-size: 15px;
  line-height: 22px;
  font-weight: 600;
}

.tl-email-drop__body {
  margin: 2px 0 0;
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
}

.tl-email-drop__pick {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--tl-radius-control);
  border: 1px solid var(--tl-border-strong);
  background: var(--tl-surface);
  color: var(--tl-text);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.tl-email-drop__pick:hover {
  background: var(--tl-surface-muted);
}

.tl-email-drop__pick:focus-visible {
  outline: none;
  border-color: var(--tl-primary);
  box-shadow: var(--tl-focus-shadow);
}

.tl-email-drop__pick[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.8;
}

@media (max-width: 639.98px) {
  .tl-email-drop {
    flex-wrap: wrap;
  }

  .tl-email-drop__pick {
    width: 100%;
    height: 44px;
  }
}

.tl-email-spin {
  animation: tl-email-spin 0.9s linear infinite;
}

@keyframes tl-email-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tl-email-spin {
    animation: none;
  }
}

/* An upload's own result line ("Reading…", "Already in the inbox", or why not). */
.tl-email-upload {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--tl-surface-muted);
  font-size: 14px;
  line-height: 20px;
  overflow-wrap: anywhere;
}

.tl-email-upload p {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.tl-email-upload .tl-icon {
  flex: none;
  margin-top: 1px;
}

.tl-email-upload.is-error {
  background: var(--tl-danger-soft);
}

.tl-email-upload.is-error .tl-icon {
  color: var(--tl-danger);
}

/* The To review card. */
.tl-email-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--tl-border);
  border-radius: var(--tl-radius-card);
  background: var(--tl-surface);
  min-width: 0;
}

.tl-email-card__head {
  display: flex;
  gap: 12px;
  min-width: 0;
}

.tl-email-card__titles {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tl-email-card__title {
  margin: 0;
  font-size: 17px;
  line-height: 24px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.tl-email-card__meta {
  margin: 0;
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
  overflow-wrap: anywhere;
}

.tl-email-card__chips {
  margin: 6px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tl-email-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 2px 10px;
  border-radius: var(--tl-radius-pill);
  background: var(--tl-surface-muted);
  color: var(--tl-text-muted);
  font: 500 12px/18px var(--tl-font);
  overflow-wrap: anywhere;
}

.tl-email-chip .tl-icon {
  flex: none;
}

.tl-email-chip--ok {
  background: var(--tl-primary-soft);
  color: var(--tl-primary);
}

.tl-email-chip--bad {
  background: var(--tl-danger-soft);
  color: var(--tl-danger);
}

.tl-email-chip--sort {
  background: var(--tl-planned-soft);
  color: var(--tl-tint-amber-fg);
}

.tl-email-card__loading {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tl-email-card__progress {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  line-height: 20px;
  color: var(--tl-text-muted);
}

.tl-email-card__target {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--tl-surface-muted);
  min-width: 0;
}

.tl-email-card__target > .tl-icon {
  flex: none;
  margin-top: 3px;
  color: var(--tl-text-muted);
}

.tl-email-card__target-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 15px;
  line-height: 22px;
  overflow-wrap: anywhere;
}

.tl-email-card__target-text p {
  margin: 0;
}

.tl-email-card__target-text a {
  color: var(--tl-text);
}

.tl-email-card__name .tl-input {
  max-width: 360px;
}

.tl-email-card__choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tl-email-card__note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
}

.tl-email-card__note .tl-icon {
  flex: none;
  margin-top: 2px;
}

.tl-email-card__pieces {
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
  overflow-wrap: anywhere;
}

.tl-email-card__pieces .tl-icon {
  flex: none;
  margin-top: 2px;
}

.tl-email-card__text summary,
.tl-email__collapsed summary {
  cursor: pointer;
  min-height: 32px;
  display: flex;
  align-items: center;
  font: 500 14px/20px var(--tl-font);
  color: var(--tl-text);
}

/* The email's text, never its HTML. */
.tl-email-text {
  margin-top: 8px;
  max-height: 320px;
  overflow: auto;
  padding: 12px 14px;
  border: 1px solid var(--tl-border);
  border-radius: 12px;
  background: var(--tl-ground);
  font-size: 13px;
  line-height: 20px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--tl-text);
}

.tl-email-text--page {
  max-height: none;
}

.tl-email-card__open {
  display: inline-block;
  margin-top: 8px;
  font: var(--tl-text-meta);
  color: var(--tl-primary);
  text-decoration: underline;
}

.tl-email-card__error {
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--tl-danger);
  font-size: 14px;
  line-height: 20px;
}

.tl-email-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--tl-border);
}

.tl-email-card__selected {
  margin: 0;
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
}

.tl-email-card__actions {
  display: flex;
  gap: 8px;
}

@media (max-width: 639.98px) {
  .tl-email-card {
    padding: 16px;
  }

  .tl-email-card__foot {
    flex-direction: column;
    align-items: stretch;
  }

  .tl-email-card__actions {
    flex-direction: column-reverse;
  }

  .tl-email-card__name .tl-input {
    max-width: none;
  }
}

/* Unsorted, Recently added, Not bookings and rejected: quiet rows. */
.tl-email-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--tl-border);
  border-radius: var(--tl-radius-card);
  background: var(--tl-surface);
}

.tl-email-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  min-width: 0;
}

.tl-email-row + .tl-email-row {
  border-top: 1px solid var(--tl-border);
}

.tl-email-row__main {
  flex: 1 1 260px;
  min-width: 0;
  display: flex;
  gap: 12px;
}

.tl-email-row__texts {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tl-email-row__title {
  font-size: 15px;
  line-height: 22px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.tl-email-row__meta {
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
  overflow-wrap: anywhere;
}

.tl-email-row__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

@media (max-width: 639.98px) {
  .tl-email-row__actions {
    width: 100%;
    margin-left: 56px;
  }
}

/* An unsorted note in "Not on a day yet": a dashed border, the mail icon and "Needs sorting" (never colour alone). */
.tl-itin-card--unsorted {
  border-style: dashed !important;
  border-color: var(--tl-border-strong) !important;
}

.tl-sort-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: var(--tl-radius-pill);
  background: var(--tl-planned-soft);
  color: var(--tl-tint-amber-fg);
  font: 500 12px/18px var(--tl-font);
  white-space: nowrap;
}

.tl-itin-card__sort {
  align-self: flex-start;
  margin-top: 4px;
}

a.tl-sort-chip {
  text-decoration: none;
}

a.tl-sort-chip:hover {
  text-decoration: underline;
}

/* A sheet opened with "Make this a…": the note it replaces. */
.tl-replaces-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--tl-planned-soft);
  font-size: 14px;
  line-height: 20px;
  overflow-wrap: anywhere;
}

.tl-replaces-note .tl-icon {
  flex: none;
  margin-top: 2px;
  color: var(--tl-tint-amber-fg);
}

/* The trip header's "2 to sort": a chip that jumps to Not on a day yet. */
.tl-trip__sort {
  margin: 4px 0 0;
}

button.tl-sort-chip {
  border: 0;
  cursor: pointer;
  min-height: 28px;
}

button.tl-sort-chip:hover {
  text-decoration: underline;
}

/* A one-line banner on Trips while emails wait. */
.tl-email-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  padding: 10px 14px;
  border: 1px solid var(--tl-border);
  border-radius: 12px;
  background: var(--tl-surface);
  font-size: 14px;
  line-height: 20px;
}

.tl-email-banner .tl-icon {
  flex: none;
  color: var(--tl-primary);
}

.tl-email-banner a {
  margin-left: auto;
  color: var(--tl-primary);
  font-weight: 500;
  white-space: nowrap;
}

/* Open email. */
.tl-email-detail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 820px;
}

.tl-email-detail__facts {
  margin: 0;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 16px;
  font-size: 14px;
  line-height: 20px;
}

.tl-email-detail__facts dt {
  color: var(--tl-text-muted);
}

.tl-email-detail__facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 639.98px) {
  .tl-email-detail__facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .tl-email-detail__facts dd {
    margin-bottom: 8px;
  }
}

/* ---------------------------------------------------------------- v1.3c */

/* Quiet lines on a card: why it wasn't added automatically, arrived again, a copy reviewed anyway. */
.tl-email-card__quiet {
  margin: 2px 0 0;
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
  overflow-wrap: anywhere;
}

/* What several bookings share, said once; the package's one total. Muted: information, not a decision. */
.tl-email-card__shared {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
}

.tl-email-card__shared li {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  overflow-wrap: anywhere;
}

.tl-email-card__shared .tl-icon {
  flex: none;
  margin-top: 2px;
}

/* Cancellations: a tick box each (they need a decision). */
.tl-email-card__cancels {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tl-email-card__cancel {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--tl-border);
  border-radius: 12px;
}

.tl-email-card__cancel input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--tl-primary);
}

.tl-email-card__cancel label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  cursor: pointer;
}

.tl-email-card__cancel-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
  line-height: 20px;
  color: var(--tl-planned);
}

/* The inbox's model banner and Recently added's lines. */
.tl-email-model-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--tl-planned-border);
  border-radius: 12px;
  background: var(--tl-surface);
  font: var(--tl-text-meta);
  color: var(--tl-text);
  overflow-wrap: anywhere;
}

.tl-email-model-banner .tl-icon {
  flex: none;
  margin-top: 1px;
  color: var(--tl-planned);
}

.tl-email-row__details {
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
  overflow-wrap: anywhere;
}
