/* =========================================================================
   Mailora — premium UI (v2 · Aurora)
   Display: Bricolage Grotesque · UI: Manrope · Mono: JetBrains Mono
   Palette: emerald + teal aurora, warm amber live-accent, forest ink
   ========================================================================= */

:root {
  --bg:        #EDF3F0;
  --bg-2:      #E3EDE8;
  --surface:   #FFFFFF;
  --surface-2: #F4FAF7;
  --ink:       #0E1E18;
  --ink-soft:  #33473F;
  --muted:     #63766D;
  --line:      #DBE7E1;
  --line-2:    #CCE0D7;

  --brand:     #0EA47F;
  --brand-700: #0A7D61;
  --brand-2:   #0BB4C4;
  --amber:     #F59E0B;
  --amber-ink: #A96208;
  --danger:    #E5484D;

  --grad-brand: linear-gradient(120deg, #12B888 0%, #0AAEBE 55%, #0B9FD0 100%);
  --grad-soft:  linear-gradient(120deg, rgba(18,184,136,.14), rgba(11,180,196,.12));
  --aura: radial-gradient(90% 60% at 50% -10%, rgba(14,164,127,.22), rgba(11,180,196,.12) 45%, transparent 72%);

  --shadow-sm: 0 1px 2px rgba(9,30,24,.05), 0 1px 3px rgba(9,30,24,.06);
  --shadow-md: 0 8px 24px -8px rgba(8,60,46,.20);
  --shadow-lg: 0 28px 64px -22px rgba(6,54,42,.34);
  --shadow-glow: 0 12px 40px -10px rgba(11,164,138,.5);

  --r-sm: 10px;
  --r:    16px;
  --r-lg: 22px;
  --r-xl: 30px;

  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

[data-bs-theme="dark"] {
  --bg:        #071310;
  --bg-2:      #0A1A15;
  --surface:   #0F201A;
  --surface-2: #15291F;
  --ink:       #E9F4EF;
  --ink-soft:  #C1D4CB;
  --muted:     #85A093;
  --line:      #1F342B;
  --line-2:    #294238;
  --amber:     #FBBF24;
  --amber-ink: #FBBF24;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.45);
  --shadow-md: 0 10px 28px -10px rgba(0,0,0,.65);
  --shadow-lg: 0 30px 72px -24px rgba(0,0,0,.8);
  --aura: radial-gradient(90% 60% at 50% -10%, rgba(16,185,129,.28), rgba(11,180,196,.16) 45%, transparent 74%);
}

/* ---------- base ---------- */
* { -webkit-tap-highlight-color: transparent; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.6;
  letter-spacing: -0.006em;
  min-height: 100vh;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 760px;
  background: var(--aura);
  pointer-events: none;
  z-index: 0;
}
/* faint dot texture for depth */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(14,164,127,.05) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(#000, transparent 620px);
  -webkit-mask-image: linear-gradient(#000, transparent 620px);
  pointer-events: none;
  z-index: 0;
}
.container { position: relative; z-index: 1; }

h1, h2, h3, h4, .display-face {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  color: var(--ink);
}
a { color: var(--brand-700); text-decoration: none; }
a:hover { color: var(--brand); }
::selection { background: rgba(14,164,127,.22); }
hr { border-color: var(--line); opacity: 1; }

/* ---------- navbar (logo + theme toggle only) ---------- */
.tm-nav {
  background: color-mix(in srgb, var(--bg) 74%, transparent);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--line);
  padding: .6rem 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.34rem;
  letter-spacing: -0.04em;
  color: var(--ink);
}
.brand:hover { color: var(--ink); }
.brand-mark { width: 36px; height: 36px; display: block; flex: 0 0 auto; filter: drop-shadow(0 5px 12px rgba(11,164,138,.4)); }
.brand-word b { font-weight: 800; }
.brand-word span { background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }

.icon-btn {
  width: 40px; height: 40px;
  display: inline-grid; place-items: center;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink-soft);
  transition: .15s ease;
}
.icon-btn:hover { color: var(--brand); border-color: var(--brand); box-shadow: var(--shadow-sm); }

/* ---------- hero ---------- */
.hero { padding: 4rem 0 1.4rem; text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .8rem; font-weight: 700; letter-spacing: .01em;
  color: var(--brand-700);
  background: color-mix(in srgb, var(--brand) 11%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--brand) 26%, transparent);
  padding: .38rem .85rem; border-radius: 100px;
  margin-bottom: 1.3rem;
  box-shadow: var(--shadow-sm);
}
[data-bs-theme="dark"] .eyebrow { color: #6EE7C4; }
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); animation: livePulse 2.4s infinite; }
.hero h1 {
  font-size: clamp(2.3rem, 6vw, 4.1rem);
  font-weight: 800;
  line-height: 1.0;
  margin: 0 auto .95rem;
  max-width: 16ch;
}
.hero h1 .grad { background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lede {
  color: var(--muted);
  font-size: clamp(1.02rem, 2.2vw, 1.22rem);
  max-width: 48ch;
  margin: 0 auto;
  font-weight: 500;
}

/* ---------- address card (the product) ---------- */
.addr-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: clamp(1.2rem, 3vw, 2rem);
  max-width: 780px;
  margin: 2.2rem auto 0;
}
.addr-card::before {
  content: "";
  position: absolute; inset: -1px;
  border-radius: inherit;
  padding: 1.4px;
  background: linear-gradient(120deg, rgba(18,184,136,.6), rgba(11,180,196,.35) 55%, transparent);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}
