/* ==========================================================
   CUSTOMER HISTORY V1
   Eigenständiger Screen – mobile first
========================================================== */

.customer-history-screen {
  min-height: 100vh;
  background:
    linear-gradient(
      180deg,
      #f8fbfc 0%,
      #f5f9fa 48%,
      #f7fafb 100%
    );
  color: #0f172a;
  padding:
    max(18px, env(safe-area-inset-top))
    18px
    calc(110px + env(safe-area-inset-bottom));
}

.customer-history-header,
.customer-history-content {
  width: min(100%, 620px);
  margin-inline: auto;
}

.customer-history-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.customer-history-header__back {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .07);
  font: inherit;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.customer-history-header__title {
  min-width: 0;
}

.customer-history-header__title span,
.customer-history-eyebrow {
  display: block;
  color: #708090;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .035em;
}

.customer-history-header__title h1 {
  margin: 3px 0 0;
  color: #0f172a;
  font-size: clamp(21px, 5vw, 28px);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.customer-history-content {
  display: grid;
  gap: 22px;
}

.customer-history-customer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border: 1px solid rgba(15, 23, 42, .035);
  border-radius: 26px;
  background: #ffffff;
  box-shadow: 0 12px 34px rgba(15, 23, 42, .055);
}

.customer-history-customer__avatar {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #16b8b1;
  color: #ffffff;
  font-size: 25px;
  font-weight: 800;
}

.customer-history-customer__identity {
  min-width: 0;
}

.customer-history-customer__identity h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
}

.customer-history-customer__identity p {
  margin: 5px 0 0;
  color: #64748b;
  font-size: 14px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.customer-history-customer__identity time {
  display: block;
  margin-top: 8px;
  color: #82909f;
  font-size: 13px;
  font-weight: 650;
}

.customer-history-summary {
  padding: 21px;
  border: 1px solid rgba(15, 23, 42, .04);
  border-radius: 26px;
  background: #ffffff;
  box-shadow: 0 12px 34px rgba(15, 23, 42, .05);
}

.customer-history-summary__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.customer-history-summary__top h2 {
  margin: 5px 0 0;
  font-size: 24px;
  line-height: 1.15;
}

.customer-history-summary__mark {
  min-width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #e9fbfb;
  color: #0f8f8a;
  font-size: 18px;
  font-weight: 850;
}

.customer-history-summary__groups {
  display: grid;
  gap: 9px;
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid rgba(15, 23, 42, .075);
}

.customer-history-summary__group {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 34px;
}

.customer-history-summary__dot,
.customer-history-position__status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #94a3b8;
}

.customer-history-summary__label {
  color: #475569;
  font-size: 14px;
  font-weight: 700;
}

.customer-history-summary__count {
  min-width: 30px;
  color: #0f172a;
  text-align: right;
  font-size: 15px;
}

.customer-history-summary__group--complaint
.customer-history-summary__dot,
.customer-history-position__status--complaint
.customer-history-position__status-dot {
  background: #e85d5d;
}

.customer-history-summary__group--clarification
.customer-history-summary__dot,
.customer-history-position__status--clarification
.customer-history-position__status-dot {
  background: #e9a23b;
}

.customer-history-summary__group--partial_delivery
.customer-history-summary__dot,
.customer-history-position__status--partial_delivery
.customer-history-position__status-dot {
  background: #d9a328;
}

.customer-history-summary__group--shipping
.customer-history-summary__dot,
.customer-history-position__status--shipping
.customer-history-position__status-dot {
  background: #4687d9;
}

.customer-history-summary__group--ordered
.customer-history-summary__dot,
.customer-history-position__status--ordered
.customer-history-position__status-dot,
.customer-history-summary__group--processing
.customer-history-summary__dot,
.customer-history-position__status--processing
.customer-history-position__status-dot {
  background: #16b8b1;
}

.customer-history-summary__group--completed
.customer-history-summary__dot,
.customer-history-position__status--completed
.customer-history-position__status-dot,
.customer-history-summary__group--delivered
.customer-history-summary__dot,
.customer-history-position__status--delivered
.customer-history-position__status-dot {
  background: #48a96b;
}

.customer-history-summary__group--reported
.customer-history-summary__dot,
.customer-history-position__status--reported
.customer-history-position__status-dot {
  background: #16b8b1;
}

.customer-history-positions {
  display: grid;
  gap: 13px;
}

.customer-history-positions__heading h2 {
  margin: 4px 0 0;
  font-size: 23px;
}

.customer-history-positions__list {
  display: grid;
  gap: 14px;
}

.customer-history-position {
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, .04);
  border-radius: 25px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .052);
}

.customer-history-position__main {
  display: grid;
  gap: 17px;
  padding: 18px;
}

