/* === WinterPost Horizontal Timeline & Letterbox Desk === */
.wp-app,
.wp-desk-card {
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

.wp-app [hidden],
.wp-modal-backdrop[hidden] {
  display: none !important;
}

.wp-desk-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.wp-desk-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 24px;
  background: #f8fafd;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

.wp-seg {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: #e9eff8;
  border-radius: var(--radius);
}

.wp-seg-btn {
  min-height: 36px;
  padding: 6px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.wp-seg-btn[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.wp-desk-controls {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr) auto;
  gap: 16px;
  align-items: end;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.wp-tfield {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.wp-tfield input,
.wp-tfield textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.4;
}

.wp-editions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.wp-ed-btn {
  min-height: 40px;
  padding: 6px 8px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.wp-ed-btn[aria-pressed="true"] {
  border-color: var(--primary);
  background: #eaf0fa;
  color: var(--primary);
}

.wp-ed-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.wp-ed-dot[data-ed="airmail"] { background: #1f56b5; }
.wp-ed-dot[data-ed="midnight"] { background: #16243d; }
.wp-ed-dot[data-ed="cedar"] { background: #235c3e; }
.wp-ed-dot[data-ed="velvet"] { background: #6b2736; }

.wp-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 24px;
  background: #f8fafd;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.wp-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  cursor: pointer;
}

.wp-inline-actions {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
  max-width: 100%;
  min-width: 0;
  gap: 14px;
}

.wp-inline-actions button {
  flex-shrink: 0;
  font-size: 13px;
  color: var(--muted);
}

.wp-lookup-bar {
  display: flex;
  gap: 8px;
  padding: 12px 24px;
  background: #f0f4fa;
  border-bottom: 1px solid var(--border);
}

.wp-lookup-bar input {
  flex: 1 1 200px;
  min-width: 0;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 14px;
}

/* Horizontal 24-Day Postmark Timeline */
.wp-timeline-zone {
  padding: 24px;
  max-width: 100%;
  overflow-x: hidden;
  transition: background-color 0.2s ease;
}

.wp-timeline-zone[data-edition="airmail"] { background: #f4f6f9; color: var(--text); }
.wp-timeline-zone[data-edition="midnight"] { background: #16243d; color: #ffffff; }
.wp-timeline-zone[data-edition="cedar"] { background: #edf4ef; color: var(--text); }
.wp-timeline-zone[data-edition="velvet"] { background: #4a1c27; color: #ffffff; }

.wp-timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.wp-box-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1.2;
}

.wp-box-meta {
  margin: 4px 0 0;
  font-size: 13px;
  opacity: 0.82;
}

.wp-scroll-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wp-scroll-btn {
  min-height: 36px;
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.wp-ribbon-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  padding: 8px 2px 14px;
  scroll-snap-type: x proximity;
}

.wp-env-slot {
  flex: 0 0 116px;
  scroll-snap-align: start;
  position: relative;
  padding: 14px 10px 12px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.wp-env-slot:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.wp-env-slot.is-active {
  border: 2px solid var(--primary);
  box-shadow: 0 6px 16px rgba(31, 86, 181, 0.18);
}

.wp-env-slot.is-today {
  border-color: var(--accent);
}

.wp-env-date {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.wp-wax-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  background: #e9eff8;
  color: var(--muted);
  border: 2px dashed #c4d0e3;
}

.wp-env-slot.has-mail .wp-wax-circle {
  border-style: solid;
  border-color: #ffffff;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(22, 36, 61, 0.22);
}

.wp-wax-circle.seal-crimson { background: #c2362b; }
.wp-wax-circle.seal-cobalt { background: #1f56b5; }
.wp-wax-circle.seal-gold { background: #b8801c; }
.wp-wax-circle.seal-silver { background: #4c627d; }

.wp-env-sender {
  font-size: 12px;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wp-env-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 6px;
  background: #fdeceb;
  color: #a62b22;
}

/* Reader / Composer Drawer below the Horizontal Strip */
.wp-reader-pane {
  margin-top: 16px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.wp-reader-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
}

.wp-reader-day {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--text);
}

.wp-postcard-body {
  margin: 0 0 12px;
  font-size: 18px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.wp-postcard-from {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}

/* Active Box Share & Utility Bar */
.wp-box-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 16px 24px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.wp-box-bar input {
  flex: 1 1 220px;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.wp-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.wp-chip {
  min-height: 38px;
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.wp-chip[aria-pressed="true"] {
  border-color: var(--primary);
  background: #eaf0fa;
  color: var(--primary);
}

.wp-status {
  padding: 0 24px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}

.wp-status.is-error {
  color: var(--accent);
}

/* Modal */
.wp-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(22, 36, 61, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.wp-modal-card {
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.wp-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.wp-modal-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--text);
}

.wp-close-btn {
  min-width: 40px;
  min-height: 40px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
}

@media (max-width: 900px) {
  .wp-desk-controls {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .wp-desk-top {
    padding: 10px 14px;
    gap: 8px;
    flex-direction: column;
    align-items: stretch;
  }
  .wp-desk-controls {
    padding: 12px 14px;
    gap: 10px;
  }
  .wp-subbar,
  .wp-timeline-zone,
  .wp-box-bar {
    padding-left: 14px;
    padding-right: 14px;
  }
  .wp-seg {
    width: 100%;
  }
  .wp-editions {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .wp-ed-btn {
    min-height: 38px;
    padding: 6px 8px;
  }
  .wp-desk-controls .wp-btn {
    width: 100%;
  }
  .wp-box-bar .wp-btn {
    width: 100%;
  }
}
