/* Dark ops console — overrides Django admin's CSS variables (Django >= 4.2).
   The palette is applied for every value of html[data-theme] so Django's own
   light/dark/auto switching never leaks its default colours in. */
:root, html[data-theme="light"], html[data-theme="dark"], html[data-theme="auto"] {
  --primary: #3d7bff; --secondary: #15171c; --accent: #8db2ff; --primary-fg: #fff;
  --body-fg: #f4f5f7; --body-bg: #0b0c0f; --body-quiet-color: #9a9ea8; --body-medium-color: #c3c6cd; --body-loud-color: #fff;
  --header-color: #f4f5f7; --header-branding-color: #f4f5f7; --header-bg: #15171c; --header-link-color: #f4f5f7;
  --breadcrumbs-fg: #9a9ea8; --breadcrumbs-bg: #0b0c0f; --breadcrumbs-link-fg: #8db2ff;
  --link-fg: #8db2ff; --link-hover-color: #b9d0ff; --link-selected-fg: #3d7bff;
  --hairline-color: #262931; --border-color: #262931;
  --error-fg: #ff5c5c; --message-success-bg: #12301f; --message-warning-bg: #3a2f10; --message-error-bg: #3a1717;
  --darkened-bg: #15171c; --selected-bg: #15233f; --selected-row: #15233f;
  --button-fg: #fff; --button-bg: #3d7bff; --button-hover-bg: #2f6af0; --default-button-bg: #3d7bff; --default-button-hover-bg: #2f6af0;
  --close-button-bg: #262931; --close-button-hover-bg: #3a3e47; --delete-button-bg: #ff5c5c; --delete-button-hover-bg: #e64b4b;
  --object-tools-fg: #fff; --object-tools-bg: #262931; --object-tools-hover-bg: #3d7bff;
  --font-family-primary: "Inter Tight", "IBM Plex Sans Arabic", system-ui, sans-serif;
  /* project tokens */
  --panel-bg: #15171c; --panel-bg-2: #1c1e24; --panel-bg-3: #121419; --radius: 14px; --radius-sm: 10px;
  --ok: #2fbf71; --warn: #f5b731; --bad: #ff5c5c; --muted: #6b6f78;
  --chart-cancelled: #e5484d; /* checked against #3d7bff on the panel surface for colour-blind separation */
}
html { color-scheme: dark; }
.theme-toggle { display: none; } /* single-theme console: the toggle would do nothing */

/* ---------- header ---------- */
#header { border-bottom: 1px solid var(--hairline-color); }
#branding h1 { font-weight: 600; letter-spacing: -.01em; }
#branding h1 small { font-size: .6em; opacity: .7; letter-spacing: .08em; margin-inline-start: 6px; }
#user-tools { display: flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 400; text-transform: none; letter-spacing: 0; color: #9a9ea8; }
#user-tools strong { color: #f4f5f7; font-weight: 600; }
#user-tools .lang-form { display: inline; }
#user-tools .lang-form select { padding: 4px 8px !important; font-size: 12px; min-height: 0; }
/* each tool is a quiet pill; the slashes Django prints between them are hidden */
#user-tools a, #user-tools #logout-form button { display: inline-block; padding: 5px 10px; border-radius: 8px; border: 0; background: none;
  color: #c3c6cd; font: inherit; font-size: 13px; text-transform: none; letter-spacing: 0; text-decoration: none; cursor: pointer; margin: 0; }
#user-tools .welcome { margin-inline-end: 6px; }
#user-tools a:hover, #user-tools a:focus, #user-tools #logout-form button:hover { background: #262931; color: #fff; text-decoration: none; }
#user-tools #logout-form { display: inline; }
/* breadcrumbs: a quiet trail under the header. Fully defined here (list style, separators, colours), so the
   row never depends on Django's own stylesheet — a browser holding an older copy of it showed a numbered list. */
nav ol.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; list-style: none; margin: 0; padding: 10px 40px;
  background: var(--body-bg); border-bottom: 1px solid #1f2229; font-size: 13px; color: #9a9ea8; }
