/* PubRescue email tools: viewer, archive view and print (Save as PDF). Uses the tokens from /static/style.css. */
.mail-tool { padding: 20px; margin: 16px auto 8px; max-width: 1080px; }
.mail-tool [hidden] { display: none !important; }
.mail-drop.mail-drop-small { padding: 10px 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 14px; }
.mail-drop.mail-drop-small svg, .mail-drop.mail-drop-small .drop-free { display: none; }
.mail-drop.mail-drop-small .drop-title { margin: 0; font-size: 1rem; }
.mail-drop.mail-drop-small .drop-buttons { margin: 0; }
.mail-status { margin: 10px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.mail-status.error { color: var(--err); }
.mail-app { margin-top: 12px; }
.pub-cross { margin-top: 32px; color: var(--muted); }
.mv-toolbar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0 0 12px; }
.mv-toolbar .mv-kind { margin: 0; }
.mv-index { padding: 12px 0; }
.mv-index progress { width: 100%; height: 10px; accent-color: var(--accent); display: block; margin: 8px 0 12px; }
.mv-index-label { margin: 0; font-weight: 500; }

/* reader */
.mv-msg { min-width: 0; }
.mv-back { display: inline-flex; margin-bottom: 4px; }
.mv-subject { margin: 4px 0 10px; font-size: clamp(1.2rem, 2.6vw, 1.5rem); }
.mv-subject:focus, .mv-subject:focus-visible { outline: none; }
.mv-head { margin: 0 0 12px; display: grid; gap: 2px; font-size: .95rem; }
.mv-head div { display: flex; gap: 8px; min-width: 0; }
.mv-head dt { color: var(--muted); flex: 0 0 3.6em; }
.mv-head dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.mv-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.mv-remote { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; background: var(--warn-soft); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin: 0 0 10px; font-size: .9rem; }
.mv-remote[hidden] { display: none; }
.mv-body { display: block; width: 100%; min-height: 120px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.mv-atts h3 { font-size: 1rem; margin: 18px 0 8px; }
.mv-att-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mv-att { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.mv-ico { color: var(--accent); display: inline-flex; }
.mv-att-name { font-weight: 600; flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
.mv-att-size { white-space: nowrap; }
.mv-att-btns { display: flex; gap: 6px; }
.mv-att-btns .btn { min-height: 36px; padding: 4px 12px; }

/* archive view */
.ma-top { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-end; }
.ma-field { display: flex; flex-direction: column; gap: 4px; min-width: 180px; }
.ma-field label, .ma-search > label:first-child { font-weight: 600; font-size: .92rem; }
.ma-folder, .ma-q { font: inherit; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); min-height: 44px; }
.ma-search { flex: 1 1 320px; display: flex; flex-direction: column; gap: 4px; }
.ma-search-row { display: flex; gap: 8px; }
.ma-q { flex: 1 1 auto; min-width: 0; }
.ma-ft { font-size: .92rem; min-height: 36px; }
.ma-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 6px; padding: 8px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.ma-bar .btn { min-height: 40px; }
.ma-bar-gap { flex: 1 1 auto; }
.ma-selinfo { color: var(--muted); font-size: .92rem; }
.ma-job { min-height: 1.4em; margin: 4px 0 8px; font-size: .92rem; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ma-job .btn { min-height: 36px; }
.ma-batches p { margin: 0 0 6px; }
.ma-batch-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.ma-panes { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: 16px; align-items: start; }
.ma-list { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); max-height: 78vh; overflow: auto; }
.ma-count { margin: 0; padding: 8px 12px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.ma-rows { list-style: none; margin: 0; padding: 0; }
.ma-row { display: flex; align-items: stretch; border-bottom: 1px solid var(--border); }
.ma-row.active { background: var(--accent-soft); }
.ma-cb { width: 20px; height: 20px; margin: 12px 4px 0 10px; accent-color: var(--accent); flex: none; }
.ma-open { flex: 1 1 auto; min-width: 0; text-align: left; background: none; border: 0; font: inherit; color: var(--text); padding: 8px 10px 8px 6px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.ma-open:hover .ma-subj { text-decoration: underline; }
.ma-line1 { display: flex; gap: 8px; justify-content: space-between; font-size: .88rem; }
.ma-from { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ma-date { color: var(--muted); white-space: nowrap; flex: none; }
.ma-subj { font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ma-meta { display: flex; gap: 6px; align-items: center; font-size: .78rem; color: var(--muted); min-height: 1em; }
.ma-clip { display: inline-flex; color: var(--muted); }
.ma-kind { display: inline-block; font-size: .75rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 0 6px; }
.mv-kindlabel { margin: 4px 0 0; }
.ma-more { margin: 10px; }
.ma-read { min-width: 0; }
.ma-back { display: none; }
.ma-empty { padding: 24px 0; }
.error { color: var(--err); }
@media (max-width: 760px) {
  .mail-tool { padding: 12px; }
  .ma-panes { grid-template-columns: 1fr; }
  .ma-list { max-height: none; }
  .ma.ma-reading .ma-list, .ma.ma-reading .ma-top, .ma.ma-reading .ma-bar { display: none; }
  .ma .ma-read { display: none; }
  .ma.ma-reading .ma-read { display: block; }
  .ma.ma-reading .ma-back { display: inline-flex; }
  .ma-bar .btn { flex: 1 1 45%; }
  .ma-bar-gap { display: none; }
  .mv-actions .btn { flex: 1 1 45%; }
}

/* print view: only #mail-print is printed; it is never shown on screen (except the dev preview) */
#mail-print { display: none; }
.mp-msg { color: #000; background: #fff; font: 11pt/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.mp-subj { font-size: 16pt; margin: 0 0 8pt; color: #000; }
.mp-head { border-collapse: collapse; margin: 0 0 10pt; font-size: 10pt; width: 100%; border-bottom: 1px solid #999; }
.mp-head th { text-align: left; vertical-align: top; padding: 1pt 10pt 1pt 0; width: 6em; color: #444; font-weight: 600; }
.mp-head td { padding: 1pt 0 3pt; overflow-wrap: anywhere; }
.mp-imgs { margin-top: 12pt; }
.mp-img { margin: 0 0 10pt; break-inside: avoid; page-break-inside: avoid; }
.mp-img img { max-width: 100%; max-height: 9in; }
.mp-img figcaption { font-size: 9pt; color: #444; }
body.mail-print-preview > *:not(#mail-print) { display: none !important; }
body.mail-print-preview #mail-print { display: block; padding: 16px; background: #fff; }
body.mail-print-preview .mp-break { border-top: 3px dashed #999; margin-top: 24px; padding-top: 24px; }
@media print {
  body { background: #fff !important; }
  body.mail-printing > *:not(#mail-print) { display: none !important; }
  body.mail-printing #mail-print { display: block; }
  .mp-break { break-before: page; page-break-before: always; }
  @page { margin: 14mm 12mm; }
}
