/*
 * The Vetti dashboard (D-51). The Django admin, restyled to match the public
 * counter: a cobalt frame, a paper workspace, and dot-matrix type only where a
 * number or a name must be read at a glance. One colour scheme on purpose.
 *
 * Signature: the draw board's dot-matrix countdown to the next draw.
 */

:root {
  --cobalt: #1b2fd0;
  --cobalt-deep: #1424a8;
  --night: #0b1150;
  --paper: #f4f6ff;
  --card: #ffffff;
  --lemon: #f3e648;
  --lemon-deep: #e2d223;
  --mist: #9ea8f5;
  --ink-quiet: #4a5190;
  --line: #dde1fa;
  --line-strong: #c3c9f3;
  --mint: #12a36b;
  --mint-soft: #d9f5e9;
  --coral: #e2412c;
  --coral-soft: #ffe4df;
  --lemon-soft: #fbf6c2;

  --display: "Doto", ui-monospace, monospace;
  --body: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Martian Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --radius: 10px;
  --gutter: clamp(16px, 3vw, 40px);

  /* The admin's own variables, retuned. */
  --primary: var(--cobalt);
  --secondary: var(--cobalt);
  --accent: var(--lemon);
  --primary-fg: var(--paper);
  --body-fg: var(--night);
  --body-bg: var(--paper);
  --body-quiet-color: var(--ink-quiet);
  --body-medium-color: #2b3275;
  --body-loud-color: var(--night);
  --header-color: var(--paper);
  --header-branding-color: var(--paper);
  --header-bg: var(--cobalt);
  --header-link-color: var(--paper);
  --breadcrumbs-fg: var(--ink-quiet);
  --breadcrumbs-link-fg: var(--cobalt);
  --breadcrumbs-bg: transparent;
  --link-fg: var(--cobalt);
  --link-hover-color: var(--night);
  --link-selected-fg: var(--night);
  --hairline-color: var(--line);
  --border-color: var(--line-strong);
  --error-fg: var(--coral);
  --message-success-bg: var(--mint-soft);
  --message-warning-bg: var(--lemon-soft);
  --message-error-bg: var(--coral-soft);
  --darkened-bg: #eef0fd;
  --selected-bg: #e3e7ff;
  --selected-row: var(--lemon-soft);
  --button-fg: var(--paper);
  --button-bg: var(--cobalt);
  --button-hover-bg: var(--night);
  --default-button-bg: var(--lemon);
  --default-button-hover-bg: var(--lemon-deep);
  --close-button-bg: var(--ink-quiet);
  --close-button-hover-bg: var(--night);
  --delete-button-bg: var(--coral);
  --delete-button-hover-bg: #b92f1d;
  --object-tools-fg: var(--night);
  --object-tools-bg: var(--lemon);
  --object-tools-hover-bg: var(--lemon-deep);
  --font-family-primary: var(--body);
  --font-family-monospace: var(--mono);

  color-scheme: light;
}

html,
body {
  background: var(--paper);
}

body {
  color: var(--night);
  font-family: var(--body);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* One ring, in the frame's cobalt. Lemon is kept for the page's main button. */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(27, 47, 208, 0.16);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--cobalt);
  box-shadow: 0 0 0 1px var(--cobalt), 0 0 0 5px rgba(27, 47, 208, 0.16);
}

/* The frame */

#header {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "brand tools"
    "tabs  tabs";
  align-items: center;
  gap: 10px 24px;
  padding: 16px var(--gutter) 0;
  background: var(--cobalt);
  color: var(--paper);
  height: auto;
}

#branding {
  grid-area: brand;
  display: block;
}

#branding .wordmark {
  font-family: var(--display);
  font-weight: 900;
  font-size: 30px;
  letter-spacing: 0.08em;
  line-height: 1;
  color: var(--paper);
  text-decoration: none;
}

#branding .wordmark:hover {
  color: var(--lemon);
}

#user-tools {
  grid-area: tools;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--paper);
}

#user-tools a,
#logout-form button {
  color: var(--paper);
  border: 0;
  text-decoration: underline;
  text-decoration-color: var(--mist);
  text-underline-offset: 3px;
  font: inherit;
  letter-spacing: 0;
  text-transform: none;
}

