/* ═══════════════════════════════════════════════════════════════════════
   SITHIYAM OS — PQE3 Editorial UI
   PE_FIX_2026_04_18_PQE3_PHASE3_5_STEP5

   Styles for:
   - Preview modal (opens after generation + when clicking current editorial)
   - History drawer (list / re-apply / delete past editorials)

   Palette matches PQE3 magazine surface: dark walnut (#14100A),
   amber accents (#C9981C), cream text (#D9CFB6). Typography is
   Cormorant Garamond display + Syne uppercase micro-labels.
═══════════════════════════════════════════════════════════════════════ */

/* ═══ Scrim + modal container ══════════════════════════════════════ */
.pqe3-ed-scrim {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(8, 6, 4, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: pqe3EdScrimFade .25s ease-out;
}
.pqe3-ed-scrim.on { display: flex; }
@keyframes pqe3EdScrimFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.pqe3-ed-modal {
  background: #14100A;
  border: 1px solid rgba(201, 152, 28, 0.24);
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.7);
  max-width: 680px;
  width: 100%;
  max-height: calc(100vh - 48px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: #D9CFB6;
  animation: pqe3EdModalIn .32s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes pqe3EdModalIn {
  from { transform: translateY(18px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.pqe3-ed-modal-head {
  position: relative;
  padding: 28px 32px 18px;
  border-bottom: 1px solid rgba(201, 152, 28, 0.16);
}
.pqe3-ed-modal-kicker {
  font-family: 'Syne', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #C9981C;
  margin-bottom: 10px;
}
.pqe3-ed-modal-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 28px;
  font-weight: 400;
  color: #F6EEE2;
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.pqe3-ed-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: rgba(246, 238, 226, 0.06);
  color: #D9CFB6;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.pqe3-ed-modal-close:hover {
  background: rgba(201, 152, 28, 0.18);
  color: #F6EEE2;
}

/* ═══ Body scroll area ═══════════════════════════════════════════ */
.pqe3-ed-modal-body {
  padding: 20px 32px 24px;
  overflow-y: auto;
  flex: 1;
}

.pqe3-ed-section {
  padding: 14px 0;
  border-bottom: 1px solid rgba(201, 152, 28, 0.08);
}
.pqe3-ed-section:last-child { border-bottom: 0; }

.pqe3-ed-label {
  font-family: 'Syne', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #C9981C;
  margin-bottom: 8px;
}

.pqe3-ed-value {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 18px;
  font-style: italic;
  color: #F6EEE2;
  line-height: 1.45;
}

/* Cover kicker + headline as stacked pair */
.pqe3-ed-cover-pair .kicker {
  font-family: 'Syne', sans-serif;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #C9981C;
  font-style: normal;
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
}
.pqe3-ed-cover-pair .headline {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 22px;
  font-weight: 400;
  color: #F6EEE2;
  font-style: italic;
  letter-spacing: -0.005em;
  line-height: 1.2;
}

/* Consultant letter — multiline */
.pqe3-ed-letter {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 15.5px;
  line-height: 1.65;
  color: #E4D9BC;
  margin-bottom: 6px;
  white-space: pre-wrap;
  font-feature-settings: "liga", "kern";
}
.pqe3-ed-letter-sig {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 13px;
  color: #B89A5E;
  margin-top: 8px;
}

/* Meta row — generated at, model, cost, fingerprint match */
.pqe3-ed-meta {
  padding: 14px 18px;
  margin-top: 12px;
  background: rgba(201, 152, 28, 0.06);
  border: 1px solid rgba(201, 152, 28, 0.18);
  border-radius: 10px;
  font-family: 'Syne', sans-serif;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #B89A5E;
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}
.pqe3-ed-meta .match-yes { color: #7FCFA0; }
.pqe3-ed-meta .match-no  { color: #E08080; }

/* Banner for persist warnings */
.pqe3-ed-warn {
  margin: 14px 0 0;
  padding: 10px 14px;
  background: rgba(200, 90, 90, 0.10);
  border-left: 3px solid #C85A5A;
  color: #F5C8C8;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 12px;
  line-height: 1.4;
}

/* ═══ Action bar ═════════════════════════════════════════════════ */
.pqe3-ed-modal-actions {
  padding: 18px 32px 24px;
  border-top: 1px solid rgba(201, 152, 28, 0.16);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.pqe3-ed-btn {
  appearance: none;
  border: 0;
  font-family: 'Syne', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 11px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pqe3-ed-btn-primary {
  background: linear-gradient(160deg, #DDB840 0%, #B8820C 60%, #C99020 100%);
  color: #0B0806;
  box-shadow: 0 6px 18px rgba(201, 152, 28, 0.28);
}
.pqe3-ed-btn-primary:hover { transform: translateY(-1px); }

.pqe3-ed-btn-secondary {
  background: rgba(201, 152, 28, 0.12);
  color: #D9CFB6;
  border: 1px solid rgba(201, 152, 28, 0.34);
}
.pqe3-ed-btn-secondary:hover {
  background: rgba(201, 152, 28, 0.22);
  color: #F6EEE2;
}

.pqe3-ed-btn-tertiary {
  background: transparent;
  color: #8C7856;
  border: 1px solid transparent;
}
.pqe3-ed-btn-tertiary:hover { color: #D9CFB6; }

.pqe3-ed-btn-danger {
  background: rgba(200, 90, 90, 0.12);
  color: #E4A4A4;
  border: 1px solid rgba(200, 90, 90, 0.34);
}
.pqe3-ed-btn-danger:hover {
  background: rgba(200, 90, 90, 0.24);
  color: #F5C8C8;
}

/* ═══ History drawer (used in Step 3.5-6) ═══════════════════════ */
.pqe3-ed-history {
  padding: 0 32px 24px;
  max-height: 540px;
  overflow-y: auto;
}
.pqe3-ed-history-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid rgba(201, 152, 28, 0.10);
}
.pqe3-ed-history-row:last-child { border-bottom: 0; }
.pqe3-ed-history-row.active {
  background: linear-gradient(90deg, rgba(201,152,28,.10), rgba(201,152,28,.02));
  margin: 0 -12px;
  padding: 14px 12px;
  border-radius: 8px;
}

.pqe3-ed-history-meta {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 12px;
  color: #B89A5E;
  line-height: 1.5;
}
.pqe3-ed-history-meta .time {
  font-weight: 600;
  color: #F6EEE2;
  margin-right: 10px;
}
.pqe3-ed-history-meta .active-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(56, 180, 120, 0.16);
  color: #7FCFA0;
  font-family: 'Syne', sans-serif;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-left: 8px;
  vertical-align: 1px;
}
.pqe3-ed-history-meta .match {
  font-family: 'Syne', sans-serif;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 4px;
  display: inline-block;
}
.pqe3-ed-history-meta .match-yes { color: #7FCFA0; }
.pqe3-ed-history-meta .match-no  { color: #E08080; }

.pqe3-ed-history-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ═══ Mobile ═════════════════════════════════════════════════════ */
@media (max-width: 620px) {
  .pqe3-ed-scrim { padding: 0; align-items: flex-end; }
  .pqe3-ed-modal {
    border-radius: 18px 18px 0 0;
    max-height: 92vh;
    border: 0;
    border-top: 1px solid rgba(201, 152, 28, 0.24);
  }
  .pqe3-ed-modal-head,
  .pqe3-ed-modal-body,
  .pqe3-ed-modal-actions,
  .pqe3-ed-history { padding-left: 20px; padding-right: 20px; }
  .pqe3-ed-modal-title { font-size: 22px; }
  .pqe3-ed-modal-actions { justify-content: stretch; }
  .pqe3-ed-btn { flex: 1; justify-content: center; }
}
