@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700;800&family=Poppins:wght@400;500;600;700&display=swap');

:root {
  --bg: #f6f8fc;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --indigo: #4f46e5;
  --accent: #14b8a6;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --soft-blue: #eef5ff;
  --shadow: 0 24px 70px rgba(15, 23, 42, .10);
  --soft-shadow: 0 14px 40px rgba(15, 23, 42, .07);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Poppins, ui-sans-serif, system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, .12), transparent 34rem),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 42%, #ffffff 100%);
  color: var(--text);
  line-height: 1.65;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
h1, h2, h3, .brand { font-family: Montserrat, Poppins, sans-serif; letter-spacing: 0; }
main { width: min(1140px, calc(100% - 32px)); margin: 0 auto 56px; }

.site-header {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  position: relative;
  z-index: 4;
}

.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); }
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 12px 30px rgba(37, 99, 235, .25);
}
.brand-copy { display: grid; line-height: 1.15; }
.brand-copy strong { font-size: 18px; }
.logo-up {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  padding: 2px 7px 3px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .22);
}
.brand-copy small { color: var(--muted); font-family: Poppins, sans-serif; font-size: 12px; font-weight: 500; }

.site-nav { display: flex; align-items: center; gap: 6px; }
.site-nav a {
  color: #334155;
  font-weight: 600;
  padding: 10px 13px;
  border-radius: 999px;
}
.site-nav a:hover, .site-nav a.active { background: #eaf1ff; color: var(--primary-dark); }
.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 10px;
  cursor: pointer;
}
.nav-toggle span { display: block; height: 2px; margin: 5px 0; border-radius: 2px; background: var(--text); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 480px);
  gap: 34px;
  align-items: center;
  padding: 54px 0 30px;
}
.hero-copy h1 {
  font-size: clamp(42px, 6vw, 72px);
  line-height: 1.02;
  margin: 10px 0 18px;
  max-width: 760px;
}
.lead { font-size: 18px; color: var(--muted); max-width: 620px; margin: 0; }
.eyebrow, .kicker {
  color: var(--primary);
  text-transform: uppercase;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0;
  margin: 0 0 8px;
}
.hero-points { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.hero-points span, .status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  color: #334155;
  padding: 9px 12px;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .05);
  font-size: 13px;
  font-weight: 600;
}

