/* ─── Tokens ──────────────────────────────────────────────────── */
:root {
  --bg:       #f7f6f3;
  --surface:  #ffffff;
  --border:   #e5e3de;
  --text:     #1a1916;
  --muted:    #6b6860;
  --accent:   #2563eb;
  --accent-h: #1d4ed8;
  --gold:     #b45309;
  --gold-bg:  #fef3c7;
  --danger:   #dc2626;
  --success:  #16a34a;
  --radius:   10px;
  --shadow:   0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  font-family: 'Sora', system-ui, sans-serif;
}

.dark {
  --bg:       #0f0e0c;
  --surface:  #1a1916;
  --border:   #2a2925;
  --text:     #f0ede8;
  --muted:    #8a8680;
  --accent:   #3b82f6;
  --accent-h: #60a5fa;
  --gold:     #fbbf24;
  --gold-bg:  #1c1506;
  --shadow:   0 1px 3px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.2);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background .2s, color .2s;
}

/* ─── Navbar ─────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -.02em;
}

.nav-right { display: flex; gap: .5rem; }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .65rem 1.4rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, transform .1s, opacity .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:active { transform: scale(.97); }

.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); }

.btn-outline  { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-gold     { background: var(--gold-bg); color: var(--gold); border: 1.5px solid var(--gold); }
.btn-gold:hover { opacity: .85; }

.btn-danger   { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: #fecaca; }

.btn-full     { width: 100%; }
.btn-sm       { padding: .45rem 1rem; font-size: .82rem; }

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: .4rem;
  border-radius: 6px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  transition: color .15s, background .15s;
}
.icon-btn:hover { color: var(--accent); background: var(--border); }

.link-btn {
  background: none; border: none; cursor: pointer;
  color: var(--accent); font-size: .8rem;
  font-family: inherit;
}

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.8rem;
  box-shadow: var(--shadow);
}

/* ─── Hero / Index ───────────────────────────────────────────── */
main { flex: 1; }

.hero {
  display: flex;
  justify-content: center;
  padding: 3rem 1.5rem 4rem;
}

.hero-inner {
  width: 100%;
  max-width: 560px;
}

.hero-badge {
  display: inline-block;
  background: var(--gold-bg);
  color: var(--gold);
  font-size: .78rem;
  font-weight: 600;
  padding: .3rem .8rem;
  border-radius: 100px;
  margin-bottom: 1.2rem;
  letter-spacing: .02em;
}

.hero-title {
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.03em;
  margin-bottom: .9rem;
}

.accent { color: var(--accent); }

.hero-sub {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

/* ─── Create form ────────────────────────────────────────────── */
.create-card { display: flex; flex-direction: column; gap: 1.1rem; }

.field-group { display: flex; flex-direction: column; gap: .35rem; }

.input-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.input {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: .65rem .9rem;
  color: var(--text);
  font-family: inherit;
  font-size: .9rem;
  transition: border-color .15s;
  outline: none;
}
.input:focus { border-color: var(--accent); }

.mono { font-family: 'JetBrains Mono', monospace; }

.input-row .input:first-child { flex: 1; min-width: 120px; }
.select-domain { cursor: pointer; }

.input-sep { color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: .9rem; }

.field-hint { font-size: .78rem; color: var(--muted); }

.h-captcha { display: flex; justify-content: center; }

.error-msg {
  background: #fee2e2;
  color: var(--danger);
  padding: .6rem 1rem;
  border-radius: var(--radius);
  font-size: .85rem;
}

/* ─── Result card ────────────────────────────────────────────── */
.result-card { display: flex; flex-direction: column; gap: 1rem; }

.result-header { display: flex; gap: .5rem; }

.badge {
  display: inline-block;
  padding: .25rem .7rem;
  border-radius: 100px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
}
.badge-free    { background: #eff6ff; color: var(--accent); }
.badge-premium { background: var(--gold-bg); color: var(--gold); }
.badge-time    { background: var(--border); color: var(--muted); }

.address-box {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: .8rem 1rem;
  word-break: break-all;
}

.address-text { flex: 1; font-size: .9rem; }

.expire-info { color: var(--muted); font-size: .85rem; }

.result-actions { display: flex; gap: .75rem; flex-wrap: wrap; }

.premium-cta {
  background: var(--gold-bg);
  border: 1.5px solid var(--gold);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  font-size: .88rem;
}

/* ─── Features ───────────────────────────────────────────────── */
.features {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2.5rem;
}

.feature {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.feature-icon {
  width: 40px;
  height: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.feature strong { display: block; font-size: .92rem; margin-bottom: .2rem; }
.feature p { font-size: .83rem; color: var(--muted); }

/* ─── Inbox layout ───────────────────────────────────────────── */
.inbox-wrap {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: calc(100vh - 57px);
  overflow: hidden;
}

.inbox-sidebar {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}

.sidebar-top {
  padding: 1.2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: .8rem;
}

.address-display .label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  display: block;
  margin-bottom: .25rem;
}

.address-row { display: flex; align-items: center; gap: .4rem; }

.addr-text {
  font-size: .78rem;
  word-break: break-all;
  flex: 1;
  color: var(--text);
}

.status-badges { display: flex; gap: .4rem; flex-wrap: wrap; }

.sidebar-actions { display: flex; gap: .5rem; }

.upgrade-box {
  background: var(--gold-bg);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: .8rem;
  font-size: .83rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

/* Message list */
.msg-list { flex: 1; overflow-y: auto; }

.msg-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .6rem 1rem;
  font-size: .78rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.empty-icon { font-size: 2.5rem; margin-bottom: .5rem; }
.empty-sub { font-size: .8rem; margin-top: .3rem; }

.msg-item {
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
}
.msg-item:hover { background: var(--bg); }
.msg-item.active { background: #eff6ff; }
.dark .msg-item.active { background: #172554; }
.msg-item.unread .msg-from { font-weight: 700; }

.msg-from {
  font-size: .8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: .2rem;
}
.msg-subject {
  font-size: .88rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: .2rem;
}
.msg-time { font-size: .74rem; color: var(--muted); }

/* ─── Viewer ─────────────────────────────────────────────────── */
.inbox-viewer {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.viewer-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.viewer-empty-icon { font-size: 3rem; margin-bottom: .75rem; }

.viewer-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.viewer-header {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.viewer-subject {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: .5rem;
}

.viewer-meta {
  display: flex;
  gap: 1rem;
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: .8rem;
  flex-wrap: wrap;
}

.viewer-actions { display: flex; gap: .5rem; }

.viewer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.email-html { max-width: 680px; font-size: .9rem; line-height: 1.7; }
.email-html a { color: var(--accent); }
.email-html img { max-width: 100%; height: auto; border-radius: 6px; }

.email-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: .83rem;
  white-space: pre-wrap;
  color: var(--text);
  line-height: 1.6;
}

/* ─── Toast ──────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: .65rem 1.4rem;
  border-radius: 100px;
  font-size: .87rem;
  font-weight: 500;
  z-index: 999;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
}

/* ─── Footer ─────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 1.5rem;
  font-size: .8rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
.footer-sub { margin-top: .25rem; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 680px) {
  .hero-title { font-size: 1.9rem; }

  .inbox-wrap {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    min-height: calc(100vh - 57px);
  }

  .inbox-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 50vh;
  }

  .inbox-viewer { min-height: 50vh; }
}

[x-cloak] { display: none !important; }
