/* ============================================================
   MailToPDF — convert page
   Three-pane editor + settings, namespaced .convert-*
============================================================ */

.page-convert {
  /* lock layout to viewport on desktop, scrollable on mobile */
  overflow-x: hidden;
}

.notice-bar {
  position: relative;
}
.notice-action {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--bg);
  border: 1px solid rgba(243, 237, 224, 0.35);
  padding: 3px 10px;
  margin-left: 16px;
  transition: background 0.2s, color 0.2s;
}
.notice-action:hover {
  background: var(--bg);
  color: var(--ink);
}

.nav-cta-light {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
}
.nav-cta-light:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

/* ============================================================
   App header
============================================================ */
.convert-app {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px var(--gutter) 0;
}
.convert-app-header {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 18px 28px;
}
.convert-app-header-meta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 6px 14px;
  border: 1px solid var(--rule);
  background: rgba(250, 246, 236, 0.5);
  align-self: center;
}
.convert-app-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
}
.convert-app-sub {
  font-size: 15px;
  color: var(--ink-muted);
  font-style: italic;
  font-family: var(--font-display);
  margin-left: auto;
}
@media (max-width: 760px) {
  .convert-app-sub { margin-left: 0; flex-basis: 100%; }
}

/* ============================================================
   Three-pane shell
============================================================ */
.convert-shell {
  display: grid;
  grid-template-columns: 240px 1fr 320px;
  gap: 0;
  border: 1px solid var(--rule);
  background: var(--paper);
  min-height: 620px;
  position: relative;
}
.convert-shell.is-drag::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid var(--accent);
  background: rgba(141, 56, 56, 0.05);
  pointer-events: none;
  z-index: 5;
}

/* ============================================================
   Left pane — files
============================================================ */
.convert-files {
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  background: var(--bg-warm);
}
.convert-files-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--paper);
}
.convert-files-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
}
.convert-add-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 4px 10px;
  transition: background 0.2s, color 0.2s;
}
.convert-add-btn:hover {
  background: var(--accent);
  color: var(--paper);
}

.convert-files-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  margin: 0;
  padding: 0;
}
.convert-files-list:empty { display: none; }
.convert-file-row {
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule-soft);
  cursor: pointer;
  transition: background 0.15s;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  align-items: start;
}
.convert-file-row:hover { background: var(--paper); }
.convert-file-row.is-active {
  background: var(--paper);
  border-left: 3px solid var(--accent);
  padding-left: 11px;
}
.convert-file-name {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  word-break: break-all;
  line-height: 1.3;
  grid-column: 1;
}
.convert-file-remove {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink-faint);
  padding: 0 6px;
  line-height: 1;
  grid-column: 2;
  grid-row: 1;
  align-self: start;
}
.convert-file-remove:hover { color: var(--accent); }
.convert-file-meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.convert-file-tag {
  padding: 1px 6px;
  border: 1px solid var(--rule);
  background: var(--bg);
}
.convert-file-tag.is-parsed { color: var(--green); border-color: var(--green); }
.convert-file-tag.is-error { color: var(--red); border-color: var(--red); }
.convert-file-tag.is-converted { color: var(--accent); border-color: var(--accent); }
.convert-file-tag.is-parsing { color: var(--gold); border-color: var(--gold); }

.convert-files-empty {
  padding: 32px 18px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 13px;
}
.convert-files-empty p { margin-bottom: 8px; }
.convert-files-empty-icon {
  width: 40px; height: 40px;
  margin: 0 auto 14px;
  color: var(--ink-faint);
  opacity: 0.5;
}

/* ============================================================
   Center pane — preview
============================================================ */
.convert-preview {
  background: var(--paper);
  overflow-y: auto;
  position: relative;
  min-height: 100%;
}

.convert-preview-empty {
  padding: clamp(32px, 6vw, 64px);
  text-align: center;
  color: var(--ink-muted);
}
.convert-preview-empty-mark {
  font-family: var(--font-display);
  font-size: clamp(60px, 10vw, 100px);
  line-height: 0.8;
  color: var(--accent);
  font-style: italic;
  margin-bottom: 18px;
  opacity: 0.6;
}
.convert-preview-empty h2 {
  font-family: var(--font-display);
  font-size: clamp(24px, 3.2vw, 32px);
  font-weight: 400;
  margin-bottom: 12px;
  color: var(--ink);
}
.convert-preview-empty p {
  max-width: 50ch;
  margin: 0 auto 32px;
  font-size: 15px;
  line-height: 1.55;
}
.convert-preview-empty p code {
  background: var(--bg-warm);
  padding: 1px 6px;
  color: var(--accent);
  border: 1px solid var(--rule-soft);
  font-size: 0.85em;
}

