* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: #f5f5f7; color: #222; }

.app-header {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: #1b1d22; color: #fff;
  border-bottom: 1px solid #000;
}
.app-header h1 { margin: 0; font-size: 1.1rem; letter-spacing: 0.02em; }
.header-sub { font-size: 0.8rem; color: #aaa; }
#env-badge { background: #3b4252; padding: 2px 6px; border-radius: 3px; }
.header-auth { margin-left: auto; display: flex; gap: 0.5rem; align-items: center; font-size: 0.85rem; }
.header-auth input { font-size: 0.85rem; padding: 3px 6px; border-radius: 3px; border: 1px solid #444; background: #2b2e35; color: #fff; }
.header-auth button { font-size: 0.85rem; padding: 3px 10px; }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  padding: 1rem;
  min-height: calc(100vh - 54px);
}

.pane {
  background: #fff;
  border: 1px solid #e0e0e4;
  border-radius: 6px;
  display: flex; flex-direction: column;
}
.pane-header {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid #eee;
  display: flex; align-items: center; justify-content: space-between;
}
.pane-header h2 { margin: 0; font-size: 0.95rem; font-weight: 600; }
.pane-actions { display: flex; gap: 0.4rem; }
.pane-body { padding: 0.9rem; display: flex; flex-direction: column; gap: 0.7rem; flex: 1; }

label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.8rem; color: #555; }
label code { background: #f0f0f3; padding: 1px 4px; border-radius: 2px; font-size: 0.75rem; color: #a0377a; }

input[type="text"], input[type="email"], input[type="password"], input[type="datetime-local"], textarea, select {
  font-family: inherit;
  font-size: 0.88rem;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: #222;
}
textarea { font-family: "SF Mono", Menlo, monospace; font-size: 0.8rem; resize: vertical; }

button {
  font-size: 0.85rem;
  padding: 5px 12px;
  border: 1px solid #333;
  border-radius: 4px;
  background: #333; color: #fff;
  cursor: pointer;
}
button:hover { background: #555; }
button.secondary { background: #eee; color: #222; border-color: #ccc; }

.row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

.fieldmap { font-size: 0.8rem; }
.fieldmap .tag { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 6px; border-radius: 3px; font-family: "SF Mono", Menlo, monospace; font-size: 0.75rem; }
.fieldmap .tag.ok { background: #dff7e1; color: #195e25; }
.fieldmap .tag.missing { background: #fddede; color: #a03131; }

iframe#template-preview {
  width: 100%;
  min-height: 260px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
}

.summary { font-size: 0.82rem; color: #333; }

table#sends-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
table#sends-table th, table#sends-table td {
  text-align: left;
  padding: 5px 8px;
  border-bottom: 1px solid #eee;
}
.status-chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-chip.pending   { background: #e8eaff; color: #3a3faa; }
.status-chip.running   { background: #fff6cc; color: #7d5e00; }
.status-chip.completed { background: #dff7e1; color: #195e25; }
.status-chip.failed    { background: #fddede; color: #a03131; }
.status-chip.cancelled { background: #eee;    color: #555; }

.muted { color: #888; font-size: 0.78rem; }
h3 { margin: 0.5rem 0 0.25rem 0; font-size: 0.85rem; font-weight: 600; color: #555; }

@media (max-width: 1100px) {
  .grid { grid-template-columns: 1fr; }
}
