:root {
  --ink: #14251b;
  --muted: #66736a;
  --line: #dfe8e1;
  --green: #9fe870;
  --green-dark: #214d2e;
  --mint: #eefae8;
  --white: #ffffff;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--white); }
button, input { font: inherit; }

.login-page { min-height: 100vh; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(390px, .85fr); }
.brand-panel { position: relative; overflow: hidden; padding: clamp(40px, 7vw, 104px); background: var(--mint); display: flex; flex-direction: column; justify-content: center; }
.brand-panel::after { content: ""; position: absolute; width: 360px; height: 360px; border: 90px solid rgba(159, 232, 112, .45); right: -170px; bottom: -180px; }
.eyebrow { font-size: .72rem; font-weight: 800; letter-spacing: .14em; color: var(--green-dark); }
h1 { max-width: 760px; margin: 24px 0; font-size: clamp(3rem, 6vw, 6.5rem); line-height: .92; letter-spacing: -.065em; }
h1 em { color: var(--green-dark); font-style: normal; }
.brand-panel p { max-width: 520px; margin: 0; font-size: clamp(1rem, 1.7vw, 1.25rem); line-height: 1.55; color: var(--muted); }
.brand-mark { position: absolute; left: clamp(40px, 7vw, 104px); bottom: 42px; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 2px; background: var(--green); color: var(--green-dark); font-weight: 900; }
.login-card { padding: clamp(32px, 7vw, 96px); display: flex; flex-direction: column; justify-content: center; gap: 48px; }
.status-dot { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: .82rem; font-weight: 700; }
.status-dot::before { content: ""; width: 9px; height: 9px; background: var(--green); box-shadow: 0 0 0 4px var(--mint); }
h2 { margin: 20px 0 8px; font-size: clamp(2rem, 4vw, 3.4rem); letter-spacing: -.05em; }
.muted { margin: 0; color: var(--muted); }
.stack { display: grid; gap: 22px; }
label { display: grid; gap: 8px; font-size: .84rem; font-weight: 750; }
input { width: 100%; border: 1px solid var(--line); border-radius: 2px; padding: 15px 16px; background: #fbfdfb; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus-visible { border-color: var(--green-dark); box-shadow: 0 0 0 4px rgba(159, 232, 112, .34); }
button { border: 0; border-radius: 2px; padding: 15px 20px; background: var(--green); color: var(--green-dark); font-weight: 850; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: transform .15s, background .15s; }
button:hover { background: #adf47e; transform: translateY(-1px); }
button:active { transform: translateY(1px); }
button:focus-visible { outline: 3px solid var(--green-dark); outline-offset: 3px; }

@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; }
  .brand-panel { min-height: 43vh; padding: 36px 28px 76px; }
  .brand-panel::after { width: 260px; height: 260px; border-width: 54px; right: -120px; bottom: -130px; }
  .brand-mark { left: 28px; bottom: 20px; width: 40px; height: 40px; }
  .login-card { padding: 44px 28px 60px; gap: 34px; }
}

.app-page { min-height: 100vh; background: #f7faf7; }
.topbar { height: 76px; padding: 0 clamp(20px, 4vw, 64px); display: flex; align-items: center; gap: 42px; border-bottom: 1px solid var(--line); background: var(--white); }
.logo { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; margin-right: auto; }
.logo span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 2px; background: var(--green); color: var(--green-dark); font-weight: 900; }
.logo strong { font-size: .92rem; }
.topbar nav { display: flex; align-self: stretch; gap: 28px; }
.topbar nav a { display: flex; align-items: center; color: var(--muted); text-decoration: none; font-size: .88rem; font-weight: 700; border-bottom: 3px solid transparent; }
.topbar nav a.active { color: var(--green-dark); border-color: var(--green); }
.admin-name { padding: 8px 13px; border-radius: 2px; background: var(--mint); color: var(--green-dark); font-size: .78rem; font-weight: 800; }
.logout { padding: 8px 13px; background: transparent; color: var(--muted); font-size: .78rem; }
.content { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 64px 0 90px; }
.content.narrow { width: min(760px, calc(100% - 40px)); }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 32px; }
.page-heading h1 { margin: 8px 0 10px; font-size: clamp(2.7rem, 5vw, 4.8rem); line-height: .95; letter-spacing: -.065em; }
.page-heading p { margin: 0; color: var(--muted); }
.primary-action { display: flex; align-items: center; gap: 24px; padding: 13px 18px; border-radius: 2px; background: var(--green); color: var(--green-dark); font-weight: 850; text-decoration: none; white-space: nowrap; }
.primary-action:hover { transform: translateY(-1px); }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 42px 0 20px; }
.summary-grid article { padding: 22px 24px; border: 1px solid var(--line); border-radius: 2px; background: var(--white); }
.summary-grid span { display: block; margin-bottom: 10px; color: var(--muted); font-size: .78rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.summary-grid strong { font-size: 2rem; letter-spacing: -.04em; }
.table-card, .editor-card { border: 1px solid var(--line); border-radius: 2px; background: var(--white); overflow: hidden; }
.search-row { display: flex; align-items: center; gap: 18px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.search-row label { display: block; }
.search-row input { max-width: 430px; padding: 11px 14px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 17px 22px; text-align: left; border-bottom: 1px solid var(--line); font-size: .88rem; }
th { color: var(--muted); background: #fbfdfb; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
td a, .back-link, .form-actions a { color: var(--green-dark); font-weight: 800; text-decoration: none; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; }
.badge { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; border-radius: 2px; font-size: .72rem; font-weight: 800; }
.badge::before { content: ""; width: 6px; height: 6px; background: currentColor; }
.badge.on { color: #176234; background: #e3f8e9; }
.badge.off { color: #7b6464; background: #f3eded; }
.empty { padding: 52px; color: var(--muted); text-align: center; }
.row-actions { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.row-actions form { margin: 0; }
.text-action { display: inline; padding: 0; background: transparent; color: var(--green-dark); font-size: .88rem; }
.text-action:hover { background: transparent; transform: none; text-decoration: underline; }
.notice { margin: 24px 0 -20px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 2px; }
.notice.success { border-color: #a8d9b7; background: #eaf8ee; color: #176234; }
.back-link { display: inline-block; margin-bottom: 38px; }
.page-heading.compact { align-items: start; margin-bottom: 30px; }
.page-heading.compact h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
.editor-card { display: grid; gap: 22px; padding: clamp(24px, 5vw, 44px); overflow: visible; }
.readonly-field { display: grid; gap: 7px; }
.readonly-field span { color: var(--muted); font-size: .82rem; font-weight: 750; }
.readonly-field strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.switch-row { grid-template-columns: 1fr auto; align-items: center; padding: 17px 18px; border: 1px solid var(--line); border-radius: 2px; }
.switch-row span { display: grid; gap: 4px; }
.switch-row small { color: var(--muted); font-weight: 500; }
.switch-row input { width: 22px; height: 22px; accent-color: var(--green-dark); }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 22px; padding-top: 8px; }
.form-actions button { min-width: 210px; }
.import-card { margin-top: 42px; grid-template-columns: minmax(220px, .75fr) minmax(320px, 1.25fr); align-items: start; }
.import-card h2, .section-heading h2 { margin: 10px 0 8px; font-size: clamp(1.65rem, 3vw, 2.35rem); letter-spacing: -.04em; }
.import-card input[type="file"] { padding: 11px; background: var(--white); }
.import-card input[type="file"]::file-selector-button { margin-right: 14px; border: 0; border-radius: 2px; padding: 9px 12px; background: var(--mint); color: var(--green-dark); font-weight: 800; cursor: pointer; }
.campaign-list { margin-top: 20px; }
.section-heading { padding: 24px 22px 18px; border-bottom: 1px solid var(--line); }
.campaign-summary strong { font-size: clamp(1.25rem, 2.5vw, 2rem); }
.badge.warning { color: #7a5416; background: #fff3d6; }
.validation-note { max-width: 310px; margin-top: 7px; color: #7a5416; font-size: .78rem; line-height: 1.4; }
.email-preview-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--mint); }
.email-preview-card { width: min(600px, 100%); padding: clamp(28px, 6vw, 52px); border: 1px solid var(--line); border-top: 4px solid var(--green); border-radius: 2px; background: var(--white); }
.email-preview-card .brand-mark { position: static; margin-bottom: 34px; }
.email-preview-card h1 { margin: 12px 0 18px; font-size: clamp(2.2rem, 6vw, 4rem); }
.email-preview-card p { margin: 0; color: var(--muted); line-height: 1.65; }

@media (max-width: 760px) {
  .topbar { height: auto; padding: 16px 20px; flex-wrap: wrap; gap: 14px; }
  .logo strong, .admin-name { display: none; }
  .topbar nav { order: 3; width: 100%; height: 42px; gap: 24px; }
  .content { padding-top: 42px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .primary-action { justify-content: space-between; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-grid article:first-child { grid-column: 1 / -1; }
  .search-row { align-items: stretch; flex-direction: column; gap: 8px; }
  .search-row input { max-width: none; }
  th, td { padding: 14px 16px; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; text-align: center; }
  .import-card { grid-template-columns: 1fr; }
}
