/* =========================================================================
   mon-cms pixel theme — AdminWebServer (AWS) overrides
   -------------------------------------------------------------------------
   Loaded AFTER reset.css, aws_style.css, jqplot and prism.css, so it is the
   last word on presentation. It changes nothing structural: no id, name,
   data-* or behavioural class (.toggling_on/.toggling_off, .diff-radio,
   .jump_form, .notification*, .subtask_*) is renamed or removed here.

   Tokens come from static/pixel/pixel-tokens.css. Anything this file needs
   that the shared token file does not define is named with an --aws- prefix
   and declared in the block below.

   Many aws_style.css rules are written as `body.admin ...`, so the overrides
   here carry the same prefix in order to win on specificity rather than on
   ordering alone.
   ========================================================================= */

:root {
  /* --px-ink-3 is only 4.06:1 on --px-paper, below the 4.5:1 floor this UI
     holds itself to, so quiet text uses the shared text-safe grey. It was a
     literal here (#5c5c54); a literal cannot follow the dark palette, so it
     is an alias now and the value lives in pixel-tokens.css. */
  --aws-ink-meta:     var(--px-meta);
  /* Fixed sidebar geometry, kept in sync with #core's left margin. */
  --aws-sidebar-w:    234px;
  --aws-sidebar-pad:  1em;
  /* Row rhythm for the data-dense tables. */
  --aws-cell-y:       4px;
  --aws-cell-x:       6px;
  --aws-table-text:   12.5px;
}

/* ---- Ground & typography ---------------------------------------------- */

body.admin {
  font-family: var(--px-font-mono);
  font-size: var(--px-text);
  line-height: var(--px-leading);
  color: var(--px-ink);
  min-width: 1180px;
  /* .px-paper (on <body>) paints the dotted grid. It deliberately scrolls with
     the page: `background-attachment: fixed` forced a full-viewport repaint on
     every scroll frame, and a 24px dot tile is indistinguishable either way. */
}

body.admin .px-label,
body.admin .aws-label {
  color: var(--aws-ink-meta);
}

body.admin strong, body.admin .bold { font-weight: 700; }
body.admin em { font-style: italic; }

body.admin p { padding: 0.5em 0; }

body.admin a,
body.admin a:visited {
  color: var(--px-green);
  text-decoration: none;
  border-bottom: 1px dotted var(--px-green);
}
body.admin a:hover {
  color: var(--px-green-2);
  background: var(--px-green-soft);
  border-bottom-style: solid;
}
/* Anchors that act as controls rather than destinations get no underline. */
body.admin a.button-link,
body.admin a.px-btn,
body.admin #sidebar a,
body.admin th a.column-sort,
body.admin .notification a,
body.admin .paste_text summary a {
  border-bottom: none;
}

body.admin :focus-visible {
  outline: 2px solid var(--px-green);
  outline-offset: 2px;
}

/* ---- Headings ---------------------------------------------------------- */

/* Silkscreen is only legible at size; it is used for page titles (>= 20px)
   and the sidebar brand, never for the small structural headings. */
body.admin #core h1,
body.admin #subpage h1,
body.admin .core_title h1 {
  font-family: var(--px-font-display);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: 0.01em;
  color: var(--px-ink);
  margin: 4px 0 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--px-ink);
  overflow-wrap: anywhere;
  -webkit-font-smoothing: none;
  text-rendering: optimizeSpeed;
}
body.admin .core_title { margin-top: 6px; }
body.admin #core h1 a,
body.admin .core_title h1 a { border-bottom: none; }

body.admin #core h2,
body.admin h2 {
  font-family: var(--px-font-mono);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--px-ink);
  padding: 0 0 0 10px;
  margin: 18px 0 8px;
  border-left: 4px solid var(--px-green);
}

body.admin h3 {
  font-family: var(--px-font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--px-ink-2);
  margin: 12px 0 6px 0;
  margin-left: 0;
}

/* Tables use <h2>/<h3> inside cells as section separators; those must not
   inherit the block treatment above. */
body.admin table h2 {
  border-left: none;
  padding-left: 0;
  margin: 14px 0 4px;
  font-size: 13px;
}
body.admin table.NestedSettings h2 { margin-left: -1em; }

/* ---- Layout ------------------------------------------------------------ */

body.admin #sidebar {
  width: var(--aws-sidebar-w);
  padding: 10px var(--aws-sidebar-pad) 2em;
  background-color: var(--px-paper);
  background-image: none;
  border-right: 1px solid var(--px-ink);
  text-shadow: none;
  text-align: left;
}

body.admin #border {
  border: none;
  width: 0;
}

body.admin #core {
  margin-left: calc(var(--aws-sidebar-w) + 2 * var(--aws-sidebar-pad) + 8px);
  padding: 0 20px 2em 0;
  /* The widest tables here (12-column submissions, the access-log detail
     column) genuinely need more room than a 1280px window leaves. Scroll them
     inside the content column so the page itself never scrolls sideways and
     the fixed sidebar stays put. */
  overflow-x: auto;
  /* macOS hides overlay scrollbars, so make the one that matters visible. */
  scrollbar-width: thin;
  scrollbar-color: var(--px-ink-3) var(--px-paper-2);
}
body.admin #core::-webkit-scrollbar { height: 10px; }
body.admin #core::-webkit-scrollbar-track {
  background: var(--px-paper-2);
  border-top: 1px solid var(--px-grid);
}
body.admin #core::-webkit-scrollbar-thumb {
  background: var(--px-ink-3);
  border: 1px solid var(--px-ink);
}

/* ---- Sidebar ----------------------------------------------------------- */