.customer-history-position__product {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.customer-history-position__image {
  position: relative;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 17px;
  background: #edfafa;
}

.customer-history-position__image img {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #ffffff;
}

.customer-history-position__image span {
  position: absolute;
  z-index: 1;
  font-size: 22px;
}

.customer-history-position__image--fallback span {
  position: static;
}

.customer-history-position__identity {
  min-width: 0;
}

.customer-history-position__identity h3 {
  margin: 0;
  color: #0f172a;
  font-size: 16px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.customer-history-position__identity p {
  margin: 7px 0 0;
  color: #718096;
  font-size: 13px;
}

.customer-history-position__identity p strong {
  color: #475569;
}

.customer-history-position__status {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 10px 13px;
  border-radius: 14px;
  background: #f4f8f9;
  color: #334155;
  font-size: 14px;
  font-weight: 800;
}

.customer-history-accordion {
  border-top: 1px solid rgba(15, 23, 42, .075);
}

.customer-history-accordion summary {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  color: #334155;
  font-size: 14px;
  font-weight: 800;
  list-style: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.customer-history-accordion summary::-webkit-details-marker {
  display: none;
}

.customer-history-accordion__arrow {
  color: #16a6a0;
  font-size: 18px;
  transition: transform .22s ease;
}

.customer-history-accordion[open]
.customer-history-accordion__arrow {
  transform: rotate(180deg);
}

.customer-history-accordion__body {
  padding: 2px 18px 20px;
}

.customer-history-timeline {
  display: grid;
}

.customer-history-event {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  min-height: 68px;
}

.customer-history-event__rail {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.customer-history-event__icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e9f8f8;
  color: #0f9f99;
  font-size: 13px;
  font-weight: 900;
}

.customer-history-event--current
.customer-history-event__icon {
  background: #16b8b1;
  color: #ffffff;
}

.customer-history-event__line {
  width: 2px;
  min-height: 38px;
  flex: 1;
  background: #dce9eb;
}

.customer-history-event__content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 3px 0 20px;
}

.customer-history-event__content strong {
  color: #0f172a;
  font-size: 14px;
  line-height: 1.3;
}

.customer-history-event__actor {
  margin-top: 5px;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
}

.customer-history-event__detail {
  margin-top: 5px;
  color: #0f8f8a;
  font-size: 14px;
  font-weight: 800;
}

.customer-history-event__content time {
  margin-top: 5px;
  color: #8996a3;
  font-size: 12px;
  font-weight: 650;
}

.customer-history-timeline__empty,
.customer-history-empty {
  padding: 18px;
  border-radius: 18px;
  background: #f4f8f9;
  color: #64748b;
  font-size: 14px;
  line-height: 1.5;
}

@media (min-width: 680px) {
  .customer-history-screen {
    padding-top: 28px;
  }

  .customer-history-position__main {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .customer-history-position__status {
    min-width: 170px;
    justify-content: center;
  }
}

@media (max-width: 380px) {
  .customer-history-screen {
    padding-inline: 14px;
  }

  .customer-history-customer,
  .customer-history-summary {
    padding: 17px;
  }

  .customer-history-position__main {
    padding: 16px;
  }

  .customer-history-position__image {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
  }
}

.customer-cancellation-info { padding: 16px; border-radius: 12px; background: #f5f7f9; overflow-wrap: anywhere; }
.customer-cancellation-button { min-height: 44px; padding: 10px 16px; border: 1px solid #a32626; border-radius: 8px; background: white; color: #8a2020; font: inherit; cursor: pointer; }
.customer-cancellation-dialog { box-sizing: border-box; width: min(480px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 24px; border: 0; border-radius: 16px; color: #172534; box-shadow: 0 20px 80px #0004; }
.customer-cancellation-dialog::backdrop { background: #10203088; }
.customer-cancellation-dialog h2 { margin-top: 0; font-size: 22px; }
.customer-cancellation-dialog p { line-height: 1.5; }
.customer-cancellation-dialog label { color: #172534; display: block; font-weight: 600; margin-bottom: 8px; }
.customer-cancellation-dialog textarea { box-sizing: border-box; width: 100%; font: inherit; font-size: 16px; padding: 12px; border: 1px solid #8795a2; border-radius: 8px; resize: vertical; }
.customer-cancellation-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.customer-cancellation-actions button { flex: 1 1 140px; min-height: 44px; padding: 12px; border-radius: 8px; border: 1px solid #8795a2; background: white; font: inherit; cursor: pointer; }
.customer-cancellation-actions button[type="submit"] { background: #942626; color: white; border-color: #942626; }
.customer-cancellation-actions button:disabled { opacity: .6; cursor: wait; }
.customer-cancellation-error { color: #942626; overflow-wrap: anywhere; }
.customer-cancellation-dialog :focus-visible { outline: 3px solid #1673bd; outline-offset: 3px; }