.addr-label {
  font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: .55rem; display: flex; align-items: center; gap: .4rem;
}
.addr-row { display: flex; gap: .6rem; align-items: stretch; }
.addr-field {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: .6rem;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  padding: .6rem .9rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.addr-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent); }
.addr-field .at {
  width: 36px; height: 36px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--grad-brand); color: #fff; font-weight: 800; font-size: 1.05rem;
  box-shadow: var(--shadow-glow);
}
#emailField {
  border: 0; background: transparent; outline: 0; width: 100%;
  font-family: var(--font-mono); font-weight: 600;
  font-size: clamp(1rem, 2.6vw, 1.34rem);
  color: var(--ink); letter-spacing: -0.02em;
}
.btn-copy {
  flex: 0 0 auto;
  border: 0; border-radius: var(--r);
  background: var(--grad-brand); color: #fff;
  font-weight: 700; padding: 0 1.35rem; font-size: .98rem;
  display: inline-flex; align-items: center; gap: .5rem;
  box-shadow: var(--shadow-glow);
  transition: transform .12s ease, filter .12s ease;
}
.btn-copy:hover { transform: translateY(-1px); filter: brightness(1.05); color: #fff; }
.btn-copy:active { transform: translateY(0); }

/* action pills row */
.addr-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: 1rem; }
.pill {
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink-soft);
  border-radius: 100px;
  font-weight: 600; font-size: .88rem;
  padding: .46rem .95rem;
  display: inline-flex; align-items: center; gap: .42rem;
  transition: .14s ease;
}
.pill:hover { color: var(--brand-700); border-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, var(--surface)); transform: translateY(-1px); }
.pill.pill-danger:hover { color: var(--danger); border-color: var(--danger); background: color-mix(in srgb, var(--danger) 6%, var(--surface)); }
.pill i { font-size: .95rem; }

/* timer aura pill — warm amber while live */
.timer-pill {
  margin-left: auto;
  font-family: var(--font-mono);
  font-weight: 700; font-size: .9rem;
  color: var(--amber-ink);
  background: color-mix(in srgb, var(--amber) 15%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent);
  padding: .46rem .85rem; border-radius: 100px;
  display: inline-flex; align-items: center; gap: .45rem;
  animation: amberPulse 2.6s ease-in-out infinite;
}
.timer-pill.expired {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
  animation: none;
}
@keyframes amberPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,.4); }
  50%      { box-shadow: 0 0 0 6px rgba(245,158,11,0); }
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(14,164,127,.4); }
  50%      { box-shadow: 0 0 0 5px rgba(14,164,127,0); }
}

.helper-note {
  margin: 1rem auto 0;
  max-width: 780px;
  font-size: .88rem; color: var(--muted);
  display: flex; align-items: center; justify-content: center; gap: .45rem;
  text-align: center;
}
.helper-note i { color: var(--brand); }