/* The one place Silkscreen appears in the chrome. */
body.admin #sidebar h1.parent {
  font-family: var(--px-font-display);
  font-weight: 700;
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: 0;
  color: var(--px-ink);
  margin: 16px 0 2px;
  -webkit-font-smoothing: none;
  text-rendering: optimizeSpeed;
}
body.admin #sidebar h1.parent::before { content: none; }
body.admin #sidebar h1.parent a { color: var(--px-ink); }
body.admin #sidebar h1.parent a:hover { background: var(--px-green-soft); }

body.admin #sidebar h1.child {
  font-family: var(--px-font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--px-green);
  margin: 0 0 2px;
  overflow-wrap: anywhere;
}
body.admin #sidebar h1.child::before { content: "\21B3\00a0"; color: var(--aws-ink-meta); }

/* Section headings: Contests / Tasks / Users / Teams. Mono, not Silkscreen —
   they are labels for lists, and this column is only 234px wide. */
body.admin #sidebar h1 {
  font-family: var(--px-font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--aws-ink-meta);
  margin: 18px 0 4px;
  padding-bottom: 3px;
  border-bottom: 1px dotted var(--px-grid);
}
body.admin #sidebar h1 a.menu_link { color: var(--aws-ink-meta); }

body.admin #sidebar_header {
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--px-ink);
}

/* The appearance control, at the top of the sidebar so it is in the same
   place on every admin page (the admin has no navbar to hang it from). The
   control itself is .px-theme from the shared token sheet; only its place on
   this page is decided here. */
body.admin .aws-theme-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--aws-ink-meta);
}
body.admin .aws-theme-slot .px-theme { margin-left: auto; }
@media print { body.admin .aws-theme-slot { display: none; } }

body.admin #sidebar ul.menu { margin-bottom: 4px; }
body.admin #sidebar .menu_entry,
body.admin #sidebar ul.menu > li {
  font-size: 12.5px;
  line-height: 1.7;
}
body.admin #sidebar a,
body.admin #sidebar a:visited {
  font-family: var(--px-font-mono);
  color: var(--px-ink-2);
  text-decoration: none;
}
body.admin .menu_link {
  display: inline-block;
  border-radius: 0;
  padding: 0 6px 0 8px;
  margin-right: 0;
  margin-left: -8px;
  border-left: 3px solid transparent;
}
body.admin #sidebar a:hover,
body.admin #sidebar a:focus {
  background-color: var(--px-green-soft);
  color: var(--px-ink);
  border-left-color: var(--px-green);
  outline: 0;
}
body.admin #sidebar a:focus-visible { outline: 2px solid var(--px-green); outline-offset: 1px; }

body.admin .login_notice {
  width: auto;
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--aws-ink-meta);
}
body.admin .login_notice form.inline { display: inline; }
body.admin .login_notice input[type="submit"] {
  padding: 2px 8px;
  font-size: 11px;
  box-shadow: var(--px-shadow-sm);
}

body.admin .secret_notice {
  margin: 12px 0;
  padding: 8px 10px;
  text-align: left;
  font-size: 11px;
  line-height: 1.45;
  color: var(--px-red);
  background: var(--px-red-soft);
  border: 1px solid var(--px-ink);
  border-left: 4px solid var(--px-red);
  overflow-wrap: anywhere;
}

body.admin .cr_notice {
  width: var(--aws-sidebar-w);
  margin-left: 0;
  font-size: 10px;
  line-height: 1.5;
  text-align: left;
  color: var(--aws-ink-meta);
  background: var(--px-paper);
  padding-top: 6px;
  border-top: 1px dotted var(--px-grid);
}
body.admin .cr_notice a { color: var(--aws-ink-meta); border-bottom: none; }

body.admin .footer {
  font-size: 12px;
  color: var(--px-ink-2);
}
body.admin #remaining_value { font-weight: 700; color: var(--px-green); }

body.admin .unread {
  border-radius: 0;
  width: auto;
  min-width: 1.6em;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.6;
  color: var(--px-on-accent);
  background-color: var(--px-red);
  border: 1px solid var(--px-ink);
  text-shadow: none;
}

/* ---- Dividers ---------------------------------------------------------- */

body.admin .hr {
  padding: 0;
  margin: 14px 0;
  height: 0;
  border-top: 2px dotted var(--px-grid);
  color: transparent;
}
body.admin .hr::before { content: none; }

body.admin hr {
  height: 0;
  border: none;
  border-top: 1px dotted var(--px-grid);
  margin: 8px 0;
}

/* ---- Buttons ----------------------------------------------------------- */

/* Every submit/reset/button/button-like anchor takes the boxed pixel look.
   Applied by selector so no template markup has to change. */
