* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  background: #f6f7f9;
  color: #1f2328;
  font-size: 15px;
  line-height: 1.5;
}

.app {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 8px;
}

header h1 {
  font-size: 22px;
  margin: 0;
}

.account-area {
  font-size: 13px;
  color: #59636e;
}

.account-area button {
  background: none;
  border: none;
  color: #0969da;
  cursor: pointer;
  font: inherit;
  padding: 0 0 0 8px;
}

.account-area button:hover { text-decoration: underline; }

.card {
  background: white;
  border-radius: 8px;
  border: 1px solid #d1d9e0;
  padding: 20px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 14px;
  margin: 0 0 14px;
  color: #59636e;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.welcome {
  text-align: center;
  padding: 48px 24px;
}

.welcome p { color: #59636e; margin-bottom: 24px; }

label {
  display: block;
  margin-bottom: 14px;
  font-size: 14px;
}

label.inline { display: block; margin-bottom: 10px; }
label.inline input { display: inline-block; margin-left: 6px; margin-right: 6px; width: 5em; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

input[type="text"], textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid #d1d9e0;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  background: white;
}

input[type="number"] {
  padding: 6px 8px;
  border: 1px solid #d1d9e0;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  background: white;
}

textarea {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  resize: vertical;
}

.editor-label {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.editor-wrap {
  border: 1px solid #d1d9e0;
  border-radius: 6px;
  background: white;
  overflow: hidden;
  margin-bottom: 14px;
}

.editor-wrap:focus-within {
  border-color: #0969da;
  box-shadow: 0 0 0 2px rgba(9, 105, 218, 0.15);
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  background: #f6f8fa;
  border-bottom: 1px solid #d1d9e0;
  flex-wrap: wrap;
}

.tb-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 4px 8px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  color: #1f2328;
  min-width: 28px;
  line-height: 1.4;
}

.tb-btn:hover {
  background: white;
  border-color: #d1d9e0;
}

.tb-btn.active {
  background: #ddedfc;
  border-color: #adcdf2;
}

.toolbar-sep {
  width: 1px;
  height: 18px;
  background: #d1d9e0;
  margin: 0 4px;
}

.editor {
  padding: 12px 14px;
  min-height: 220px;
  max-height: 600px;
  overflow-y: auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  outline: none;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.editor:empty::before {
  content: attr(data-placeholder);
  color: #8c959f;
  white-space: pre-wrap;
  pointer-events: none;
}

.editor a { color: #0969da; }
.editor ul, .editor ol { padding-left: 24px; margin: 8px 0; }
.editor p { margin: 0 0 8px 0; }

input:focus, textarea:focus {
  outline: none;
  border-color: #0969da;
  box-shadow: 0 0 0 2px rgba(9, 105, 218, 0.15);
}

.hint {
  font-size: 13px;
  color: #59636e;
  margin: 6px 0;
}

.hint code, p code {
  background: #eff1f3;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid #d1d9e0;
  background: #f6f8fa;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  text-decoration: none;
  color: inherit;
}

.btn:hover { background: #e7eaee; }

.btn.primary {
  background: #2e7d4f;
  color: white;
  border-color: #2e7d4f;
}

.btn.primary:hover { background: #266a42; }

.btn.small { font-size: 12px; padding: 4px 10px; }
.btn.danger { color: #a04040; }

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

.saved-indicator {
  font-size: 13px;
  color: #2e7d4f;
  opacity: 0;
  transition: opacity 0.3s;
}

.saved-indicator.show { opacity: 1; }

.lead-stats {
  display: flex;
  gap: 8px;
  margin: 16px 0 0;
  flex-wrap: wrap;
}

.stat {
  padding: 6px 12px;
  background: #f6f8fa;
  border-radius: 4px;
  font-size: 13px;
}

.stat strong { margin-left: 6px; }
.stat.sent { background: #e8f5ec; color: #1c6b3a; }
.stat.failed { background: #fbeaea; color: #b22a2a; }

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 13px;
}

th, td {
  text-align: left;
  padding: 8px 8px;
  border-bottom: 1px solid #eaecef;
  vertical-align: top;
}

th {
  color: #59636e;
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-card { background: #fffbf2; border-color: #f0d49a; }

#run-status {
  font-size: 14px;
  margin: 0 0 12px;
}

details summary {
  cursor: pointer;
  margin-top: 16px;
  font-size: 13px;
  color: #0969da;
}

.status-pending { color: #59636e; }
.status-sent { color: #1c6b3a; }
.status-failed { color: #b22a2a; }
