:root {
  --brand: #6a1b9a;
  --brand-dark: #4a148c;
  --bg: #f4f2f8;
  --card: #ffffff;
  --text: #2a2233;
  --muted: #6b6577;
  --border: #ddd7e6;
  --error: #c62828;
  --ok: #2e7d32;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

.app-header {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  padding: 22px 16px;
  text-align: center;
}
.app-header h1 { margin: 0; font-size: 1.6rem; letter-spacing: .5px; }
.app-header p { margin: 4px 0 0; opacity: .9; font-size: .95rem; }

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 18px 14px 60px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 6px 20px rgba(74, 20, 140, .06);
}

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: .88rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.field .req { color: var(--error); }

input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(106, 27, 154, .12);
}
textarea { resize: vertical; min-height: 70px; }
.invalid input, .invalid select { border-color: var(--error); }
.err-text { color: var(--error); font-size: .8rem; margin-top: 4px; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .row-2 { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary { background: var(--brand); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: #efeaf5; color: var(--brand-dark); }
.btn-danger { background: #fdecea; color: var(--error); padding: 7px 12px; font-size: .85rem; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #323232;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: .95rem;
  z-index: 50;
  max-width: 90vw;
}
.toast.ok { background: var(--ok); }
.toast.bad { background: var(--error); }

.thanks { text-align: center; padding: 40px 10px; }
.thanks .tick {
  width: 72px; height: 72px; line-height: 72px;
  border-radius: 50%; background: #e8f5e9; color: var(--ok);
  font-size: 2.4rem; margin: 0 auto 16px;
}
.thanks h2 { margin: 0 0 6px; }
.thanks p { color: var(--muted); margin: 0 0 22px; }

/* admin */
.admin-bar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters input { width: auto; flex: 1 1 160px; }
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: #f3eff8; color: var(--brand-dark); position: sticky; top: 0; }
tr:last-child td { border-bottom: none; }
.muted { color: var(--muted); }
.qr-panel { text-align: center; margin-top: 18px; }
.qr-panel img { width: 200px; height: 200px; border: 1px solid var(--border); border-radius: 10px; background:#fff; }
.link-line { display: flex; gap: 8px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.link-line code { background: #efeaf5; padding: 6px 10px; border-radius: 6px; font-size: .85rem; }
.hidden { display: none !important; }