body.admin button,
body.admin input[type="submit"],
body.admin input[type="button"],
body.admin input[type="reset"],
body.admin a.button-link,
body.admin .px-btn {
  display: inline-block;
  font-family: var(--px-font-mono);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.2;
  padding: 7px 12px;
  margin: 0 6px 4px 0;
  color: var(--px-ink);
  background: var(--px-paper);
  border: 1px solid var(--px-ink);
  border-radius: 0;
  box-shadow: var(--px-shadow-sm);
  text-decoration: none;
  text-shadow: none;
  cursor: pointer;
  vertical-align: middle;
  transition: transform 60ms steps(2), box-shadow 60ms steps(2);
}
body.admin button:hover,
body.admin input[type="submit"]:hover,
body.admin input[type="button"]:hover,
body.admin input[type="reset"]:hover,
body.admin a.button-link:hover,
body.admin .px-btn:hover {
  color: var(--px-ink);
  background: var(--px-paper-2);
  text-decoration: none;
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--px-ink);
}
body.admin button:active,
body.admin input[type="submit"]:active,
body.admin input[type="button"]:active,
body.admin input[type="reset"]:active,
body.admin a.button-link:active,
body.admin .px-btn:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}
body.admin button:focus-visible,
body.admin input[type="submit"]:focus-visible,
body.admin input[type="button"]:focus-visible,
body.admin input[type="reset"]:focus-visible,
body.admin a.button-link:focus-visible,
body.admin .px-btn:focus-visible {
  outline: 2px solid var(--px-green);
  outline-offset: 2px;
}
body.admin button[disabled],
body.admin input[disabled],
body.admin .px-btn.disabled {
  color: var(--aws-ink-meta);
  background: var(--px-paper-2);
  border-color: var(--px-ink-3);
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

body.admin .px-btn-primary,
body.admin input.px-btn-primary,
body.admin button.px-btn-primary {
  background: var(--px-green);
  color: var(--px-on-accent);
  border-color: var(--px-ink);
}
body.admin .px-btn-primary:hover,
body.admin button.px-btn-primary:hover { background: var(--px-green-2); color: var(--px-on-accent); }

/* Destructive confirmations. */
body.admin .px-btn-danger,
body.admin a.button-link.px-btn-danger,
body.admin input.px-btn-danger,
body.admin button.px-btn-danger {
  background: var(--px-red);
  color: var(--px-on-accent);
  border-color: var(--px-ink);
}
body.admin .px-btn-danger:hover,
body.admin a.button-link.px-btn-danger:hover { background: var(--px-red-2); color: var(--px-on-accent); }
/* :visited on an <a class="button-link px-btn-danger"> would otherwise win the
   colour back from the rule above. */
body.admin a.px-btn-danger:visited,
body.admin a.button-link.px-btn-danger:visited { color: var(--px-on-accent); }
body.admin a.px-btn-primary:visited { color: var(--px-on-accent); }

/* Buttons that live inside a data cell stay tight so rows keep their rhythm
   (the C / E / S reevaluation triple, "Rerun and archive"). */
body.admin table td button,
body.admin table td input[type="submit"],
body.admin table td input[type="button"] {
  padding: 4px 9px;
  margin: 0 3px 0 0;
  font-size: 11.5px;
}

/* "Remove ..." / "Delete ..." submits scattered through the list pages read as
   destructive. Outlined rather than filled: these still need a confirmation
   step, so they should warn without shouting. */
body.admin input[type="submit"][value^="Remove"]:not([disabled]),
body.admin input[type="submit"][value^="Delete"]:not([disabled]) {
  color: var(--px-red);
  border-color: var(--px-red);
  font-weight: 700;
}
body.admin input[type="submit"][value^="Remove"]:not([disabled]):hover,
body.admin input[type="submit"][value^="Delete"]:not([disabled]):hover {
  background: var(--px-red-soft);
}

/* ---- Inputs ------------------------------------------------------------ */

body.admin input[type="text"],
body.admin input[type="password"],
body.admin input[type="number"],
body.admin input[type="email"],
body.admin input[type="search"],
body.admin input[type="url"],
body.admin input[type="date"],
body.admin input[type="datetime-local"],
body.admin input[type="time"],
body.admin input[type="file"],
body.admin select,
body.admin textarea,
body.admin .px-input {
  font-family: var(--px-font-mono);
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--px-ink);
  background: var(--px-field-bg);
  border: 1px solid var(--px-ink);
  border-radius: 0;
  box-shadow: none;
  padding: 5px 7px;
}
body.admin select { padding: 4px 6px; }
body.admin textarea { line-height: 1.5; }
/* Several templates set style="width: 100%" inline; without border-box those
   fields overflow their container by the border + padding. */
body.admin input,
body.admin select,
body.admin textarea { box-sizing: border-box; }
body.admin input[type="checkbox"],
body.admin input[type="radio"] { box-sizing: content-box; }

body.admin input:focus,
body.admin select:focus,
body.admin textarea:focus,
body.admin .px-input:focus {
  outline: none;
  border: 1px solid var(--px-ink);
  box-shadow: var(--px-focus);
}
body.admin input::placeholder,
body.admin textarea::placeholder { color: var(--px-ink-3); }

body.admin input[type="checkbox"],
body.admin input[type="radio"] {
  accent-color: var(--px-green);
  border: 0;
  vertical-align: middle;
  margin: 0 2px;
}

body.admin label { font-family: var(--px-font-mono); }

/* ---- Tables ------------------------------------------------------------ */

body.admin table {
  font-family: var(--px-font-mono);
  font-size: var(--aws-table-text);
  line-height: 1.45;
  margin-top: 0;
  border-collapse: collapse;
}

body.admin table th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--px-ink);
  background: var(--px-paper-3);
  text-align: left;
  vertical-align: bottom;
  padding: var(--aws-cell-y) var(--aws-cell-x);
  border-bottom: 1px solid var(--px-ink);
  text-shadow: none;
}

body.admin table td {
  font-size: var(--aws-table-text);
  padding: var(--aws-cell-y) var(--aws-cell-x);
  vertical-align: top;
}

body.admin table.nested th,
body.admin table.nested td {
  font-size: 11.5px;
  padding: 2px 6px;
}

body.admin table.bordered {
  border: 1px solid var(--px-ink);
  border-radius: 0;
  box-shadow: var(--px-shadow-sm);
  background: var(--px-paper);
}
body.admin table.bordered td,
body.admin table.bordered th {
  border-right: 1px solid var(--px-grid);
}
body.admin table.bordered td:last-child,
body.admin table.bordered th:last-child {
  border-right: 0;
}
body.admin table.bordered thead th {
  background-color: var(--px-paper-3);
  border-bottom: 1px solid var(--px-ink);
}
body.admin table.bordered tbody tr:nth-child(even) { background-color: var(--px-paper); }
body.admin table.bordered tbody tr:nth-child(odd)  { background-color: var(--px-paper-2); }
body.admin table.bordered tbody tr:hover { background-color: var(--px-green-soft); }

