:root {
  --bg: #f5efe4;
  --ink: #1f1b16;
  --paper: #fffaf2;
  --line: #d9ccb8;
  --accent: #0a6c74;
  --accent-strong: #07464b;
  --muted: #746b61;
  --success: #d9f0dc;
  --error: #f7d8d2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top right, rgba(10, 108, 116, 0.12), transparent 30%),
    linear-gradient(180deg, #efe6d9 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
}

a {
  color: var(--accent-strong);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 242, 0.85);
  backdrop-filter: blur(10px);
}

.topbar nav {
  display: inline-flex;
  gap: 1rem;
  margin-left: 1.5rem;
}

.brand {
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: bold;
}

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

.page-head,
.row.between {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
}

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

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

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

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

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem;
  box-shadow: 0 12px 30px rgba(31, 27, 22, 0.06);
}

.narrow {
  max-width: 420px;
  margin: 4rem auto;
}

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

label,
.actions {
  display: grid;
  gap: 0.35rem;
}

.full {
  grid-column: 1 / -1;
}

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

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

input,
textarea,
select {
  width: 100%;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fffdf8;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1rem;
  border-radius: 999px;
  border: 0;
  background: var(--accent);
  color: white;
  text-decoration: none;
  cursor: pointer;
}

button.ghost {
  background: transparent;
  color: var(--accent-strong);
  border: 1px solid var(--line);
}

.badge {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: #e5f4f5;
  color: var(--accent-strong);
}

.badge.muted {
  background: #ece7df;
  color: var(--muted);
}

.metric {
  font-size: 2rem;
  margin: 0;
}

.flash {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
}

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

.flash.error {
  background: var(--error);
}

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

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

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

.rule-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

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

.help-text {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.qr-code {
  width: 220px;
  max-width: 100%;
  padding: 0.75rem;
  background: white;
  border-radius: 16px;
  border: 1px solid var(--line);
}

.active-view {
  background: var(--accent-strong);
}

button.danger {
  color: #8b1e1e;
  border-color: #d9b0b0;
}

@media (max-width: 720px) {
  .page-head,
  .row.between,
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar nav {
    margin-left: 0;
    margin-top: 0.75rem;
    flex-wrap: wrap;
  }
}
