/* ── Email Archive — Shared Styles ── */

:root {
  --bg-deep:    #0c0c12;
  --bg-base:    #111119;
  --bg-surface: #161622;
  --bg-card:    #1c1c2a;
  --bg-elevated:#262636;
  --border:     #2a2a3c;
  --border-dim: #1e1e2e;
  --border-bright:#3a3a50;
  --text:       #e8e6e1;
  --text-dim:   #a0a0a0;
  --text-muted: #707070;
  --text-bright:#ffffff;
  --red:        #ff5545;
  --gold:       #ffb732;
  --blue:       #3a86ba;
  --green:      #2de0b6;
  --purple:     #a77bdb;
  --orange:     #ff8c42;
  --mono:       'IBM Plex Mono', monospace;
  --sans:       'IBM Plex Sans', system-ui, sans-serif;
  --data:       'JetBrains Mono', 'Fira Code', monospace;
  --radius:     6px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--text-bright); }

/* ── Site Bar (header) ── */
.site-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: var(--bg-base);
  border-bottom: 2px solid var(--border-bright);
  flex-shrink: 0;
  z-index: 100;
}
.bar-brand {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--red);
  letter-spacing: 5px;
  text-transform: uppercase;
}
.bar-sep { color: var(--text-muted); font-size: 18px; }
.bar-section {
  font-family: var(--mono);
  font-size: 12px;
  color: #b0b0b0;
  text-transform: uppercase;
  letter-spacing: 2px;
}
.bar-nav {
  margin-left: auto;
  display: flex;
  gap: 10px;
  align-items: center;
}
.bar-link {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  border: 1px solid var(--border-bright);
  padding: 5px 12px;
  border-radius: 4px;
  transition: 0.15s;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.bar-link:hover {
  color: var(--text-bright);
  border-color: var(--red);
}

/* ── App Layout ── */
.app-layout {
  display: flex;
  height: calc(100vh - 50px);
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: 420px;
  min-width: 280px;
  background: var(--bg-base);
  border-right: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-title {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 4px;
}
.sidebar-count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--red);
}

/* ── Sidebar Toggle Buttons ── */
.sidebar-toggles {
  display: flex;
  gap: 0;
  padding: 8px 8px 0;
  flex-shrink: 0;
}
.sidebar-toggle {
  flex: 1;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-deep);
  border: 1px solid var(--border);
  padding: 8px 12px;
  cursor: pointer;
  transition: 0.15s;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
}
.sidebar-toggle:first-child { border-radius: 4px 0 0 4px; }
.sidebar-toggle:last-child { border-radius: 0 4px 4px 0; margin-left: -1px; }
.sidebar-toggle.active {
  color: var(--text-bright);
  background: var(--bg-surface);
  border-color: var(--red);
  z-index: 1;
  position: relative;
}
.sidebar-toggle .toggle-count {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 4px;
}
.sidebar-toggle.active .toggle-count { color: var(--red); }

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

/* ── Sealed-Archive Card ── always at top of EMAILS list, sticky on scroll.
   Informational + actionable: shows zip size, click-to-copy SHA-256,
   primary download button, and OTS proof button. NOT a sidebar selector. */
.archive-card {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 12px 14px;
  margin: -8px -8px 8px;  /* extend to sidebar-list edges, then buffer below */
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-card) 100%);
  border-bottom: 2px solid var(--gold);
  box-shadow: 0 4px 12px rgba(0,0,0,0.45);
  cursor: default;
}
.archive-card-titlerow {
  display: flex;
  align-items: center;
  gap: 8px;
}
.archive-card-badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--bg-deep);
  background: var(--gold);
  padding: 3px 7px;
  border-radius: 3px;
  flex-shrink: 0;
}
.archive-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-bright);
  line-height: 1.3;
}
.archive-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
}
.archive-card-size { color: var(--text-bright); font-weight: 600; }
.archive-card-sep  { color: var(--text-muted); }
.archive-card-hash {
  color: var(--green);
  cursor: pointer;
  word-break: break-all;
  transition: color 0.15s;
}
.archive-card-hash:hover { color: var(--text-bright); }
.archive-card-hash.copied { color: var(--gold); }
.archive-card-actions {
  display: flex;
  gap: 6px;
}
.archive-card-dl {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  background: rgba(255,183,50,0.08);
  color: var(--gold);
  border: 1px solid rgba(255,183,50,0.45);
  text-decoration: none;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  border-radius: 3px;
  transition: all 0.15s;
}
.archive-card-dl:hover {
  background: rgba(255,183,50,0.15);
  border-color: var(--gold);
  color: var(--text-bright);
}
.archive-card-ots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  background: transparent;
  color: var(--purple);
  border: 1px solid rgba(167,123,219,0.30);
  border-radius: 3px;
  text-decoration: none;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  transition: all 0.15s;
}
.archive-card-ots:hover {
  background: rgba(167,123,219,0.10);
  border-color: var(--purple);
  color: var(--text-bright);
}