/* Sub tables (queue/workers/logs/audit) are borderless in the original;
   give them the same crisp frame without changing their markup. */
body.admin table.sub_table {
  border: 1px solid var(--px-ink);
  background: var(--px-paper);
  width: auto;
}
body.admin table.sub_table > thead > tr > th,
body.admin table.sub_table > tbody > tr > th,
body.admin table.sub_table > tr > th {
  background: var(--px-paper-3);
}
body.admin table.sub_table > tbody > tr:nth-child(even),
body.admin table.sub_table > tr:nth-child(even) { background: var(--px-paper-2); }

body.admin table.TaskTypeOptions {
  border: 1px solid var(--px-ink);
  margin: 6px 0;
  background: var(--px-paper);
}
body.admin table.NestedSettings { margin-left: 28px; display: inline-table; }
body.admin table.NestedSettings h2::before { content: "\21B3\00a0"; }

body.admin table td.partial::after { content: "*"; color: var(--px-amber); font-weight: 700; }
/* The latency cell used to carry id="latency" -- once per row, so the id was
   duplicated as many times as there were submissions. It is a class now;
   aws_style.css still only knows the old `td#latency`, so keep the
   right-alignment here. */
body.admin table td.latency { text-align: right; }
body.admin table.sortable th { white-space: nowrap; }
body.admin th .column-sort { text-decoration: none; margin-left: 8px; color: var(--px-ink); }

body.admin div.task_dataset {
  padding: 0 1em;
  border: 1px solid var(--px-ink);
  background: var(--px-paper);
  box-shadow: var(--px-shadow-sm);
  margin-bottom: 12px;
}

/* jqplot injects a <table class="jqplot-table-legend">; it must not pick up
   the frame above. */
body.admin table.jqplot-table-legend,
body.admin table.jqplot-table-legend td,
body.admin table.jqplot-table-legend th {
  width: auto;
  border: none;
  background: transparent;
  box-shadow: none;
  text-transform: none;
  letter-spacing: 0;
  padding: 0 2px;
  font-size: 11px;
}

/* ---- Toggling section headers ------------------------------------------ */

body.admin .toggling_on,
body.admin .toggling_off {
  cursor: pointer;
  user-select: none;
}
body.admin h2.toggling_on:hover,
body.admin h2.toggling_off:hover,
body.admin h3.toggling_on:hover,
body.admin h3.toggling_off:hover { color: var(--px-green); }
/* The ▾ / ▸ markers come from aws_style.css :before rules — left untouched,
   they are the only affordance telling a section apart from a closed one. */

/* ---- Code, pre, Prism --------------------------------------------------- */

body.admin pre,
body.admin code {
  font-family: var(--px-font-mono);
}
body.admin pre {
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 10px;
  background: var(--px-paper-2);
  border: 1px solid var(--px-grid);
  border-left: 3px solid var(--px-green);
  overflow-x: auto;
  min-height: 1.5em;
  /* white-space stays `pre`: aws_style.css gives every <td> width:1px, so a
     wrapping <pre> (the log message column) collapses to one glyph wide. */
}
body.admin td > code,
body.admin p > code {
  background: var(--px-paper-2);
  border: 1px solid var(--px-grid);
  padding: 0 4px;
  font-size: 11.5px;
}

/* Prism-highlighted source in the file/diff popup: keep the token palette
   (it is tuned for a light ground and stays legible) but drop the glow and
   the rounded chrome, and use the theme's monospace face. */
body.admin code[class*="language-"],
body.admin pre[class*="language-"] {
  font-family: var(--px-font-mono);
  font-size: 12px;
  text-shadow: none;
  background: none;
  white-space: pre;
}
body.admin pre[class*="language-"] {
  background: var(--px-paper-hi);
  border: 1px solid var(--px-ink);
  border-left: 1px solid var(--px-ink);
  border-radius: 0;
  padding: 12px;
  margin: 8px 0;
  box-shadow: var(--px-shadow-sm);
}
body.admin pre[class*="language-"].line-numbers { padding-left: 3.8em; }
body.admin .line-numbers .line-numbers-rows { border-right: 1px solid var(--px-grid); }
body.admin .line-numbers-rows > span::before { color: var(--px-ink-3); }
body.admin pre.diff-highlight > code .token.deleted:not(.prefix),
body.admin pre > code.diff-highlight .token.deleted:not(.prefix) {
  background-color: var(--px-red-soft);
}
body.admin pre.diff-highlight > code .token.inserted:not(.prefix),
body.admin pre > code.diff-highlight .token.inserted:not(.prefix) {
  background-color: var(--px-green-soft);
}

/* ---- Notifications & communications ------------------------------------ */

body.admin #notifications { margin: 0; padding: 12px 0 4px; }

body.admin #notifications .notification,
body.admin .notifications .notification {
  position: relative;
  text-align: left;
  margin-bottom: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  border-radius: 0;
  background-color: var(--px-paper);
  border: 1px solid var(--px-ink);
  border-left: 4px solid var(--px-amber);
  box-shadow: var(--px-shadow-sm);
}

body.admin #notifications .notification_msg,
body.admin .notifications .notification_msg { padding: 8px 10px; }

/* The close button, the timestamp and the Reply / Ignore / Claim controls are
   all floats with nothing clearing them, so without a block formatting
   context they spill through the bottom border of the card. */
body.admin #notifications .notification,
body.admin .notifications .notification,
body.admin #notifications .notification_msg,
body.admin .notifications .notification_msg { display: flow-root; }

