:root {
  --ink: #17212b;
  --muted: #5c6875;
  --line: #e2e5e9;
  --bg: #f6f5f2;
  --card: #ffffff;
  --brand: #d9512c;
  --brand-dark: #b23d1d;
  --teal: #2c7a89;
  --green: #2f7d57;
  --yellow: #e9ab1f;
  --purple: #7d3c6e;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--teal); }
a:hover { color: var(--brand-dark); }
h1 { font-size: 1.7rem; line-height: 1.25; margin: 0 0 1rem; }
h2 { font-size: 1.2rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .4rem; }
p { margin: 0 0 1rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* Header */
.stripe {
  height: 5px;
  background: linear-gradient(90deg, var(--purple) 0 20%, var(--brand) 20% 40%,
    var(--yellow) 40% 60%, var(--green) 60% 80%, var(--teal) 80% 100%);
}
.topbar { background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: .75rem 1rem;
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.wordmark { font-weight: 800; letter-spacing: -.01em; color: var(--ink); text-decoration: none; line-height: 1.1; }
.wordmark span { display: block; font-size: .7rem; font-weight: 500; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.nav a {
  padding: .4rem .7rem; border-radius: 999px; text-decoration: none; color: var(--ink); font-size: .95rem;
}
.nav a:hover { background: var(--bg); }
.nav a.active { background: var(--ink); color: #fff; }
.nav .divider { width: 1px; background: var(--line); margin: .3rem .4rem; }
.tools { display: flex; align-items: center; gap: .75rem; font-size: .875rem; }
.tools form { display: inline; }
.linkbutton {
  background: none; border: 0; padding: 0; font: inherit; color: var(--teal); cursor: pointer; text-decoration: underline;
}
.lang button { font-weight: 400; color: var(--muted); text-decoration: none; }
.lang button.current { font-weight: 700; color: var(--ink); }

main { max-width: 1120px; margin: 0 auto; padding: 2rem 1rem 4rem; }
main.narrow { max-width: 760px; }
footer { max-width: 1120px; margin: 0 auto; padding: 0 1rem 2rem; color: var(--muted); font-size: .875rem; }

/* Building blocks */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; margin-bottom: 1.25rem;
}
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.head h1 { margin: 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

.button {
  display: inline-block; padding: .55rem 1.1rem; border-radius: 999px; border: 1px solid var(--brand);
  background: var(--brand); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.button:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.button.secondary { background: var(--card); color: var(--ink); border-color: #c9ced4; }
.button.secondary:hover { background: var(--bg); color: var(--ink); }
.button.danger { background: var(--card); color: #a12a2a; border-color: #e0b4b4; }
.button.danger:hover { background: #fbeeee; }
.button.small { padding: .3rem .8rem; font-size: .875rem; }

.badge { display: inline-block; padding: .1rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: #eceff2; color: var(--muted); white-space: nowrap; }
.badge.ok { background: #dff1e7; color: var(--green); }
.badge.warn { background: #fcefcf; color: #8a6100; }
.badge.info { background: #dcedf0; color: var(--teal); }

.messages { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.messages li { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: .5rem; background: #dcedf0; }
.messages li.success { background: #dff1e7; }
.messages li.error { background: #fbe3e3; }
.messages li.warning { background: #fcefcf; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .5rem .6rem; border-bottom: 2px solid var(--line); }
td { padding: .65rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.center, th.center { text-align: center; }
.thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--bg); display: block; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }

/* Forms */
.field { margin-bottom: 1.25rem; }
.field > label, .field > .label { display: block; font-weight: 600; margin-bottom: .3rem; }
.field .help { color: var(--muted); font-size: .875rem; margin-top: .3rem; }
.field .errorlist, .errorlist.nonfield { list-style: none; padding: 0; margin: .3rem 0 0; color: #a12a2a; font-size: .9rem; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=date],
input[type=datetime-local], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid #c9ced4; border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
textarea { resize: vertical; }
.field.check { display: flex; gap: .6rem; align-items: flex-start; }
.field.check input { margin-top: .3rem; }
.field.check label { font-weight: 400; margin: 0; }
/* Radio and checkbox groups as rendered by Django */
.field div[id^=id_] > div { margin-bottom: .35rem; }
.field div[id^=id_] label { font-weight: 400; }
.field div[id^=id_] input { margin-right: .5rem; }
.options div[id^=id_] > div label {
  display: block; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.options div[id^=id_] > div label:has(input:checked) { border-color: var(--teal); background: #eef6f7; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters input, .filters select { width: auto; flex: 1 1 180px; }
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: flex-end; margin-top: 1.5rem; }

/* Entry form steps */
.steps { list-style: none; display: flex; gap: .5rem; padding: 0; margin: 0 0 1.5rem; flex-wrap: wrap; counter-reset: step; }
.steps li { counter-increment: step; }
.steps a, .steps span {
  display: flex; align-items: center; gap: .5rem; padding: .4rem .9rem .4rem .45rem; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-size: .9rem;
}
.steps a::before, .steps span::before {
  content: counter(step); width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--bg);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem;
}
.steps .current { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.steps .current::before { background: var(--ink); color: #fff; }

/* Entry detail */
dl.facts { margin: 0; }
dl.facts dt { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-top: 1rem; }
dl.facts dt:first-child { margin-top: 0; }
dl.facts dd { margin: .15rem 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.images { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .4rem; }
.images img { height: 130px; border-radius: 8px; display: block; }
.filelist { list-style: none; padding: 0; margin: .3rem 0 0; }
.filelist li { display: flex; gap: .75rem; align-items: center; padding: .25rem 0; }
.filelist form { display: inline; }
.todo { margin: 0; padding-left: 1.2rem; }

/* Jury */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.cards .card { margin: 0; }
.progress { height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; margin: .6rem 0; }
.progress div { height: 100%; background: var(--teal); }
.criterion { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.criterion:first-of-type { padding-top: 0; }
.criterion .label { font-weight: 600; }
.scale div[id^=id_] { display: flex; gap: .4rem; margin-top: .5rem; }
.scale div[id^=id_] > div { margin: 0; }
.scale label {
  display: inline-flex; width: 2.6rem; height: 2.6rem; align-items: center; justify-content: center;
  border: 1px solid #c9ced4; border-radius: 50%; cursor: pointer; font-weight: 600; position: relative;
}
.scale input { position: absolute; opacity: 0; }
.scale label:has(input:checked) { background: var(--teal); border-color: var(--teal); color: #fff; }
.scale label:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }
.sticky { position: sticky; top: 1rem; }

/* Landing */
.hero { padding: 1.5rem 0 .5rem; }
.hero h1 { font-size: 2.3rem; letter-spacing: -.02em; max-width: 18ch; }
.hero .lead { font-size: 1.15rem; max-width: 60ch; }
.deadline { font-weight: 600; }