#user-tools a:hover,
#logout-form button:hover {
  color: var(--lemon);
  text-decoration-color: var(--lemon);
}

.who {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}

.who__role {
  color: var(--night);
  background: var(--mist);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 12px;
  font-weight: 500;
}

.tabs {
  grid-area: tabs;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin: 0 calc(var(--gutter) * -1);
  padding: 0 var(--gutter);
  overflow-x: auto;
}

#header .tabs a {
  display: block;
  padding: 10px 14px 12px;
  border-radius: var(--radius) var(--radius) 0 0;
  color: var(--paper);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

#header .tabs a:hover {
  background: var(--cobalt-deep);
  color: var(--paper);
}

#header .tabs a[aria-current="page"] {
  background: var(--paper);
  color: var(--night);
}

.tabs__gap {
  flex: 0 0 18px;
}

div.breadcrumbs {
  padding: 18px var(--gutter) 0;
  background: transparent;
  color: var(--ink-quiet);
  font-size: 13px;
}

div.breadcrumbs a {
  color: var(--cobalt);
}

#content {
  padding: 16px var(--gutter) 48px;
}

#content > h1,
#content h1 {
  font-family: var(--body);
  font-weight: 700;
  font-size: clamp(24px, 2.6vw, 32px);
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--night);
  margin: 6px 0 20px;
}

#content h2 {
  font-family: var(--body);
}

/* Messages */

ul.messagelist li {
  margin: 0 var(--gutter) 10px;
  padding: 12px 16px 12px 44px;
  border-radius: var(--radius);
  color: var(--night);
  background-position: 16px center;
  font-size: 14px;
}

ul.messagelist {
  padding-top: 16px;
}

/* Buttons */

.button,
input[type="submit"],
input[type="button"],
.submit-row input,
a.button,
.btn {
  border-radius: 8px;
  padding: 9px 16px;
  font-family: var(--body);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.btn {
  border: 0;
  background: var(--cobalt);
  color: var(--paper);
  white-space: nowrap;
}

.btn:hover {
  background: var(--night);
}

.btn--go,
.button.default,
input[type="submit"].default,
.submit-row input.default {
  background: var(--lemon);
  color: var(--night);
}

.btn--go:hover,
.button.default:hover,
input[type="submit"].default:hover,
.submit-row input.default:hover {
  background: var(--lemon-deep);
  color: var(--night);
}

.object-tools a:link,
.object-tools a:visited {
  border-radius: 999px;
  padding: 7px 14px;
  font-weight: 700;
  color: var(--night);
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
}

/* Lists and tables */

.module,
#changelist .changelist-form-container,
#changelist-filter,
fieldset.module {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.module h2,
.module caption,
.inline-group h2,
fieldset.module h2,
fieldset .fieldset-heading,
fieldset .inline-heading,
:not(.inline-related) .collapse summary {
  border: 0;
  background: transparent;
  color: var(--night);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}

thead th,
tfoot td {
  background: var(--darkened-bg);
  color: var(--ink-quiet);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}

thead th a:link,
thead th a:visited {
  color: var(--ink-quiet);
}

td,
th {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  font-size: 14px;
  vertical-align: middle;
}

tr:hover td {
  background: #f8f9ff;
}

#changelist.module {
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: visible;
}

#changelist #toolbar {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

#changelist #toolbar form input[type="text"] {
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  padding: 9px 12px;
  height: auto;
  min-width: min(360px, 100%);
}

#changelist #toolbar form input[type="submit"] {
  background: var(--cobalt);
  color: var(--paper);
  border: 0;
}

#changelist .actions {
  background: var(--darkened-bg);
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  color: var(--ink-quiet);
}

#changelist .actions select {
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  padding: 6px 8px;
  background: var(--card);
}

#changelist .actions .button {
  background: var(--night);
  color: var(--paper);
  padding: 8px 16px;
  height: auto;
  vertical-align: middle;
}

#changelist-filter {
  padding-bottom: 8px;
}

#changelist-filter h2 {
  background: transparent;
  color: var(--night);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 14px 16px 6px;
}

#changelist-filter h3 {
  color: var(--ink-quiet);
  font-size: 12px;
  padding: 0 16px;
}

