:root {
  --bg: #f5f2e8;
  --card: #fffdf6;
  --ink: #242018;
  --accent: #c53f14;
  --accent-2: #0d847b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 0% 0%, #fff8dd 0, var(--bg) 55%);
  color: var(--ink);
}

.container {
  width: min(960px, 92vw);
  margin: 2rem auto 3rem;
}

h1 {
  margin: 0 0 1rem;
  letter-spacing: 0.03em;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.topbar h1 {
  margin: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.locale-switch {
  display: inline-flex;
  border: 1px solid #d4ccb8;
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
}

.locale-btn {
  background: transparent;
  color: var(--ink);
  border-radius: 0;
  border: none;
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
}

.locale-btn + .locale-btn {
  border-left: 1px solid #e7dfcf;
}

.locale-btn.is-active {
  background: var(--accent-2);
  color: #fff;
}

.profile-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.secondary-btn {
  background: var(--accent-2);
}

.card {
  background: var(--card);
  border: 2px solid #e7dfcf;
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
}

form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
}

input, select, button {
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid #d4ccb8;
  font-size: 0.95rem;
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  font-weight: 700;
  cursor: pointer;
}

button:hover { opacity: 0.92; }

.hidden { display: none; }

.hint {
  margin: 0.5rem 0 0;
  color: #6d6659;
  font-size: 0.85rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 42px;
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

.admin-results {
  margin-top: 0.9rem;
  padding: 0.85rem;
  border: 1px solid #d4ccb8;
  border-radius: 8px;
  background: #fff;
  white-space: pre-wrap;
  line-height: 1.45;
}

.badge-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.badge-category + .badge-category {
  margin-top: 1rem;
}

.badge-category-title {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6d6659;
}

.badge-category-empty {
  margin: 0;
  color: #7b7468;
  font-size: 0.9rem;
}

.badge {
  border: 1px dashed #c9baa2;
  border-radius: 8px;
  padding: 0.5rem;
  width: 220px;
  max-width: 220px;
  text-align: center;
  background: #fff;
}

.badge img {
  width: 48px;
  height: 48px;
  display: block;
  margin: 0 auto 0.35rem;
}

.badge-title {
  font-weight: 600;
}

.badge-description {
  margin-top: 0.35rem;
  font-size: 0.82rem;
  line-height: 1.3;
  color: #5a5246;
}

.groups-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.6rem 0 0.8rem;
}

.groups-table th,
.groups-table td {
  border-bottom: 1px solid #e7dfcf;
  padding: 0.45rem 0.5rem;
  text-align: left;
}

.groups-table th:last-child,
.groups-table td:last-child {
  text-align: right;
}

.activity-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.6rem 0 0.8rem;
}

.activity-table th,
.activity-table td {
  border-bottom: 1px solid #e7dfcf;
  padding: 0.45rem 0.5rem;
  text-align: left;
}

.activity-table th:last-child,
.activity-table td:last-child {
  text-align: right;
}

.groups-table td:last-child button,
.activity-table td:last-child button {
  width: 40px;
  padding-left: 0;
  padding-right: 0;
  text-align: center;
}

.action-buttons {
  display: inline-flex;
  gap: 0.35rem;
}

.group-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-2);
  text-decoration: underline;
  font-weight: 700;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 20;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(640px, 100%);
  max-height: 80vh;
  overflow: auto;
  background: var(--card);
  border: 2px solid #e7dfcf;
  border-radius: 10px;
  padding: 0.9rem;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.modal-actions {
  display: flex;
  gap: 0.4rem;
}

@media (max-width: 700px) {
  .topbar {
    align-items: flex-start;
  }

  .topbar-actions {
    flex-direction: column;
    align-items: flex-end;
  }
}
