:root {
  color-scheme: light;
  --ink: #17211c;
  --muted: #68746e;
  --line: #dfe7e2;
  --paper: #f6f8f5;
  --card: #ffffff;
  --forest: #173f32;
  --forest-2: #245744;
  --mint: #d9eee4;
  --cream: #f4eddf;
  --danger: #a43a3a;
  --shadow: 0 24px 70px rgba(31, 55, 44, 0.12);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 12% 14%, rgba(178, 214, 195, .52), transparent 30%),
    radial-gradient(circle at 88% 84%, rgba(232, 214, 178, .4), transparent 28%),
    #eef3ef;
}

.login-shell {
  width: min(980px, 100%);
  min-height: 590px;
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 26px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--card);
}

.brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 72px;
  color: #f7fbf8;
  background:
    linear-gradient(145deg, rgba(255,255,255,.08), transparent 52%),
    var(--forest);
  isolation: isolate;
}
.brand-panel::after {
  content: "";
  position: absolute;
  inset: auto -90px -120px auto;
  width: 360px;
  height: 360px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 50%;
  box-shadow: 0 0 0 55px rgba(255,255,255,.025), 0 0 0 110px rgba(255,255,255,.018);
  z-index: -1;
}
.brand-mark, .wordmark span {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 0 44px;
  border-radius: 14px;
  font-family: Georgia, serif;
  font-size: 25px;
  color: var(--forest);
  background: var(--cream);
}
.eyebrow { margin: 0 0 12px; font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.brand-panel h1 { margin: 0; font-family: Georgia, "Noto Serif SC", serif; font-size: clamp(40px, 5vw, 60px); font-weight: 500; letter-spacing: -.03em; }
.brand-copy { max-width: 430px; margin: 22px 0 0; color: rgba(247,251,248,.72); font-size: 16px; line-height: 1.75; }
.brand-status { margin-top: auto; padding-top: 48px; color: rgba(247,251,248,.72); font-size: 13px; }
.status-dot { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: #8bd7ad; box-shadow: 0 0 0 4px rgba(139,215,173,.12); }

.login-card { display: flex; flex-direction: column; justify-content: center; gap: 38px; padding: 72px 64px; }
.login-card h2 { margin: 0 0 8px; font-size: 30px; letter-spacing: -.03em; }
.muted { color: var(--muted); }
.login-card .muted { margin: 0; }
form { display: grid; gap: 10px; }
label { color: #3c4942; font-size: 13px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fbfcfb;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
input { height: 48px; padding: 0 14px; margin-bottom: 10px; }
textarea { min-height: 92px; padding: 13px 14px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: #6a9682; box-shadow: 0 0 0 4px rgba(87,139,114,.12); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(164,58,58,.1); }
.primary-button, .secondary-button, .ghost-button {
  border: 0;
  border-radius: 10px;
  font-weight: 750;
  transition: transform .15s, background .15s;
}
.primary-button { min-height: 50px; margin-top: 6px; color: #fff; background: var(--forest); }
.primary-button:hover:not(:disabled) { background: var(--forest-2); transform: translateY(-1px); }
.form-message { min-height: 20px; margin: 2px 0; color: var(--muted); font-size: 13px; }
.form-message.error, .event-error { color: var(--danger); }
.form-message.success { color: #28704d; }
.fine-print { margin: -16px 0 0; text-align: center; color: #89928d; font-size: 12px; }

.app-page { min-height: 100vh; background: #f5f7f4; }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100vw - 1160px) / 2)); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.88); backdrop-filter: blur(16px); }
.wordmark { display: flex; align-items: center; gap: 12px; color: var(--ink); font-weight: 800; text-decoration: none; }
.wordmark span { width: 34px; height: 34px; margin: 0; border-radius: 9px; color: #fff; background: var(--forest); font-size: 18px; }
.account-actions { display: flex; align-items: center; gap: 10px; }
.user-chip { padding: 8px 12px; border-radius: 999px; color: var(--forest); background: var(--mint); font-size: 13px; font-weight: 750; }
.ghost-button { padding: 9px 12px; color: var(--muted); background: transparent; }
.ghost-button:hover { background: #edf1ee; }
.workspace { width: min(1160px, calc(100% - 48px)); margin: 0 auto; padding: 52px 0 80px; }
.page-intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 28px; }
.page-intro h1 { margin: 0 0 8px; font-family: Georgia, "Noto Serif SC", serif; font-size: clamp(36px, 5vw, 52px); font-weight: 500; letter-spacing: -.035em; }
.page-intro p { margin-top: 0; }
.privacy-note { display: flex; align-items: center; gap: 12px; min-width: 240px; padding: 14px 16px; border: 1px solid #d6e5dc; border-radius: 12px; color: #486056; background: #f9fcfa; font-size: 12px; line-height: 1.5; }
.shield-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: #fff; background: #497960; font-weight: 800; }
.tabs { display: flex; gap: 8px; margin-top: 42px; border-bottom: 1px solid var(--line); }
.tab { padding: 14px 16px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-weight: 750; }
.tab.active { color: var(--forest); border-bottom-color: var(--forest); }
.panel { margin-top: 24px; padding: 30px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: 0 14px 40px rgba(28,54,42,.055); }
.panel-header { display: flex; justify-content: space-between; gap: 28px; }
.panel h2 { margin: 0 0 7px; font-size: 21px; }
.small { margin: 0; font-size: 13px; }
.status-controls { display: grid; grid-template-columns: auto 160px auto; align-items: center; gap: 10px; }
.status-controls label { color: var(--muted); }
.status-controls input, .status-controls select { height: 40px; padding: 0 11px; }
.secondary-button { height: 40px; padding: 0 16px; color: var(--forest); background: var(--mint); }
.secondary-button:hover:not(:disabled) { background: #c9e5d7; }
.send-header { align-items: center; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.batch-count { flex: 0 0 auto; padding: 8px 12px; border-radius: 999px; color: var(--forest); background: var(--mint); font-size: 12px; font-weight: 800; }
.send-form { display: grid; grid-template-columns: 1fr 1fr; gap: 24px 22px; padding-top: 28px; }
.field-group { display: flex; min-width: 0; flex-direction: column; gap: 8px; }
.field-group:nth-of-type(2), .field-group:nth-of-type(4), .field-group:nth-of-type(5) { grid-column: 1 / -1; }
.field-group input { margin: 0; }
.field-help { min-height: 18px; margin: 0; color: #7b8580; font-size: 11px; line-height: 1.5; }
.field-help code { padding: 1px 4px; border-radius: 4px; background: #eef2ef; }
.file-drop { display: flex; align-items: center; gap: 13px; min-height: 76px; padding: 14px 16px; border: 1px dashed #b9c9c0; border-radius: 12px; background: #fafcfb; cursor: pointer; transition: border-color .15s, background .15s; }
.file-drop:hover { border-color: #6d9782; background: #f4faf6; }
.file-drop small { color: var(--muted); font-weight: 500; }
.file-icon { display: grid; flex: 0 0 auto; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--forest); background: var(--mint); font-size: 21px; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.attachment-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.attachment-item { display: flex; justify-content: space-between; gap: 14px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
.attachment-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-size, .attachment-total { color: var(--muted); white-space: nowrap; }
.attachment-total { padding: 2px 4px; text-align: right; font-size: 11px; }
.send-notice { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 13px 15px; border: 1px solid #eadcbf; border-radius: 10px; color: #6f5b32; background: #fffaf0; }
.send-notice > span { display: grid; flex: 0 0 auto; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #fff; background: #af8a43; font-weight: 900; }
.send-notice p { margin: 0; font-size: 12px; line-height: 1.55; }
.send-form > .form-message { grid-column: 1 / -1; margin: -8px 0; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; }
.ghost-button.bordered { border: 1px solid var(--line); }
.primary-button.compact { min-width: 150px; min-height: 42px; margin: 0; padding: 0 19px; }
.send-results { margin-top: 30px; padding-top: 26px; border-top: 1px solid var(--line); }
.result-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.result-heading-row h3 { margin: 0; font-size: 17px; }
.text-button { padding: 5px; border: 0; color: #32654e; background: transparent; font-weight: 750; }
.result-list { display: grid; gap: 9px; margin-top: 14px; }
.result-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; background: #fcfdfc; }
.result-indicator { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: #fff; background: #7d8a83; font-size: 13px; font-weight: 900; }
.result-delivered .result-indicator, .result-queued .result-indicator { background: #4b8968; }
.result-failed .result-indicator, .result-permanentBounce .result-indicator { background: #b25b5b; }
.result-unknown .result-indicator { background: #aa874a; }
.result-copy { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.result-from { overflow: hidden; text-overflow: ellipsis; font-size: 13px; white-space: nowrap; }
.result-detail { color: var(--muted); font-size: 11px; }
.result-outcome { padding: 5px 8px; border-radius: 999px; color: #4d5b54; background: #edf0ee; font-size: 10px; font-weight: 800; white-space: nowrap; }
.outcome-delivered, .outcome-queued { color: #276346; background: #dff2e8; }
.outcome-failed, .outcome-permanentBounce { color: #923c3c; background: #fae7e7; }
.outcome-unknown { color: #795f28; background: #f5ecd4; }
.event-list { display: grid; gap: 12px; margin-top: 18px; }
.event-card { padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; background: #fcfdfc; }
.event-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.status-badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; color: #4c5a53; background: #edf0ee; font-size: 11px; font-weight: 800; }
.status-delivered { color: #276346; background: #dff2e8; }
.status-deliveryFailed, .status-rejected, .status-failed { color: #923c3c; background: #fae7e7; }
.status-queued, .status-processing { color: #795f28; background: #f5ecd4; }
.event-time { color: var(--muted); font-size: 12px; }
.event-subject { margin: 15px 0 8px; font-size: 16px; }
.event-addresses, .event-meta, .event-error { margin: 5px 0 0; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.event-addresses, .event-meta { color: var(--muted); }
.address-label { font-size: 9px; font-weight: 850; letter-spacing: .1em; }
.address-arrow { color: #9da7a2; }
.empty-state { display: grid; justify-items: center; padding: 64px 20px; text-align: center; border: 1px dashed #d6dfda; border-radius: 12px; }
.empty-state h3 { margin: 14px 0 4px; }
.empty-state p { max-width: 410px; margin: 0; font-size: 13px; }
.empty-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; color: #5c786a; background: #e9f0ec; font-size: 20px; }

@media (max-width: 780px) {
  .login-page { padding: 0; }
  .login-shell { min-height: 100vh; grid-template-columns: 1fr; border: 0; border-radius: 0; }
  .brand-panel { min-height: 280px; padding: 44px 32px; }
  .brand-mark { margin-bottom: 28px; }
  .brand-copy { margin-top: 14px; }
  .brand-status { display: none; }
  .login-card { padding: 46px 32px; }
  .workspace { width: min(100% - 28px, 1160px); padding-top: 34px; }
  .page-intro, .panel-header { align-items: stretch; flex-direction: column; }
  .privacy-note { min-width: 0; }
  .status-controls { grid-template-columns: 1fr 1fr; }
  .status-controls label { grid-column: 1 / -1; }
  .panel { padding: 20px; }
  .send-form { grid-template-columns: 1fr; }
  .field-group, .field-group:nth-of-type(2), .field-group:nth-of-type(4), .field-group:nth-of-type(5) { grid-column: 1; }
  .form-actions { flex-direction: column-reverse; }
  .primary-button.compact, .ghost-button.bordered { width: 100%; min-height: 44px; }
  .result-item { grid-template-columns: 30px minmax(0, 1fr); }
  .result-outcome { grid-column: 2; justify-self: start; }
  .topbar { padding: 0 16px; }
  .user-chip { display: none; }
}
