/* ============================================================
   EMAIL / WINMAIL.DAT VIEWER — same soft classic theme as the
   archive viewer / hash generator tools.
   ============================================================ */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --ink: #1e232a;
  --muted: #5b6571;
  --subtle: #6c7480;
  --line: #e3e7ec;
  --accent: #4f63a0;
  --accent-soft: #eceff7;
  --good: #4f8a6b;
  --danger: #c0563f;
  --shadow: 0 12px 32px -20px rgba(30, 40, 60, 0.30);
  --radius: 16px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, monospace;
}
:root[data-theme="dark"] {
  --bg: #16171a;
  --surface: #1d1f23;
  --surface-2: #25282e;
  --ink: #e7e8ec;
  --muted: #9aa0aa;
  --subtle: #9197a0;
  --line: #2c2f36;
  --accent: #9aa9d2;
  --accent-soft: #232733;
  --good: #79b393;
  --danger: #e08a78;
  --shadow: 0 20px 48px -24px rgba(0, 0, 0, 0.6);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16171a;
    --surface: #1d1f23;
    --surface-2: #25282e;
    --ink: #e7e8ec;
    --muted: #9aa0aa;
    --subtle: #9197a0;
    --line: #2c2f36;
    --accent: #9aa9d2;
    --accent-soft: #232733;
    --good: #79b393;
    --danger: #e08a78;
    --shadow: 0 20px 48px -24px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.55; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button, input { font: inherit; }
code { font-family: var(--mono); font-size: 0.9em; color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.app-shell { width: min(1100px, 100%); margin: 0 auto; padding: clamp(18px, 3vw, 38px); display: grid; gap: 16px; }
.eyebrow { margin: 0; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(30px, 5vw, 54px); line-height: 1.0; letter-spacing: -0.02em; font-weight: 820; color: var(--ink); }
.ev-hero { text-align: center; display: grid; gap: 10px; margin-bottom: 8px; }
.ev-hero .eyebrow { justify-self: center; }
.ev-hero .lede { color: var(--muted); max-width: 68ch; margin: 0 auto; }

.cell { position: relative; display: grid; gap: 12px; align-content: start; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* Dropzone */
.dropzone { display: grid; justify-items: center; gap: 8px; padding: clamp(26px, 5vw, 48px) 18px; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface-2); color: var(--muted); text-align: center; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone svg { color: var(--accent); }
.dropzone strong { color: var(--ink); font-size: 15px; }
.dropzone span { font-size: 12px; }

/* Message header area */
.crumbs { font-weight: 750; word-break: break-all; }
.crumbs button { border: 0; padding: 0; background: none; color: var(--accent); cursor: pointer; font-weight: 750; }
.crumbs button:hover { text-decoration: underline; }
.status { margin: 0; color: var(--muted); font-size: 13px; }
.status.error { color: var(--danger); font-weight: 650; }
.status:empty { display: none; }

.meta-table { border-collapse: collapse; font-size: 13.5px; width: 100%; }
.meta-table th { text-align: left; vertical-align: top; color: var(--muted); font-weight: 700; padding: 3px 14px 3px 0; white-space: nowrap; width: 1%; }
.meta-table td { padding: 3px 0; word-break: break-word; }

.raw-wrap summary { cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 650; }
.raw-wrap pre { margin: 8px 0 0; max-height: 300px; overflow: auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-family: var(--mono); font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-all; }

/* Body */
.body-tabs { display: flex; gap: 6px; }
.tab.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
/* Blocked-references banner (click to expand the full list) */
.blocked-note { border: 1px solid var(--line); border-left: 3px solid var(--good); border-radius: 10px; background: var(--surface-2); overflow: hidden; }
.blocked-head { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 12px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 12.5px; text-align: left; cursor: pointer; }
.blocked-head:hover { color: var(--ink); }
.blk-shield { width: 16px; height: 16px; color: var(--good); flex: none; }
.blk-sum { flex: 1; min-width: 0; }
.blk-chev { width: 15px; height: 15px; flex: none; transition: transform 0.15s; }
.blocked-note.is-open .blk-chev { transform: rotate(180deg); }
.blk-list { list-style: none; margin: 0; padding: 2px 12px 10px; display: grid; gap: 7px; border-top: 1px solid var(--line); }
.blk-list li { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: baseline; gap: 8px; font-size: 12px; }
.blk-ico { width: 14px; height: 14px; color: var(--subtle); flex: none; align-self: center; }
.blk-kind { color: var(--ink); font-weight: 650; white-space: nowrap; }
.blk-url { color: var(--muted); font-family: var(--mono); font-size: 11.5px; word-break: break-all; overflow-wrap: anywhere; user-select: all; }
.body-html iframe { width: 100%; height: min(62vh, 560px); border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.body-text { margin: 0; max-height: min(62vh, 560px); overflow: auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-family: var(--mono); font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }

/* Attachments */
.att-block { display: grid; gap: 8px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.att { width: 100%; border-collapse: collapse; font-size: 13px; }
.att th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.att td { padding: 7px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.att tbody tr:last-child td { border-bottom: 0; }
.att tbody tr:hover { background: var(--surface-2); }
.att .fname { word-break: break-all; }
.col-type { color: var(--subtle); font-size: 12px; word-break: break-all; }
.col-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }
.col-act { white-space: nowrap; text-align: right; }
.count { margin: 0; color: var(--subtle); font-size: 12px; }

.fk { display: inline-block; width: 8px; height: 8px; border-radius: 3px; margin-right: 8px; background: var(--subtle); vertical-align: 1px; }
.fk-image { background: var(--good); }
.fk-pdf { background: var(--danger); }
.fk-html { background: #b58a3e; }
.fk-text { background: var(--accent); }
.fk-message { background: var(--accent); border-radius: 50%; }
.badge-inline { margin-left: 8px; padding: 1px 7px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); font-size: 10.5px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.05em; }

.row-btn { padding: 5px 11px; margin-left: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 650; cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.row-btn:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.row-btn.row-icon { padding: 6px 8px; }
.row-btn svg { width: 15px; height: 15px; display: block; }

/* Preview */
.pv-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pv-title { font-weight: 750; word-break: break-all; }
.pv-body { display: grid; gap: 10px; justify-items: start; }
.pv-body pre { margin: 0; width: 100%; max-height: 420px; overflow: auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-family: var(--mono); font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.pv-body img { max-width: 100%; max-height: 60vh; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); justify-self: center; }
.pv-body iframe { width: 100%; height: min(70vh, 640px); border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.pv-html { width: 100%; }
.pv-note { margin: 0; color: var(--subtle); font-size: 12px; }

/* Info + FAQ */
.info { display: grid; gap: 18px; padding: clamp(18px, 3vw, 30px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.info-intro p:last-child { margin: 0; color: var(--muted); max-width: 78ch; }
.info h2 { font-size: clamp(19px, 2.6vw, 26px); letter-spacing: -0.01em; margin-bottom: 8px; }
.faq { display: grid; gap: 10px; }
.faq-2col { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.faq details { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); padding: 12px 14px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details p { margin: 9px 0 0; color: var(--muted); font-size: 13px; }
.xlink { margin: 0; color: var(--subtle); font-size: 12px; }
.xlink a { color: var(--accent); }

@media (max-width: 640px) {
  .col-type { display: none; }
  th.col-type { display: none; }
  .row-btn { margin-left: 4px; padding: 5px 8px; }
}