body.admin #notifications .notification_close,
body.admin .notifications .notification_close {
  float: right;
  cursor: pointer;
  width: 1.8em;
  padding: 1px 0;
  margin: 0;
  text-align: center;
  font-weight: 700;
  color: var(--px-ink);
  background-color: var(--px-paper-2);
  border: 0;
  border-left: 1px solid var(--px-ink);
  border-bottom: 1px solid var(--px-ink);
  border-radius: 0;
}
body.admin #notifications .notification_close:hover,
body.admin .notifications .notification_close:hover {
  background-color: var(--px-red-soft);
  color: var(--px-red);
}

body.admin .notification_subject {
  font-weight: 700;
  color: var(--px-ink);
}
body.admin .notifications .notification_timestamp {
  float: right;
  padding-right: 0.5em;
  font-size: 11px;
  color: var(--aws-ink-meta);
}
body.admin .notification_text { padding-top: 2px; }
body.admin .notifications .notification_admin_owner {
  font-style: italic;
  font-size: 11px;
  color: var(--aws-ink-meta);
}

/* Semantic left bars. */
body.admin .notification_type_announcement { border-left-color: var(--px-blue); }
body.admin .notification_type_message,
body.admin .notification_type_question,
body.admin .notification_type_new_question { border-left-color: var(--px-green); }

body.admin .notifications .communication {
  background-color: var(--px-paper);
  border: 1px solid var(--px-ink);
  border-left: 4px solid var(--px-blue);
}
body.admin .notifications .ignored {
  background-color: var(--px-paper-2);
  border: 1px solid var(--px-ink-3);
  border-left: 4px solid var(--px-ink-3);
  color: var(--aws-ink-meta);
  box-shadow: none;
}
body.admin .notifications .answered {
  background-color: var(--px-green-soft);
  border: 1px solid var(--px-ink);
  border-left: 4px solid var(--px-green);
}

body.admin .notifications .claim_reply,
body.admin .notifications .ignore_reply,
body.admin .notifications .reply_question_toggle {
  float: right;
  padding-right: 0.75em;
  font-size: 12px;
}
body.admin .notifications .announcement_remove {
  float: right;
  width: auto;
  padding-right: 0.75em;
  font-size: 12px;
  font-weight: 400;
}
body.admin .notifications .announcement_remove a { color: var(--px-red); border-bottom: none; }
body.admin .notifications .announcement_remove a:hover { background: var(--px-red-soft); }
body.admin .reply_question_quick_answer {
  margin-left: 15px;
  font-style: italic;
  text-decoration: underline;
}
body.admin .preserve_line_breaks { white-space: pre-line; }

/* The capacity estimator reuses .notification as a result card, but outside
   any .notifications wrapper, so it needs the box spelled out here. */
body.admin #capacity_result {
  display: block;
  margin: 10px 0;
  padding: 10px 12px;
  font-size: 12.5px;
  background: var(--px-paper);
  border: 1px solid var(--px-ink);
  border-left: 4px solid var(--px-blue);
  box-shadow: var(--px-shadow-sm);
}
body.admin #capacity_result strong { display: block; margin-bottom: 4px; }
body.admin #capacity_result ul { list-style: square; margin: 6px 0 0 18px; }
body.admin #capacity_result li { margin: 2px 0; }

/* ---- Flash / error boxes ----------------------------------------------- */

body.admin .login_error,
body.admin .aws-flash {
  display: block;
  padding: 8px 12px;
  margin: 10px 0;
  font-family: var(--px-font-mono);
  font-size: 12.5px;
  background: var(--px-amber-soft);
  border: 1px solid var(--px-ink);
  border-left: 4px solid var(--px-amber);
  color: var(--px-ink);
}
body.admin .login_error,
body.admin .aws-flash-error,
body.admin #login-content .alert {
  color: var(--px-red);
  background: var(--px-red-soft);
  border-left-color: var(--px-red);
  font-weight: 700;
}

/* ---- Login page -------------------------------------------------------- */

body.admin.login-page {
  display: flex;
  /* A column now: the way-out nav sits above the centred panel rather than
     beside it. The pair is still centred as a group. */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-width: 0;
  box-sizing: border-box;   /* with min-height: 100vh, or the padding scrolls */
  padding: 24px 16px 32px;
}
/* The links back to the public site, and the appearance control. One row,
   links to the left and the theme to the right; on a narrow screen the
   theme wraps onto its own line and stays right. Held to the panel's width
   so the two read as one card. */
body.admin.login-page .login-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  width: 400px;
  max-width: 100%;
  margin: 0 0 14px;
  font-size: 11px;
  letter-spacing: 0.06em;
}
body.admin.login-page .login-nav a {
  color: var(--px-ink-2);
  text-decoration: none;
  border-bottom: 1px solid var(--px-grid);
  white-space: nowrap;
}
body.admin.login-page .login-nav a:hover,
body.admin.login-page .login-nav a:focus-visible {
  color: var(--px-green-2);
  border-bottom-color: var(--px-green-2);
}
/* The sidebar layout of .aws-theme-slot does not apply here: no bottom
   margin, and the buttons sit next to their label instead of being pushed
   to the far end of a full-width column. The auto margin moves to the slot
   itself, which is what holds it against the right edge of the nav row. */
