:root {
  --cream: #F4FDE9;
  --green: #4CAF50;
  --green-dark: #388E3C;
  --green-light: #E8F5E9;
  --brown: #3E2F27;
  --brown-light: #5C3D2E;
  --white: #ffffff;
  --gray-100: #f5f5f5;
  --gray-200: #eeeeee;
  --gray-400: #bdbdbd;
  --gray-600: #757575;
  --red: #e53935;
  --yellow: #FFA726;
  --shadow: 0 2px 12px rgba(76, 175, 80, 0.10);
  --radius: 16px;
  --radius-sm: 10px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--cream);
  color: var(--brown);
  min-height: 100vh;
  line-height: 1.5;
}

.container { max-width: 900px; margin: 0 auto; padding: 24px 16px; }

/* ---- NAV ---- */
.nav {
  background: var(--white);
  box-shadow: var(--shadow);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  font-size: 20px;
  font-weight: 800;
  color: var(--green-dark);
  text-decoration: none;
}
.nav-brand span { color: var(--brown); }
.nav-links { display: flex; gap: 12px; align-items: center; }
.nav-links a {
  color: var(--brown);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: background .2s;
}
.nav-links a:hover { background: var(--green-light); }

/* ---- CARDS ---- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--brown);
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--green);
  color: var(--white);
}
.btn-primary:hover { background: var(--green-dark); }
.btn-outline {
  background: transparent;
  color: var(--green-dark);
  border: 2px solid var(--green);
}
.btn-outline:hover { background: var(--green-light); }
.btn-danger {
  background: transparent;
  color: var(--red);
  border: 2px solid var(--red);
}
.btn-danger:hover { background: #fbe9e7; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--brown-light);
  margin-bottom: 4px;
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--brown);
  transition: border .2s;
  background: var(--white);
}
.form-input:focus { outline: none; border-color: var(--green); }

/* ---- TABLE ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
  font-size: 14px;
}
th {
  font-weight: 700;
  color: var(--brown-light);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ---- BADGE ---- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}
.badge-green { background: var(--green-light); color: var(--green-dark); }
.badge-yellow { background: #FFF3E0; color: #E65100; }
.badge-red { background: #FFEBEE; color: var(--red); }

/* ---- INVITE CODE ---- */
.invite-code {
  font-family: 'Courier New', monospace;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 6px;
  color: var(--green-dark);
  background: var(--green-light);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  text-align: center;
  user-select: all;
}

/* ---- PROGRESS BAR ---- */
.progress-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .4s ease;
}
.progress-fill.green { background: var(--green); }
.progress-fill.yellow { background: var(--yellow); }
.progress-fill.red { background: var(--red); }

/* ---- STATS GRID ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--green-light);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}
.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--green-dark);
}
.stat-label {
  font-size: 12px;
  color: var(--brown-light);
  margin-top: 4px;
}

/* ---- MODAL ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  justify-content: center;
  align-items: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  width: 90%;
  max-width: 440px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--brown);
}

/* ---- SPINNER ---- */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin: 24px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- LOGIN PAGE ---- */
.login-wrapper {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(76,175,80,0.12);
  padding: 40px 32px;
  width: 90%;
  max-width: 400px;
  text-align: center;
}
.login-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--green-dark);
  margin-bottom: 6px;
}
.login-subtitle {
  font-size: 14px;
  color: var(--gray-600);
  margin-bottom: 28px;
}

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-600);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-text { font-size: 15px; }

/* ---- QR CODE ---- */
.qr-container { text-align: center; margin: 16px 0; }

/* ---- RESPONSIVE ---- */
@media (max-width: 600px) {
  .container { padding: 16px 10px; }
  .card { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .nav { padding: 12px 16px; }
}