nav ol.breadcrumbs li { display: inline-flex; align-items: center; padding: 0; font-size: 13px; }
nav ol.breadcrumbs li::after, nav ol.breadcrumbs li:not([aria-current="page"])::after { content: "\203A"; margin: 0 9px; color: var(--muted); font-size: 15px; line-height: 1; }
[dir="rtl"] nav ol.breadcrumbs li::after, [dir="rtl"] nav ol.breadcrumbs li:not([aria-current="page"])::after { content: "\2039"; } /* generated text isn't bidi-mirrored */
nav ol.breadcrumbs li[aria-current="page"]::after, nav ol.breadcrumbs li:last-child::after { content: none; }
nav ol.breadcrumbs li[aria-current="page"], nav ol.breadcrumbs li:last-child { color: #f4f5f7; font-weight: 500; }
/* #container outranks Django 6.1's a:not(#content-main.app-list a, …) underline rule, whose :not() carries that ID's weight */
#container nav ol.breadcrumbs a:is(:link, :visited) { color: #9a9ea8; text-decoration: none; padding: 3px 6px; margin: 0 -6px; border-radius: 6px; }
#container nav ol.breadcrumbs a:hover, #container nav ol.breadcrumbs a:focus { color: #fff; background: #262931; text-decoration: none; }
#content > h1, #content h1 { font-size: 22px; font-weight: 600; letter-spacing: -.02em; color: #f4f5f7; margin: 0 0 18px; }
.hdr-badges { display: flex; gap: 12px; align-items: center; }
.hdr-badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.hdr-badge::before { content: "● "; }
/* id+class beats Django's "#header a:link" so the badge keeps its own colour */
#header a.hdr-badge.bad { color: var(--bad); background: #3a1717; }
#header a.hdr-badge.warn { color: var(--warn); background: #3a2f10; }

/* Django 6.1 underlines content links for accessibility; keep that for text links but not for pill-style components */
/* the upstream rule scores (1,1,2) because of "#content-main.app-list a" inside :not(); these score (1,2,2) */
#content-main div.states a:is(:link, :visited), #content-main div.attn a:is(:link, :visited),
#content-main div.kpi a:is(:link, :visited), #content-main p.paginator a:is(:link, :visited) { text-decoration: none; }
#content-main div.attn a:hover, #content-main div.states a:hover { text-decoration: underline; }

/* ---------- sidebar ---------- */
/* even spacing between groups, and the "+ Add" links only on the row under the pointer, so the menu reads as a list of places */
#nav-sidebar .module { margin-bottom: 10px; }
#nav-sidebar .module caption { padding-block: 9px; }
#nav-sidebar .module th, #nav-sidebar .module td { padding-block: 7px; }
#nav-sidebar .module tr .addlink { opacity: 0; transition: opacity .15s; }
#nav-sidebar .module tr:hover .addlink, #nav-sidebar .module .addlink:focus { opacity: 1; }

/* ---------- modules, lists, forms ---------- */
.module h2, .module caption, .inline-group h2 { background: var(--panel-bg-2); color: #9a9ea8; text-transform: uppercase; letter-spacing: .08em; font-size: 11px; }
.module, fieldset.module, #changelist, #changelist-filter { background: var(--panel-bg); border: 1px solid #262931; border-radius: var(--radius); }
#changelist { gap: 16px; }
#toolbar { padding: 12px 16px; border-bottom: 1px solid #262931; background: transparent; border-radius: var(--radius) var(--radius) 0 0; }
#changelist-search > div { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#changelist-search label { display: flex; align-items: center; margin: 0; } #changelist-search label img { opacity: .5; }
#searchbar { min-width: min(320px, 60vw); }
#changelist-search .small.quiet { color: var(--muted); font-size: 12px; } #changelist-search .small.quiet a { color: #8db2ff; }
/* date hierarchy: a label and chips */
.toplinks { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 10px 16px; border-bottom: 1px solid #262931; font-size: 12.5px; color: var(--muted); }
#content-main .toplinks a:is(:link, :visited) { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--panel-bg-2); color: #c3c6cd; font-weight: 500; text-decoration: none; }
#content-main .toplinks a:hover { background: #262931; color: #fff; text-decoration: none; } #content-main .toplinks a.date-back:is(:link, :visited) { color: #8db2ff; }
.actions { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: transparent; border-bottom: 1px solid #262931; border-radius: 0; }
.actions label { display: inline-flex; align-items: center; gap: 8px; color: #9a9ea8; font-size: 13px; }
.actions select { min-width: 220px; } .actions .action-counter { color: var(--muted); font-size: 12.5px; }
#changelist table { font-size: 13.5px; }
#changelist table thead th { background: transparent; color: #9a9ea8; text-transform: uppercase; letter-spacing: .08em; font-size: 11px; padding: 10px 12px; }
#changelist table thead th { white-space: nowrap; }
#changelist table thead th .text { display: inline-block; vertical-align: middle; } #changelist table thead th .text a { color: inherit; padding: 0; }
#changelist table thead th.sorted { color: #f4f5f7; } #changelist table thead th.sorted .text { padding-inline-end: 0; }
#changelist table thead th .sortoptions { display: inline-flex; align-items: center; gap: 4px; float: none; vertical-align: middle; padding: 0; margin-inline-start: 6px; }
#changelist table thead th .clear { display: none; }
#changelist .results { overflow-x: auto; }
#changelist table tbody th, #changelist table tbody td { padding: 11px 12px; border-bottom: 1px solid #1f2229; vertical-align: middle; }
#changelist table tbody tr:hover { background: #181b21; }
.row1 { background: transparent; } .row2 { background: transparent; }
/* the row's own links are the row; only underline on hover */
#content-main #changelist table tbody a:is(:link, :visited) { color: #f4f5f7; text-decoration: none; font-weight: 500; }
#content-main #changelist table tbody a:hover { color: #8db2ff; text-decoration: underline; }
/* footer: page numbers as quiet chips in one row, the count beside them, and (with editable rows) Save at the end.
   Django gives the page links role="button" and paints them as blue buttons; #changelist outranks that. */
#changelist .changelist-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 16px; margin: 0;
  border-top: 1px solid #262931; background: transparent; }
#content-main #changelist .changelist-footer .paginator, #content-main #changelist .paginator { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
  flex: 1 1 auto; margin: 0; padding: 0; border: 0; background: transparent; font-size: 13px; line-height: 1.4; color: #9a9ea8; }
#changelist .paginator ul { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
#changelist .paginator li { display: block; margin: 0; padding: 0; color: var(--muted); }
#changelist .paginator a:is(:link, :visited), #changelist .paginator a[role="button"] { display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 7px; background: transparent; color: #c3c6cd; font-weight: 500;
  font-variant-numeric: tabular-nums; text-decoration: none; }
#changelist .paginator a:hover { background: var(--panel-bg-2); color: #fff; }
#changelist .paginator a[aria-current="page"], #changelist .paginator .this-page { background: #15233f; color: #8db2ff; font-weight: 600; cursor: default; }
#changelist .paginator .showall { color: #8db2ff; }
#changelist .changelist-footer input[type=submit] { margin-inline-start: auto; }
.paginator a:link, .paginator a:visited { padding: 4px 9px; border-radius: 6px; color: #c3c6cd; } .paginator a:hover { background: var(--panel-bg-2); color: #fff; }
#changelist .actions.selected { background: #15233f; }

/* filter bar: the search box and one dropdown per filter in a row above the results.
   Django's changelists.css loads after this file, so its #changelist-filter rules are outranked with #content-main. */
.list-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px 16px; border-bottom: 1px solid #262931; }
.list-tools #toolbar { padding: 0; border: 0; border-radius: 0; flex: 0 1 auto; }
#content-main #changelist-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1 1 auto; order: 0; min-width: 0;
  margin: 0; padding: 0; background: none; border: 0; }
#content-main #changelist .changelist-form-container:has(#changelist-filter) > div { max-width: 100%; width: 100%; }
#content-main #changelist-filter .flt { position: relative; margin: 0; }
#content-main #changelist-filter .flt > summary { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; margin: 0;
  border: 1px solid #343842; border-radius: var(--radius-sm); background: var(--panel-bg-2); color: #c3c6cd; font-size: 13px; font-weight: 500;
  white-space: nowrap; cursor: pointer; list-style: none; transition: background .15s, border-color .15s; }
#content-main #changelist-filter .flt > summary::-webkit-details-marker { display: none; }
#content-main #changelist-filter .flt > summary::before { display: none; content: none; }
#content-main #changelist-filter .flt > summary::after { content: ""; width: 6px; height: 6px; margin-inline-start: 2px; margin-top: -3px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); opacity: .7; }
#content-main #changelist-filter .flt > summary:hover, #content-main #changelist-filter .flt[open] > summary { background: #262931; border-color: #3f444e; color: #fff; }
/* a filter with a value chosen reads "Status: Open" and turns blue, so the active filters are visible at a glance */
#content-main #changelist-filter .flt-value { color: #fff; font-weight: 600; }
#content-main #changelist-filter .flt:has(.flt-value) > summary { background: #15233f; border-color: #3d7bff; color: #8db2ff; }
#content-main #changelist-filter .flt:has(.flt-value) > summary .flt-title::after { content: ":"; }
#content-main #changelist-filter .flt > ul { position: absolute; top: calc(100% + 6px); inset-inline-start: 0; z-index: 30; min-width: 200px; max-width: 320px;
  max-height: 320px; overflow: auto; margin: 0; padding: 6px; list-style: none; background: #1c1e24; border: 1px solid #343842; border-radius: 10px;
  box-shadow: 0 14px 36px #000a; }
#content-main #changelist-filter .flt li { margin: 0; padding: 0; border: 0; list-style: none; }
#content-main #changelist-filter .flt li a:is(:link, :visited) { display: block; padding: 7px 10px; border-radius: 7px; color: #c3c6cd; font-size: 13px;
  text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#content-main #changelist-filter .flt li a:hover { background: #262931; color: #fff; }
#content-main #changelist-filter .flt li.selected a:is(:link, :visited) { background: #15233f; color: #8db2ff; font-weight: 600; }
#content-main #changelist-filter .flt-clear:is(:link, :visited), #content-main #changelist-filter .flt-counts:is(:link, :visited) {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 10px; border-radius: var(--radius-sm); font-size: 12.5px; text-decoration: none; }
#content-main #changelist-filter .flt-clear:is(:link, :visited) { color: var(--bad); } #content-main #changelist-filter .flt-clear:hover { background: #2a1414; }
#content-main #changelist-filter .flt-counts:is(:link, :visited) { color: var(--muted); margin-inline-start: auto; } #content-main #changelist-filter .flt-counts:hover { color: #c3c6cd; }

input:not([type=submit]):not([type=button]):not([type=reset]):not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  background: var(--panel-bg-2) !important; color: #f4f5f7 !important; border: 1px solid #2e313a !important; border-radius: var(--radius-sm) !important;
  min-height: 36px; padding: 6px 12px; font-size: 13.5px; }
textarea { min-height: 0; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: #3d7bff !important; box-shadow: 0 0 0 3px #15233f; outline: 0; }
input[type=checkbox], input[type=radio] { accent-color: #3d7bff; width: 16px; height: 16px; margin: 0; }
.select2-container .select2-selection--single, .select2-container--admin-autocomplete .select2-selection--single {
  background: var(--panel-bg-2); border: 1px solid #2e313a; border-radius: var(--radius-sm); height: 36px; }

/* ---------- buttons: one shape everywhere; blue only for the main action of a page ---------- */
.button, input[type=submit], input[type=button], .submit-row input, .submit-row a, a.button, .object-tools a, .object-tools button,
.actions .button, #changelist-search input[type=submit], .login .submit-row input {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px; box-sizing: border-box;
  border: 1px solid #343842; border-radius: var(--radius-sm); background: var(--panel-bg-2); color: #f4f5f7;
  font: 600 13px/1 var(--font-family-primary); text-transform: none; letter-spacing: 0; text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s; float: none; }
.button:hover, input[type=submit]:hover, input[type=button]:hover, .submit-row input:hover, .submit-row a:hover, a.button:hover,
.object-tools a:hover, .object-tools button:hover, .object-tools a:focus, .actions .button:hover { background: #262931; border-color: #3f444e; color: #fff; }
.button.default, input[type=submit].default, .submit-row input.default, .login .submit-row input, .object-tools a.addlink {
  background: #3d7bff; border-color: #3d7bff; color: #fff; }
.button.default:hover, input[type=submit].default:hover, .submit-row input.default:hover, .login .submit-row input:hover, .object-tools a.addlink:hover {
  background: #2f6af0; border-color: #2f6af0; }
.submit-row a.deletelink, .submit-row a.deletelink:link, .submit-row a.deletelink:visited { background: #2a1414; border-color: #4a1f1f; color: var(--bad); }
.submit-row a.deletelink:hover { background: #3a1717; border-color: #6a2a2a; color: #ff7b7b; }
.submit-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; background: var(--panel-bg); border: 1px solid #262931; border-radius: var(--radius); }
.submit-row a.deletelink { margin-inline-start: auto; }
.object-tools { display: flex; gap: 8px; }
.object-tools li { display: block; } .object-tools li + li { margin: 0; }
.object-tools a, .object-tools a:link, .object-tools a:visited { display: inline-flex; padding: 0 14px; font-size: 13px; background-image: none; }
.object-tools a.addlink::before { content: "+"; font-size: 16px; line-height: 1; margin-top: -1px; }
.object-tools form { display: inline; }
.paginator .this-page { background: #15233f; color: #8db2ff; border-radius: 6px; padding: 4px 9px; }
/* related-object icons (add / change / delete / view) are Django's saturated defaults; mute them until hovered */
.related-widget-wrapper-link img { filter: grayscale(1) brightness(1.7); opacity: .45; transition: opacity .15s, filter .15s; }
.related-widget-wrapper-link:hover img, .related-widget-wrapper-link:focus img { filter: none; opacity: 1; }
/* tabular inlines: drop the redundant "<object repr>" caption above each row */
.inline-group .tabular td.original p { display: none; }
.inline-group .tabular tr.has_original td { padding-top: 8px; }


/* ---------- messages: one banner shape with a coloured mark, instead of Django's icon backgrounds ---------- */
ul.messagelist { margin: 0 0 16px; padding: 0; }
ul.messagelist li, ul.messagelist li.success, ul.messagelist li.warning, ul.messagelist li.error, ul.messagelist li.info {
  position: relative; margin: 0 0 8px; padding: 12px 16px 12px 46px; border-radius: var(--radius-sm); border: 1px solid #262931;
  background: var(--panel-bg); background-image: none; color: #f4f5f7; font-size: 13.5px; line-height: 1.45; }
[dir="rtl"] ul.messagelist li { padding: 12px 46px 12px 16px; }
ul.messagelist li::before { content: "i"; position: absolute; inset-inline-start: 14px; top: 11px; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; font-style: normal; background: #15233f; color: #8db2ff; }
ul.messagelist li.success { border-color: #1f4a31; background: #12301f; } ul.messagelist li.success::before { content: "✓"; background: var(--ok); color: #0b0c0f; }
ul.messagelist li.warning { border-color: #5a4716; background: #3a2f10; } ul.messagelist li.warning::before { content: "!"; background: var(--warn); color: #0b0c0f; }
ul.messagelist li.error { border-color: #5a2424; background: #3a1717; } ul.messagelist li.error::before { content: "!"; background: var(--bad); color: #fff; }
ul.messagelist li a { color: inherit; font-weight: 600; }
.errornote { border-radius: var(--radius-sm); border: 1px solid #5a2424; background: #3a1717; color: #ff7b7b; padding: 12px 16px; font-size: 13.5px; }
ul.errorlist { margin: 4px 0 0; padding: 0; list-style: none; color: var(--bad); font-size: 12.5px; }
.form-row.errors, .flex-container.errors input, .flex-container.errors select, .flex-container.errors textarea { border-color: var(--bad) !important; }

/* status pills rendered by admin display functions */
.pill { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-open { background: #15233f; color: #3d7bff; } .pill-full { background: #15233f; color: #8db2ff; }
.pill-in_progress { background: #12301f; color: var(--ok); } .pill-finished { background: #3a2f10; color: var(--warn); }
.pill-closed { background: var(--panel-bg-2); color: #9a9ea8; } .pill-cancelled { background: #3a1717; color: var(--bad); }
.rel-ok { color: var(--ok); font-weight: 600; } .rel-warn { color: var(--warn); font-weight: 600; } .rel-bad { color: var(--bad); font-weight: 600; }
.badge-unreliable { background: #3a1717; color: var(--bad); font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.muted { color: var(--muted); }

/* ---------- dashboard ---------- */
/* Django pins the dashboard to a 600px column with a floated 260px sidebar; use the full width instead. */
.dashboard #content { width: auto; }
.dashboard .colMS { margin-right: 0; }
.dashboard #content-main { float: none; width: auto; }
.ov-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.ov-head h2 { margin: 0; font-size: 13px; font-weight: 600; color: #9a9ea8; text-transform: uppercase; letter-spacing: .08em; }
.range-form select { padding: 4px 10px; font-size: 13px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpi { background: var(--panel-bg); border: 1px solid #262931; border-radius: var(--radius); padding: 16px 18px; }
.kpi { display: flex; flex-direction: column; gap: 10px; }
.kpi .label { font-size: 12.5px; color: #c3c6cd; font-weight: 500; }
.kpi .value { font-size: 32px; font-weight: 600; letter-spacing: -.03em; line-height: 1; }
.kpi .bar { position: relative; height: 6px; background: var(--panel-bg-2); border-radius: 3px; }
.kpi .bar i { display: block; height: 100%; max-width: 100%; border-radius: 3px; }
/* the target: a hairline tick across the track, so "how far from target" reads without the label */
.kpi .bar .target { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-inline-start: -1px; background: #c3c6cd; border-radius: 1px; }
.kpi-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.kpi-foot .status { font-weight: 600; } .kpi-foot .status.ok { color: var(--ok); } .kpi-foot .status.bad { color: var(--bad); }
.kpi-foot .status.none { color: var(--muted); font-weight: 500; }
.kpi .bar .ok { background: var(--ok); } .kpi .bar .bad { background: var(--bad); }
.kpi .sub { font-size: 11.5px; color: var(--muted); border-top: 1px solid #262931; padding-top: 10px; margin-top: auto; }
.ov-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-bottom: 12px; }
.panel { background: var(--panel-bg); border: 1px solid #262931; border-radius: var(--radius); padding: 18px; min-width: 0; }
.panel h3 { margin: 0 0 12px; font-size: 14px; font-weight: 600; color: #f4f5f7; background: none; padding: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; }
.legend > span { white-space: nowrap; }
.legend { display: flex; gap: 12px; font-size: 11px; color: #9a9ea8; font-weight: 400; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-inline-end: 5px; vertical-align: 0; }
.legend b { color: #f4f5f7; font-weight: 600; margin-inline-start: 2px; }
.legend .p { background: #3d7bff; } .legend .c { background: var(--chart-cancelled); }
/* daily columns: thin marks (≤24px) from one baseline, a 2px surface gap between stacked parts, 4px rounded top */
.chart { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
.y-axis { display: flex; flex-direction: column; justify-content: space-between; height: 180px; font-size: 11px; color: var(--muted);
  font-variant-numeric: tabular-nums; text-align: end; transform: translateY(-6px); }
.y-axis span:last-child { transform: translateY(12px); }
.funnel { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 180px; border-bottom: 1px solid #2e313a;
  background: linear-gradient(#22252c, #22252c) top / 100% 1px no-repeat, linear-gradient(#1d2026, #1d2026) center / 100% 1px no-repeat; }
.funnel > div { position: relative; flex: 1; max-width: 24px; margin: 0 auto; display: flex; flex-direction: column; justify-content: flex-end;
  gap: 2px; height: 100%; border-radius: 4px 4px 0 0; outline: 0; cursor: default; }
.funnel > div > span { display: block; min-height: 2px; }
.funnel > div > span:first-child { border-radius: 4px 4px 0 0; }
.funnel .p { background: #3d7bff; } .funnel .c { background: var(--chart-cancelled); }
.funnel > div:hover, .funnel > div:focus-visible { background: #ffffff0d; }
/* hover / focus readout for one day; the same numbers are in each column's aria-label */
.funnel > div[data-tip]:hover::after, .funnel > div[data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 5;
  white-space: nowrap; font-size: 12px; color: #f4f5f7; background: #23262e; border: 1px solid #343842;
  padding: 6px 9px; border-radius: 8px; box-shadow: 0 6px 18px #0008; pointer-events: none; }
.funnel > div:nth-child(-n+6)[data-tip]:hover::after, .funnel > div:nth-child(-n+6)[data-tip]:focus-visible::after { left: 0; transform: none; }
.funnel > div:nth-last-child(-n+6)[data-tip]:hover::after, .funnel > div:nth-last-child(-n+6)[data-tip]:focus-visible::after { left: auto; right: 0; transform: none; }
[dir="rtl"] .funnel > div:nth-child(-n+6)[data-tip]:hover::after, [dir="rtl"] .funnel > div:nth-child(-n+6)[data-tip]:focus-visible::after { left: auto; right: 0; }
[dir="rtl"] .funnel > div:nth-last-child(-n+6)[data-tip]:hover::after, [dir="rtl"] .funnel > div:nth-last-child(-n+6)[data-tip]:focus-visible::after { right: auto; left: 0; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); font-size: 13px; }
.funnel-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; padding-inline-start: 22px; }
.states a { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; margin: 0 -8px; border-radius: 8px; color: inherit; }
.states a:hover { background: var(--panel-bg-2); }
.states b { font-variant-numeric: tabular-nums; } .states a.zero b { color: var(--muted); font-weight: 500; }
.dist-row { display: grid; grid-template-columns: 170px 1fr 40px; gap: 10px; align-items: center; font-size: 13px; margin: 6px 0; }
.dist-row > a { color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dist-row > a:hover { color: #3d7bff; }
.place-crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); margin: -4px 0 10px; }
.place-crumbs a { color: #3d7bff; } .place-crumbs .sep { color: var(--muted); }
.dist-bar { height: 8px; background: var(--panel-bg-2); border-radius: 4px; overflow: hidden; }
.dist-bar i { display: block; height: 100%; background: #3d7bff; border-radius: 4px; }
.dist-row .n { text-align: end; color: #9a9ea8; font-variant-numeric: tabular-nums; }
.attn a { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #262931; color: inherit; }
.attn i, .all-clear i { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  font-style: normal; font-size: 12px; font-weight: 700; background: #3a2f10; color: var(--warn); }
.attn .attn-report i, .attn .attn-risk i { background: #3a1717; color: var(--bad); }
.all-clear { display: flex; align-items: center; gap: 10px; color: #9a9ea8; }
.all-clear i { background: #12301f; color: var(--ok); }
.panel h3 .count { font-size: 11px; font-weight: 600; color: var(--warn); background: #3a2f10; padding: 2px 8px; border-radius: 999px; }
.attn a:last-child { border-bottom: 0; }
.panel-stack { display: grid; gap: 12px; align-content: start; min-width: 0; }
.ov-grid-top { align-items: start; } /* panels keep their own height instead of stretching to the tallest */
#recent-actions-module .actionlist { margin: 0; padding: 0; list-style: none; font-size: 13px; }
#recent-actions-module .actionlist li { position: relative; display: grid; gap: 2px; padding: 8px 0 8px 16px; border-bottom: 1px solid #262931; background: none; }
#recent-actions-module .actionlist li::before { content: ""; position: absolute; inset-inline-start: 0; top: 14px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
#recent-actions-module .actionlist li.added::before { background: var(--ok); } #recent-actions-module .actionlist li.deleted::before { background: var(--bad); }
[dir="rtl"] #recent-actions-module .actionlist li { padding: 8px 16px 8px 0; }
#content-main #recent-actions-module .what a:is(:link, :visited), #content-main .dist-row > a:is(:link, :visited) { text-decoration: none; color: #f4f5f7; }
#content-main #recent-actions-module .what a:hover, #content-main .dist-row > a:hover { color: #8db2ff; text-decoration: underline; }
#recent-actions-module .actionlist li:last-child { border-bottom: 0; }
#recent-actions-module .mini.quiet { font-size: 11px; color: var(--muted); }

/* ---------- report change form: chat context ---------- */
.ctx { padding: 14px; }
.ctx-msg { display: flex; gap: 8px; font-size: 13px; margin: 6px 0; padding: 4px 6px; border-radius: 6px; }
.ctx-msg.flag { background: #3a1717; color: var(--bad); }
.ctx-msg time { margin-inline-start: auto; color: var(--muted); white-space: nowrap; }
.ctx-note { color: #9a9ea8; font-size: 12px; margin: 12px 0 0; }

/* ---------- responsive ---------- */
@media (max-width: 1024px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767px) {
  .kpis, .ov-grid { grid-template-columns: 1fr; }
  .dist-row { grid-template-columns: 120px 1fr 32px; }
  .hdr-badges { flex-wrap: wrap; }
}

/* ---------- match change form: ratings matrix ---------- */
.matrix-wrap { padding: 12px 14px; overflow-x: auto; }
.matrix { width: 100%; border-collapse: collapse; font-size: 13px; }
.matrix th, .matrix td { padding: 6px 8px; text-align: start; border-bottom: 1px solid #262931; white-space: nowrap; }
.matrix thead th { color: #9a9ea8; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; background: none; }
.matrix thead th.rater { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
.matrix tbody th { font-weight: 600; }
.vote { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.vote-present { background: #12301f; color: var(--ok); } .vote-late { background: #3a2f10; color: var(--warn); }
.vote-absent { background: #3a1717; color: var(--bad); } .vote-undetermined { background: var(--panel-bg-2); color: #9a9ea8; }
.vote.auto { outline: 1px dashed currentColor; outline-offset: 1px; }

/* ---------- forms: Django 6.1 stacks labels over fields; on wide screens lay each row out as label | field ---------- */
@media (min-width: 1024px) {
  .aligned .form-row { padding: 8px 12px; }
  .aligned .form-row > .flex-container:not(.checkbox-row) {
    display: grid; grid-template-columns: 180px minmax(0, 1fr); column-gap: 16px; row-gap: 4px; align-items: center; justify-items: start;
  }
  .aligned .form-row > .flex-container:not(.checkbox-row) > label { grid-column: 1; margin: 0; align-self: center; }
  .aligned .form-row > .flex-container > :not(label) { grid-column: 2; }
  /* Django prints the hint before the field; read it after the field instead */
  .aligned .form-row > .flex-container > .help { order: 3; margin: 0; font-size: 12px; }
  .aligned .form-row > .flex-container > .errorlist { order: 2; }
  .aligned .form-row > .flex-container > .readonly { padding: 4px 0; }
  .aligned .checkbox-row { padding-inline-start: 196px; }
  /* several fields on one row: keep them side by side, each as label | field, the first label aligned to the column */
  .aligned .form-row.form-multiline { display: flex; gap: 8px 28px; align-items: center; }
  .aligned .form-row.form-multiline > .fieldBox { display: flex; flex-direction: row; align-items: center; gap: 10px; }
  .aligned .form-row.form-multiline > .fieldBox:first-child > label { width: 180px; margin-inline-end: 6px; }
  .aligned .form-row.form-multiline > .fieldBox > label { margin: 0; }
  .aligned .form-row .datetime { margin: 0; display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; }
  .aligned .form-row .datetime br { display: none; }
}
.aligned .form-row .related-widget-wrapper { display: inline-flex; align-items: center; gap: 2px; }
.related-widget-wrapper-link img { width: 15px; height: 15px; }
.aligned label { color: #c3c6cd; font-size: 13px; } .aligned label.required, form .required label { color: #f4f5f7; font-weight: 600; }
.aligned .form-row { border-bottom: 1px solid #1f2229; } .aligned .form-row:last-child { border-bottom: 0; }
.aligned .readonly, .aligned .form-row .readonly { color: #c3c6cd; font-size: 13.5px; }
.help, .aligned .help, form .help, .aligned .form-row .help { color: var(--muted); font-size: 12px; line-height: 1.45; }
fieldset.module { padding: 0 4px; } fieldset.module.aligned h2.fieldset-heading, fieldset.module h2 { margin: 0 -4px 6px; border-radius: var(--radius) var(--radius) 0 0; padding: 10px 16px; }
.fieldset-heading { font-size: 11px; }
.inline-group h2 { padding: 10px 16px; }
.inline-group .tabular { padding: 0; } .inline-group .tabular .add-row td { padding: 10px 14px; border-top: 1px solid #262931; }
.inline-group .tabular .add-row a { color: #8db2ff; text-decoration: none; }

/* readonly-style inlines (Timeline, Score history, Matches, Reports): denser rows */
.inline-group .tabular td { font-size: 13px; padding: 8px 10px; vertical-align: middle; }
.inline-group .tabular td p, .inline-group .tabular td .readonly { margin: 0; padding: 0; }
.inline-group .tabular thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #9a9ea8; }

/* ---------- login ---------- */
.login #header { justify-content: center; padding: 28px 16px 20px; border-bottom: 0; background: transparent; }
.login #branding h1 { font-size: 2.4rem; margin: 0; }
.login #branding h1 small { display: block; text-align: center; font-size: .45em; letter-spacing: .2em; margin: 6px 0 0; }
.login #container { background: transparent; border: 0; }
.login #container { width: min(400px, 92vw); margin-top: 6vh; }
.login #content { background: var(--panel-bg); border: 1px solid #262931; border-radius: var(--radius); padding: 28px; box-shadow: 0 24px 60px #0009; }
.login .login-tagline { margin: 0 0 22px; text-align: center; color: #9a9ea8; font-size: 13px; }
.login .form-row { padding: 0 0 14px; border: 0; } .login .form-row label { display: block; margin-bottom: 6px; color: #c3c6cd; font-size: 13px; }
.login .form-row input { width: 100%; min-height: 42px; }
.login .submit-row { background: none; border: 0; padding: 6px 0 0; }
.login .submit-row input { width: 100%; min-height: 42px; font-size: 14px; }
.login .password-reset-link { text-align: center; }