body.admin.login-page .login-theme {
  margin: 0 0 0 auto;
  font-size: 10px;
  color: var(--aws-ink-meta);
}
body.admin.login-page .login-theme .px-theme { margin-left: 0; }
body.admin.login-page #login-content {
  width: 400px;
  padding: 32px 34px 26px;
  background: var(--px-paper);
  border: 1px solid var(--px-ink);
  box-shadow: var(--px-shadow);
}
body.admin.login-page .login-brand {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--aws-ink-meta);
  margin-bottom: 10px;
}
body.admin.login-page #login-content h1 {
  font-family: var(--px-font-display);
  font-size: 30px;
  line-height: 1.1;
  font-weight: 700;
  color: var(--px-ink);
  border: none;
  padding: 0;
  margin: 0;
  -webkit-font-smoothing: none;
  text-rendering: optimizeSpeed;
}
body.admin.login-page .login-tagline {
  font-size: 12px;
  color: var(--aws-ink-meta);
  padding: 6px 0 0;
  margin-bottom: 18px;
}
body.admin.login-page #login-content h4 {
  font-family: var(--px-font-mono);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
}
body.admin.login-page #login-content .section {
  padding: 0 0 12px;
}
body.admin.login-page #login-content .section:last-child {
  float: none;
  clear: both;
  padding-top: 8px;
  border-top: 2px dotted var(--px-grid);
  margin-top: 6px;
}
body.admin.login-page #login-content form label {
  display: flex;
  align-items: center;
  gap: 10px;
}
body.admin.login-page #login-content form label span {
  flex: 0 0 92px;
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--aws-ink-meta);
}
body.admin.login-page #login-content form label input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  padding: 8px 10px;
  font-size: 13px;
}
body.admin.login-page .login-already { font-size: 13px; }

/* ---- Subpage dialog (file viewer / diff) -------------------------------- */

body.admin #subpage_popup {
  background: var(--px-paper);
  border: 1px solid var(--px-ink);
  border-radius: 0;
  box-shadow: var(--px-shadow);
  padding: 20px 22px;
  color: var(--px-ink);
}
body.admin #subpage_popup::backdrop { background: var(--px-scrim); }
body.admin #subpage_close {
  right: 0.75em;
  top: 0.75em;
  margin: 0;
  padding: 2px 9px;
  font-weight: 700;
  line-height: 1.3;
}
body.admin #subpage_content h1 {
  font-family: var(--px-font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--px-ink);
  padding-bottom: 8px;
  margin: 0 0 12px;
}
body.admin #subpage_border { border: none; }

/* ---- jqplot (resource charts) ------------------------------------------ */

/* The plots draw onto a canvas, so only the chrome is themeable. Give each
   one a light card so the series stay legible over the dotted paper. */
body.admin .jqplot-target {
  font-family: var(--px-font-mono);
  font-size: 11px;
  color: var(--px-ink);
  background: var(--px-paper-hi);
  border: 1px solid var(--px-ink);
  box-sizing: content-box;
}
body.admin .jqplot-axis,
body.admin .jqplot-xaxis-tick,
body.admin .jqplot-yaxis-tick {
  font-family: var(--px-font-mono);
  font-size: 10px;
  color: var(--px-ink-2);
}
body.admin .jqplot-table-legend {
  background: var(--px-paper);
  border: 1px solid var(--px-ink);
  border-radius: 0;
}
body.admin .jqplot-table-legend-label {
  font-family: var(--px-font-mono);
  font-size: 10px;
  color: var(--px-ink);
  padding: 0 4px;
}

/* ---- Misc -------------------------------------------------------------- */

body.admin ul.normal_list { list-style: square; list-style-position: outside; padding-left: 1.4em; }
body.admin #core ul { list-style: square; padding-left: 1.4em; margin: 4px 0; }
body.admin #core ul.menu, body.admin #sidebar ul { list-style: none; padding-left: 0; }
body.admin #core li { margin: 2px 0; }

body.admin span.info {
  color: var(--px-on-accent);
  font-size: 10px;
  background-color: var(--px-ink-2);
  border-radius: 0;
  width: 14px;
  height: 14px;
  line-height: 14px;
  font-weight: 700;
  margin: 0 6px 0 0;
  cursor: help;
  vertical-align: middle;
}

body.admin fieldset {
  border: 1px solid var(--px-ink);
  border-radius: 0;
  background: var(--px-paper);
  padding: 12px 14px;
  margin: 0 0 14px;
}
body.admin legend {
  font-family: var(--px-font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border: 1px solid var(--px-ink);
  background: var(--px-paper-3);
}

body.admin .inline { display: inline; }
body.admin .displayed { display: block; }
body.admin .markdown_input { width: 100%; }
body.admin .markdown_preview {
  border: 1px dotted var(--px-grid);
  padding: 6px 8px;
  margin-top: 6px;
}

body.admin details > summary {
  cursor: pointer;
  font-family: var(--px-font-mono);
  font-size: 12.5px;
}
body.admin #diffchooser {
  border: 1px solid var(--px-ink);
  background: var(--px-paper);
  padding: 8px 10px;
  margin-bottom: 10px;
  box-shadow: var(--px-shadow-sm);
}
body.admin #diffchooser > summary { font-weight: 700; }
body.admin #diffchooser input[type="number"] { width: 6em; }

body.admin th.diff-only,
body.admin td.diff-only { display: none; }
body.admin table.diff-open th.diff-only,
body.admin table.diff-open td.diff-only { display: table-cell; }

body.admin .score_details table { font-size: 11.5px; }
body.admin .language-item label { display: block; white-space: nowrap; cursor: pointer; }
body.admin .language-item input[type="checkbox"] { margin-right: 6px; }
body.admin table td.wrapping-options { display: flex; flex-wrap: wrap; width: 100%; }
body.admin table td.wrapping-options label { margin-right: 15px; }

body.admin img[src$="loading.gif"] { image-rendering: pixelated; }


/* ---- Forced colours (Windows High Contrast) ---------------------------- */
/* Focus here is `outline: none` + box-shadow (see .jump_input in base.html and
   the token sheet); box-shadows are not painted in forced-colors mode. */
@media (forced-colors: active) {
  body.admin a:focus-visible,
  body.admin button:focus-visible,
  body.admin input:focus,
  body.admin select:focus,
  body.admin textarea:focus,
  body.admin .jump_input:focus,
  body.admin [tabindex]:focus-visible {
    outline: 2px solid Highlight;
    outline-offset: 2px;
  }
}


