:root {
  --mt-red: #7a1f2b;
  --mt-red-dark: #5c1620;
  --mt-navy: #1b1b3a;
  --mt-gold: #c9a24b;
  --bg: #f4f5f7;
  --card: #ffffff;
  --border: #e1e3e8;
  --text: #23242b;
  --text-muted: #6b6d78;
  --green: #1f6f4a;
  --amber: #b06a00;
  --grey: #8a8d99;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

header.top {
  background: linear-gradient(135deg, var(--mt-red), var(--mt-red-dark));
  color: #fff;
  padding: 22px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

header.top .brand {
  display: flex;
  flex-direction: column;
}

header.top .brand strong {
  font-size: 1.4rem;
  letter-spacing: 0.02em;
}

header.top .brand span {
  font-size: 0.85rem;
  opacity: 0.85;
}

header.top .case-badge {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: 600;
  font-size: 0.95rem;
  display: none;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 22px;
  box-shadow: 0 1px 2px rgba(20,20,30,0.04);
}

.card h2 {
  margin-top: 0;
  font-size: 1.1rem;
  color: var(--mt-navy);
}

.card p.hint {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: -8px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 18px;
}

.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }
.form-field.full { grid-column: 1 / -1; }

input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], select, textarea {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.92rem;
  background: #fff;
  font-family: inherit;
}
textarea { resize: vertical; }
input[readonly] { background: #f0f1f4; color: var(--text-muted); font-weight: 600; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--mt-red); outline-offset: 1px; }

.section-head {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--mt-navy);
  padding: 7px 12px;
  border-radius: 6px;
  margin: 22px 0 12px;
}

.provider-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 6px;
}
.provider-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) 1fr 1fr;
  gap: 10px;
  align-items: center;
}
.provider-row.provider-head span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.provider-row span { font-size: 0.85rem; }

.output-tiers {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.output-tiers label {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.output-tiers input { accent-color: var(--mt-red); }
.output-tiers label:has(input:checked) {
  border-color: var(--mt-red);
  background: rgba(122,31,43,0.06);
  font-weight: 600;
}

button.primary {
  background: var(--mt-red);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px 22px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
}
button.primary:hover { background: var(--mt-red-dark); }
button.primary:disabled { background: var(--grey); cursor: not-allowed; }

.error-box {
  background: #fdeceb;
  color: #8a2b20;
  border: 1px solid #f2b8b0;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-top: 10px;
  display: none;
}

#zones-section { display: none; }

.zone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.zone-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.zone-card .zone-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.zone-card h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--mt-navy);
}
.zone-card h3 .req { color: var(--mt-red); }

.zone-card .zone-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

.agent-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f4f5f7;
  border: 1px solid var(--border);
  width: fit-content;
}
.agent-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.agent-pill .agent-name { font-size: 0.78rem; font-weight: 600; }
.status-tag {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}
.status-tag.active { background: #e4f4ec; color: var(--green); }
.status-tag.building { background: #fdf1de; color: var(--amber); }
.status-tag.unassigned { background: #eceef2; color: var(--grey); }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 22px 10px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone.dragover {
  border-color: var(--mt-red);
  background: rgba(122,31,43,0.05);
  color: var(--mt-red);
}
.dropzone input[type=file] { display: none; }

.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: #f9f9fb;
  border-radius: 6px;
  font-size: 0.8rem;
}
.file-row .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.file-row .file-meta { display: flex; align-items: center; gap: 6px; }
.file-row button.remove {
  border: none;
  background: none;
  color: var(--grey);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
}
.file-row button.remove:hover { color: var(--mt-red); }

.badge {
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
}
.badge.queued { background: #e8eefc; color: #2a4fb0; }
.badge.needs_review { background: #fdf1de; color: var(--amber); }
.badge.completed { background: #e4f4ec; color: var(--green); }
.badge.error { background: #fdeceb; color: #8a2b20; }
.badge.no_agent { background: #eceef2; color: var(--grey); }
.badge.processing { background: #e8eefc; color: #2a4fb0; }

footer.foot {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 20px;
}
