/* Dresses Django's admin in the app's theme (see app.css): New Progress Group
   navy on a cool grey page, white cards. Loaded after all of Django's own admin
   stylesheets by templates/admin/base_site.html. */

html[data-theme="light"],
:root {
  --primary: #303691;
  --secondary: #252a75;
  --accent: #cfd3f0;
  --primary-fg: #fff;

  --body-fg: #171a2b;
  --body-bg: #fff;
  --body-quiet-color: #646b82;
  --body-medium-color: #3b4157;
  --body-loud-color: #171a2b;

  --header-color: #646b82;
  --header-branding-color: #303691;
  --header-bg: #fff;
  --header-link-color: #303691;

  --breadcrumbs-fg: #646b82;
  --breadcrumbs-link-fg: #303691;
  --breadcrumbs-bg: transparent;

  --link-fg: #303691;
  --link-hover-color: #252a75;
  --link-selected-fg: #303691;

  --hairline-color: #e3e6ef;
  --border-color: #cfd4e0;
  --error-fg: #b3261e;

  --message-success-bg: #dcf3e4;
  --message-warning-bg: #fdf1d3;
  --message-error-bg: #fbe0dd;

  --darkened-bg: #fafbfd;
  --selected-bg: #eceefa;
  --selected-row: #eceefa;

  --button-fg: #fff;
  --button-bg: #303691;
  --button-hover-bg: #252a75;
  --default-button-bg: #303691;
  --default-button-hover-bg: #252a75;
  --close-button-bg: #646b82;
  --close-button-hover-bg: #3b4157;
  --delete-button-bg: #b3261e;
  --delete-button-hover-bg: #8f1e18;

  --object-tools-fg: #fff;
  --object-tools-bg: #303691;
  --object-tools-hover-bg: #252a75;

  --font-family-primary: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;

  --page: #f4f5fa;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(23 26 43 / 0.05), 0 4px 16px rgb(23 26 43 / 0.04);
}

html, body { background: var(--page); }
body { font-size: 0.875rem; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a:link, a:visited { text-decoration: none; }
a:focus, a:hover { text-decoration: underline; }

/* --- Header ---------------------------------------------------------------- */

#header { padding: 0 32px; min-height: 64px; align-items: center; border-bottom: 1px solid var(--hairline-color); }
#header .brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
#header .brand img { height: 40px; width: auto; }
#header .brand span { display: flex; flex-direction: column; line-height: 1.2; }
#header .brand strong { font-size: 1.05rem; color: var(--primary); }
#header .brand small { font-size: 0.72rem; color: var(--body-quiet-color); }
#user-tools { font-size: 0.8125rem; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--body-quiet-color); }
#user-tools strong { color: var(--body-fg); }
#user-tools a, #logout-form button { border-bottom: 0; text-transform: none; letter-spacing: 0; font-size: 0.8125rem; font-weight: 600; color: var(--primary); }
#user-tools a:focus, #user-tools a:hover, #logout-form button:hover { color: var(--secondary); border-bottom: 0; text-decoration: underline; margin-bottom: 0; }

/* The bar of models under the header; a thin rule separates one app's from the next. */
.subnav { display: flex; flex-wrap: wrap; padding: 0 22px; background: var(--body-bg); border-bottom: 1px solid var(--hairline-color); }
.subnav-group { display: flex; align-items: stretch; gap: 2px; }
.subnav-group + .subnav-group::before { content: ""; align-self: center; width: 1px; height: 18px; margin: 0 12px; background: var(--border-color); }
.subnav a:link, .subnav a:visited { padding: 11px 10px 9px; border-bottom: 3px solid transparent; color: var(--body-medium-color); font-size: 0.875rem; font-weight: 500; }
.subnav a:hover { color: var(--body-fg); text-decoration: none; }
.subnav a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

div.breadcrumbs { padding: 14px 32px 0; font-size: 0.8125rem; }
div.breadcrumbs a:focus, div.breadcrumbs a:hover { color: var(--secondary); }

/* --- Page ------------------------------------------------------------------ */

#content { padding: 20px 32px 48px; }
#content h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; color: var(--body-fg); margin-bottom: 18px; }
#content .kicker { margin: 0 0 2px; color: var(--body-quiet-color); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
#content h2 { font-weight: 600; }
.colM > h2, #content > h2 { font-size: 1rem; color: var(--body-quiet-color); margin-top: -10px; }

/* Cards: app lists, fieldsets, inlines, tables. */
.module { background: var(--body-bg); border: 1px solid var(--hairline-color); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 20px; }
.module h2, .module caption, .inline-group h2,
fieldset.module > h2, fieldset .fieldset-heading, .module summary {
  padding: 12px 16px; background: var(--darkened-bg); color: var(--body-quiet-color);
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--hairline-color);
}
.module caption a.section:link, .module caption a.section:visited { color: var(--body-quiet-color); }
.module table { width: 100%; }
.module .module { box-shadow: none; }
fieldset.module { padding: 0; }
details > summary { cursor: pointer; }