/* ---- Contest admins and scheduling ------------------------------------- */
/* Additive only, and every colour comes from the token sheet: a literal here
   would not follow the dark palette, and these rows are read in both. */

/* A value the current admin may see but not change: contest times on the
   General page, the task type on a task page. Deliberately not a disabled
   <input>: a greyed-out field reads as "broken", whereas this reads as
   "shown, not yours". */
body.admin .px-readonly {
  font-family: var(--px-font-mono);
  color: var(--px-ink-2);
  background: var(--px-paper-2);
  border: 1px dashed var(--px-border);
  padding: 1px 6px;
}

/* A short explanatory line above a form, e.g. "you can also set these
   directly on the groups page". */
body.admin .px-note {
  font-size: var(--px-text-sm);
  color: var(--px-meta);
  border-left: 3px solid var(--px-border);
  padding-left: 8px;
  margin: 6px 0;
}

/* The status of a schedule request. Three states, and they must be
   distinguishable without colour -- hence the weight and the border, not a
   coloured word on its own. */
body.admin .schedule_status {
  font-family: var(--px-font-mono);
  font-weight: 700;
  text-transform: uppercase;
  font-size: var(--px-text-sm);
  padding: 1px 6px;
  border: 1px solid var(--px-border);
}
body.admin .schedule_status_pending {
  color: var(--px-amber-text);
  background: var(--px-amber-soft);
}
body.admin .schedule_status_approved {
  color: var(--px-green-2);
  background: var(--px-green-soft);
}
body.admin .schedule_status_rejected {
  color: var(--px-red-2);
  background: var(--px-red-soft);
}

/* Timestamps under a name in the schedule tables. */
body.admin .schedule_muted {
  color: var(--px-meta);
  font-size: var(--px-text-sm);
}

/* Approve / Reject sit under their note box rather than beside it: the two
   buttons are destructive-ish and a wide row makes it easy to hit the wrong
   contest's. */
body.admin .schedule_decision textarea {
  font-family: var(--px-font-mono);
  font-size: var(--px-text-sm);
  width: 100%;
  box-sizing: border-box;
}
body.admin .schedule_decision button {
  margin-top: 4px;
  margin-right: 4px;
}

/* -------------------------------------------------------------------------
   Booking intake (/schedule): the month grid and the create-contest form
   -------------------------------------------------------------------------
   The grid is the same data structure the public page draws
   (cms/server/schedule_calendar.py); only the skin differs. Tokens only --
   a literal cannot follow the dark-theme swap.
   ---------------------------------------------------------------------- */

body.admin .schedule_cal_head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
body.admin .schedule_cal_month {
  font-family: var(--px-font-display);
  font-size: 15px;
  flex: 1 1 auto;
  text-align: center;
  -webkit-font-smoothing: none;
}
body.admin .schedule_cal_nav {
  font-family: var(--px-font-mono);
  font-size: var(--px-text-sm);
  white-space: nowrap;
}
body.admin table.schedule_cal { table-layout: fixed; width: 100%; }
body.admin td.schedule_cal_cell {
  vertical-align: top;
  height: 58px;
  padding: 3px 4px 5px;
  /* The day panel is absolutely positioned against this. */
  position: relative;
}
body.admin td.schedule_cal_out { background: var(--px-paper-2); }
body.admin td.schedule_cal_out .schedule_cal_daynum { color: var(--px-ink-3); }
body.admin td.schedule_cal_today {
  box-shadow: inset 0 0 0 2px var(--px-green);
}
body.admin .schedule_cal_daynum {
  display: block;
  font-family: var(--px-font-mono);
  font-size: var(--px-text-sm);
  color: var(--px-ink-2);
  margin-bottom: 2px;
}
body.admin .schedule_cal_taken,
body.admin .schedule_cal_pending {
  display: block;
  font-family: var(--px-font-mono);
  font-size: 11px;
  line-height: 1.3;
  padding: 1px 3px;
  margin-bottom: 2px;
  overflow-wrap: anywhere;
}
body.admin .schedule_cal_taken {
  background: var(--px-green-soft);
  color: var(--px-ink);
}
/* A pending day is a count and nothing else, here as on the public page. */
body.admin .schedule_cal_pending {
  background: var(--px-amber-soft);
  color: var(--px-amber-text);
  font-style: italic;
}

/* How much of a day is booked. Mirrors the public page's .host_cal_load
   (macro/calendar.html there, macro/calendar.html here) because the two
   servers load templates from their own packages and cannot share one --
   what they do share is the arithmetic, in schedule_calendar.py. The bar
   is the glance and the hours beside it are the answer: colour is never
   the only signal. --fill is the one inline style, and it carries a
   number, not a colour. */
body.admin .schedule_cal_note { margin: 0 0 6px; }
body.admin .schedule_cal_load {
  display: block;
  margin: 0 0 3px;
}
body.admin .schedule_cal_load_track {
  display: flex;
  height: 8px;
  border: 1px solid var(--px-ink-3);
  background: var(--px-paper-3);
  overflow: hidden;
}
body.admin .schedule_cal_load_fill {
  display: block;
  width: var(--fill, 0%);
  height: 100%;
  flex: none;
}
body.admin .schedule_cal_load_approved { background: var(--px-green); }
/* Hatched rather than merely paler: "asked for" is a different fact from
   "taken", and a pattern says so without asking the eye to tell two
   greens apart. */