#changelist-filter li.selected a {
  color: var(--cobalt);
  font-weight: 700;
}

#changelist-filter li.selected {
  border-left-color: var(--lemon);
  border-left-width: 4px;
}

.paginator {
  border: 0;
  color: var(--ink-quiet);
  padding: 12px;
}

/* Forms */

fieldset.module {
  margin-bottom: 20px;
}

.form-row {
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
}

select {
  height: auto;
  min-height: 36px;
  line-height: 1.3;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="url"],
input[type="tel"],
textarea,
select,
.vTextField {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 7px 10px;
  background: var(--card);
  color: var(--night);
}

.submit-row {
  background: transparent;
  border: 0;
  padding: 16px 0;
  gap: 10px;
}

.help,
p.help,
form .help,
div.help {
  color: var(--ink-quiet);
}

.errornote {
  border-radius: var(--radius);
  border: 1px solid var(--coral);
  background: var(--coral-soft);
  color: var(--night);
}

ul.errorlist li {
  color: var(--coral);
  font-weight: 500;
}

/* Codes, numbers and statuses */

.code,
.digits {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.92em;
  letter-spacing: 0.02em;
}

.code {
  display: inline-block;
  padding: 3px 9px;
  border: 1.5px dashed var(--cobalt);
  border-radius: 6px;
  color: var(--cobalt);
  background: var(--card);
  white-space: nowrap;
}

.chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.chip--pending,
.chip--open {
  background: var(--lemon-soft);
  color: #6b5d00;
}

.chip--claimed,
.chip--drawn {
  background: var(--mint-soft);
  color: #0a6b46;
}

.chip--unclaimed {
  background: var(--coral-soft);
  color: #a3291a;
}

.chip--closed {
  background: var(--night);
  color: var(--lemon);
}

/* The draw board */

.board-page #content {
  padding-top: 24px;
  width: auto;  /* the admin fixes its home page at 600px */
  max-width: 1440px;
}

.board {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "next"
    "ready"
    "waiting"
    "live";
}

@media (min-width: 1024px) {
  .board {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    grid-template-areas:
      "next  ready"
      "live  waiting";
    align-items: start;
  }
}

.next {
  grid-area: next;
  container-type: inline-size;
  min-width: 0;
  background: var(--night);
  color: var(--paper);
  border-radius: 16px;
  padding: clamp(20px, 3vw, 32px);
  display: grid;
  gap: 10px;
  align-content: start;
}

#content .next .eyebrow {
  margin: 0;
  font-family: var(--body);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mist);
}

.next__clock {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(40px, 13cqi, 104px);
  white-space: nowrap;
  line-height: 0.95;
  letter-spacing: 0.02em;
  color: var(--lemon);
  font-variant-numeric: tabular-nums;
}

.next__clock.is-idle {
  color: #2a327a;
}

.next__clock.is-due {
  animation: due 1s steps(2, jump-none) infinite;
}

@keyframes due {
  50% {
    color: var(--paper);
  }
}

.next__what {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 16px;
  color: var(--mist);
}

.next__what strong {
  color: var(--paper);
  font-weight: 700;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 6px 0 8px;
}

.ready {
  grid-area: ready;
}

.live {
  grid-area: live;
}

.waiting {
  grid-area: waiting;
}

.panel__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 14px 20px 10px;
}

#content .panel__head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--night);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel__head a {
  font-size: 14px;
  font-weight: 500;
}

.count {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--lemon);
  color: var(--night);
  border-radius: 999px;
  padding: 2px 8px;
}

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

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  list-style: none;
}

.row form {
  margin: 0;
}