.email-card, .inbox-card, .content-card, .disclaimer-card {
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.email-card { padding: 28px; backdrop-filter: blur(16px); }
.card-heading { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.card-heading h2 { margin: 0; font-size: 22px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgba(20, 184, 166, .13); }
.email-row { margin: 22px 0 16px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: stretch; }
.email-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: clamp(18px, 2.4vw, 24px);
  background: var(--soft-blue);
  border: 1px solid #cfe0ff;
  color: #172554;
  padding: 16px;
  border-radius: 18px;
  display: flex;
  align-items: center;
}
.tool-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.tool-status { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.tool-message {
  display: none;
  margin-top: 12px;
  border-radius: 14px;
  padding: 11px 13px;
  font-size: 13px;
  font-weight: 600;
}
.tool-message.show { display: block; }
.tool-message.error { color: #991b1b; background: #fee2e2; border: 1px solid #fecaca; }

.button {
  font-family: Poppins, sans-serif;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 14px;
  padding: 11px 15px;
  font-weight: 700;
  letter-spacing: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}
.button:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(15, 23, 42, .08); }
.button:active { transform: translateY(0); box-shadow: none; }
.button:disabled { opacity: .62; cursor: not-allowed; transform: none; box-shadow: none; }
.button.primary { background: linear-gradient(135deg, var(--primary), var(--indigo)); border-color: transparent; color: #fff; }
.button.danger { color: #fff; border-color: var(--danger); background: var(--danger); }
.ghost-danger { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.copy-icon { width: 15px; height: 17px; border: 2px solid currentColor; border-radius: 4px; position: relative; opacity: .8; }
.copy-icon::before { content: ""; position: absolute; width: 100%; height: 100%; border: 2px solid currentColor; border-radius: 4px; left: -6px; top: 4px; background: inherit; }

.inbox-card { padding: 26px; margin: 26px 0; }
.standalone-inbox { margin-top: 28px; }
.inbox-card-header, .section-title { display: flex; justify-content: space-between; gap: 18px; align-items: center; }
.inbox-card-header h1, .inbox-card-header h2 { margin: 0; font-size: 30px; }
.muted { color: var(--muted); }
.inbox-check {
  min-width: 220px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-weight: 600;
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e1;
  border-top-color: var(--primary);
  border-radius: 50%;
  opacity: 0;
}
.spinner.active { opacity: 1; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.inbox-list { display: grid; gap: 12px; margin-top: 20px; }
.message-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  padding: 15px;
  color: var(--text);
  box-shadow: 0 8px 22px rgba(15, 23, 42, .04);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.message-row:hover { transform: translateY(-2px); border-color: #bfdbfe; box-shadow: 0 14px 34px rgba(37, 99, 235, .10); }
.message-row.unread { border-left: 5px solid var(--primary); }
.message-avatar {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, #dbeafe, #ccfbf1);
  color: #1e3a8a;
  display: grid;
  place-items: center;
  font-weight: 800;
}
.message-main { min-width: 0; display: grid; gap: 2px; }
.message-main b { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-main small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-row time { color: var(--muted); font-size: 13px; white-space: nowrap; }

.empty-state {
  min-height: 240px;
  border: 1px dashed #cbd5e1;
  border-radius: 22px;
  background: linear-gradient(180deg, #f8fbff, #ffffff);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 34px;
  color: var(--muted);
}
.empty-state h3 { color: var(--text); margin: 12px 0 4px; }
.empty-state p { margin: 0; }
.empty-illustration {
  width: 82px;
  height: 62px;
  border-radius: 18px;
  background: linear-gradient(135deg, #dbeafe, #ccfbf1);
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .12);
}
.empty-illustration::before, .empty-illustration::after {
  content: "";
  position: absolute;
  width: 48px;
  height: 2px;
  background: rgba(37, 99, 235, .35);
  left: 17px;
  transform-origin: center;
  top: 30px;
}
.empty-illustration::before { transform: rotate(28deg); }
.empty-illustration::after { transform: rotate(-28deg); }
.empty-illustration span {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  right: -3px;
  top: -3px;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.25); opacity: .55; } }

.section-block { margin: 68px 0; }
.section-copy { max-width: 720px; margin-bottom: 22px; }
.section-copy h2 { font-size: clamp(28px, 4vw, 42px); margin: 0; }
.steps-grid, .benefit-grid, .faq-list {
  display: grid;
  gap: 16px;
}
.steps-grid { grid-template-columns: repeat(3, 1fr); }
.benefit-grid { grid-template-columns: repeat(4, 1fr); }
.steps-grid article, .benefit-grid article, .faq-list article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--soft-shadow);
}
.steps-grid span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-weight: 800;
}
.steps-grid h3, .benefit-grid h3, .faq-list h3 { margin: 14px 0 8px; }
.steps-grid p, .benefit-grid p, .faq-list p { margin: 0; color: var(--muted); }
.faq-list { grid-template-columns: repeat(2, 1fr); }
.disclaimer-card, .content-card { padding: 28px; margin: 32px 0; }
.page-shell { min-height: 48vh; }

.message-page { max-width: 960px; }
.message-detail {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-top: 28px;
}
.back-link {
  display: inline-flex;
  align-items: center;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  font-weight: 700;
  color: var(--text);
}
.message-head h1 { margin: 0 0 18px; font-size: clamp(28px, 4vw, 44px); }
.message-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 0;
}
.message-meta div {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px;
  background: #f8fafc;
  min-width: 0;
}
.message-meta dt { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.message-meta dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.message-body { margin-top: 22px; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; background: #fff; }
.email-frame { width: 100%; height: 620px; border: 0; background: #fff; display: block; }
.plain-message { margin: 0; white-space: pre-wrap; background: #fff; padding: 24px; overflow: auto; font-family: Poppins, sans-serif; }
.message-actions { margin-top: 18px; }

.site-footer {
  background: #0f172a;
  color: #cbd5e1;
  margin-top: 72px;
  padding: 50px 0 22px;
}

.terms-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, .62);
  backdrop-filter: blur(8px);
}
.terms-dialog {
  width: min(520px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 30px;
  box-shadow: var(--shadow);
}
.terms-dialog h2 { margin: 0 0 12px; }
.terms-dialog p { color: var(--muted); }

.contact-layout { display: grid; grid-template-columns: .85fr 1.15fr; gap: 24px; align-items: start; margin-top: 28px; }
.contact-form { display: grid; gap: 14px; }
.honeypot { position: absolute; left: -9999px; opacity: 0; pointer-events: none; }
.legal-content { max-width: 900px; margin-left: auto; margin-right: auto; }
.legal-content h1 { font-size: clamp(34px, 5vw, 54px); margin: 0 0 20px; }
.legal-content h2 { margin: 26px 0 8px; font-size: 22px; }
.legal-content p { color: var(--muted); }

.dashboard-charts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.bar-chart { display: grid; gap: 10px; }
.bar-chart div { display: grid; grid-template-columns: 110px 1fr 34px; gap: 10px; align-items: center; }
.bar-chart span, .bar-chart em { color: var(--muted); font-size: 12px; font-style: normal; }
.bar-chart b { height: 12px; width: var(--bar-width); min-width: 4px; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--accent)); display: block; }
.mini-list { display: grid; gap: 10px; }
.mini-list div { display: flex; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #f8fafc; }
.footer-inner, .footer-bottom {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}
.footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 34px; align-items: start; }
.footer-brand { color: #fff; }
.footer-inner p { max-width: 620px; margin: 16px 0 0; }
.footer-links { display: grid; gap: 11px; min-width: 210px; }
.footer-links a { color: #e2e8f0; }
.footer-bottom { border-top: 1px solid rgba(226, 232, 240, .15); margin-top: 28px; padding-top: 18px; font-size: 13px; color: #94a3b8; }

.panel { padding: 24px; margin: 24px 0; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--soft-shadow); }
.auth-shell { min-height: 100vh; display: grid; place-items: center; }
.auth-shell .panel { width: min(460px, calc(100vw - 32px)); }
.form-grid { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
  background: #fff;
}
input[type="checkbox"] { width: auto; }
textarea { min-height: 180px; }
.notice { padding: 12px 14px; border-radius: 14px; }
.notice.error { background: #fee2e2; color: #991b1b; }
.notice.success { background: #dcfce7; color: #166534; }
.check-list { color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }

.admin-layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.admin-sidebar { background: #0f172a; color: #fff; padding: 22px; }
.admin-sidebar h2 { margin-top: 0; }
.admin-sidebar .logo-up { box-shadow: none; }
.admin-sidebar a { color: #dbeafe; display: block; padding: 9px 0; }
.admin-main { padding: 24px; width: min(1180px, 100%); }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.stat strong { display: block; font-size: 30px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
pre { white-space: pre-wrap; background: #f8fafc; padding: 16px; border-radius: 12px; overflow: auto; }
.admin-table th { background: #f8fafc; color: #334155; font-size: 13px; }
.admin-table td { vertical-align: middle; }
.admin-table tr:hover td { background: #fbfdff; }
.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
}
.status-badge.active { color: #047857; background: #d1fae5; }
.status-badge.expired { color: #b91c1c; background: #fee2e2; }
.status-badge.inactive { color: #475569; background: #e2e8f0; }
.bulk-toolbar, .pagination-bar, .admin-action-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  margin: 16px 0;
  box-shadow: var(--soft-shadow);
}
.bulk-toolbar select { width: auto; min-width: 190px; }
.pagination-links { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}
.stat-date { font-size: 15px !important; overflow-wrap: anywhere; }
.cleanup-stats { margin-bottom: 18px; }
code { background: #f1f5f9; border: 1px solid var(--line); border-radius: 8px; padding: 2px 6px; }

@media (max-width: 980px) {
  .hero, .steps-grid, .benefit-grid, .faq-list, .footer-inner, .message-meta, .contact-layout, .dashboard-charts { grid-template-columns: 1fr; }
  .hero { padding-top: 24px; }
  .tool-actions { grid-template-columns: 1fr; }
  .inbox-card-header { align-items: flex-start; flex-direction: column; }
  .inbox-check { justify-content: flex-start; min-width: 0; }
  .admin-filter-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  main, .site-header, .footer-inner, .footer-bottom { width: min(100% - 24px, 1140px); }
  .site-header { align-items: flex-start; }
  .nav-toggle { display: grid; }
  .site-nav {
    display: none;
    position: absolute;
    right: 0;
    top: 76px;
    width: min(280px, calc(100vw - 32px));
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 10px;
    box-shadow: var(--shadow);
  }
  .site-nav.open { display: grid; }
  .site-nav a { border-radius: 12px; }
  .brand-copy small { display: none; }
  .email-row { grid-template-columns: 1fr; }
  .message-row { grid-template-columns: 42px minmax(0, 1fr); }
  .message-row time { grid-column: 2; }
  .message-avatar { width: 42px; height: 42px; border-radius: 14px; }
  .admin-layout, .stats { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; }
}
