:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-alt: #edf2f7;
  --text: #17212b;
  --muted: #5b6b7c;
  --primary: #0f5fa8;
  --primary-dark: #0c4b84;
  --danger: #b73838;
  --success: #2d7b46;
  --border: #d7e0e8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #edf3f8 0%, #f9fbfc 100%);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

a {
  color: var(--primary);
  text-decoration: none;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: #12314d;
  color: white;
}

.brand {
  color: white;
  font-size: 1.4rem;
  font-weight: 700;
}

.nav {
  display: flex;
  gap: 1rem;
}

.nav a {
  color: white;
}

.subtle {
  margin-top: 0.25rem;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

.hero,
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(17, 38, 58, 0.06);
}

.hero {
  margin-bottom: 1.5rem;
}

.grid {
  display: grid;
  gap: 1.5rem;
}

.grid.two {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.narrow {
  max-width: 640px;
}

.form-grid {
  display: grid;
  gap: 1rem;
}

.inline-form,
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

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

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: white;
}

button,
.button-link {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  padding: 0.8rem 1rem;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: white;
  cursor: pointer;
}

.button-link.secondary {
  background: #dfe8f1;
  color: var(--text);
}

.button-link.secondary:hover {
  background: #cedae6;
}

button:hover,
.button-link:hover {
  background: var(--primary-dark);
}

.danger-link {
  background: var(--danger);
}

fieldset {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin: 0;
}

legend {
  padding: 0 0.35rem;
  color: var(--muted);
}

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

.details dt {
  color: var(--muted);
  font-weight: 600;
}

.details dd {
  margin: 0.2rem 0 0;
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--surface-alt);
}

.list li:last-child {
  border-bottom: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

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

.flash-list {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.flash {
  padding: 0.9rem 1rem;
  border-radius: 10px;
}

.flash.success {
  background: #e6f5eb;
  color: var(--success);
}

.flash.danger {
  background: #fdecec;
  color: var(--danger);
}

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

.checkbox input {
  width: auto;
}

.checkbox-list {
  display: grid;
  gap: 0.65rem;
}

.spaced-top {
  margin-top: 1rem;
}

.pagination {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .nav {
    flex-wrap: wrap;
  }
}
