:root {
  --bg: #f2f1ee;
  --surface: #ffffff;
  --ink: #111318;
  --ink-soft: #3a404c;
  --muted: #7c8491;
  --line: rgba(17, 19, 24, 0.09);
  --line-strong: rgba(17, 19, 24, 0.16);
  --magenta: #9a1a86;
  --yes: #0f4a38;
  --yes-bg: rgba(15, 74, 56, 0.08);
  --no-bg: rgba(17, 19, 24, 0.06);
  --font: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: var(--font);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

button, input, select {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
}

button { cursor: pointer; }

.hidden { display: none !important; }

/* Login */
.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(24px + var(--safe-t)) 20px calc(24px + var(--safe-b));
  background:
    radial-gradient(ellipse 70% 45% at 50% 0%, rgba(154, 26, 134, 0.08), transparent 55%),
    var(--bg);
}

.login-panel {
  width: min(100%, 400px);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 36px 28px 28px;
  box-shadow: 0 20px 50px rgba(17, 19, 24, 0.06);
}

.login-panel .brand {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.login-logos {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 18px;
  padding: 12px 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.login-logos img {
  height: 28px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
}

.login-panel h1 {
  font-family: var(--font);
  font-size: 1.45rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.login-panel .sub {
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 28px;
}

.login-panel label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.login-panel input {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  background: #fafaf8;
  margin-bottom: 14px;
  outline: none;
}

.login-panel input:focus {
  border-color: var(--magenta);
  box-shadow: 0 0 0 3px rgba(154, 26, 134, 0.1);
  background: #fff;
}

.login-panel .error {
  min-height: 1.2em;
  font-size: 0.86rem;
  color: #8b1e2d;
  margin-bottom: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: opacity 0.2s ease, background 0.2s ease;
}

.btn-primary {
  width: 100%;
  background: var(--ink);
  color: #f7f5f2;
}

.btn-primary:hover { background: #000; }

.btn-ghost {
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  background: transparent;
}

.btn-ghost:hover { background: rgba(17, 19, 24, 0.04); }

.btn-sm {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 0.78rem;
}

/* App shell */
.app {
  min-height: 100dvh;
  padding-bottom: calc(32px + var(--safe-b));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(242, 241, 238, 0.88);
  border-bottom: 1px solid var(--line);
  padding: calc(14px + var(--safe-t)) 20px 14px;
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar h1 {
  font-family: var(--font);
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.topbar .meta {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

@media (min-width: 720px) {
  .stats { grid-template-columns: repeat(5, 1fr); }
}

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: rgba(17, 19, 24, 0.04);
  border: 1px solid var(--line);
}

.tab {
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: -0.01em;
}

.tab.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(17,19,24,0.06);
}

.message-cell {
  max-width: 320px;
  white-space: normal;
  line-height: 1.4;
  color: var(--ink-soft);
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 16px 16px 14px;
}

.stat span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat strong {
  font-family: var(--font);
  font-size: 1.9rem;
  font-weight: 500;
  line-height: 1;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filters select {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  min-width: 200px;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th, td {
  text-align: left;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 0.9rem;
}

th {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  background: #fafaf8;
  position: sticky;
  top: 0;
}

tr:last-child td { border-bottom: 0; }

tr:hover td { background: rgba(17, 19, 24, 0.015); }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge.yes {
  background: var(--yes-bg);
  color: var(--yes);
}

.badge.no {
  background: rgba(180, 35, 24, 0.1);
  color: #b42318;
}

.badge.muted {
  background: rgba(17, 19, 24, 0.04);
  color: var(--muted);
}

.name-cell {
  font-weight: 600;
}

.date-cell {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.invite-cell {
  font-size: 0.85rem;
  color: var(--ink-soft);
  max-width: 220px;
}

.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}

.empty strong {
  display: block;
  font-family: var(--font);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
}

.row-actions button {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.row-actions button:hover { color: #8b1e2d; }

.links {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

.links a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  width: fit-content;
}

.links a:hover { border-bottom-color: var(--line-strong); }

.links span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