.row__main {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.row__main strong {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row__count {
  color: var(--ink-quiet);
  white-space: nowrap;
}

.row__count b {
  font-family: var(--mono);
  color: var(--night);
}

.row__due {
  color: var(--ink-quiet);
  font-size: 13px;
  white-space: nowrap;
}

.row__due.is-soon {
  color: #a3291a;
  font-weight: 700;
}

.quiet {
  color: var(--ink-quiet);
  font-size: 13px;
}

.empty {
  margin: 0;
  padding: 16px 20px 18px;
  border-top: 1px solid var(--line);
  color: var(--ink-quiet);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  padding: 4px 20px 14px;
}

.card {
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  display: grid;
  gap: 4px;
  background: var(--paper);
}

.card p {
  margin: 0;
  padding: 0;
}

.card__client {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-quiet);
}

.card__title {
  font-size: 16px;
  font-weight: 700;
}

.card__dial {
  font-family: var(--display);
  font-weight: 900;
  font-size: 26px;
  color: var(--cobalt);
  letter-spacing: 0.02em;
  margin: 4px 0 !important;
}

.card__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  color: var(--ink-quiet);
  font-size: 13px;
}

.card__stats b {
  font-family: var(--mono);
  color: var(--night);
}

.card__links {
  display: flex;
  gap: 14px;
  font-size: 14px;
  font-weight: 500;
  margin-top: 6px !important;
}

/* Draw day (D-52): the steps, running, announcing and handing over */

.btn--small {
  padding: 6px 12px;
  font-size: 13px;
  text-decoration: none;
}

.btn--big {
  padding: 16px 24px;
  font-size: 18px;
  border-radius: 12px;
}

a.btn {
  display: inline-block;
  text-decoration: none;
  text-align: center;
}

.btn--idle,
.btn--idle:hover {
  display: inline-block;
  background: #2a327a;
  color: var(--mist);
  cursor: default;
}

.steps {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.steps li {
  list-style: none;
  border-top: 4px solid #2a327a;
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--mist);
}

.steps strong {
  color: var(--paper);
  font-size: 15px;
}

.steps__when {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.steps li.is-now {
  border-top-color: var(--lemon);
}

.steps li.is-now .steps__when {
  color: var(--lemon);
}

.next__actions {
  margin: 6px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

#content .next__actions a {
  color: var(--paper);
}

.panel__foot {
  margin: 0;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-quiet);
}

.eyebrow {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-quiet);
}

/* Run the draw */

.run {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  max-width: 1280px;
}

.run__facts {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#content .run__facts h1 {
  margin: 0;
  font-size: clamp(30px, 3.4vw, 44px);
}

.facts {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.facts div {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 18px;
}

.facts dt {
  font-size: 13px;
  color: var(--ink-quiet);
}

.facts dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.facts .facts__big {
  font-family: var(--display);
  font-weight: 900;
  font-size: 44px;
  line-height: 1.05;
  color: var(--cobalt);
}

.pools {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.run__explain {
  margin: 0;
  color: var(--ink-quiet);
  max-width: 40em;
}

.run__go {
  background: var(--night);
  color: var(--paper);
  border-radius: 16px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.run__go .eyebrow {
  color: var(--mist);
}

.run__lead {
  margin: 0;
  font-size: 19px;
}

.run__go form {
  margin: 0;
}

.run__go .btn--big {
  width: 100%;
  padding: 20px;
  font-size: 22px;
}

#content .run__back {
  color: var(--mist);
  text-align: center;
}

/* Announce: the whole window, for the stage */

.announce-page,
.announce-page #container {
  background: var(--night);
}

.announce-page #content {
  padding: 0;
}

.announce {
  min-height: calc(100vh - 110px);
  box-sizing: border-box;
  padding: 36px var(--gutter) 40px;
  color: var(--paper);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
}

.announce__top {
  margin: 0;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--mist);
}

#content .announce a:not(.btn) {
  color: var(--paper);
}

.announce__lead {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 30px);
  color: var(--mist);
}

.announce__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 18px;
}

