:root {
  --ink: #14201b;
  --paper: #f3efe6;
  --line: #d5cec0;
  --teal: #0f766e;
  --teal-deep: #0b5a54;
  --coral: #c45c26;
  --muted: #5c675f;
  --ok: #1f7a4c;
  --bad: #a33b2b;
  --shadow: 0 18px 50px rgba(20, 32, 27, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body {
  font-family: Manrope, system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(15, 118, 110, 0.12), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(196, 92, 38, 0.08), transparent 55%),
    linear-gradient(180deg, #f7f3ea 0%, var(--paper) 40%, #efe8db 100%);
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, .brand-word {
  font-family: Fraunces, Georgia, serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.shell {
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 4rem;
}

.shell-narrow { width: min(480px, calc(100% - 2rem)); }

.card {
  background: rgba(255, 252, 246, 0.92);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1.25rem 1.35rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1.15rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none !important;
}

.btn-primary { background: var(--teal); color: #f7fffd; }
.btn-primary:hover { background: var(--teal-deep); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-danger { background: transparent; color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 35%, white); }

.field { display: grid; gap: 0.35rem; margin-bottom: 0.9rem; }
.field label { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.field input, .field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf8;
  padding: 0.75rem 0.9rem;
  font: inherit;
  color: var(--ink);
}
.field input:focus, .field select:focus {
  outline: 2px solid color-mix(in srgb, var(--teal) 45%, white);
  border-color: var(--teal);
}

.hint { color: var(--muted); font-size: 0.92rem; line-height: 1.45; }
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--teal) 12%, white);
  color: var(--teal-deep);
}
.row { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.check { display: flex; align-items: center; gap: 0.55rem; font-size: 0.95rem; margin-bottom: 1rem; }
.muted { color: var(--muted); }
.hero-mark { width: 42px; height: 42px; flex: none; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left;
  padding: 0.7rem 0.2rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 0.92rem;
}
.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-sent { color: var(--ok); font-weight: 600; }
.status-failed { color: var(--bad); font-weight: 600; }
.rule-line { font-size: 1.05rem; line-height: 1.5; }
.rule-line strong { font-family: Fraunces, Georgia, serif; }

.error-banner, .ok-banner {
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}
.error-banner {
  background: color-mix(in srgb, var(--bad) 10%, white);
  border: 1px solid color-mix(in srgb, var(--bad) 30%, white);
  color: var(--bad);
}
.ok-banner {
  background: color-mix(in srgb, var(--ok) 10%, white);
  border: 1px solid color-mix(in srgb, var(--ok) 30%, white);
  color: var(--ok);
}

.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf8;
  padding: 0.75rem 0.9rem;
  font: inherit;
  color: var(--ink);
  resize: vertical;
  min-height: 5rem;
}
.field textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--teal) 45%, white);
  border-color: var(--teal);
}

.rules-stack { display: grid; gap: 0.85rem; margin: 1rem 0 1.25rem; }

.rule-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.05rem;
  background: #fffcf6;
}
.rule-card-off { opacity: 0.72; }
.rule-card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: flex-start;
}
.rule-tag {
  font-family: Fraunces, Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--teal-deep);
}

.email-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}
.email-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--coral) 12%, white);
  border: 1px solid color-mix(in srgb, var(--coral) 28%, white);
  color: #8a3d14;
  font-size: 0.88rem;
  font-weight: 600;
}

.rule-edit { margin-top: 0.85rem; }
.rule-edit summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}
.rule-add {
  border-top: 1px solid var(--line);
  padding-top: 1.1rem;
  margin-top: 0.5rem;
}

.activity-fold summary {
  cursor: pointer;
  list-style: none;
}
.activity-fold summary::-webkit-details-marker { display: none; }

.poll-bar {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 246, 0.85);
}
.poll-dot {
  width: 0.65rem;
  height: 0.65rem;
  margin-top: 0.4rem;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 18%, transparent);
  flex: none;
}
