:root {
  --bg: #f3f6f4;
  --surface: #ffffff;
  --ink: #1a2e24;
  --muted: #5c6f66;
  --accent: #1f6f54;
  --accent-hover: #175643;
  --border: #d5e0da;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --radius: 10px;
  --shadow: 0 8px 24px rgba(26, 46, 36, 0.08);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #dceee4 0%, transparent 40%),
    radial-gradient(circle at bottom right, #e8f0ec 0%, transparent 35%),
    var(--bg);
}

.app {
  width: min(920px, 92vw);
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem 1.5rem;
}

.login-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
}

.login-card > p {
  margin: 0 0 1.25rem;
  color: var(--muted);
}

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

.header-top {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.75rem;
}

.header h1 {
  margin: 0 0 0.35rem;
  font-size: 2rem;
  letter-spacing: -0.02em;
}

.header p {
  margin: 0;
  color: var(--muted);
}

.session-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

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

@media (min-width: 700px) {
  .account-form {
    grid-template-columns: 1fr 1fr 1fr 140px auto;
    align-items: end;
  }
}

.form-section,
.list-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem 1.5rem;
  margin-bottom: 1.25rem;
}

h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
}

form {
  display: grid;
  gap: 0.85rem;
}

@media (min-width: 700px) {
  form {
    grid-template-columns: 1fr 1fr 140px auto;
    align-items: end;
  }

  .form-actions {
    grid-column: auto;
  }
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
}

input:focus,
select:focus {
  outline: 2px solid rgba(31, 111, 84, 0.35);
  border-color: var(--accent);
}

.form-actions {
  display: flex;
  gap: 0.5rem;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

button:hover {
  background: var(--accent-hover);
}

button.secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

button.secondary:hover {
  background: #f0f4f2;
}

button.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

button.danger:hover {
  background: #fde8e6;
}

button.small {
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.list-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.list-header h2 {
  margin: 0;
}

#search {
  width: min(280px, 100%);
}

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

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

th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.role-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #e8f3ee;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: capitalize;
}

.actions {
  display: flex;
  gap: 0.4rem;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
}

.page-size {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
}

.page-size select {
  width: auto;
  padding: 0.3rem 0.5rem;
}

.pager-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.page-info {
  color: var(--muted);
  font-size: 0.85rem;
  min-width: 12rem;
  text-align: center;
}

.pager button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pager button:disabled:hover {
  background: transparent;
}

.message {
  min-height: 1.25rem;
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
}

.message.error {
  color: var(--danger);
}

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

.empty {
  margin: 1rem 0 0;
  color: var(--muted);
  text-align: center;
}

.hidden {
  display: none !important;
}

@media (max-width: 640px) {
  th:nth-child(3),
  td:nth-child(3) {
    display: none;
  }
}