/* ---------- how it works (3 steps) ---------- */
.steps { max-width: 980px; margin: 2.6rem auto 0; }
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.step {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.25rem 1.25rem 1.1rem;
  box-shadow: var(--shadow-sm);
}
.step-no {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-weight: 700; font-size: .95rem;
  color: var(--brand-700);
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--brand) 26%, transparent);
  margin-bottom: .7rem;
}
[data-bs-theme="dark"] .step-no { color: #6EE7C4; }
.step h4 { font-size: 1rem; font-weight: 700; margin-bottom: .25rem; }
.step p { color: var(--muted); font-size: .88rem; margin: 0; }

/* ---------- inbox + reader ---------- */
.workspace { max-width: 1140px; margin: 2.8rem auto 0; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  height: 100%;
}
.panel-head {
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: .55rem; flex-wrap: wrap;
  background: var(--surface-2);
}
.panel-title { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; margin: 0; display: flex; align-items: center; gap: .4rem; }

.btn-refresh {
  margin-left: auto;
  border: 1px solid var(--brand);
  background: color-mix(in srgb, var(--brand) 9%, var(--surface));
  color: var(--brand-700);
  border-radius: 11px; font-weight: 700; font-size: .86rem;
  padding: .44rem .9rem; display: inline-flex; align-items: center; gap: .4rem;
  transition: .14s ease;
}
[data-bs-theme="dark"] .btn-refresh { color: #6EE7C4; }
.btn-refresh:hover { background: var(--grad-brand); color: #fff; border-color: transparent; box-shadow: var(--shadow-glow); }
.btn-refresh:disabled { opacity: .7; }

.filters { padding: .75rem 1.1rem; display: flex; gap: .5rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.filters .search { flex: 1 1 100%; }

.form-control, .form-select {
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  color: var(--ink);
  border-radius: 11px;
  font-size: .9rem;
  box-shadow: none;
}
.form-control:focus, .form-select:focus {
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
  color: var(--ink);
}
.form-control::placeholder { color: var(--muted); }

/* inbox list (classes emitted by app.js) */
#inboxList { list-style: none; margin: 0; padding: .45rem; max-height: 62vh; overflow-y: auto; }
#inboxList .list-group-item {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 13px;
  padding: .75rem .85rem;
  margin-bottom: .3rem;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
  color: var(--ink);
}
#inboxList .list-group-item:hover { background: var(--surface-2); border-color: var(--line); }
#inboxList .list-group-item.active {
  background: color-mix(in srgb, var(--brand) 9%, var(--surface));
  border-color: color-mix(in srgb, var(--brand) 34%, transparent);
  box-shadow: inset 3px 0 0 var(--brand);
  color: var(--ink);
}
.tm-from { font-size: .93rem; color: var(--ink-soft); display: flex; align-items: center; }
.tm-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); display: inline-block; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.tm-time { font-size: .74rem; color: var(--muted); font-family: var(--font-mono); white-space: nowrap; }
.subj { font-weight: 600; font-size: .9rem; margin-top: .18rem; color: var(--ink); }
.tm-preview { font-size: .82rem; color: var(--muted); margin-top: .12rem; }

.empty-state { text-align: center; color: var(--muted); padding: 3.2rem 1.3rem; }
.empty-state .ico {
  width: 62px; height: 62px; margin: 0 auto .85rem;
  display: grid; place-items: center; border-radius: 18px;
  background: var(--grad-soft);
  color: var(--brand); font-size: 1.6rem;
}
.empty-state strong { color: var(--ink-soft); display: block; margin-bottom: .25rem; font-weight: 700; }

/* reader */
.tm-reader { min-height: 60vh; }
.reader-head { padding: 1.15rem 1.25rem; border-bottom: 1px solid var(--line); }
.reader-head h5 { font-family: var(--font-display); font-weight: 700; margin: 0; font-size: 1.18rem; }
.reader-meta { font-size: .84rem; color: var(--muted); margin-top: .4rem; }
.reader-meta .who { color: var(--ink-soft); font-weight: 600; }
.reader-body { padding: 1.25rem; }
.tm-reader iframe { width: 100%; border: 0; min-height: 46vh; background: #fff; border-radius: 12px; }
.tm-reader pre {
  white-space: pre-wrap; word-break: break-word;
  font-family: var(--font-body); font-size: .98rem; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 1.1rem; margin: 0;
}
.tm-att {
  border: 1px solid var(--line-2); background: var(--surface-2);
  border-radius: 12px; color: var(--ink-soft);
}
.tm-att:hover { border-color: var(--brand); color: var(--brand-700); }
.reader-tools .btn { border-radius: 10px; }

/* ---------- features ---------- */
.section { padding: 4.5rem 0 1rem; }
.section-eyebrow { text-align: center; font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--brand-700); margin-bottom: .55rem; }
[data-bs-theme="dark"] .section-eyebrow { color: #6EE7C4; }
.section h2 { text-align: center; font-size: clamp(1.7rem, 3.8vw, 2.5rem); font-weight: 800; margin-bottom: 2.4rem; }

.feature {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.5rem;
  height: 100%;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--line-2); }
.feature .tile {
  width: 48px; height: 48px; border-radius: 14px;
  display: grid; place-items: center; font-size: 1.35rem; color: #fff;
  background: var(--grad-brand); box-shadow: var(--shadow-glow);
  margin-bottom: 1rem;
}
.feature h3 { font-size: 1.08rem; font-weight: 700; margin-bottom: .4rem; }
.feature p { color: var(--muted); font-size: .92rem; margin: 0; }

/* ---------- FAQ ---------- */
.accordion { max-width: 800px; margin: 0 auto; }
.accordion-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r) !important; margin-bottom: .75rem; overflow: hidden; }
.accordion-button {
  background: var(--surface); color: var(--ink);
  font-family: var(--font-display); font-weight: 600; font-size: 1.02rem;
  padding: 1.1rem 1.25rem;
}
.accordion-button:not(.collapsed) { background: var(--surface-2); color: var(--brand-700); box-shadow: none; }
[data-bs-theme="dark"] .accordion-button:not(.collapsed) { color: #6EE7C4; }
.accordion-button:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent); border: 0; }
.accordion-body { color: var(--muted); font-size: .94rem; }

