* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: #1a1a1a;
  background: #f5f5f5;
}
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.header {
  background: #1a1a1a;
  color: #fff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.domain-context {
  font-size: 0.9rem;
  opacity: 0.9;
}
.main {
  flex: 1;
  padding: 24px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}
.screen {
  animation: fade 0.2s ease;
}
@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.card {
  background: #fff;
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  max-width: 420px;
}
.card h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}
.muted {
  color: #666;
  margin: 0 0 20px;
  font-size: 0.9rem;
}
.form label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 0.9rem;
}
.form input[type="password"],
.form input[type="text"],
.form input[type="url"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  margin-bottom: 16px;
}
.form input:focus {
  outline: none;
  border-color: #1a1a1a;
  box-shadow: 0 0 0 2px rgba(26,26,26,0.15);
}
.btn {
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
}
.btn-primary {
  background: #1a1a1a;
  color: #fff;
}
.btn-primary:hover {
  background: #333;
}
.btn-ghost {
  color: #fff;
  opacity: 0.9;
}
.btn-ghost:hover {
  opacity: 1;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}
.btn-secondary {
  background: #e5e5e5;
  color: #1a1a1a;
}
.btn-secondary:hover {
  background: #d4d4d4;
}
.btn-link {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  font-weight: 500;
  cursor: pointer;
  color: #1a1a1a;
  text-decoration: none;
}
.btn-link:hover {
  text-decoration: underline;
}
.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
}
.api-key-box {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  padding: 12px;
  background: #f5f5f5;
  border-radius: 6px;
  flex-wrap: wrap;
}
.api-key-box code {
  font-size: 0.85rem;
  word-break: break-all;
  flex: 1;
  min-width: 0;
}
.table .actions {
  white-space: nowrap;
}
.action-sep {
  color: #999;
  margin: 0 4px;
}
.error {
  color: #b91c1c;
  font-size: 0.9rem;
  margin-top: 12px;
}
.loading, .empty {
  padding: 24px;
  text-align: center;
  color: #666;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.toolbar h2 {
  margin: 0;
  font-size: 1.25rem;
}
.toolbar select {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9rem;
}
.table-wrap {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  overflow: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th,
.table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #eee;
}
.table th {
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #666;
}
.table tbody tr:hover {
  background: #f9f9f9;
}
.table .status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
}
.status.sent { background: #dcfce7; color: #166534; }
.status.failed { background: #fee2e2; color: #b91c1c; }
.status.pending { background: #fef3c7; color: #92400e; }
.table .subject {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table .link {
  color: #1a1a1a;
  font-weight: 500;
}
.table .link:hover {
  text-decoration: underline;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
}
.modal-content {
  position: relative;
  background: #fff;
  border-radius: 8px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.modal-header h3 {
  margin: 0;
  font-size: 1rem;
  flex: 1;
  word-break: break-word;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #666;
  padding: 0 4px;
}
.modal-close:hover {
  color: #1a1a1a;
}
.modal-body {
  padding: 20px;
  overflow: auto;
}
.email-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 24px;
  margin: 0 0 20px;
  font-size: 0.9rem;
}
.email-meta dt { color: #666; margin: 0; }
.email-meta dd { margin: 0; }
.email-body h4 {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: #666;
}
.email-body pre {
  margin: 0;
  padding: 12px;
  background: #f5f5f5;
  border-radius: 6px;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow: auto;
}
