:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --ink: #112133;
  --muted: #4a5a6a;
  --accent: #0f8a70;
  --accent-dark: #0b6e59;
  --danger: #c0392b;
  --border: #d7e0e8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 10% 10%, #eef7f5 0%, var(--bg) 45%);
  color: var(--ink);
}

.container {
  width: min(1050px, 94vw);
  margin: 0 auto;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.row {
  display: flex;
  gap: 0.8rem;
}

.between {
  justify-content: space-between;
}

.center-v {
  align-items: center;
}

.gap {
  gap: 0.8rem;
}

.inline-form {
  display: inline-flex;
  align-items: center;
}

.brand {
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  padding: 1rem 0;
}

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

.nav a {
  text-decoration: none;
  color: var(--muted);
}

.main {
  padding: 1rem 0 1.5rem;
}

.flash {
  background: #e9f8f3;
  color: #0a5e4c;
  border: 1px solid #bbe9dc;
  border-radius: 10px;
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 8px 20px rgba(17, 33, 51, 0.04);
}

.card.small {
  width: min(420px, 100%);
  margin: 2rem auto;
}

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

.stack {
  display: grid;
  gap: 0.8rem;
}

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

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

input,
textarea,
select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
}

button,
.button {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  text-decoration: none;
  cursor: pointer;
  display: inline-block;
}

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

.button-secondary {
  background: #8ea1b3;
}

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

.button-small {
  padding: 0.35rem 0.6rem;
  font-size: 0.9rem;
}

.button-link {
  background: transparent;
  color: var(--muted);
  padding: 0.25rem 0.4rem;
}

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

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

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

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

@media (max-width: 760px) {
  .brand {
    padding: 0.6rem 0;
  }

  .topbar {
    position: static;
  }

  .topbar-inner {
    flex-wrap: wrap;
    padding: 0.5rem 0;
    min-height: auto;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.6rem;
  }

  .nav {
    gap: 0.55rem;
    flex-wrap: wrap;
    align-items: flex-start;
    font-size: 0.95rem;
  }

  h1 {
    font-size: 1.35rem;
    margin: 0.4rem 0 0.8rem;
  }

  h2 {
    font-size: 1.05rem;
  }

  .card {
    padding: 0.85rem;
  }

  .row {
    flex-direction: column;
    align-items: stretch;
  }

  .main .card button,
  .main .card .button {
    width: 100%;
    text-align: center;
  }

  .main .card .button-link {
    width: auto;
  }

  table.responsive thead {
    display: none;
  }

  table.responsive,
  table.responsive tbody,
  table.responsive tr,
  table.responsive td {
    display: block;
    width: 100%;
  }

  table.responsive tr {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.55rem;
    margin-bottom: 0.6rem;
    background: #fff;
  }

  table.responsive td {
    border: none;
    padding: 0.35rem 0.15rem;
  }

  table.responsive td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    margin-bottom: 0.15rem;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .actions .inline-form {
    display: block;
  }
}