/* ── Draggable Splitter ── */
.splitter {
  width: 6px;
  background: var(--border);
  cursor: col-resize;
  flex-shrink: 0;
  transition: background 0.15s;
  z-index: 10;
}
.splitter:hover, .splitter.dragging {
  background: var(--red);
}

/* ── Email Cards (sidebar) ── */
.email-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  margin-bottom: 4px;
  background: var(--bg-deep);
  border: 1px solid var(--border-dim);
  border-left: 3px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: 0.15s;
}
.email-card:hover {
  background: var(--bg-surface);
  border-color: var(--border-bright);
  border-left-color: var(--blue);
}
.email-card.active {
  background: var(--bg-surface);
  border-color: var(--border-bright);
  border-left-color: var(--red);
}
.email-card-date {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 0.5px;
}
.email-card-subject {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.email-card-meta {
  display: flex;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
}
.email-card-from { color: var(--green); }

/* ── Document Cards (sidebar) ── */
.doc-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 4px;
  background: var(--bg-deep);
  border: 1px solid var(--border-dim);
  border-left: 3px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: 0.15s;
}
.doc-card:hover {
  background: var(--bg-surface);
  border-color: var(--border-bright);
  border-left-color: var(--purple);
}
.doc-card.active {
  background: var(--bg-surface);
  border-left-color: var(--purple);
  border-color: var(--border-bright);
}
.doc-card-icon {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--purple);
  background: rgba(167,123,219,0.12);
  padding: 4px 8px;
  border-radius: 3px;
  flex-shrink: 0;
  text-transform: uppercase;
  font-weight: 700;
}
.doc-card-icon.icon-png { color: var(--green); background: rgba(45,224,182,0.12); }
.doc-card-icon.icon-md { color: var(--gold); background: rgba(255,183,50,0.12); }
.doc-card-name {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-deep);
}

/* ── Viewer Toolbar ── */
.viewer-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.viewer-tabs {
  display: flex;
  gap: 4px;
}
.tab-btn {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-deep);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: 0.15s;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.tab-btn:hover { color: var(--text-bright); border-color: var(--border-bright); }
.tab-btn.active { color: var(--red); border-color: var(--red); background: rgba(255,85,69,0.08); }

.download-btn {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--green);
  background: rgba(45,224,182,0.08);
  border: 1px solid var(--green);
  padding: 6px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: 0.15s;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.download-btn:hover { background: rgba(45,224,182,0.18); color: var(--text-bright); }
.download-size {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--gold);
  margin-left: auto;
  margin-right: 8px;
}

/* ── Email Meta Bar ── */
.email-meta {
  padding: 16px 24px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-dim);
  flex-shrink: 0;
}
.email-meta-subject {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 8px;
}
.email-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 14px;
}
.email-meta-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-right: 4px;
}
.email-meta-value { color: var(--text); font-size: 14px; }
.email-meta-value.hash {
  font-family: var(--data);
  font-size: 12px;
  color: var(--gold);
  word-break: break-all;
}

