:root {
  font-family: Inter, Segoe UI, Arial, sans-serif;
  color: #1f2937;
  background: #f6f8f7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

a {
  color: #1d6e42;
}

main.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
}

.header {
  background: linear-gradient(135deg, #0f5c33 0%, #1d6e42 55%, #238651 100%);
  color: #fff;
  border-radius: 12px;
  border: 1px solid #17653c;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  box-shadow: 0 10px 24px rgba(20, 80, 48, 0.2);
  position: relative;
  overflow: hidden;
}

.header::before {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -120px;
  top: -110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}

.header-main,
.header-side {
  position: relative;
  z-index: 1;
}

.header h1 {
  margin: 0;
  font-size: clamp(1.9rem, 2.5vw, 2.9rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.header-eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(228, 255, 238, 0.9);
}

.header-subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: rgba(225, 255, 235, 0.86);
}

.header-meta {
  font-size: 0.9rem;
}

.logout-form {
  margin: 0;
}

.header-side {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border-radius: 999px;
  padding: 0.36rem 0.58rem 0.36rem 0.38rem;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  min-width: 0;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.77rem;
  font-weight: 700;
  color: #145c37;
  background: #def8e8;
}

.user-chip-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.user-name {
  color: #f8fffb;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}

.user-mail {
  color: rgba(224, 255, 236, 0.8);
  font-size: 0.74rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.user-role {
  color: rgba(210, 255, 229, 0.92);
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.logout-btn {
  background: rgba(11, 55, 30, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(2px);
}

.logout-btn:hover {
  background: rgba(7, 44, 23, 0.5);
}

.grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.card {
  background: #fff;
  border: 1px solid #dbe3de;
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.list-card {
  gap: 0.75rem;
}

input,
select,
textarea,
button {
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font: inherit;
}

textarea {
  min-height: 90px;
}

button {
  background: #1d6e42;
  color: #fff;
  border: 0;
  cursor: pointer;
}

button.secondary,
.btn-link.secondary {
  background: #f3f4f6;
  color: #1f2937;
  border: 1px solid #d1d5db;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  background: #1d6e42;
  color: #fff;
  border: 1px solid transparent;
}

.inline-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar h2,
.toolbar h3 {
  margin: 0;
}

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 0.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  border-bottom: 1px solid #e5e7eb;
  padding: 0.45rem;
  text-align: left;
  vertical-align: top;
}

.table-actions {
  justify-content: flex-start;
}

.audit-panel {
  margin-top: 0.5rem;
  border-top: 1px solid #e5e7eb;
  padding-top: 0.75rem;
}

.audit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.audit-list li {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 0.55rem;
  background: #fafafa;
}

.audit-list pre {
  margin: 0.35rem 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.82rem;
}

.admin-users-card {
  grid-column: 1 / -1;
  border-top: 3px solid #1d6e42;
}

.users-form {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(180px, 1.4fr) minmax(170px, 1.2fr) minmax(130px, 1fr) auto auto;
  gap: 0.5rem;
  align-items: center;
}

.users-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #374151;
  font-size: 0.9rem;
  white-space: nowrap;
}

.users-checkbox input {
  margin: 0;
  width: 16px;
  height: 16px;
}

.users-table th,
.users-table td {
  white-space: nowrap;
}

button.danger {
  background: #b42318;
}

button.danger:hover {
  background: #8f1b12;
}

.ok {
  color: #1d6e42;
}

.error {
  color: #b91c1c;
}

.muted {
  color: #6b7280;
  font-size: 0.9rem;
}

@media (max-width: 1200px) {
  .filters {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .users-form {
    grid-template-columns: 1fr;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .header-side {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .user-chip {
    flex: 1;
    min-width: 200px;
  }
}