td, th { padding: 10px 16px; border-bottom: 1px solid var(--hairline-color); font-size: 0.875rem; line-height: 1.45; }
thead th, thead th a:link, thead th a:visited { color: var(--body-quiet-color); }
thead th { background: var(--darkened-bg); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; border-top: 0; border-bottom: 1px solid var(--hairline-color); }
thead th .text a, thead th .text span { padding: 10px 16px; }
table thead th.sorted .text { padding-right: 46px; }
tr:last-child > td, tr:last-child > th { border-bottom: 0; }
tbody tr:hover { background: #fafbfe; }
.dashboard .module table td a { font-weight: 600; }

/* --- Dashboard -------------------------------------------------------------- */

/* App cards on the left, the administrator's recent actions on the right. */
.dashboard #content { width: auto; max-width: 1240px; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 0 20px; align-items: start; }
.dashboard #content > h1 { grid-column: 1 / -1; }
.dashboard #content > br { display: none; }
.dashboard #content-main { float: none; width: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; align-items: start; }
.dashboard #content-main .module { margin-bottom: 0; }
.dashboard #content-related { float: none; width: auto; margin: 0; background: none; }
.dashboard #content-related .module { background: var(--body-bg); }
.dashboard #content-related .module h2 { margin: 0; padding: 12px 16px; font-size: 0.72rem; color: var(--body-quiet-color); background: var(--darkened-bg); }
.dashboard #content-related .module h3 { padding: 12px 16px 0; margin: 0; font-size: 0.875rem; color: var(--body-fg); }
.dashboard #content-related .module p, .dashboard #content-related .module ul { padding: 4px 16px 12px; margin: 0; }
.dashboard .module table th { font-weight: 600; }
@media (max-width: 900px) { .dashboard #content { grid-template-columns: 1fr; } .dashboard #content-related { margin-top: 20px; } }

/* --- Buttons and links that look like buttons ---------------------------------- */

.button, input[type="submit"], input[type="button"], .submit-row input, a.button {
  padding: 9px 16px; border-radius: 8px; font-weight: 600; font-size: 0.875rem; text-transform: none; letter-spacing: 0; height: auto; line-height: 1.4;
}
.button.default, input[type="submit"].default, .submit-row input.default { text-transform: none; font-weight: 600; }
.submit-row a.deletelink, .submit-row a.closelink { padding: 9px 16px; border-radius: 8px; height: auto; line-height: 1.4; font-weight: 600; }
.object-tools { margin-top: -52px; }
.object-tools a:link, .object-tools a:visited { padding: 8px 14px; border-radius: 8px; font-size: 0.8125rem; font-weight: 600; text-transform: none; letter-spacing: 0; }
.object-tools a.addlink, .object-tools a.viewsitelink, .object-tools a.historylink { background-image: none; padding-right: 14px; }
.object-tools a.addlink::before { content: "+ "; }

/* --- Forms ----------------------------------------------------------------- */

input[type="text"], input[type="password"], input[type="email"], input[type="url"], input[type="number"],
input[type="tel"], input[type="search"], textarea, select, .vTextField {
  padding: 8px 10px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 0.875rem; background: var(--body-bg); color: var(--body-fg);
}
select { height: auto; min-height: 2.35rem; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgb(48 54 145 / 0.15); }
.form-row { padding: 14px 16px; border-bottom: 1px solid var(--hairline-color); }
fieldset .form-row:last-child { border-bottom: 0; }
.aligned label { width: 190px; padding-top: 8px; color: var(--body-medium-color); font-weight: 600; }
.aligned label.vCheckboxLabel { font-weight: 400; }
form .aligned div.help, form .aligned p.help, .help { color: var(--body-quiet-color); font-size: 0.8125rem; }
/* Under the field, not under the label: label width plus its gap. */
form .aligned div.help, form .aligned p.help { margin-left: 200px; padding-left: 0; }
form .aligned div.readonly, div.readonly { padding-top: 8px; font-size: 0.875rem; }
.errornote { border-radius: 8px; border-color: #f3bdb7; background: var(--message-error-bg); font-weight: 600; }
ul.errorlist li { font-weight: 500; }

.submit-row { padding: 14px 16px; border-radius: var(--radius); background: var(--body-bg); box-shadow: var(--shadow); gap: 10px; }
.inline-group { border-radius: var(--radius); }
.inline-group .tabular fieldset.module { border: 0; box-shadow: none; }

/* Pick-several widgets and autocomplete boxes. */
.selector .selector-available h2, .selector .selector-chosen h2, .selector-available-title, .selector-chosen-title {
  background: var(--darkened-bg); color: var(--body-quiet-color); border-radius: 8px 8px 0 0;
}
.selector .selector-chosen .selector-chosen-title, .selector .selector-chosen h2 { background: var(--selected-bg); color: var(--primary); }
.selector select { border-radius: 0 0 8px 8px; }
.select2-container--admin-autocomplete .select2-selection--single,
.select2-container--admin-autocomplete .select2-selection--multiple { border-color: var(--border-color); border-radius: 8px; min-height: 2.35rem; }
.select2-container--admin-autocomplete .select2-selection--single .select2-selection__rendered { line-height: 2.2rem; padding-left: 10px; }
.select2-container--admin-autocomplete .select2-selection--single .select2-selection__arrow { height: 2.2rem; }
.select2-container--admin-autocomplete .select2-selection--multiple .select2-selection__choice { border-radius: 6px; background: var(--selected-bg); border-color: var(--accent); color: var(--primary); }
.select2-container--admin-autocomplete .select2-results__option--highlighted[aria-selected] { background: var(--primary); }

/* --- Lists ----------------------------------------------------------------- */

#changelist { border: 0; background: none; box-shadow: none; overflow: visible; align-items: flex-start; gap: 20px; }
#changelist .changelist-form-container { background: var(--body-bg); border: 1px solid var(--hairline-color); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
#changelist #toolbar { padding: 12px 16px; background: var(--body-bg); border-top: 0; border-bottom: 1px solid var(--hairline-color); }
#changelist #toolbar form input[type="text"] { min-width: 280px; padding: 7px 10px; border-radius: 8px; }
#changelist table td, #changelist table th { padding-left: 12px; padding-right: 12px; }
#changelist table thead th .text a, #changelist table thead th .text span { padding-left: 12px; padding-right: 12px; }
#changelist .actions { padding: 10px 16px; background: var(--darkened-bg); border-bottom: 1px solid var(--hairline-color); }
/* The small "search" and "go" buttons: quiet, so the primary ones stand out. */
#changelist #toolbar form input[type="submit"], #changelist .actions .button {
  padding: 7px 12px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--body-bg); color: var(--body-fg); font-size: 0.8125rem; font-weight: 600; box-shadow: none;
}
#changelist #toolbar form input[type="submit"]:hover, #changelist .actions .button:hover { border-color: var(--primary); color: var(--primary); background: var(--body-bg); }
#changelist .actions select { min-height: 2.1rem; padding: 5px 8px; }
#changelist table tbody td, #changelist table tbody th { vertical-align: middle; }
#changelist table thead th { border-bottom: 1px solid var(--hairline-color); }
#changelist .paginator { padding: 12px 16px; border-top: 1px solid var(--hairline-color); background: var(--body-bg); }
#changelist .toplinks { border-bottom: 1px solid var(--hairline-color); padding: 10px 16px; }
#changelist-filter { flex: 0 0 250px; margin: 0; background: var(--body-bg); border: 1px solid var(--hairline-color); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
#changelist-filter h2 { padding: 12px 16px; margin: 0; background: var(--darkened-bg); color: var(--body-quiet-color); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--hairline-color); }
#changelist-filter details > summary { background: none; border: 0; padding: 0; color: var(--body-fg); font-size: 0.8125rem; text-transform: none; letter-spacing: 0; }
#changelist-filter h3, #changelist-filter details > summary { font-weight: 600; }
#changelist-filter details, #changelist-filter > h3, #changelist-filter > ul { padding-left: 4px; padding-right: 4px; }
#changelist-filter li.selected { border-left-color: var(--primary); }
#changelist-filter li.selected a { color: var(--primary); font-weight: 600; }
#changelist-filter #changelist-filter-extra-actions { padding: 10px 16px; border-bottom: 1px solid var(--hairline-color); }
#changelist-filter #changelist-filter-extra-actions h3, #changelist-filter #changelist-filter-extra-actions a { margin: 0; font-size: 0.8125rem; font-weight: 500; }
#changelist table tbody th a { font-weight: 600; }
.paginator a:link, .paginator a:visited, .paginator .this-page { border-radius: 6px; }

/* Status and approval pills in the ticket list; same colours as the app. */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; background: #eceff4; color: #4b5468; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.awaiting, .pill.testing { background: #fdf1d3; color: #8a5a00; }
.pill.rejected, .pill.returned { background: #fbe0dd; color: #b3261e; }
.pill.analysis { background: #efe9fb; color: #5b3bb0; }
.pill.in_progress { background: #e2eefd; color: #1c5fb8; }
.pill.done { background: #dcf3e4; color: #17713c; }
.ticket-number { white-space: nowrap; font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace; font-weight: 600; }

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

#nav-sidebar { background: var(--body-bg); border-right: 1px solid var(--hairline-color); }
#nav-sidebar .module { border: 0; border-radius: 0; box-shadow: none; margin-bottom: 0; }
#nav-sidebar .module th, #nav-sidebar .module td { border-bottom: 0; padding: 7px 16px; }
#nav-sidebar .current-model { background: var(--selected-bg); }
#nav-sidebar .current-model a { color: var(--primary); font-weight: 600; }
#nav-filter { border-radius: 8px; margin: 12px 16px; width: calc(100% - 32px); }
.toggle-nav-sidebar { background: var(--body-bg); border-right: 1px solid var(--hairline-color); color: var(--primary); }

/* --- Messages --------------------------------------------------------------- */

ul.messagelist { padding: 16px 32px 0; }
ul.messagelist li { margin: 0 0 8px; padding: 10px 14px 10px 44px; border: 1px solid var(--hairline-color); border-radius: 10px; font-size: 0.875rem; font-weight: 500; background-position: 14px 12px; }
ul.messagelist li.success { border-color: #b5e2c6; color: #17713c; }
ul.messagelist li.warning { border-color: #f0d691; color: #8a5a00; }
ul.messagelist li.error { border-color: #f3bdb7; color: #b3261e; }

/* --- Sign-in page ----------------------------------------------------------- */

body.login { background: radial-gradient(1200px 600px at 50% -10%, #dfe3fa 0%, var(--page) 60%); min-height: 100vh; display: flow-root; }
.login #container { margin: 90px auto; width: 400px; max-width: calc(100% - 32px); border: 1px solid var(--hairline-color); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.login #header { justify-content: center; padding: 22px 24px 18px; border-bottom: 1px solid var(--hairline-color); }
.login #header .brand img { height: 52px; }
.login #content { padding: 22px 28px 26px; }
.login .form-row { padding: 6px 0; border: 0; }
.login .form-row label { display: block; margin-bottom: 4px; font-weight: 600; color: var(--body-medium-color); }
.login .form-row input { width: 100%; box-sizing: border-box; }
.login .submit-row { padding: 14px 0 0; background: none; border: 0; box-shadow: none; }
.login .submit-row input { width: 100%; }

@media (max-width: 1024px) {
  #header { padding: 10px 16px; }
  div.breadcrumbs { padding: 12px 16px 0; }
  #content { padding: 16px 16px 40px; }
  ul.messagelist { padding: 12px 16px 0; }
  .object-tools { margin-top: 0; }
  #changelist { gap: 0; }
  #changelist-filter { flex-basis: auto; margin-top: 16px; }
}