/* ── Tab Container ── */
.tab-container-hidden { display: none !important; }
.tab-container-visible {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Tab Panes ── */
.tab-pane {
  flex: 1;
  display: none;
  overflow: hidden;
}
.tab-pane.active { display: flex; flex-direction: column; flex: 1; }

/* Body tab — scrollable with inline attachments */
.body-pane-inner {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
}
.body-frame {
  width: 100%;
  height: 500px;
  border: none;
  background: #fff;
  border-radius: var(--radius);
  display: block;
}
.body-frame.fullpage {
  height: 100%;
  flex: 1;
  min-height: 0;
}
.body-pane-inner.doc-mode {
  display: flex;
  flex-direction: column;
}

/* Inline attachments below body */
.inline-attachments {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.inline-att-header {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

/* Headers tab */
.headers-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.headers-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.headers-table th {
  text-align: left;
  padding: 8px 12px;
  background: var(--bg-surface);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
}
.headers-table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-dim);
  vertical-align: top;
}
.headers-table td:first-child {
  font-family: var(--mono);
  color: var(--blue);
  white-space: nowrap;
  width: 200px;
}
.headers-table td:last-child {
  color: var(--text-dim);
  word-break: break-all;
  font-family: var(--data);
  font-size: 12px;
}
.headers-table tr:hover { background: var(--bg-surface); }

/* Raw tab */
.raw-wrap {
  flex: 1;
  overflow: auto;
  padding: 16px 20px;
}
.raw-pre {
  font-family: var(--data);
  font-size: 11px;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.6;
}

/* Attachments tab */
.att-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.att-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  margin-bottom: 6px;
}
.att-name { font-weight: 500; color: var(--text); flex: 1; font-size: 13px; }
.att-type { font-family: var(--mono); font-size: 10px; color: var(--text-muted); }
.att-size { font-family: var(--mono); font-size: 11px; color: var(--gold); }
.att-view {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--blue);
  background: rgba(77,171,240,0.08);
  border: 1px solid var(--blue);
  padding: 3px 10px;
  border-radius: 3px;
  cursor: pointer;
  transition: 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.att-view:hover { background: rgba(77,171,240,0.18); color: var(--text-bright); }
.att-dl {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--green);
  border: 1px solid var(--green);
  padding: 3px 10px;
  border-radius: 3px;
  cursor: pointer;
  transition: 0.15s;
  text-decoration: none;
}
.att-dl:hover { background: rgba(45,224,182,0.12); }

/* Attachment split pane (inline below body) */
.att-split {
  display: flex;
  gap: 0;
  min-height: 200px;
}
.att-list-col {
  flex: 1;
  min-width: 200px;
  overflow-y: auto;
}
.att-splitter {
  width: 6px;
  background: var(--border);
  cursor: col-resize;
  flex-shrink: 0;
  transition: background 0.15s;
  display: none;
}
.att-splitter:hover, .att-splitter.dragging { background: var(--red); }
.att-split.has-preview .att-splitter { display: block; }
.att-split.has-preview .att-list-col {
  flex: none;
  width: 50%;
}
.att-preview-col {
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.att-split.has-preview .att-preview-col {
  display: flex;
  flex: 1;
  height: 700px;
  max-height: 700px;
}
.att-preview-header {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-dim);
}
.att-preview-img-wrap {
  flex: 1;
  overflow: scroll;
  background: var(--bg-deep);
  border-radius: var(--radius);
  position: relative;
  min-height: 0;
}
.att-preview-img-wrap img {
  width: 100%;
  height: auto;
  display: block;
}
.att-preview-pdf {
  width: 100%;
  flex: 1;
  min-height: 680px;
  border: none;
  background: #1a1a28;
  border-radius: var(--radius);
}

/* Image nav + zoom controls */
.att-img-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-dim);
}
.att-nav-btn {
  font-size: 14px;
  color: var(--text-dim);
  background: var(--bg-deep);
  border: 1px solid var(--border);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.15s;
}
.att-nav-btn:hover { color: var(--text-bright); border-color: var(--red); }
.att-nav-info {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  min-width: 50px;
  text-align: center;
}
.att-zoom-btn {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--bg-deep);
  border: 1px solid var(--border);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.15s;
  margin-left: 2px;
}
.att-zoom-btn:hover { color: var(--text-bright); border-color: var(--blue); }
.att-zoom-btn:first-of-type { margin-left: 12px; }
.att-zoom-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 6px;
  min-width: 40px;
}

/* Inline entities section */
.inline-entities {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* Entities tab (LinkedIn) */
.entities-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.entity-card {
  padding: 14px 16px;
  background: var(--bg-base);
  border: 1px solid var(--border-dim);
  border-left: 3px solid var(--orange);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.entity-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 4px;
}
.entity-tagline {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
  line-height: 1.4;
}
.entity-confirmed {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--green);
  margin-bottom: 6px;
}
.entity-attrs {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  font-size: 11px;
}
.entity-attr-key {
  font-family: var(--mono);
  color: var(--text-muted);
  font-size: 10px;
}
.entity-attr-val { color: var(--text-dim); }
.entity-background {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-top: 8px;
}
.entity-tech {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-top: 6px;
}
.entity-tech-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* PDF viewer */
.pdf-viewer-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pdf-embed {
  flex: 1;
  border: none;
  background: #1a1a28;
  margin: 12px 20px;
  border-radius: var(--radius);
}

