/* ============================================================
   Newsletter Reader v2 — compact, mobile-first, RIR-density.
   Uses base.css tokens (Chakra Petch / Inter / JetBrains Mono).
   ============================================================ */
.nr-page { padding-bottom: 130px; max-width: 1080px; }
.nr-ic { display: inline-flex; align-items: center; }
.nr-ic svg { display: block; }
.nr-spin { width: 15px; height: 15px; border: 2px solid var(--border-light); border-top-color: var(--mint); border-radius: 50%; display: inline-block; animation: nr-rot .7s linear infinite; }
.nr-spin.lg { width: 26px; height: 26px; border-width: 3px; }
@keyframes nr-rot { to { transform: rotate(360deg); } }

/* ── header (slim, RIR-tight) ──────────────────────────────── */
.nr-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.nr-title { font-family: var(--font-display); font-weight: 700; font-size: 1.7rem; line-height: 1.05; margin: 2px 0 0; }
.nr-title span { color: var(--mint); }
.nr-head-r { display: flex; gap: 8px; flex: 0 0 auto; }
.nr-head-r .btn-sm { padding: 8px 10px; }
.nr-refresh.spinning .nr-ic { animation: nr-rot .8s linear infinite; }

/* ── summary strip ─────────────────────────────────────────── */
.nr-summary { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 10px 14px; margin-bottom: 14px; background: linear-gradient(180deg, var(--card), var(--card-2)); border: 1px solid var(--border); border-radius: 12px; }
.nr-sum { font-size: 12.5px; color: var(--text-faint); }
.nr-sum b { color: var(--text); font-family: var(--font-mono); font-weight: 700; font-size: 14px; }

/* ── tabs ──────────────────────────────────────────────────── */
.nr-tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 11px; margin-bottom: 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.nr-tab { flex: 1; min-width: max-content; background: transparent; border: none; color: var(--text-faint); font-family: var(--font-display); font-weight: 600; font-size: 13px; padding: 8px 14px; border-radius: 8px; cursor: pointer; transition: all .15s; white-space: nowrap; }
.nr-tab:hover { color: var(--text); }
.nr-tab.active { background: var(--mint); color: #06231b; }

/* ── controls (search + selects) ───────────────────────────── */
.nr-controls { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.nr-search { display: flex; align-items: center; gap: 9px; padding: 0 12px; background: var(--bg-elevated); border: 1px solid var(--border-light); border-radius: 10px; color: var(--text-faint); transition: border-color .15s; }
.nr-search:focus-within { border-color: var(--mint); }
.nr-search-input { flex: 1; background: transparent; border: none; outline: none; color: var(--text); font-family: var(--font-body); font-size: 14px; padding: 11px 0; }
.nr-control-row { display: flex; gap: 8px; }
.nr-select { flex: 1; background: var(--bg-elevated); border: 1px solid var(--border-light); color: var(--text); font-family: var(--font-body); font-size: 13px; padding: 9px 10px; border-radius: 9px; cursor: pointer; min-width: 0; }
.nr-select:hover { border-color: var(--mint); }

/* ── list + cards (compact, horizontal, with depth) ────────── */
.nr-list { display: flex; flex-direction: column; gap: 8px; }
.nr-card {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 11px;
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--border); border-radius: 12px; cursor: pointer;
  box-shadow: 0 2px 10px -6px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.02);
  transition: border-color .15s, transform .12s, box-shadow .15s;
}
.nr-card:hover { border-color: rgba(95,176,137,.45); transform: translateY(-2px); box-shadow: 0 10px 26px -14px rgba(0,0,0,.85); }
.nr-card.playing { border-color: var(--mint); box-shadow: 0 0 0 1px rgba(95,176,137,.25), 0 0 28px -10px rgba(95,176,137,.4); }
.nr-card.played { opacity: .58; }
.nr-card.played:hover { opacity: 1; }

