/*
  Theme: "Postmark" — a calm, editorial look built around the idea of a
  mailroom ledger: hairline rules, a deep teal ink accent, a serif display
  face for headings paired with a plain-spoken sans for everything you
  actually have to read and act on.
*/

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600&family=Inter:wght@400;500;600&display=swap');

:root {
  --paper: #F6F7F4;
  --paper-raised: #FFFFFF;
  --ink: #1A2420;
  --ink-soft: #4B5750;
  --line: #DCE1DA;
  --line-strong: #B9C1B8;
  --teal: #2C6E63;
  --teal-deep: #1F4E46;
  --teal-wash: #E7F0EE;
  --brick: #B84B2C;
  --brick-wash: #FBEBE4;
  --gold: #C99A3B;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(26, 36, 32, 0.06), 0 1px 1px rgba(26, 36, 32, 0.04);
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.5em;
  color: var(--ink);
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }

p { margin: 0 0 1em; color: var(--ink-soft); }

a { color: var(--teal-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* ---------- Layout shells ---------- */

.public-shell {
  max-width: 540px;
  margin: 6vh auto;
  padding: 0 20px;
}

.card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  color: var(--teal-deep);
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 1.05rem;
}
.brand-mark .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); display: inline-block; }

/* ---------- Forms ---------- */

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
}
.field .hint { font-size: 0.8rem; color: var(--ink-soft); margin-top: 4px; }
.field .required { color: var(--brick); }

input[type=text],
input[type=email],
input[type=password],
input[type=search],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  transition: border-color 0.15s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--teal); }
textarea { min-height: 140px; resize: vertical; }

.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }

/* Honeypot: present in the DOM for bots that parse it, invisible + unreachable for people */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  top: -9999px !important;
  width: 1px; height: 1px; overflow: hidden;
  opacity: 0;
}

button, .btn {
  display: inline-block;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-align: center;
}
.btn-primary { background: var(--teal-deep); color: #fff; }
.btn-primary:hover { background: var(--teal); text-decoration: none; }
.btn-secondary { background: transparent; color: var(--teal-deep); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--teal); text-decoration: none; }
.btn-danger { background: var(--brick); color: #fff; }
.btn-danger:hover { background: #9b3f24; text-decoration: none; }
.btn-block { display: block; width: 100%; }

/* ---------- Alerts ---------- */

.alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.alert-success { background: var(--teal-wash); border-color: #BFDAD3; color: var(--teal-deep); }
.alert-error { background: var(--brick-wash); border-color: #E9C3B2; color: #7A3018; }
.alert-info { background: #EFF2ED; border-color: var(--line); color: var(--ink-soft); }

/* ---------- Admin shell ---------- */

.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--ink);
  color: #E9ECE7;
  padding: 22px 0;
}
.admin-sidebar .brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 0 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 14px;
}
.admin-sidebar .brand .brand-title {
  font-family: 'Fraunces', serif;
  font-size: 1.15rem;
  color: #fff;
}
.admin-sidebar nav a {
  display: block;
  padding: 10px 22px;
  color: #C7CFC7;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
}
.admin-sidebar nav a:hover { color: #fff; text-decoration: none; }
.admin-sidebar nav a.active { color: #fff; border-left-color: var(--gold); background: rgba(255,255,255,0.04); }
.admin-sidebar .logout { margin-top: 20px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.1); }

.admin-main { flex: 1; padding: 30px 40px; max-width: 1100px; }

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }

table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
table.data th, table.data td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}
table.data th {
  background: var(--teal-wash);
  color: var(--teal-deep);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #FAFBF9; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 0.74rem;
  font-weight: 600;
}
.badge-confirmed { background: var(--teal-wash); color: var(--teal-deep); }
.badge-pending { background: #FCF3DD; color: #8A6A16; }
.badge-unsubscribed { background: #EFEAE4; color: #6B6459; }
.badge-bounced { background: var(--brick-wash); color: #7A3018; }
.badge-sent { background: var(--teal-wash); color: var(--teal-deep); }
.badge-failed { background: var(--brick-wash); color: #7A3018; }
.badge-queued, .badge-pending2 { background: #EFF2ED; color: var(--ink-soft); }
.badge-scheduled { background: #E8EEF7; color: #2A5A96; }

.stat-grid { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.stat {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  min-width: 140px;
}
.stat .num { font-family: 'Fraunces', serif; font-size: 1.7rem; color: var(--teal-deep); }
.stat .label { font-size: 0.78rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.03em; }

.pagination { display: flex; gap: 6px; margin-top: 16px; }
.pagination a, .pagination span {
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.pagination .current { background: var(--teal-deep); color: #fff; border-color: var(--teal-deep); }

.muted { color: var(--ink-soft); font-size: 0.85rem; }
.footer-note { margin-top: 30px; font-size: 0.78rem; color: var(--ink-soft); text-align: center; }

@media (max-width: 820px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar { width: 100%; padding: 14px 0; }
  .admin-sidebar nav { display: flex; overflow-x: auto; }
  .admin-sidebar nav a { border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; }
  .admin-sidebar nav a.active { border-left-color: transparent; border-bottom-color: var(--gold); }
  .admin-sidebar .brand, .admin-sidebar .logout { display: none; }
  .admin-main { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