body.admin .schedule_cal_load_pending {
  background: repeating-linear-gradient(
      45deg,
      var(--px-amber) 0, var(--px-amber) 3px,
      var(--px-amber-soft) 3px, var(--px-amber-soft) 6px);
}
body.admin .schedule_cal_load_text {
  display: block;
  font-family: var(--px-font-mono);
  font-size: 10px;
  line-height: 1.3;
  color: var(--px-ink-2);
  margin-top: 1px;
}
body.admin td.schedule_cal_full .schedule_cal_load_text {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* The day panel, mirroring .host_cal_panel on the public page. A native
   <details>: the cell is the summary, so it opens on click, on Enter and on
   Space with no script, and aws_utils.js only adds the manners.

   It is absolutely positioned against the cell. #core sets overflow-x:auto
   and is therefore a clip in both axes; the right-hand columns open
   leftwards so nothing is cut off sideways, and downwards there is always
   the rest of the page (the intake, pending and agenda sections) below the
   calendar. */
body.admin .schedule_cal_details { display: block; }
body.admin .schedule_cal_summary {
  display: block;         /* not list-item: the marker would eat the cell */
  list-style: none;
  cursor: pointer;
}
body.admin .schedule_cal_summary::-webkit-details-marker { display: none; }
/* A caret, so a cell looks like something that opens. Decoration: the
   accessible name is the summary's aria-label. It inherits the day
   number's colour, which is a measured pair. */
body.admin .schedule_cal_summary .schedule_cal_daynum::after {
  content: " \25B8";
}
body.admin .schedule_cal_details[open] .schedule_cal_summary
    .schedule_cal_daynum::after {
  content: " \25BE";
}
body.admin .schedule_cal_summary:hover .schedule_cal_daynum {
  color: var(--px-ink);
}
body.admin .schedule_cal_summary:focus-visible {
  outline: none;
  box-shadow: var(--px-focus);
}
/* Every cell is positioned, so the open one has to be lifted or the panel
   slides under the cells that come after it. */
body.admin .schedule_cal_details[open] {
  position: relative;
  z-index: 5;
}
body.admin .schedule_cal_panel {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 5;
  width: 230px;
  max-width: calc(100vw - 24px);
  box-sizing: border-box;
  margin-top: 2px;
  padding: 8px 10px 9px;
  text-align: left;
  cursor: auto;
  background: var(--px-paper);
  border: 1px solid var(--px-ink);
  box-shadow: var(--px-shadow);
  font-family: var(--px-font-mono);
  font-size: 11px;
  line-height: 1.45;
  color: var(--px-ink);
  white-space: normal;
}
body.admin .schedule_cal_panel_left {
  left: auto;
  right: 0;
}
body.admin .schedule_cal_panel_day {
  margin: 0 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--px-grid);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--px-ink-2);
}
body.admin .schedule_cal_panel_list {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
}
body.admin .schedule_cal_panel_item {
  display: block;
  margin: 0 0 3px;
  padding: 2px 4px;
  border: 1px solid var(--px-grid);
  overflow-wrap: anywhere;
}
body.admin .schedule_cal_panel_time {
  display: block;
  font-variant-numeric: tabular-nums;
}
body.admin .schedule_cal_panel_what { display: block; }
/* The link at the request keeps the row's own ink rather than the admin
   link green: green on the amber tint of a pending row is not one of the
   pairs check_contrast.py measures, and the underline is the affordance
   here anyway. */
body.admin .schedule_cal_panel_item a {
  color: inherit;
  text-decoration: underline;
}
body.admin .schedule_cal_panel_status,
body.admin .schedule_cal_panel_who {
  display: block;
  font-size: 10px;
}
body.admin .schedule_cal_panel_taken {
  background: var(--px-green-soft);
  color: var(--px-ink);
}
/* Only this page names a pending booking: it is PERMISSION_ALL and its
   calendar is built with include_private=True. The public one is not. */
body.admin .schedule_cal_panel_requested {
  background: var(--px-amber-soft);
  color: var(--px-amber-text);
}
body.admin .schedule_cal_panel_requested .schedule_cal_panel_status {
  font-style: italic;
}
body.admin .schedule_cal_panel_free {
  margin: 0;
  color: var(--px-green);
}
body.admin .schedule_cal_panel_none,
body.admin .schedule_cal_panel_empty {
  margin: 0;
  color: var(--aws-ink-meta);
}

@media (forced-colors: active) {
  /* Forced colours repaint every background as Canvas and would empty the
     bar. The words beside it still carry the meaning, but an always-empty
     bar is worse than none, so paint these in system colours. */
  body.admin .schedule_cal_summary:focus-visible {
    outline: 2px solid Highlight;
    outline-offset: 2px;
  }
  body.admin .schedule_cal_load_track { border-color: CanvasText; }
  body.admin .schedule_cal_load_approved {
    forced-color-adjust: none;
    background: Highlight;
  }
  body.admin .schedule_cal_load_pending {
    forced-color-adjust: none;
    background: repeating-linear-gradient(
        45deg, Highlight 0, Highlight 2px, Canvas 2px, Canvas 5px);
  }
}

/* The create-contest form: label above field, wrapped, so the six inputs
   stay readable next to the booking they belong to. */
body.admin .schedule_intake_form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: flex-end;
  margin: 6px 0 10px;
}
body.admin .schedule_intake_form label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: var(--px-font-mono);
  font-size: var(--px-text-sm);
  color: var(--px-ink-2);
}
body.admin .schedule_intake_form textarea { width: 260px; }
body.admin table.schedule_intake { margin-bottom: 6px; }

/* The one-time password notice. Loud on purpose: reloading the page does
   not bring the password back. */
body.admin .schedule_once {
  border: 1px solid var(--px-ink);
  border-left: 5px solid var(--px-amber);
  background: var(--px-amber-soft);
  color: var(--px-ink);
  padding: 11px 13px;
  margin: 0 0 16px;
  line-height: 1.55;
}
body.admin textarea.schedule_block {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--px-font-mono);
  font-size: 13px;
  line-height: 1.5;
  background: var(--px-field-bg);
  color: var(--px-ink);
  border: 1px solid var(--px-ink);
  padding: 10px 12px;
}
