:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #162033;
  --muted: #65758b;
  --line: #d9e1ec;
  /* Bleu de la marque SES E-Tech */
  --primary: #2a22e0;
  --primary-dark: #1f18b8;
  --accent: #f59e0b;
  --danger: #b42318;
  --success: #067647;
  --shadow: 0 18px 60px rgba(16, 32, 51, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(42, 34, 224, 0.10), rgba(124, 118, 255, 0.06)),
    var(--bg);
}

.app-shell {
  width: min(1040px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 18px;
  display: grid;
  gap: 18px;
  align-items: center;
}

.tracking-panel,
.result-panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(217, 225, 236, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tracking-panel {
  padding: 28px;
}

.result-panel {
  padding: 24px;
}

.is-hidden {
  display: none !important;
}

.brand-row,
.result-header,
.amount-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-row {
  justify-content: flex-start;
  margin-bottom: 28px;
}

.brand-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
}

.brand-logo {
  display: block;
  height: 44px;
  width: auto;
}

.site-footer {
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.65rem, 2.8vw, 2.3rem);
  line-height: 1.05;
}

h2 {
  font-size: 1.35rem;
  line-height: 1.15;
}

.tracking-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
}

label,
.info-item span,
.detail-block span,
.amount-row span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
  outline: none;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(42, 34, 224, 0.12);
}

.primary-button {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #ffffff;
  background: var(--primary);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.primary-button:hover {
  background: var(--primary-dark);
}

.primary-button:disabled {
  cursor: progress;
  opacity: 0.68;
}

.button-icon {
  font-weight: 900;
}

.message {
  min-height: 22px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.95rem;
}

.message.error {
  color: var(--danger);
}

.message.success {
  color: var(--success);
}

.status-badge {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 13px;
  color: #ffffff;
  background: var(--primary);
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
}

.result-panel[data-status="completed"] .status-badge {
  background: var(--success);
}

.result-panel[data-status="cancelled"] .status-badge,
.result-panel[data-status="refused"] .status-badge {
  background: var(--danger);
}

.result-panel[data-status="delivered"] .status-badge {
  background: var(--success);
}

.result-panel[data-status="delayed"] .status-badge {
  background: #c2410c;
}

.timeline {
  list-style: none;
  margin: 24px 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
}

.timeline-item {
  min-height: 84px;
  padding: 14px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
  font-size: 0.82rem;
}

.timeline-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid #bac6d6;
}

.timeline-item.is-done {
  color: var(--ink);
  border-color: rgba(42, 34, 224, 0.42);
  background: rgba(42, 34, 224, 0.08);
}

.timeline-item.is-done .timeline-dot {
  border-color: var(--primary);
  background: var(--primary);
}

.timeline-item.is-current {
  box-shadow: inset 0 0 0 2px rgba(245, 158, 11, 0.55);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.info-item,
.detail-block,
.amount-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.info-item {
  min-height: 82px;
  padding: 14px;
  display: grid;
  align-content: center;
  gap: 6px;
}

.info-item strong,
.amount-row strong {
  overflow-wrap: anywhere;
}

.detail-block {
  margin-top: 12px;
  padding: 14px;
}

.detail-block p {
  margin: 8px 0 0;
  line-height: 1.5;
}

.amount-row {
  margin-top: 12px;
  padding: 16px;
}

.amount-row > div {
  display: grid;
  gap: 4px;
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
    align-items: start;
    padding-top: 18px;
  }
}

@media (max-width: 560px) {
  .tracking-panel,
  .result-panel {
    padding: 20px;
  }

  .result-header,
  .amount-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .timeline,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    min-height: 64px;
    grid-template-columns: auto 1fr;
    justify-items: start;
    text-align: left;
  }
}

/* ---- Phase 10b : code de l'appareil transmis par le client ---- */

.secret-hint,
.secret-help {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.92rem;
}

.secret-sent {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.secret-sent li {
  border: 1px solid rgba(6, 118, 71, 0.35);
  background: rgba(6, 118, 71, 0.07);
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 700;
}

.secret-sent li small {
  display: block;
  color: var(--muted);
  font-weight: 500;
}

.secret-form {
  margin-top: 18px;
  display: grid;
  gap: 16px;
}

.kind-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: var(--bg);
  border-radius: 8px;
  padding: 4px;
}

.kind-tab {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.kind-tab[aria-selected="true"] {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(16, 32, 51, 0.12);
}

.pattern-lock {
  width: min(280px, 100%);
  margin: 12px auto 0;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  touch-action: none;
  user-select: none;
}

.pattern-svg {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.pattern-hit {
  fill: transparent;
}

.pattern-dot {
  fill: #bac6d6;
}

.pattern-dot.is-on {
  fill: var(--primary);
}

.pattern-dot.is-start {
  fill: var(--success);
}

.pattern-line,
.pattern-live {
  stroke: var(--primary);
  stroke-width: 2.4;
  stroke-linecap: round;
  opacity: 0.75;
}

.pattern-live {
  opacity: 0.35;
}

.pattern-arrow {
  fill: var(--primary);
}

.pattern-rank {
  font-size: 5px;
  font-weight: 800;
  fill: var(--ink);
}

.pattern-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.pattern-text {
  font-weight: 700;
}

.link-button {
  border: 0;
  background: none;
  color: var(--primary);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  padding: 6px;
}

.inline-check,
.consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.95rem;
}

.inline-check {
  margin-top: 8px;
  font-weight: 500;
}

.inline-check input,
.consent input {
  width: 20px;
  min-height: 20px;
  height: 20px;
  margin: 1px 0 0;
  flex: none;
}
