:root {
  --bg: #f5f5f7;
  --bg-2: #ffffff;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-border: rgba(15, 23, 42, 0.06);
  --panel-glow: rgba(0, 113, 227, 0.08);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --accent: #0071e3;
  --accent-strong: #0058b0;
  --accent-warm: #8a8a8f;
  --danger: #d93025;
  --success: #1b7f4a;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top center, rgba(0, 113, 227, 0.07), transparent 22%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  min-height: 100vh;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), transparent 18%);
  opacity: 1;
}

.shell {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 88px;
}

.hero {
  padding: 52px 8px 40px;
  position: relative;
  text-align: center;
}

.hero-topline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.eyebrow {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
  font-size: 12px;
  font-weight: 600;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  letter-spacing: 0.08em;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: clamp(48px, 9vw, 88px);
  line-height: 0.95;
  margin-bottom: 14px;
  letter-spacing: -0.06em;
  max-width: none;
  white-space: nowrap;
  font-weight: 700;
}

.hero-copy {
  margin: 0;
  color: var(--muted);
  font-size: clamp(18px, 2.4vw, 24px);
  font-weight: 400;
}

h2 {
  font-size: 34px;
  margin-bottom: 8px;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.muted,
.status,
label span {
  color: var(--muted);
}

.section-kicker {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-warm);
  font-weight: 600;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(160%);
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
  animation: panel-enter 500ms ease both;
}

.panel::after {
  content: "";
  position: absolute;
  inset: auto -14% -42% auto;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--panel-glow) 0%, transparent 64%);
  pointer-events: none;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.row.split {
  justify-content: space-between;
  align-items: center;
}

.row.actions {
  justify-content: flex-start;
}

label {
  display: block;
}

label span {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
  font-size: 16px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(0, 113, 227, 0.36);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
  transform: translateY(-1px);
}

textarea {
  resize: vertical;
}

.toggle {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  font-weight: 600;
  cursor: pointer;
}

.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  position: relative;
  width: 52px;
  height: 32px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.12);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
  transition: background 180ms ease, box-shadow 180ms ease;
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.14);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.toggle input:checked + .toggle-track {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 113, 227, 0.08), 0 8px 18px rgba(0, 113, 227, 0.18);
}

.toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(20px);
}

.toggle input:focus-visible + .toggle-track {
  box-shadow:
    inset 0 0 0 1px rgba(0, 113, 227, 0.08),
    0 0 0 4px rgba(0, 113, 227, 0.12);
}

.toggle-label {
  color: var(--text);
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 13px 22px;
  cursor: pointer;
  transition:
    transform 120ms ease,
    background 120ms ease,
    box-shadow 120ms ease,
    filter 120ms ease;
  position: relative;
  overflow: hidden;
}

.button:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.button:active {
  transform: translateY(1px) scale(0.985);
}

.button.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
  box-shadow: 0 14px 28px rgba(0, 113, 227, 0.18);
  font-weight: 600;
}

.button.primary:hover {
  box-shadow: 0 18px 36px rgba(0, 113, 227, 0.22);
}

.button.secondary {
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.button.danger {
  background: rgba(217, 48, 37, 0.08);
  color: var(--danger);
}

.rule-list {
  display: grid;
  gap: 16px;
}

.email-list {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.email-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.rule-card {
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: var(--radius-lg);
  padding: 22px;
  background: rgba(255, 255, 255, 0.88);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.rule-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 113, 227, 0.18);
  background: rgba(255, 255, 255, 0.96);
}

.rule-help {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.rule-help p {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.6;
}

.rule-help p strong {
  color: var(--text);
}

.rule-recipient-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.recipient-label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.recipient-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.recipient-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(15, 23, 42, 0.08);
  color: var(--text);
  font-size: 13px;
}

.recipient-chip input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.recipient-empty {
  color: var(--muted);
  font-size: 13px;
}

.rule-actions {
  display: flex;
  align-items: flex-end;
  height: 100%;
}

.status {
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.88);
}

.status[data-tone="success"] {
  color: var(--success);
  border-color: rgba(27, 127, 74, 0.18);
}

.status[data-tone="error"] {
  color: var(--danger);
  border-color: rgba(217, 48, 37, 0.18);
}

@keyframes panel-enter {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 800px) {
  .grid.two,
  .grid.four {
    grid-template-columns: 1fr;
  }

  .email-row {
    grid-template-columns: 1fr;
  }

  .row.split {
    flex-direction: column;
  }

  .shell {
    width: min(100% - 20px, 1040px);
    padding-top: 20px;
  }

  h1 {
    white-space: normal;
  }
}
