:root {
  --holcim-blue: #0057b8;
  --holcim-blue-deep: #003f8a;
  --holcim-green: #00a870;
  --holcim-green-deep: #00885a;
  --bg: #f3f9ff;
  --panel: #ffffff;
  --ink: #0f1f33;
  --muted: #3d5a80;
  --muted-light: #5a7a9a;
  --line: #dbe8f7;
  --radius-lg: 16px;
  --radius-md: 12px;
}

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

body {
  min-height: 100vh;
  font-family: "Segoe UI", "Inter", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 640px at -5% -10%, rgba(0, 87, 184, 0.14), transparent 62%),
    radial-gradient(1000px 560px at 108% 8%, rgba(0, 168, 112, 0.18), transparent 58%),
    linear-gradient(170deg, #f8fcff 0%, #edf6ff 45%, #edf9f4 100%);
  padding: 1rem;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: linear-gradient(95deg, rgba(0, 87, 184, 0.06), rgba(0, 168, 112, 0.06));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 760;
  color: var(--holcim-blue);
  font-size: 1.25rem;
  text-decoration: none;
}

.dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: linear-gradient(140deg, var(--holcim-blue), var(--holcim-green));
  box-shadow: 0 0 0 4px rgba(0, 87, 184, 0.12);
}

.nav-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.nav-links a {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 150ms ease;
}

.nav-links a:hover {
  background: rgba(0, 87, 184, 0.1);
  color: var(--holcim-blue);
}

.nav-links a.active {
  background: var(--holcim-blue);
  color: white;
  border-color: var(--holcim-blue);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.points-badge {
  background: linear-gradient(140deg, var(--holcim-green), var(--holcim-green-deep));
  color: white;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
}

.user-name {
  color: var(--ink);
  font-weight: 500;
  font-size: 0.9rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--line);
}

.section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 1rem 0;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: linear-gradient(160deg, #ffffff 0%, #fbfdff 65%, #f5fbf8 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 780;
  color: var(--holcim-blue);
  line-height: 1;
}