/* ---------- footer (brand + copyright only, no menu) ---------- */
.footer { border-top: 1px solid var(--line); margin-top: 4.5rem; padding: 3rem 0 2.4rem; color: var(--muted); text-align: center; }
.footer .brand { font-size: 1.25rem; justify-content: center; }
.footer .foot-tag { margin: .9rem auto 1.4rem; max-width: 42ch; font-size: .92rem; }
.footer .fine { font-size: .82rem; opacity: .85; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff;
  font-weight: 600; font-size: .9rem;
  padding: .72rem 1.2rem; border-radius: 100px;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: .25s ease; z-index: 60;
  display: inline-flex; align-items: center; gap: .5rem;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
[data-bs-theme="dark"] #toast { background: #123028; border: 1px solid var(--line-2); color: #EAF4F0; }

/* ---------- modal ---------- */
.modal-content { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
.modal-header, .modal-footer { border-color: var(--line); }
.modal-title { font-family: var(--font-display); font-weight: 700; }
.input-group-text { background: var(--surface-2); border-color: var(--line-2); color: var(--muted); }
.btn-light { background: var(--surface-2); border-color: var(--line-2); color: var(--ink-soft); }

/* ---------- ad slots ---------- */
.ad-slot { max-width: 970px; margin: 1.4rem auto 0; text-align: center; }
.ad-slot:empty { display: none; }

/* ---------- confirm modal ---------- */
.tm-modal { position: fixed; inset: 0; z-index: 80; display: none; place-items: center; padding: 1rem; }
.tm-modal.show { display: grid; }
.tm-modal-backdrop { position: absolute; inset: 0; background: rgba(6,20,16,.5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.tm-modal-card {
  position: relative;
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.8rem 1.6rem 1.4rem;
  text-align: center;
  animation: popIn .18s cubic-bezier(.2,.8,.2,1);
}
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
.tm-modal-ico {
  width: 58px; height: 58px; margin: 0 auto 1rem;
  display: grid; place-items: center; border-radius: 16px;
  font-size: 1.5rem; color: var(--brand-700);
  background: var(--grad-soft);
}
.tm-modal.danger .tm-modal-ico { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.tm-modal-card h3 { font-size: 1.28rem; font-weight: 800; margin-bottom: .4rem; }
.tm-modal-card p { color: var(--muted); font-size: .93rem; margin: 0 auto 1.4rem; max-width: 34ch; }
.tm-modal-actions { display: flex; gap: .6rem; }
.tm-modal-actions > * { flex: 1; justify-content: center; }
.tm-modal-actions .pill { padding: .62rem 1rem; font-size: .92rem; }
.btn-solid {
  border: 0; border-radius: 100px;
  background: var(--grad-brand); color: #fff;
  font-weight: 700; font-size: .92rem; padding: .62rem 1rem;
  display: inline-flex; align-items: center; gap: .45rem;
  box-shadow: var(--shadow-glow);
  transition: transform .12s ease, filter .12s ease;
}
.btn-solid:hover { transform: translateY(-1px); filter: brightness(1.05); color: #fff; }
.btn-solid.danger { background: linear-gradient(120deg, #F0575C 0%, #E5484D 100%); box-shadow: 0 12px 34px -12px rgba(229,72,77,.6); }

/* ---------- motion / a11y ---------- */
.rise { opacity: 0; transform: translateY(16px); animation: rise .65s cubic-bezier(.2,.7,.2,1) forwards; }
.rise.d1 { animation-delay: .07s; } .rise.d2 { animation-delay: .14s; } .rise.d3 { animation-delay: .21s; } .rise.d4 { animation-delay: .28s; }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

@media (max-width: 767.98px) {
  .steps-grid { grid-template-columns: 1fr; }
}
@media (max-width: 575.98px) {
  .addr-row { flex-wrap: wrap; }
  .btn-copy { flex: 1 1 100%; justify-content: center; padding: .65rem; }
  .timer-pill { margin-left: 0; }
  .hero { padding: 2.6rem 0 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .rise { opacity: 1; transform: none; }
}