:root {
  --purple: #4B2D8F;
  --lime: #8DC63F;
  --purple-tint: #EDE7F6;
  --lime-tint: #F1F8E9;
  --ink: #201a2e;
  --muted: #6b6577;
  --line: #e4e0ec;
  --ok: #2e7d32;
  --fail: #c62828;
  --warn: #b26a00;
}

* { box-sizing: border-box; }

body {
  font-family: 'Titillium Web', system-ui, sans-serif;
  margin: 0;
  background: var(--purple-tint);
  color: var(--ink);
}

.topbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  background: var(--purple);
  color: #fff;
}
.topbar nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.topbar a, .topbar .link {
  color: #fff;
  text-decoration: none;
  margin: 0 12px;
  font-size: 15px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.topbar a:hover, .topbar .link:hover { color: var(--lime); }
.inline { display: inline; }

.brand { font-size: 18px; }
.brand.big { font-size: 22px; margin-bottom: 8px; }
.brand strong { font-weight: 700; }
.dot {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--lime);
  margin-right: 6px;
  vertical-align: middle;
}

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

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 18px;
}
.card h2 {
  margin: 0 0 14px;
  font-size: 17px;
  color: var(--purple);
  border-bottom: 2px solid var(--lime);
  display: inline-block;
  padding-bottom: 4px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 12px 0 5px;
  color: var(--ink);
}
input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--purple);
}

.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  margin: 10px 0;
  font-size: 15px;
}
.switch input { width: auto; }

.btn {
  background: #fff;
  border: 1.5px solid var(--purple);
  color: var(--purple);
  padding: 10px 18px;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.btn:hover { background: var(--purple-tint); }
.btn.primary { background: var(--purple); color: #fff; }
.btn.primary:hover { background: #3c2374; }
.btn.full { width: 100%; margin-top: 10px; }

.test-row { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.result { font-size: 13px; color: var(--muted); }
.result.pass { color: var(--ok); font-weight: 600; }
.result.fail { color: var(--fail); font-weight: 600; }

.muted { color: var(--muted); }
.small { font-size: 12px; }

.alert { padding: 10px 14px; border-radius: 8px; font-size: 14px; margin: 0 0 14px; }
.alert.ok { background: var(--lime-tint); color: var(--ok); border: 1px solid var(--lime); }
.alert.error, .alert.fail { background: #fdecea; color: var(--fail); border: 1px solid #f5c6c0; }
.alert.warn { background: #fff6e5; color: var(--warn); border: 1px solid #ffe0a3; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-card { max-width: 360px; width: 100%; }
.login-card .brand { color: var(--purple); }

.bubble {
  background: var(--lime-tint);
  border: 1px solid var(--lime);
  border-radius: 10px;
  padding: 12px;
  max-width: 320px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.bubble-img { font-size: 12px; color: var(--muted); margin-bottom: 8px; overflow-wrap: anywhere; word-break: break-word; }
.bubble-body { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.bubble-btn {
  margin-top: 8px;
  text-align: center;
  color: var(--purple);
  border-top: 1px solid var(--line);
  padding-top: 8px;
  font-weight: 600;
  font-size: 13px;
  overflow-wrap: anywhere;
  word-break: break-word;
}


/* ---- accordions ---- */
details.acc {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 18px;
  overflow: hidden;
}
details.acc > summary {
  cursor: pointer;
  padding: 18px 20px;
  font-size: 17px;
  font-weight: 700;
  color: var(--purple);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::after {
  content: '+';
  font-size: 22px;
  line-height: 1;
  color: var(--lime);
  font-weight: 700;
}
details.acc[open] > summary::after { content: '\2212'; }
details.acc > summary:hover { background: var(--purple-tint); }
.acc-body { padding: 4px 20px 20px; }

.subhead {
  margin: 20px 0 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--purple);
  border-bottom: 2px solid var(--lime);
  display: inline-block;
  padding-bottom: 3px;
}

/* ---- message totals ---- */
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 560px) { .stats { grid-template-columns: repeat(5, 1fr); } }
.stat {
  background: var(--lime-tint);
  border: 1px solid var(--lime);
  border-radius: 10px;
  padding: 14px 8px;
  text-align: center;
}
.stat .num { font-size: 26px; font-weight: 700; color: var(--purple); line-height: 1.1; }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }


.seg-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  margin-bottom: 6px;
}
.seg-list .switch { margin: 6px 0; font-weight: 500; font-size: 14px; }