.stat-label {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.btn-primary {
  color: white;
  background: linear-gradient(140deg, var(--holcim-blue), var(--holcim-green));
  box-shadow: 0 6px 18px rgba(0, 87, 184, 0.24);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(0, 87, 184, 0.30);
  background: linear-gradient(140deg, var(--holcim-blue-deep), var(--holcim-green-deep));
}

.btn-secondary {
  color: #24446f;
  background: #e9f2fb;
  border: 1px solid #c3d9f2;
}

.btn-secondary:hover {
  transform: translateY(-1px);
  background: #dfedf9;
}

.btn-success {
  color: white;
  background: linear-gradient(140deg, var(--holcim-green), var(--holcim-green-deep));
}

.btn-danger {
  color: white;
  background: linear-gradient(140deg, #ef4444, #dc2626);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.form-control {
  width: 100%;
  border: 1px solid #c8dbf2;
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  background: white;
  color: var(--ink);
  outline: none;
  transition: box-shadow 140ms ease, border-color 140ms ease;
  font-family: inherit;
}

.form-control:focus {
  border-color: #7fb3f3;
  box-shadow: 0 0 0 3px rgba(0, 87, 184, 0.16);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
}

th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

tr:hover {
  background: rgba(0, 87, 184, 0.03);
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-pending {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.badge-active, .badge-approved {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.badge-disabled, .badge-cancelled {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.loading {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
}

.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.tab {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--muted);
  transition: all 150ms ease;
}

.tab.active {
  background: var(--holcim-blue);
  color: white;
  border-color: var(--holcim-blue);
}

.tab:hover:not(.active) {
  background: rgba(0, 87, 184, 0.1);
  color: var(--holcim-blue);
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 31, 51, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding: 1rem;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.reward-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.reward-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 87, 184, 0.15);
}

.reward-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: linear-gradient(160deg, #f8fcff 0%, #edf9f4 100%);
}

.reward-image-placeholder {
  width: 100%;
  height: 180px;
  background: linear-gradient(140deg, var(--holcim-blue), var(--holcim-green));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
}

.reward-content {
  padding: 1.25rem;
}

.reward-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.reward-description {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.reward-points {
  font-size: 1.5rem;
  font-weight: 780;
  color: var(--holcim-green);
  margin-bottom: 1rem;
}

.reward-points span {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}

.user-card {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 150ms ease;
}

.user-card:hover {
  border-color: var(--holcim-blue);
  transform: translateY(-2px);
}

.user-card.selected {
  border-color: var(--holcim-green);
  background: rgba(0, 168, 112, 0.05);
}

.user-avatar-medium {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 0.5rem;
  border: 2px solid var(--line);
}

.user-card-name {
  font-weight: 600;
  color: var(--ink);
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.user-card-email {
  font-size: 0.75rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-section {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem;
  background: linear-gradient(95deg, rgba(0, 87, 184, 0.06), rgba(0, 168, 112, 0.06));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--holcim-green);
}

.profile-info {
  flex: 1;
}

.profile-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.25rem;
}

.profile-email {
  color: var(--muted);
  font-size: 0.9rem;
}

.points-selector {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}

.point-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: white;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 150ms ease;
  color: var(--ink);
}

.point-btn:hover:not(:disabled) {
  border-color: var(--holcim-blue);
  transform: scale(1.1);
}

.point-btn.selected {
  background: var(--holcim-blue);
  color: white;
  border-color: var(--holcim-blue);
}

.point-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.categories-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.category-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: white;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  color: var(--ink);
}

.category-btn:hover {
  border-color: var(--holcim-blue);
  background: rgba(0, 87, 184, 0.05);
}

.category-btn.selected {
  background: var(--holcim-blue);
  color: white;
  border-color: var(--holcim-blue);
}

.category-name {
  text-transform: capitalize;
}

.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: capitalize;
}

.category-badge.creativity { background: #e0e7ff; color: #3730a3; }
.category-badge.collaboration { background: #dcfce7; color: #166534; }
.category-badge.empowerment { background: #fef3c7; color: #92400e; }
.category-badge.freedom { background: #f0fdfa; color: #0f766e; }
.category-badge.impact { background: #fee2e2; color: #991b1b; }

.quick-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.quick-reason {
  padding: 0.4rem 0.8rem;
  background: rgba(0, 87, 184, 0.08);
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 150ms ease;
  color: var(--holcim-blue);
  font-weight: 500;
}

.quick-reason:hover {
  background: var(--holcim-blue);
  color: white;
}

.hero {
  text-align: center;
  padding: 2rem;
  background: linear-gradient(140deg, rgba(0, 87, 184, 0.08), rgba(0, 168, 112, 0.08));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.hero-subtitle {
  color: var(--muted);
  margin-bottom: 1rem;
}

.hero-points {
  font-size: 3rem;
  font-weight: 780;
  color: var(--holcim-blue);
}

.hero-points-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.search-container {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-input {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  border: 1px solid #c8dbf2;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  background: white;
  color: var(--ink);
  outline: none;
  transition: box-shadow 140ms ease, border-color 140ms ease;
}

.search-input:focus {
  border-color: #7fb3f3;
  box-shadow: 0 0 0 3px rgba(0, 87, 184, 0.16);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
}

.success-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 31, 51, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 3000;
}

.success-overlay.show {
  display: flex;
}

.success-card {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  max-width: 400px;
  animation: popIn 0.3s ease;
}

@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.success-emoji {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.success-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--holcim-green);
  margin-bottom: 0.5rem;
}

.success-message {
  color: var(--muted);
}

.char-counter {
  text-align: right;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .nav-links {
    justify-content: center;
  }
  
  .nav-user {
    justify-content: center;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  table {
    font-size: 0.85rem;
  }
  
  th, td {
    padding: 0.5rem;
  }
  
  .profile-section {
    flex-direction: column;
    text-align: center;
  }
  
  .tabs {
    justify-content: center;
  }
}