.convert-bigdrop {
  position: relative;
  border: 1.5px dashed var(--rule);
  padding: 40px 24px;
  max-width: 480px;
  margin: 0 auto;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  transition: border-color 0.2s, background 0.2s;
}
.convert-bigdrop:hover,
.convert-bigdrop:focus-visible,
.convert-bigdrop.is-drag {
  border-color: var(--accent);
  background: #fbf7ec;
  outline: none;
}
.convert-bigdrop-text {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink);
}
.convert-bigdrop-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* Document preview */
.convert-preview-doc {
  padding: clamp(28px, 4.5vw, 56px);
  max-width: 720px;
  margin: 0 auto;
  font-family: var(--font-body);
}
.convert-preview-doc-head {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 18px;
  margin-bottom: 24px;
}
.convert-preview-doc-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 14px;
}
.convert-preview-subject {
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 400;
  line-height: 1.15;
  color: var(--ink);
  letter-spacing: -0.015em;
}

.convert-preview-headers {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 28px;
  font-size: 14px;
}
.convert-preview-headers tr { border-bottom: 1px dotted var(--rule-soft); }
.convert-preview-headers th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
  padding: 8px 14px 8px 0;
  width: 80px;
  vertical-align: top;
}
.convert-preview-headers td {
  padding: 8px 0;
  color: var(--ink);
  word-break: break-word;
  font-family: var(--font-body);
}
.convert-preview-headers td.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
}

.convert-preview-body-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule-soft);
}

.convert-preview-body {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.convert-preview-body iframe {
  width: 100%;
  min-height: 400px;
  border: 1px solid var(--rule-soft);
  background: #ffffff;
}
.convert-preview-body pre {
  font-family: var(--font-mono);
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-warm);
  padding: 16px;
  border: 1px solid var(--rule-soft);
  color: var(--ink-soft);
  line-height: 1.5;
}

.convert-preview-attachments {
  margin-top: 32px;
}
.convert-preview-attachments ul {
  list-style: none;
}
.convert-preview-attachments li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dotted var(--rule-soft);
  font-size: 14px;
}
.convert-preview-attachments .att-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.convert-preview-attachments .att-name {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  word-break: break-all;
}
.convert-preview-attachments .att-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.att-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  background: var(--bg);
  flex-shrink: 0;
}
.att-badge.is-embedded { color: var(--green); border-color: var(--green); }
.att-badge.is-appended { color: var(--accent); border-color: var(--accent); }
.att-badge.is-zipped { color: var(--gold); border-color: var(--gold); }
.att-badge.is-reference { color: var(--ink-muted); }

/* ============================================================
   Right pane — settings
============================================================ */
.convert-settings {
  border-left: 1px solid var(--rule);
  background: var(--bg-warm);
  padding: 18px 18px 24px;
  overflow-y: auto;
}
.convert-settings-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}
.convert-settings-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
}

.settings-group {
  border: none;
  padding: 0 0 18px;
  margin-bottom: 18px;
  border-bottom: 1px dotted var(--rule);
}
.settings-group:last-of-type { border-bottom: none; }
.settings-group legend {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 10px;
  padding: 0;
}

/* radios */
.settings-radio {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 8px 0;
  cursor: pointer;
  border-bottom: 1px dotted var(--rule-soft);
}
.settings-radio:last-child { border-bottom: none; }
.settings-radio input { position: absolute; opacity: 0; pointer-events: none; }
.settings-radio-bullet {
  width: 14px; height: 14px;
  border: 1.5px solid var(--rule);
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
  background: var(--paper);
  position: relative;
  transition: border-color 0.2s;
}
.settings-radio input:checked + .settings-radio-bullet {
  border-color: var(--accent);
}
.settings-radio input:checked + .settings-radio-bullet::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--accent);
}
.settings-radio input:focus-visible + .settings-radio-bullet {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.settings-radio-text strong {
  display: block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 2px;
}
.settings-radio-text em {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--ink-muted);
  line-height: 1.3;
}