.announce__list li {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.announce__code {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(96px, 15vw, 230px);
  line-height: 0.9;
  color: var(--lemon);
  letter-spacing: 0.01em;
}

.announce__list.is-many {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.announce__list.is-many .announce__code {
  font-size: clamp(56px, 6vw, 96px);
}

.announce__who {
  font-size: clamp(20px, 2.4vw, 34px);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.announce__who b {
  font-family: var(--mono);
}

.announce__foot {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  flex-wrap: wrap;
}

.announce__foot p {
  margin: 0;
  font-size: 20px;
  max-width: 36em;
}

.announce__side {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 10px;
}

.announce__side .announce__proof {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mist);
}

/* Hand over */

.handover {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  max-width: 1280px;
}

.handover__main {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

#content .handover__main h1 {
  margin: 0;
}

.lookup label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

.lookup__row {
  display: flex;
  gap: 10px;
}

.lookup input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 26px;
  padding: 12px 16px;
  border: 2px solid var(--cobalt);
  border-radius: 12px;
  text-transform: uppercase;
}

.winner-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.winner-card__head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.winner-card__head p {
  margin: 0;
  padding: 0;
}

.winner-card__prize {
  font-size: 30px;
  font-weight: 700;
}

.winner-card__checks {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.winner-card__label {
  margin: 0;
  font-weight: 700;
}

.winner-card__checks label {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 16px;
}

.winner-card__checks input[type="checkbox"] {
  width: 22px;
  height: 22px;
  flex: none;
}

.winner-card__note {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-weight: 500;
}

.chip--waiting {
  background: var(--lemon-soft);
  color: #6b5d00;
}

.chip--collected {
  background: var(--mint-soft);
  color: #0a6b46;
}

.chip--expired {
  background: var(--coral-soft);
  color: #a3291a;
}

@media (max-width: 900px) {
  .run,
  .handover {
    grid-template-columns: minmax(0, 1fr);
  }

  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Sign in */

html:has(body.login),
body.login {
  background: var(--cobalt);
  min-height: 100vh;
}

body.login #container {
  background: var(--card);
  border: 0;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(11, 17, 80, 0.35);
  overflow: hidden;
  margin-top: clamp(24px, 12vh, 120px);
}

body.login #header {
  padding: 22px 28px;
  grid-template-areas: "brand";
  grid-template-columns: 1fr;
}

body.login #content {
  padding: 24px 28px 28px;
}

body.login .submit-row input {
  width: 100%;
  background: var(--lemon);
  color: var(--night);
}

/* Small screens */

@media (max-width: 767px) {
  #header {
    grid-template-columns: 1fr;
    grid-template-areas:
      "brand"
      "tools"
      "tabs";
  }

  #user-tools {
    justify-self: start;
    flex-wrap: wrap;
  }

  .tabs {
    flex-wrap: nowrap;
  }

  .row {
    flex-wrap: wrap;
  }

  .row__main {
    flex-basis: 100%;
    order: -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .next__clock.is-due {
    animation: none;
  }
}

/* Entries page: counts for the listed entries, and why numbers are masked (D-55) */
.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  align-items: baseline;
  margin: 0 0 12px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-quiet);
}

.summary b {
  font-family: var(--mono);
  color: var(--night);
}

.summary__options {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}

.privacy-note {
  margin: 0 0 12px;
  color: var(--ink-quiet);
  font-size: 13px;
}

/* Forms (the forms redesign): sections as cards, labels above fields, plain
   switches for two to four choices, toggles for yes/no, errors beside the
   field, labelled add/edit/view buttons, and a save bar that stays in view. */

.change-form form {
  counter-reset: section;
}

.change-form fieldset.module.aligned {
  counter-increment: section;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 24px;
  padding: 0 24px 16px;
  margin-bottom: 20px;
  border-radius: 16px;
}

.change-form fieldset.module.aligned > .fieldset-heading,
.change-form fieldset.module.aligned > .description,
.change-form fieldset.module.aligned > details {
  grid-column: 1 / -1;
}

.change-form fieldset.module .fieldset-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 22px 0 6px;
  border: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--night);
}

.change-form fieldset.module .fieldset-heading::before {
  content: counter(section);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--cobalt);
  color: var(--paper);
  font-size: 13px;
}

.change-form fieldset.module .description {
  margin: 0 0 8px;
  padding: 0;
  color: var(--ink-quiet);
  font-size: 13px;
}

.change-form .aligned .form-row {
  border: 0;
  padding: 10px 0;
  min-width: 0;
}

/* Long fields take the whole width. */
.change-form .aligned .form-row:has(textarea),
.change-form .aligned .form-row.field-title,
.change-form .aligned .form-row.field-screen_preview,
.change-form .aligned .form-row.field-draw_periods,
.change-form .aligned .form-row.field-confirm_optout_route {
  grid-column: 1 / -1;
}

