:root {
  --accent: #14b8c6;
  --accent-dark: #0d8f9c;
  --accent-tint: #e3f7f9;
  --header-bg: #0d545e;
  --bg: #f4f7f8;
  --card: #ffffff;
  --text: #182225;
  --muted: #64767b;
  --border: #dde5e7;
  --heading-font: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

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

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
}

h1, h2 { font-family: var(--heading-font); font-weight: 800; }
h1 { margin: 4px 0 0; font-size: 1.6rem; }
.muted { color: var(--muted); margin: 4px 0 0; font-size: 0.92rem; }
.page-updated { margin-bottom: 28px; }

.header-actions { display: flex; align-items: center; gap: 14px; }

button.primary, .login-card button, a.refresh-link {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button.primary:hover, .login-card button:hover, a.refresh-link:hover { background: var(--accent-dark); }

.logout-link, .back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}
.logout-link:hover, .back-link:hover { color: var(--text); }
.back-link { display: inline-block; margin-bottom: 6px; }

.site-header { background: var(--header-bg); }
.site-header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { display: block; }
.brand span { font: 800 20px/1 Montserrat, Helvetica, sans-serif; letter-spacing: .03em; color: #fff; }
.site-header .logout-link { color: rgba(255, 255, 255, 0.65); }
.site-header .logout-link:hover { color: #fff; }

.event-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.event-row {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 20px;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.event-row:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.08); transform: translateY(-1px); }
.event-row h2 { font-size: 1.05rem; margin: 0; flex: 1 1 220px; }
.event-row .entries { font-weight: 600; color: var(--accent-dark); margin: 0; flex: 0 0 auto; }
.event-row .categories { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 auto; justify-content: flex-end; }

.tag {
  display: inline-block;
  background: var(--accent-tint);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.78rem;
  margin: 0 6px 6px 0;
}

.empty-state { color: var(--muted); padding: 40px 0; text-align: center; }

.dupr-badge {
  display: inline-block;
  min-width: 34px;
  text-align: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
}
.dupr-grey   { background: #9aa39d; }
.dupr-red    { background: #c94c3f; }
.dupr-orange { background: #d9822b; }
.dupr-blue   { background: #2f6fb3; }
.dupr-green  { background: #2f9e5c; }
.dupr-yellow { background: #cfa221; }
.dupr-other-event { box-shadow: 0 0 0 2px #d9822b; }

.extras-section { margin-top: 40px; }
.extras-section > h2 { font-size: 1.2rem; margin-bottom: 4px; }
.extras-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.extras-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.extras-card h3 { font-size: 0.95rem; margin: 0 0 8px; color: var(--accent-dark); }
.extras-card ul { margin: 0; padding-left: 18px; font-size: 0.88rem; }
.extras-card li { margin-bottom: 4px; }

.category-section { margin-bottom: 32px; }
.category-section h2 { font-size: 1.1rem; margin-bottom: 10px; }

.category-table-section { margin-bottom: 32px; }
.category-table-section h2 { font-size: 1.1rem; margin-bottom: 10px; }
.category-matrix th, .category-matrix td { text-align: center; white-space: normal; }
.category-matrix thead th:first-child, .category-matrix tbody th { text-align: left; }
.category-matrix tbody th { background: var(--accent-tint); font-weight: 600; color: var(--accent-dark); }
.category-matrix .col-total { font-weight: 600; }
.category-matrix tfoot th { background: var(--accent-tint); color: var(--accent-dark); }

.table-wrap {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--accent-tint); font-weight: 600; color: var(--accent-dark); }
tr:last-child td { border-bottom: none; }

.loading-overlay {
  padding: 120px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}
.spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  animation: dink-spin 0.8s linear infinite;
}
@keyframes dink-spin {
  to { transform: rotate(360deg); }
}
.noscript-warning { padding: 40px; text-align: center; color: var(--muted); }

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 4px;
  margin-right: 18px;
  font-size: 0.92rem;
  color: var(--muted);
  cursor: pointer;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent-dark); border-bottom-color: var(--accent); font-weight: 600; }
.tab-warning-dot {
  display: inline-block;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  border-radius: 50%;
  background: #c94c3f;
  color: #fff;
  font-size: 0.7rem;
  text-align: center;
  margin-left: 4px;
}

.warning-banner {
  background: #fbe9e7;
  color: #8a3226;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 0.88rem;
}
.unmatched-row { background: #fdf3f1; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-card h1 { font-size: 1.3rem; margin: 0; }
.login-card .subtitle { margin: 0; color: var(--muted); font-size: 0.9rem; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; color: var(--muted); }
.login-card input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
}
.login-card .error { color: #b3261e; font-size: 0.88rem; margin: 0; }

.flash-wrap { max-width: 960px; margin: 16px auto 0; padding: 0 20px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 10px; font-size: 0.88rem; }
.flash-success { background: var(--accent-tint); color: var(--accent-dark); }
.flash-error { background: #fbe9e7; color: #b3261e; }