/* Image viewer */
.img-viewer-wrap {
  flex: 1;
  overflow: auto;
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
}
.img-viewer-wrap img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}

/* ── Welcome / Empty State ── */
.welcome-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
}
.welcome-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}
.welcome-title {
  font-family: var(--mono);
  font-size: 18px;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.welcome-desc {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 400px;
  line-height: 1.5;
}

/* ── Index Page ── */
.index-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 30px;
}
.index-header {
  text-align: center;
  margin-bottom: 40px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--border);
}
.index-title {
  font-family: var(--mono);
  font-size: 28px;
  color: var(--text-bright);
  letter-spacing: 2px;
  margin-bottom: 8px;
}
.index-subtitle {
  font-size: 15px;
  color: var(--text-dim);
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.6;
}
.index-case {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
  letter-spacing: 1px;
}

/* ── Section Cards (index) ── */
.section-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 700px;
}
.section-card {
  display: flex;
  gap: 20px;
  padding: 22px 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--red);
  border-radius: var(--radius);
  cursor: pointer;
  transition: 0.2s;
  text-decoration: none;
  color: inherit;
}
.section-card:hover {
  background: var(--bg-card);
  border-color: var(--border-bright);
  transform: translateX(4px);
}
.section-card-num {
  font-family: var(--mono);
  font-size: 24px;
  color: var(--red);
  font-weight: 700;
  min-width: 40px;
  opacity: 0.5;
}
.section-card-body { flex: 1; }
.section-card-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 4px;
}
.section-card-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.4;
}
.section-card-stats {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}
.section-card-stats span { margin-right: 16px; }
.stat-eml { color: var(--blue); }
.stat-pdf { color: var(--purple); }

/* ── Scrollbars ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--red); }

/* ═══════════════════════════════════════════
   MOBILE LAYOUT (≤900px)
   Drop the side-by-side split, stack the viewer ON TOP and the email
   list (sidebar) BELOW it. Releases the desktop overflow:hidden locks
   so the page itself scrolls instead of two independent panes.
   ═══════════════════════════════════════════ */
@media (max-width: 900px) {
  /* Page itself becomes the scroll container */
  html, body { height: auto; overflow: visible; }

  /* column-reverse renders main-content (viewer) FIRST → top of screen,
     splitter (hidden), then sidebar at the bottom. */
  .app-layout {
    flex-direction: column-reverse;
    height: auto;
    overflow: visible;
  }

  .splitter { display: none; }

  /* Sidebar: full width, content scrolls with the page (not its own pane) */
  .sidebar {
    width: 100% !important;  /* override any inline width set by the desktop splitter */
    min-width: 0;
    border-top: 1px solid var(--border);
    overflow: visible;
    flex-shrink: 0;
  }
  .sidebar-list {
    overflow-y: visible;
    max-height: none;
  }

  /* Archive card: drop sticky on mobile (sidebar-list isn't a scroll
     container any more — sticky-to-list-top has no effect). Render inline. */
  .archive-card {
    position: static;
  }

  /* Viewer fills the visible area on initial load (welcome state stays
     centered). Once an email is open, body content extends; user scrolls
     past the viewer to reach the email list below. */
  .main-content {
    overflow: visible;
    min-height: calc(100vh - 50px);
  }

  /* Tab container needs explicit min-height so flex:1 children resolve to
     a real height (with the page-level scroll, parent height is auto). */
  .tab-container-visible {
    overflow: visible;
    min-height: 60vh;
  }
  .tab-pane,
  .tab-pane.active {
    overflow: visible;
  }
  .body-pane-inner {
    overflow-y: visible;
    padding: 12px;
  }
  .body-frame {
    max-width: 100%;
  }

  /* Toolbar tightens; tabs wrap to multiple rows on narrow screens */
  .viewer-toolbar {
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .viewer-tabs {
    flex-wrap: wrap;
    flex: 1 1 auto;
    min-width: 0;
  }
  .tab-btn {
    padding: 5px 10px;
    font-size: 10px;
    letter-spacing: 0.5px;
  }
  .download-btn { flex-shrink: 0; }

  /* Email-meta block: tighter padding on mobile */
  .email-meta { padding: 12px; }
  .email-meta-subject { font-size: 14px; }

  /* Sidebar header + toggles: tighter */
  .sidebar-header { padding: 10px 12px 8px; }
  .sidebar-toggle { padding: 6px 10px; font-size: 10px; }
}