.change-form .aligned .form-row > div > .flex-container:not(.checkbox-row) {
  flex-direction: column;
  align-items: stretch;
}

.change-form .aligned label:not(.vCheckboxLabel) {
  width: auto;
  min-width: 0;
  padding: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--night);
}

.change-form .aligned label.required::after {
  content: "";
}

form .aligned div.help,
form .aligned p.help,
form .aligned input + div.help,
form .aligned select + div.help,
form .aligned textarea + div.help,
.aligned .checkbox-row + div.help {
  margin: 6px 0 0;
  padding: 0;
  font-size: 12px;
  color: var(--ink-quiet);
}

.change-form .aligned input[type="text"],
.change-form .aligned input[type="number"],
.change-form .aligned input[type="email"],
.change-form .aligned input[type="password"],
.change-form .aligned input[type="url"],
.change-form .aligned select,
.change-form .aligned .vTextField {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 15px;
}

.change-form .aligned textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 96px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 15px;
}

/* USSD screens are fixed-width text: show them that way. */
.model-campaign .aligned textarea {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
}

.change-form .aligned .datetime input {
  width: auto;
}

input[type="text"]:hover,
input[type="number"]:hover,
select:hover,
textarea:hover {
  border-color: var(--mist);
}

/* A switch for two to four choices (the admin's inline radio list). */
form .aligned div.radiolist.inline,
form div.radiolist.inline {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 4px;
  max-width: 620px;
  background: #eef0ff;
  border-radius: 12px;
}

div.radiolist.inline > div {
  flex: 1;
  margin: 0;
}

div.radiolist.inline label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-quiet);
  cursor: pointer;
  white-space: nowrap;
}

div.radiolist.inline label input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

div.radiolist.inline label:has(input:checked) {
  background: var(--card);
  color: var(--night);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(11, 17, 80, 0.12), 0 0 0 1px var(--line-strong);
}

div.radiolist.inline label:has(input:focus-visible) {
  outline: 2px solid var(--cobalt);
  outline-offset: 2px;
}

/* Yes/no fields as toggles. */
.change-form .checkbox-row input[type="checkbox"],
.inline-group td.field-is_active input[type="checkbox"] {
  appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 26px;
  margin: 0;
  border-radius: 999px;
  background: var(--line-strong);
  cursor: pointer;
  transition: background-color 0.15s;
}

.change-form .checkbox-row input[type="checkbox"]::before,
.inline-group td.field-is_active input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 1px 2px rgba(11, 17, 80, 0.25);
  transition: transform 0.15s;
}

.change-form .checkbox-row input[type="checkbox"]:checked,
.inline-group td.field-is_active input[type="checkbox"]:checked {
  background: var(--cobalt);
}

.change-form .checkbox-row input[type="checkbox"]:checked::before,
.inline-group td.field-is_active input[type="checkbox"]:checked::before {
  transform: translateX(18px);
}

.change-form .checkbox-row {
  align-items: center;
  gap: 12px;
  min-height: 44px;
}

.change-form .aligned .vCheckboxLabel {
  width: auto;
  min-width: 0;
  padding: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--night);
}

/* Errors beside the field, saying what to do. */
ul.errorlist {
  margin: 0 0 6px;
  padding: 0;
}

ul.errorlist li {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: #a3291a;
}

ul.errorlist li::before {
  content: "!";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--coral);
  color: var(--card);
  font-size: 11px;
  font-weight: 700;
}

.form-row.errors input,
.form-row.errors select,
.form-row.errors textarea,
.fieldBox.errors input,
.fieldBox.errors select {
  border: 1.5px solid var(--coral);
  background: #fffafa;
}

.form-row.errors .flex-container > label:not(.vCheckboxLabel) {
  color: #a3291a;
}

.change-form .form-row.errors {
  background: transparent;
}

/* Add, edit and view: labelled buttons under the select. They stay siblings of
   the select (Django's script needs that), so the select takes a whole row. */
.related-widget-wrapper {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.related-widget-wrapper > select {
  flex: 1 1 100%;
}

a.related-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card);
  font-size: 13px;
  font-weight: 500;
  color: var(--cobalt);
  text-decoration: none;
  opacity: 1;
}

