:root {
  --ink: #1f1f1f;
  --muted: #6b6760;
  --line: #e2ded7;
  --surface: #f4f2ee;
  --card: #ffffff;
  --accent: #e0472b;
  --accent-ink: #ffffff;
  --warn: #b5541a;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--surface);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--surface); }
a { color: inherit; }

header.top {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 10px 24px; background: var(--ink); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 18px; }
.brand img { width: 40px; height: 40px; background: #fff; border-radius: 8px; padding: 3px; }
header nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
header nav a { text-decoration: none; padding: 8px 12px; border-radius: 8px; opacity: .8; }
header nav a:hover { opacity: 1; background: rgba(255,255,255,.08); }
header nav a.on { opacity: 1; background: rgba(255,255,255,.14); }
.who { font-size: 14px; opacity: .8; }

main { max-width: 1100px; margin: 0 auto; padding: 24px 24px 64px; }
h1 { font-size: 28px; margin: 4px 0 18px; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 28px 0 8px; }
h2.alert { color: var(--accent); }
h3 { font-size: 16px; margin: 22px 0 8px; }
.muted { color: var(--muted); font-size: 14px; }
.warn { color: var(--warn); font-weight: 600; }
.error { color: var(--accent); font-weight: 600; }

.card { background: var(--card); border-radius: var(--radius); padding: 18px 20px; border: 1px solid var(--line); margin-bottom: 16px; }
.card.narrow { max-width: 520px; }
.flash { background: #fff7e0; border: 1px solid #f0d58a; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; }
.big { font-size: 18px; }
code { background: var(--surface); padding: 2px 6px; border-radius: 6px; }
code.code { font-size: 32px; letter-spacing: .15em; font-weight: 700; padding: 4px 12px; }

label { display: block; margin: 0 0 14px; font-size: 14px; font-weight: 600; }
label.check { font-weight: 400; display: flex; gap: 8px; align-items: center; }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; font: inherit; font-weight: 400;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
label.check input { width: auto; margin: 0; }
textarea { resize: vertical; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 14px; padding: 8px 12px 0; }
legend { font-size: 14px; font-weight: 600; padding: 0 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

button, .button {
  display: inline-block; padding: 10px 18px; border-radius: 8px; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; text-decoration: none;
}
button.secondary, .button.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.danger { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
button.link { background: none; color: var(--muted); padding: 0; text-decoration: underline; font-weight: 400; font-size: 14px; }
.buttons { display: flex; gap: 10px; margin-top: 8px; }
.danger-zone { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }

form.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
form.inline input, form.inline select { width: auto; min-width: 260px; margin: 0; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

table.list { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
table.list th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); }
table.list td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr.clickable { cursor: pointer; }
table.list tr.clickable:hover td { background: #faf9f6; }
table.list tr.expired td { background: #fdf0ed; }
table.list tr.inactive td { opacity: .5; }
td.actions { text-align: right; white-space: nowrap; }
td.actions form { display: inline; }
table.map td { padding: 6px 12px 6px 0; }
table.map td:first-child { font-weight: 600; white-space: nowrap; }
table.map select { margin: 0; }

@media (max-width: 700px) {
  header.top { padding: 10px 16px; gap: 10px; }
  main { padding: 16px; }
  .grid2 { grid-template-columns: 1fr; }
  form.inline input, form.inline select { min-width: 0; flex: 1; }
  table.list th:nth-child(n+3), table.list td:nth-child(4) { display: none; }
  td.actions { white-space: normal; }
}
table.list.items { table-layout: fixed; }