/* checkboxes */
.settings-check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 4px 0 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink);
}
.settings-check input { position: absolute; opacity: 0; pointer-events: none; }
.settings-check-bullet {
  width: 14px; height: 14px;
  border: 1.5px solid var(--rule);
  background: var(--paper);
  position: relative;
  flex-shrink: 0;
}
.settings-check input:checked + .settings-check-bullet {
  background: var(--accent);
  border-color: var(--accent);
}
.settings-check input:checked + .settings-check-bullet::after {
  content: "";
  position: absolute;
  left: 3px; top: 0;
  width: 5px; height: 9px;
  border: solid var(--paper);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.settings-check input:focus-visible + .settings-check-bullet {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Bates fields */
.settings-bates-fields {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dotted var(--rule-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0.4;
  pointer-events: none;
  transition: opacity 0.2s;
}
.settings-bates-fields.is-active {
  opacity: 1;
  pointer-events: auto;
}
.settings-field {
  display: grid;
  grid-template-columns: 80px 1fr;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.settings-field input,
.settings-field select {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 8px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  text-transform: none;
  width: 100%;
}
.settings-field input:focus,
.settings-field select:focus {
  outline: none;
  border-color: var(--accent);
}
.settings-bates-preview {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  margin-top: 4px;
}
.settings-bates-preview span {
  color: var(--accent);
  font-weight: 500;
}

/* pills */
.settings-pills {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.settings-pill {
  cursor: pointer;
  text-align: center;
  position: relative;
}
.settings-pill input { position: absolute; opacity: 0; pointer-events: none; }
.settings-pill span {
  display: block;
  padding: 8px 6px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  background: var(--paper);
  transition: all 0.15s;
  letter-spacing: 0.03em;
}
.settings-pill input:checked + span {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.settings-pill input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* convert CTA full width */
.convert-cta-full {
  width: 100%;
  justify-content: center;
  margin-top: 12px;
}
.convert-cta-full:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

.convert-progress {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.convert-progress-track {
  flex: 1;
  height: 4px;
  background: var(--rule);
  position: relative;
  overflow: hidden;
}
.convert-progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--accent);
  width: 0;
  transition: width 0.3s;
}
.convert-progress-text {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  white-space: nowrap;
}

/* ============================================================
   Status bar
============================================================ */
.convert-statusbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding: 12px 16px;
  margin-top: 16px;
  border: 1px solid var(--rule);
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.convert-statusbar strong {
  color: var(--ink);
  font-weight: 600;
}
.status-cluster { display: inline-flex; gap: 6px; align-items: baseline; }
.status-divider { width: 1px; height: 12px; background: var(--rule); }
.status-warn {
  color: var(--accent);
  border-left: 2px solid var(--accent);
  padding-left: 10px;
}

/* ============================================================
   Modal
============================================================ */
.convert-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.convert-modal[hidden] { display: none; }
.convert-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 22, 18, 0.5);
  backdrop-filter: blur(2px);
}
.convert-modal-card {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--rule);
  max-width: 540px;
  width: 100%;
  padding: clamp(28px, 5vw, 44px);
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease-out;
}
.convert-modal-num {
  font-family: var(--font-display);
  font-size: 56px;
  line-height: 0.8;
  color: var(--accent);
  font-style: italic;
  margin-bottom: 12px;
}
.convert-modal-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  color: var(--ink);
}
.convert-modal p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin-bottom: 16px;
}
.convert-modal-steps {
  margin: 0 0 16px 24px;
  padding: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
}
.convert-modal-steps li {
  margin-bottom: 10px;
  padding-left: 4px;
}
.convert-modal-steps code {
  background: var(--bg-warm);
  padding: 1px 6px;
  font-size: 0.85em;
  color: var(--accent);
  border: 1px solid var(--rule-soft);
}
.convert-modal-fine {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-muted);
  border-top: 1px solid var(--rule-soft);
  padding-top: 16px;
  margin-top: 8px;
}
.convert-modal-close {
  position: absolute;
  top: 12px; right: 16px;
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--ink-faint);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.convert-modal-close:hover { color: var(--accent); }

/* ============================================================
   Responsive
============================================================ */
@media (max-width: 1080px) {
  .convert-shell {
    grid-template-columns: 220px 1fr 300px;
  }
}
@media (max-width: 920px) {
  .convert-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  .convert-files,
  .convert-settings {
    border-right: none;
    border-left: none;
    border-bottom: 1px solid var(--rule);
    max-height: 320px;
  }
  .convert-files-list { max-height: 240px; }
  .convert-preview { min-height: 480px; }
  .convert-settings { border-bottom: none; border-top: 1px solid var(--rule); }
}
@media (max-width: 540px) {
  .convert-app { padding: 18px var(--gutter) 0; }
  .settings-pills { grid-template-columns: 1fr 1fr; }
  .notice-bar { flex-wrap: wrap; padding: 9px 14px; font-size: 11px; }
  .notice-action { margin-left: 0; }
}