a.related-action:hover {
  border-color: var(--cobalt);
  color: var(--cobalt-deep);
}

/* Edit and view follow the selection; with nothing selected they rest. */
a.related-action:not([href]) {
  opacity: 0.45;
  pointer-events: none;
}

/* The save bar stays in view at the bottom of long forms. */
.change-form .submit-row {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin: 8px 0 0;
  padding: 16px 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 24px rgba(11, 17, 80, 0.06);
}

.change-form .submit-row input[type="submit"] {
  text-transform: none;
  letter-spacing: 0;
  height: 48px;
  margin: 0;
  padding: 0 22px;
  border: 1.5px solid var(--cobalt);
  border-radius: 12px;
  background: var(--card);
  color: var(--cobalt);
  font-size: 15px;
}

.change-form .submit-row input[type="submit"]:hover {
  background: #eef0ff;
}

.change-form .submit-row input.default {
  order: 10;
  border: 0;
  background: var(--lemon);
  color: var(--night);
  box-shadow: inset 0 -2px 0 var(--lemon-deep);
}

.change-form .submit-row input.default:hover {
  background: var(--lemon-deep);
}

/* Prizes and other inline tables. */
.change-form .inline-group {
  border-radius: 16px;
}

.change-form .inline-group .tabular td {
  vertical-align: middle;
  padding: 10px 12px;
}

.change-form .inline-group .tabular td input[type="text"],
.change-form .inline-group .tabular td input[type="number"] {
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
}

@media (max-width: 767px) {
  .change-form fieldset.module.aligned {
    grid-template-columns: minmax(0, 1fr);
    padding: 0 16px 12px;
  }
}

/* "Add another prize": words and a plus, not the framework's icon. */
.change-form .inline-group .add-row a,
.change-form .inline-group .add-row a:link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  background: none;
  font-weight: 700;
  font-size: 14px;
  color: var(--cobalt);
}

.change-form .inline-group .add-row a::before {
  content: "+";
  font-size: 18px;
  line-height: 1;
}

/* An error goes under its field, flush left: the admin's aligned layout
   indents it and puts it above the label. */
.change-form .aligned .form-row.errors {
  display: flex;
  flex-direction: column;
}

.change-form .aligned .form-row.errors > ul.errorlist {
  order: 2;
}

.change-form .aligned ul.errorlist,
.change-form .aligned ul.errorlist li {
  margin: 6px 0 0;
  padding: 0;
  background: none;
  border: 0;
}

div.radiolist.inline {
  max-width: 100%;
}

/* Route tiles: every route with who holds it (SRS 3.3, D-57). */
div.route-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
  width: 100%;
}

div.route-tiles > div {
  margin: 0;
}

.change-form .aligned div.route-tiles label,
div.route-tiles label {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: auto;
  min-width: 0;
  min-height: 64px;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--card);
  cursor: pointer;
}

div.route-tiles label input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.route-tile__number {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--night);
}

.route-tile__note {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink-quiet);
}

/* A route another live campaign holds: choosable for a draft, but quieter. */
.change-form .aligned div.route-tiles label:has(.route-tile__note--taken),
div.route-tiles label:has(.route-tile__note--taken) {
  background: var(--paper);
  border-style: dashed;
}

.change-form .aligned div.route-tiles label:hover,
div.route-tiles label:hover {
  border-color: var(--mist);
}

.change-form .aligned div.route-tiles label:has(input:checked),
div.route-tiles label:has(input:checked) {
  border: 1.5px solid var(--cobalt);
  background: #eef0ff;
  box-shadow: 0 0 0 3px rgba(27, 47, 208, 0.12);
}

div.route-tiles label:has(input:focus-visible) {
  outline: 2px solid var(--cobalt);
  outline-offset: 2px;
}

/* Routes 1 to 9 need the whole width. */
.change-form .aligned .form-row.field-route_code {
  grid-column: 1 / -1;
}

/* Run the draw, late: the reason box (FR-82, D-61). */
.run__late {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 16px;
}

.run__late label {
  font-weight: 700;
  font-size: 14px;
}

.run__late textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font: inherit;
  font-size: 15px;
}