.nr-card-play { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-elevated); border: 1.5px solid var(--border-light); color: var(--text); cursor: pointer; transition: all .15s; }
.nr-card-play:hover { background: var(--mint); color: #06231b; border-color: transparent; transform: scale(1.06); }
.nr-card-play.on, .nr-card.playing .nr-card-play { background: var(--mint); color: #06231b; border-color: transparent; }
.nr-card-play.voiceify { background: var(--gold-dim); border-color: rgba(245,184,66,.4); color: var(--gold); }
.nr-card-play.voiceify:hover { background: var(--gold); color: #1a1406; }
.nr-card-play.busy { background: var(--bg-elevated); }

.nr-card-main { flex: 1; min-width: 0; }
.nr-card-top { display: flex; align-items: center; gap: 6px; }
.nr-card-sender { font-family: var(--font-display); font-weight: 600; font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.nr-dot-sep { color: var(--text-faint); }
.nr-card-time { font-size: 11px; color: var(--text-faint); }
.nr-card-flags { margin-left: auto; color: var(--green); display: flex; align-items: center; }
.nr-card-subject { font-weight: 600; color: var(--text); font-size: .98rem; line-height: 1.2; margin: 2px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nr-card-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nr-chip { display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; color: var(--text-faint); padding: 2px 6px; border: 1px solid var(--border); border-radius: 999px; }
.nr-chip-pend { color: var(--amber); border-color: rgba(245,158,11,.3); background: var(--amber-dim); }
.nr-mini-voiceify { display: inline-flex; align-items: center; gap: 3px; font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; color: var(--gold); background: var(--gold-dim); border: 1px solid rgba(245,184,66,.4); border-radius: 999px; padding: 2px 8px; cursor: pointer; transition: all .15s; }
.nr-mini-voiceify:hover { background: var(--gold); color: #1a1406; }

/* full chart preview — contained on white so the whole chart shows */
.nr-card-thumb { flex: 0 0 auto; position: relative; width: 94px; height: 60px; border-radius: 9px; overflow: hidden; border: 1px solid var(--border); background: #fff; cursor: zoom-in; transition: transform .12s; }
.nr-card-thumb:hover { transform: scale(1.04); }
.nr-card-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.nr-card-thumb.empty { display: grid; place-items: center; background: var(--bg-elevated); cursor: default; }
.nr-card-thumb-n { position: absolute; bottom: 3px; right: 3px; background: rgba(13,17,23,.82); color: #fff; font-size: 9.5px; font-weight: 700; padding: 1px 5px; border-radius: 999px; }

.nr-card-star { flex: 0 0 auto; width: 30px; height: 30px; display: grid; place-items: center; background: transparent; border: none; color: var(--border-light); cursor: pointer; transition: color .15s, transform .12s; }
.nr-card-star:hover { color: var(--gold); transform: scale(1.15); }
.nr-card-star.on { color: var(--gold); }
.nr-card-star.on svg { fill: var(--gold); }

/* clear Voiceify control + voice picker on unvoiced cards */
.nr-card-actions { display: inline-flex; align-items: center; gap: 6px; }
.nr-voicebar { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nr-voiceify-btn { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: #1a1406; background: var(--gold); border: none; border-radius: 999px; padding: 4px 11px; cursor: pointer; transition: filter .15s, transform .12s; }
.nr-voiceify-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.nr-icon-btn { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--bg-elevated); border: 1px solid var(--border-light); color: var(--text-muted); cursor: pointer; transition: all .15s; }
.nr-icon-btn:hover { border-color: var(--mint); color: var(--mint); }
.nr-chip-busy { color: var(--gold); border-color: rgba(245,184,66,.35); background: var(--gold-dim); }
.nr-spin.sm { width: 11px; height: 11px; border-width: 2px; }
.nr-voice-select.mini { font-size: 11.5px; padding: 4px 6px; max-width: 92px; border-radius: 7px; }
.nr-ready-note { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--mint); background: var(--teal-glow); border: 1px solid rgba(95,176,137,.3); border-radius: 10px; padding: 11px 13px; }

/* intro / how-it-works */
.nr-intro .panel-body { display: flex; flex-direction: column; gap: 16px; }
.nr-intro-step { display: flex; gap: 13px; align-items: flex-start; }
.nr-intro-num { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: var(--mint); background: var(--teal-glow); border: 1px solid rgba(95,176,137,.3); }
.nr-intro-title { font-family: var(--font-display); font-weight: 600; color: var(--text); margin-bottom: 3px; }
.nr-intro-body { font-size: 13px; line-height: 1.5; }
.btn-block { width: 100%; }

/* ── empty / loading ───────────────────────────────────────── */
.nr-empty { text-align: center; padding: 50px 20px; color: var(--text-faint); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.nr-empty h4 { font-family: var(--font-display); color: var(--text); margin: 0; }
.nr-empty p { max-width: 400px; margin: 0; }
.nr-empty .nr-ic { color: var(--mint); opacity: .55; }

/* ── stats (wrapped) ───────────────────────────────────────── */
.nr-stats-wrap { display: flex; flex-direction: column; gap: 14px; }
.nr-wrapped { text-align: center; padding: 26px 18px; border-radius: 16px; background: radial-gradient(120% 140% at 50% 0%, rgba(95,176,137,.18), transparent 60%), linear-gradient(180deg, var(--card), var(--card-2)); border: 1px solid rgba(95,176,137,.3); }
.nr-wrapped-eyebrow { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: .12em; color: var(--mint); }
.nr-wrapped-hero { font-family: var(--font-display); font-weight: 700; font-size: 2.8rem; color: var(--text); margin: 6px 0 2px; }
.nr-stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.nr-stat-big { padding: 16px; background: linear-gradient(180deg, var(--card), var(--card-2)); border: 1px solid var(--border); border-radius: 12px; }
.nr-stat-big-val { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; }
.nr-stat-big-val.mint { color: var(--mint); } .nr-stat-big-val.gold { color: var(--gold); }
.nr-stat-big-label { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.nr-stat-big-sub { font-size: 11px; }
.nr-toplist { padding: 16px; background: linear-gradient(180deg, var(--card), var(--card-2)); border: 1px solid var(--border); border-radius: 12px; }
.nr-toplist-head { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 600; color: var(--text); margin-bottom: 12px; }
.nr-toplist-head .nr-ic { color: var(--gold); }
.nr-toprow { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.nr-toprank { font-size: 12px; color: var(--text-faint); width: 24px; }
.nr-card-avatar { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 13px; border: 1px solid var(--border); flex: 0 0 auto; }
.nr-card-avatar.sm { width: 30px; height: 30px; font-size: 11px; border-radius: 8px; }
.nr-topmeta { flex: 1; min-width: 0; }
.nr-topname { font-size: 13px; color: var(--text); margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nr-topbar { height: 7px; background: var(--border); border-radius: 999px; overflow: hidden; }
.nr-topbar-fill { height: 100%; border-radius: 999px; }
.nr-toptime { font-size: 11.5px; flex: 0 0 auto; }

/* ── chart stage (in player) ───────────────────────────────── */
.nr-stage { position: relative; max-width: 1040px; margin: 0 auto 12px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }
.nr-stage-frame { position: relative; flex: 1 1 auto; min-width: 0; display: grid; place-items: center; background: #fff; border: 1px solid var(--border-light); border-radius: 12px; overflow: hidden; cursor: zoom-in; box-shadow: 0 10px 30px -16px rgba(0,0,0,.8); }
.nr-stage-img { max-width: 100%; max-height: 40vh; object-fit: contain; display: block; }
.nr-stage-expand { position: absolute; top: 9px; right: 9px; background: rgba(13,17,23,.66); color: #fff; border: none; border-radius: 7px; padding: 6px; cursor: pointer; display: grid; place-items: center; opacity: .82; }
.nr-stage-expand:hover { opacity: 1; }
.nr-stage-counter { position: absolute; bottom: 9px; right: 9px; background: rgba(13,17,23,.74); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 999px; }
.nr-stage-nav { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; background: var(--bg-elevated); border: 1px solid var(--border-light); color: var(--text); cursor: pointer; display: grid; place-items: center; transition: all .15s; }
.nr-stage-nav:hover { background: var(--mint); color: #06231b; border-color: transparent; }
.nr-stage-dots { flex-basis: 100%; display: flex; justify-content: center; gap: 6px; margin-top: 2px; }
.nr-stage-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-light); cursor: pointer; transition: all .15s; }
.nr-stage-dot.on { background: var(--mint); transform: scale(1.3); }
body.nr-stage-open .nr-page { padding-bottom: 62vh; }

/* ── lightbox (fixed: clear bar + labeled close) ───────────── */
.nr-lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(5,8,12,.94); backdrop-filter: blur(8px); display: flex; flex-direction: column; }
.nr-lb-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.nr-lb-title { color: #fff; font-family: var(--font-display); font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nr-lb-actions { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.nr-lb-count { color: rgba(255,255,255,.6); font-size: 12px; }
.nr-lb-close { display: inline-flex; align-items: center; gap: 6px; background: var(--mint); color: #06231b; border: none; border-radius: 9px; padding: 9px 14px; font-weight: 700; font-size: 13px; cursor: pointer; }
.nr-lb-close:hover { filter: brightness(1.08); }
.nr-lb-stage { flex: 1; position: relative; display: grid; place-items: center; padding: 18px; cursor: zoom-out; }
.nr-lb-img { max-width: 92vw; max-height: calc(100vh - 110px); object-fit: contain; border-radius: 8px; background: #fff; cursor: default; }
.nr-lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.14); border: none; color: #fff; border-radius: 50%; width: 50px; height: 50px; cursor: pointer; display: grid; place-items: center; }
.nr-lb-nav:hover { background: rgba(255,255,255,.28); }
.nr-lb-nav.prev { left: 16px; } .nr-lb-nav.next { right: 16px; }

/* ── player ────────────────────────────────────────────────── */
.nr-player { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: linear-gradient(180deg, rgba(13,17,23,.88), rgba(13,17,23,.98)); backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%); border-top: 1px solid rgba(95,176,137,.28); box-shadow: 0 -12px 40px -18px rgba(0,0,0,.9); transform: translateY(120%); transition: transform .32s var(--ease); padding: 11px 18px; }
.nr-player.show { transform: translateY(0); }
.nr-pl-inner { max-width: 1080px; margin: 0 auto; display: grid; grid-template-columns: minmax(140px,1fr) minmax(260px,2fr) minmax(150px,1fr); align-items: center; gap: 18px; }
.nr-pl-meta { display: flex; align-items: center; gap: 11px; min-width: 0; }
.nr-pl-cover { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; border: 1px solid var(--border); flex: 0 0 auto; }
.nr-pl-text { min-width: 0; }
.nr-pl-title { font-weight: 600; color: var(--text); font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nr-pl-sender { font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nr-pl-center { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.nr-pl-controls { display: flex; align-items: center; gap: 14px; }
.nr-pl-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; display: grid; place-items: center; transition: color .15s, transform .12s; position: relative; padding: 3px; }
.nr-pl-btn:hover { color: var(--text); transform: scale(1.08); }
.nr-skip-n { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-mono); font-size: 8.5px; font-weight: 700; padding-top: 2px; pointer-events: none; }
.nr-pl-main { width: 46px; height: 46px; border-radius: 50%; background: var(--mint); color: #06231b; }
.nr-pl-main:hover { background: var(--mint); color: #06231b; box-shadow: 0 0 22px -4px rgba(95,176,137,.7); }
.nr-pl-seek { display: flex; align-items: center; gap: 10px; width: 100%; }
.nr-time { font-size: 11px; color: var(--text-faint); flex: 0 0 auto; min-width: 34px; }
.nr-time#nr-dur { text-align: right; }
.nr-progress { flex: 1; height: 6px; background: var(--border); border-radius: 999px; cursor: pointer; position: relative; overflow: hidden; }
.nr-progress::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: var(--pct,0%); background: linear-gradient(90deg, var(--mint-deep), var(--mint)); border-radius: 999px; }
.nr-progress:hover { height: 8px; }
.nr-pl-right { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.nr-pl-speed { background: var(--bg-elevated); border: 1px solid var(--border-light); color: var(--text); font-family: var(--font-mono); font-size: 12px; font-weight: 700; padding: 6px 9px; border-radius: 8px; cursor: pointer; min-width: 44px; }
.nr-pl-speed:hover { border-color: var(--mint); color: var(--mint); }
.nr-pl-voicewrap { display: flex; align-items: center; gap: 6px; color: var(--text-faint); }
.nr-voice-select { background: var(--bg-elevated); border: 1px solid var(--border-light); color: var(--text); font-family: var(--font-body); font-size: 12.5px; padding: 6px 8px; border-radius: 8px; cursor: pointer; max-width: 110px; }
.nr-voice-select:hover { border-color: var(--mint); }
.nr-pl-close { background: transparent; border: none; color: var(--text-faint); cursor: pointer; padding: 4px; display: grid; place-items: center; }
.nr-pl-close:hover { color: var(--text); }

/* ── settings modal ────────────────────────────────────────── */
.nr-modal-back { position: fixed; inset: 0; z-index: 120; background: rgba(5,8,12,.74); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; }
.nr-modal { width: 100%; max-width: 540px; max-height: 88vh; overflow: auto; }
.nr-x { background: transparent; border: none; color: var(--text-faint); cursor: pointer; display: grid; place-items: center; }
.nr-x:hover { color: var(--text); }
.nr-help-txt { font-size: 12.5px; margin: 2px 0 10px; }
.nr-voice-catalog { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.nr-voice-pill { font-size: 11px; color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; padding: 3px 9px; }
.nr-sender-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow: auto; }
.nr-sender-row { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 10px; }
.nr-sender-name { flex: 1; min-width: 0; font-size: .85rem; }
.nr-sender-name > div:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nr-sender-email { font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── help popover + toast ──────────────────────────────────── */
.nr-help { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border-light); background: var(--bg-elevated); color: var(--text-faint); font-size: 10px; font-weight: 700; cursor: pointer; display: inline-grid; place-items: center; margin-left: 6px; vertical-align: middle; }
.nr-help:hover { border-color: var(--mint); color: var(--mint); }
.nr-pop { position: absolute; z-index: 300; max-width: 260px; background: var(--bg-elevated); border: 1px solid var(--border-light); border-radius: 10px; padding: 11px 13px; font-size: 12.5px; line-height: 1.45; color: var(--text-muted); box-shadow: 0 14px 40px -16px rgba(0,0,0,.9); }
.nr-toast { position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 20px); z-index: 250; background: var(--bg-elevated); border: 1px solid var(--mint); color: var(--text); font-size: 13px; padding: 11px 16px; border-radius: 11px; box-shadow: 0 14px 40px -14px rgba(0,0,0,.9); opacity: 0; transition: opacity .25s, transform .25s; max-width: 88vw; text-align: center; }
.nr-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── responsive / mobile ───────────────────────────────────── */
@media (max-width: 760px) {
  .nr-title { font-size: 1.4rem; }
  .nr-pl-inner { grid-template-columns: 1fr; gap: 8px; }
  .nr-pl-meta { order: 1; } .nr-pl-center { order: 2; } .nr-pl-right { order: 3; justify-content: space-between; }
  .nr-player { padding: 9px 12px 12px; }
  .nr-card { padding: 8px 9px; gap: 9px; }
  .nr-card-play { width: 40px; height: 40px; }
  .nr-card-thumb { width: 78px; height: 52px; }
  .nr-card-subject { font-size: .92rem; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .nr-stat-grid { grid-template-columns: repeat(2, 1fr); }
  .nr-wrapped-hero { font-size: 2.2rem; }
  .nr-stage-img { max-height: 32vh; }
  body.nr-stage-open .nr-page { padding-bottom: 72vh; }
  .nr-summary { gap: 6px 12px; }
}
@media (max-width: 420px) {
  .nr-card-star { width: 26px; }
  .nr-card-thumb { width: 64px; height: 46px; }
}
