/* Barq's theme layers over Django admin; native forms and navigation stay intact. */
:root, html[data-theme="light"], html[data-theme="auto"] {
  color-scheme: light;
  --primary: var(--barq-color-red);
  --secondary: var(--barq-color-charcoal);
  --accent: var(--barq-color-white);
  --primary-fg: var(--barq-color-white);
  --body-fg: var(--barq-color-charcoal);
  --body-bg: var(--barq-color-warm);
  --body-quiet-color: var(--barq-color-shade-081);
  --body-medium-color: var(--barq-color-shade-082);
  --body-loud-color: var(--barq-color-charcoal);
  --header-color: var(--barq-color-warm);
  --header-branding-color: var(--barq-color-white);
  --header-bg: var(--barq-color-charcoal);
  --header-link-color: var(--barq-color-white);
  --breadcrumbs-fg: var(--barq-color-shade-081);
  --breadcrumbs-link-fg: var(--barq-color-red);
  --breadcrumbs-bg: var(--barq-color-white);
  --link-fg: var(--barq-color-shade-083);
  --link-hover-color: var(--barq-color-shade-084);
  --link-selected-fg: var(--barq-color-shade-083);
  --hairline-color: var(--barq-color-shade-085);
  --border-color: var(--barq-color-shade-086);
  --error-fg: var(--barq-color-red);
  --message-success-bg: var(--barq-color-shade-087);
  --message-warning-bg: var(--barq-color-shade-088);
  --message-error-bg: var(--barq-color-shade-089);
  --darkened-bg: var(--barq-color-shade-020);
  --selected-bg: var(--barq-color-shade-090);
  --selected-row: var(--barq-color-shade-065);
  --button-fg: var(--barq-color-white);
  --button-bg: var(--barq-color-red);
  --button-hover-bg: var(--barq-color-shade-091);
  --default-button-bg: var(--barq-color-red);
  --default-button-hover-bg: var(--barq-color-shade-091);
  --close-button-bg: var(--barq-color-shade-081);
  --close-button-hover-bg: var(--barq-color-charcoal);
  --delete-button-bg: var(--barq-color-shade-091);
  --delete-button-hover-bg: var(--barq-color-shade-092);
  --object-tools-fg: var(--barq-color-white);
  --object-tools-bg: var(--barq-color-charcoal);
  --object-tools-hover-bg: var(--barq-color-red);
  --barq-surface: var(--barq-color-white);
  --barq-shadow: 0 4px 18px rgb(43 43 43 / 7%);
  --barq-input-border: var(--barq-color-shade-093);
  --barq-table-hover: var(--barq-color-shade-094);
  --barq-success-fg: var(--barq-color-shade-095);
  --barq-success-bg: var(--barq-color-shade-087);
  --barq-error-fg: var(--barq-color-shade-091);
  --barq-error-bg: var(--barq-color-shade-089);
}
html[data-theme="dark"] {
  color-scheme: dark;
  --barq-brand-accent: var(--barq-color-shade-096);
  --barq-brand-ink: var(--barq-color-warm);
  --primary: var(--barq-color-red);
  --secondary: var(--barq-color-charcoal);
  --accent: var(--barq-color-white);
  --body-bg: var(--barq-color-shade-040);
  --body-fg: var(--barq-color-warm);
  --body-loud-color: var(--barq-color-white);
  --body-quiet-color: var(--barq-color-shade-097);
  --body-medium-color: var(--barq-color-shade-098);
  --header-bg: var(--barq-color-charcoal);
  --header-color: var(--barq-color-warm);
  --header-branding-color: var(--barq-color-white);
  --header-link-color: var(--barq-color-warm);
  --breadcrumbs-bg: var(--barq-color-charcoal);
  --breadcrumbs-fg: var(--barq-color-shade-097);
  --breadcrumbs-link-fg: var(--barq-color-warm);
  --link-fg: var(--barq-color-shade-096);
  --link-hover-color: var(--barq-color-white);
  --link-selected-fg: var(--barq-color-shade-096);
  --hairline-color: var(--barq-color-shade-099);
  --border-color: var(--barq-color-shade-081);
  --darkened-bg: var(--barq-color-shade-100);
  --selected-bg: var(--barq-color-shade-101);
  --selected-row: var(--barq-color-shade-102);
  --error-fg: var(--barq-color-shade-096);
  --message-success-bg: var(--barq-color-shade-103);
  --message-warning-bg: var(--barq-color-shade-104);
  --message-error-bg: var(--barq-color-shade-102);
  --barq-surface: var(--barq-color-charcoal);
  --barq-shadow: none;
  --barq-input-border: var(--barq-color-shade-105);
  --barq-table-hover: var(--barq-color-shade-106);
  --barq-success-fg: var(--barq-color-shade-107);
  --barq-success-bg: var(--barq-color-shade-103);
  --barq-error-fg: var(--barq-color-shade-108);
  --barq-error-bg: var(--barq-color-shade-102);
}
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; }
.barq-activity-notice, .barq-activity-intro { color: var(--body-quiet-color); line-height: 1.65; }
.barq-activity-notice { max-width: 950px; margin: 0 0 24px; padding: 14px 18px; border-left: 3px solid var(--primary); background: var(--barq-surface); border-radius: 4px; }
.barq-activity-notice p, .barq-activity-intro p { margin: 0 0 8px; }
.barq-activity-notice p:last-child { margin-bottom: 0; }
.barq-activity-intro { padding: 18px 22px; }
.barq-activity-link { display: inline-block; margin-top: 4px; font-weight: 600; }
.barq-activity-table-scroll { overflow-x: auto; }
.barq-api-activity table { width: 100%; min-width: 960px; }
.barq-api-activity td, .barq-api-activity th { padding: 12px 18px; vertical-align: middle; }
.barq-api-activity td:first-child, .barq-api-activity th { white-space: nowrap; }
.barq-api-activity code, .model-apirequestactivity .field-endpoint { overflow-wrap: anywhere; font-size: 12px; }
.barq-activity-secondary { color: var(--body-quiet-color); font-size: 12px; }
.model-apirequestactivity #result_list { min-width: 800px; table-layout: fixed; }
.model-apirequestactivity #result_list .column-request_time { width: 12%; }
.model-apirequestactivity #result_list .column-key_identity { width: 20%; }
.model-apirequestactivity #result_list .column-source_address { width: 16%; }
.model-apirequestactivity #result_list .column-method { width: 7%; }
.model-apirequestactivity #result_list .column-endpoint { width: 23%; }
.model-apirequestactivity #result_list .column-http_status { width: 8%; }
.model-apirequestactivity #result_list .column-authentication_result { width: 14%; }
.barq-source-ip { font-size: 12px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.model-apirequestactivity #result_list th, .model-apirequestactivity #result_list td { padding: 12px 10px; vertical-align: middle; white-space: normal; overflow-wrap: anywhere; }
.model-apirequestactivity #result_list thead th { padding: 0; overflow-wrap: normal; }
.model-apirequestactivity #result_list .field-method { font-size: 12px; }
.barq-activity-scroll-hint { display: none; }
.barq-activity-table-scroll:focus-visible { outline: 3px solid var(--link-fg); outline-offset: -3px; }
.barq-activity-empty { padding: 8px 22px 22px; color: var(--body-quiet-color); }
.barq-http-status { display: inline-block; padding: 3px 8px; border-radius: 5px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.barq-http-status-success { color: var(--barq-success-fg); background: var(--barq-success-bg); }
.barq-http-status-error { color: var(--barq-error-fg); background: var(--barq-error-bg); }
.barq-http-status-neutral { color: var(--body-medium-color); background: var(--darkened-bg); }
#header { box-sizing: border-box; flex-shrink: 0; padding: 18px 32px; border-top: 4px solid var(--barq-color-red); border-bottom: 1px solid var(--hairline-color); gap: 20px; }
#branding { display: flex; align-items: center; gap: 14px; }
.barq-brand { display: flex; align-items: center; gap: 22px; }
.barq-brand-logo { display: flex; background: var(--barq-color-white); border-radius: 6px; padding: 2px 8px; flex-shrink: 0; }
.barq-brand-logo img { display: block; width: 154px; height: auto; }
.barq-brand-title { border-left: 1px solid var(--barq-color-shade-081); padding-left: 22px; display: grid; gap: 7px; color: var(--barq-color-white); font-size: 20px; font-weight: 600; }
.barq-brand-title .barq-eyebrow { color: var(--barq-color-shade-109); }
.barq-eyebrow { display: block; font-size: 10px; font-weight: 700; letter-spacing: .14em; color: var(--link-fg); }
#user-tools { line-height: 1.9; font-size: 11px; letter-spacing: .03em; }
#header a:link, #header a:visited, #logout-form button { color: var(--header-link-color); }
#header a.barq-brand-logo { border-bottom: 0; }
#logout-form button { font-family: inherit; }
div.breadcrumbs { padding: 14px 32px; border-bottom: 1px solid var(--hairline-color); font-size: 12px; }
#content { padding: 32px; }
#content h1 { color: var(--body-loud-color); font-size: 26px; font-weight: 600; letter-spacing: -.035em; margin-bottom: 24px; }
.module { background: var(--barq-surface); border: 1px solid var(--hairline-color); border-radius: 10px; overflow: hidden; box-shadow: var(--barq-shadow); }
.module h2, .module caption, .inline-group h2 { background: var(--secondary); color: var(--barq-color-white); font-size: 12px; padding: 14px 18px; letter-spacing: .045em; }
.module caption a:link, .module caption a:visited { color: var(--barq-color-white); font-weight: 600; }
.module th, .module td { padding: 14px 18px; }
.dashboard #content { width: auto; }
.dashboard #content-main { width: auto; float: none; margin-right: 294px; }
.dashboard #content-main .module { margin-bottom: 24px; }
.dashboard .module table { width: 100%; }
.dashboard #content-related { margin-left: -270px; width: 270px; background: transparent; }
#content-related .module { padding: 0 0 12px; background: var(--barq-surface); }
#content-related .module h2 { padding: 14px 18px; color: var(--barq-color-white); background: var(--barq-color-charcoal); }
#content-related h3, #content-related .actionlist { margin: 18px; }
#content-related .actionlist li { padding-bottom: 16px; }
.barq-welcome { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 28px; background: var(--barq-surface); border: 1px solid var(--hairline-color); border-left: 4px solid var(--barq-color-red); border-radius: 10px; margin-bottom: 28px; box-shadow: var(--barq-shadow); }
.barq-welcome h2 { font-size: 28px; letter-spacing: -.035em; font-weight: 600; margin: 10px 0; color: var(--body-loud-color); }
.barq-welcome p { margin: 0; color: var(--body-quiet-color); line-height: 1.6; }
a.barq-docs-link { display: inline-flex; align-items: center; gap: 16px; padding: 12px 18px; border: 1px solid var(--border-color); border-radius: 6px; white-space: nowrap; font-weight: 600; }
a.barq-docs-link:hover { border-color: var(--link-fg); }
#nav-sidebar { background: var(--barq-color-charcoal); border-right: 1px solid var(--barq-color-shade-081); padding: 16px 10px; box-sizing: border-box; }
#nav-sidebar .module { border: 0; box-shadow: none; border-radius: 0; background: transparent; }
#nav-sidebar .module caption { background: transparent; padding: 20px 10px 10px; font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
#nav-sidebar .module caption a, #nav-sidebar .current-app .section:link, #nav-sidebar .current-app .section:visited { color: var(--barq-color-shade-110); }
#nav-sidebar .module th, #nav-sidebar .module td { padding: 12px 10px; border: 0; }
#nav-sidebar th a:link, #nav-sidebar th a:visited { color: var(--barq-color-white); }
#nav-sidebar td a:link, #nav-sidebar td a:visited { color: var(--barq-color-shade-109); }
#nav-sidebar tbody tr { background: transparent; }
#nav-sidebar tbody tr:hover { background: var(--barq-color-shade-111); }
#nav-sidebar .current-model, #nav-sidebar .current-model:hover { background: var(--barq-color-red); }
#nav-sidebar .current-model th a, #nav-sidebar .current-model td a { color: var(--barq-color-white); }
#nav-sidebar a:focus-visible, #nav-filter:focus-visible, .toggle-nav-sidebar:focus-visible, #header a:focus-visible, #header button:focus-visible { outline-color: var(--barq-color-white); }
#nav-filter { width: calc(100% - 12px); margin: 4px 6px 12px; padding: 10px 12px; border-radius: 6px; box-sizing: border-box; background: var(--barq-color-shade-112); color: var(--barq-color-white); border: 1px solid var(--barq-color-shade-105); }
#nav-filter::placeholder { color: var(--barq-color-shade-085); opacity: 1; }
#nav-filter.no-results { background: var(--barq-color-shade-102); color: var(--barq-color-shade-108); }
.toggle-nav-sidebar { background: var(--barq-color-charcoal); border-color: var(--barq-color-shade-081); color: var(--barq-color-white); }
.toggle-nav-sidebar:hover, .toggle-nav-sidebar:focus { background: var(--barq-color-shade-111); }
#changelist { border-radius: 10px; border: 1px solid var(--hairline-color); background: var(--barq-surface); box-shadow: var(--barq-shadow); }
#changelist #toolbar { padding: 16px 18px; background: var(--barq-surface); border: 0; }
#changelist .actions { padding: 12px 18px; background: var(--darkened-bg); }
#changelist .paginator { padding: 16px 18px; }
#changelist-filter { background: var(--barq-surface); border-left: 1px solid var(--hairline-color); }
#changelist-filter h2 { background: var(--secondary); color: var(--barq-color-white); padding: 14px 18px; }
#changelist-filter h3 { color: var(--body-loud-color); }
#changelist-filter a { color: var(--body-quiet-color); }
#changelist-filter li.selected a { color: var(--link-fg); }
#changelist-filter li.selected { border-left-color: var(--barq-color-red); }
/* Keep sortable labels, arrows and keyboard focus readable on dark headings. */
#changelist tbody tr, .barq-api-activity tbody tr, .dashboard #content-main tbody tr { background: var(--barq-surface); }
#changelist table thead th, #changelist table thead th.sorted, .barq-api-activity thead th { background: var(--barq-color-charcoal); color: var(--barq-color-white); border-color: var(--barq-color-shade-081); }
#changelist table thead th a:link, #changelist table thead th a:visited { color: var(--barq-color-white); }
#changelist table thead th .text a:hover, #changelist table thead th .text a:focus { background: var(--barq-color-shade-111); }
#changelist table thead th .sortpriority { color: var(--barq-color-white); }
#changelist table thead th .sortoptions a { filter: brightness(0) invert(1); }
#changelist table thead a:focus-visible { outline: 2px solid var(--barq-color-white); outline-offset: -3px; }
#changelist tbody tr:nth-child(even), .barq-api-activity tbody tr:nth-child(even), .dashboard #content-main tbody tr:nth-child(even) { background: var(--darkened-bg); }
#changelist tbody tr:hover, .barq-api-activity tbody tr:hover, .dashboard #content-main tbody tr:hover { background: var(--barq-table-hover); }
#changelist tbody tr.selected, #changelist tbody tr.selected:hover { background: var(--selected-row); }
#changelist-filter li.selected { background: var(--selected-row); }
#changelist #toolbar { border-bottom: 1px solid var(--hairline-color); }
#changelist #toolbar form input[type="text"], #changelist .actions select { border-color: var(--barq-input-border); }
#changelist #toolbar form input[type="submit"] { background: var(--button-bg); color: var(--barq-color-white); border: 1px solid var(--button-bg); }
#changelist #toolbar form input[type="submit"]:hover { background: var(--button-hover-bg); }
input[type="text"], input[type="password"], input[type="email"], input[type="url"], input[type="number"], input[type="date"], input[type="time"], textarea, select { border-radius: 6px; padding: 9px 12px; font-family: inherit; border-color: var(--barq-input-border); background: var(--barq-surface); color: var(--body-fg); }
input::placeholder, textarea::placeholder { color: var(--body-quiet-color); opacity: 1; }
.aligned label, .form-row label { color: var(--body-fg); }
.help, p.help, form p.help, div.help, form div.help, div.help li { color: var(--body-quiet-color); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--barq-color-red); }
.button, input[type="submit"], input[type="button"], .submit-row input, a.button { border-radius: 6px; padding: 11px 18px; font-family: inherit; font-weight: 600; }
.object-tools a { border-radius: 6px; padding: 10px 16px; }
.submit-row { background: var(--barq-surface); border-color: var(--hairline-color); border-radius: 8px; padding: 18px; }
.form-row { padding: 16px 18px; }
fieldset.module { margin-bottom: 24px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--link-fg); outline-offset: 3px; }
body.login { background: var(--body-bg); }
.login #container { width: min(440px, calc(100% - 32px)); margin: 8vh auto; border: 1px solid var(--hairline-color); border-radius: 14px; box-shadow: 0 16px 60px rgb(43 43 43 / 9%); background: var(--barq-surface); }
.login #header { padding: 24px; justify-content: center; border-radius: 14px 14px 0 0; }
.login .barq-brand-title { display: none; }
.login .barq-brand-logo img { width: 218px; }
.login #branding { justify-content: center; }
.login #content { padding: 30px; }
.barq-login-intro h1 { margin: 10px 0 8px !important; font-size: 28px !important; }
.barq-login-intro p { margin: 0 0 24px; color: var(--body-quiet-color); line-height: 1.6; }
.login .form-row label { color: var(--body-fg); font-weight: 600; margin-bottom: 7px; }
.login .form-row { padding: 8px 0; }
.login .form-row #id_username, .login .form-row #id_password { padding: 12px; }
.login .submit-row { padding: 16px 0 0; border: 0; background: transparent; }
.login .submit-row input { width: 100%; padding: 13px; }
@media (max-width: 1024px) {
  #header { padding: 16px 24px; }
  #content { padding: 24px; }
  .barq-brand-title { font-size: 17px; }
  .barq-welcome { align-items: flex-start; flex-direction: column; }
  .dashboard #content-main { margin-right: 0; }
  .dashboard #content-related { width: 100%; margin: 0; float: none; }
}
@media (max-width: 767px) {
  .barq-activity-scroll-hint { display: block; font-size: 12px; margin-top: 12px; }
  #header { padding: 14px 16px; gap: 14px; }
  #branding { max-width: 100%; }
  .barq-brand { gap: 14px; }
  .barq-brand-logo img { width: 118px; }
  .barq-brand-title { padding-left: 14px; font-size: 15px; }
  #user-tools { margin-top: 0; text-align: center; }
  #content { padding: 20px 16px; }
  div.breadcrumbs { padding: 12px 16px; }
  .barq-welcome { padding: 22px; }
  .barq-welcome h2 { font-size: 25px; }
  .module th, .module td { padding: 12px; }
  .barq-docs-link { white-space: normal; }
  .login #container { margin: 4vh auto; }
  .login #content { padding: 24px; }
  .login #header { padding: 20px; }
  .login .barq-brand-logo img { width: 200px; }
}
/* Keep the overview and recent actions in one responsive grid. */
.dashboard #content { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 24px; margin-right: 0; }
.dashboard #content > h1, .dashboard .barq-welcome { grid-column: 1 / -1; margin-bottom: 0; }
.dashboard #content-main { margin: 0; min-width: 0; }
.dashboard #content-related { float: none; margin: 0; width: auto; }
.dashboard #content > br.clear { display: none; }
@media (max-width: 1024px) { .dashboard #content { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 767px) {
  .aligned select, .aligned input[type="text"], .aligned input[type="url"], .aligned input[type="email"], .aligned input[type="number"], .aligned textarea { box-sizing: border-box; max-width: 100%; }
  .aligned .related-widget-wrapper { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; float: none; }
  .aligned .related-widget-wrapper select { width: 100%; }
}
@media (max-width: 767px) {
  .aligned .form-row > div { width: 100%; max-width: 100%; min-width: 0; }
}

/* Bright, high-contrast Admin navigation with the complete corporate logo. */
#header { border-top: 4px solid var(--barq-color-red); }
.barq-brand-logo .barq-identity-logo { width: 190px; height: auto; }
#nav-sidebar { background: var(--barq-color-white); border-right: 1px solid var(--barq-color-shade-085); }
#nav-sidebar .module caption a, #nav-sidebar .current-app .section:link, #nav-sidebar .current-app .section:visited { color: var(--barq-color-shade-081); }
#nav-sidebar th a:link, #nav-sidebar th a:visited { color: var(--barq-color-charcoal); }
#nav-sidebar td a:link, #nav-sidebar td a:visited { color: var(--barq-color-red); }
#nav-sidebar tbody tr:hover { background: var(--barq-color-warm); }
#nav-sidebar .current-model { background: var(--barq-color-shade-065); }
#nav-sidebar .current-model th a { color: var(--barq-color-red); }
#nav-filter { color: var(--barq-color-charcoal); background: var(--barq-color-white); border: 1px solid var(--barq-color-shade-086); }
.barq-welcome { border-radius: 6px; }
.barq-welcome h2 { color: var(--barq-color-charcoal); font-weight: 550; }
.barq-admin-tools { display:flex; align-items:center; gap:16px; flex-wrap:wrap; font-size:13px; text-transform:none; }
#user-tools.barq-admin-tools button { border:1px solid var(--barq-color-red); border-radius:5px; padding:8px 12px; color:var(--barq-color-red); background:var(--barq-color-white); cursor:pointer; font-size:13px; }
@media(max-width:700px) { .barq-brand-logo .barq-identity-logo {width:160px} .barq-admin-tools {justify-content:center;gap:10px} }

#header { background:var(--barq-color-white); color:var(--barq-color-charcoal); }
#header a:link, #header a:visited {color:var(--barq-color-shade-083)}
.barq-brand-title { display:block; border:0; padding:0; color:var(--barq-color-charcoal); font:550 23px/1.2 Geist,Arial,sans-serif; }
.barq-brand-logo {padding:0; background:var(--barq-color-white)}
.barq-brand-title .barq-wordmark-accent {color:var(--barq-color-red)}

/* Welcome actions share one row; navigation echoes the table's light bands. */
.barq-welcome > div:first-child {flex:1 1 420px;min-width:0}
.barq-workspace-links {display:flex;align-items:center;gap:12px;flex:0 0 auto}
.barq-workspace-links .barq-docs-link {min-height:44px;box-sizing:border-box}
#nav-sidebar .module caption {background:var(--barq-color-shade-046);margin-top:12px;border-radius:5px;padding:14px 10px}
#nav-sidebar tbody tr:nth-child(odd) {background:var(--barq-color-white)}
#nav-sidebar tbody tr:nth-child(even) {background:var(--barq-color-warm)}
#nav-sidebar tbody tr:hover {background:var(--barq-color-shade-094)}
#nav-sidebar tbody tr.current-model, #nav-sidebar tbody tr.current-model:hover {background:var(--barq-color-shade-065)}
#nav-sidebar .current-model th a:link, #nav-sidebar .current-model th a:visited, #nav-sidebar .current-model td a:link, #nav-sidebar .current-model td a:visited {color:var(--barq-color-red)}
#nav-filter::placeholder {color:var(--barq-color-shade-081)}
#nav-sidebar a:focus-visible, #nav-filter:focus-visible {outline-color:var(--barq-color-red)}
@media(max-width:1024px) {.barq-welcome > div:first-child {flex:0 1 auto}}
@media(max-width:600px) {
 .barq-workspace-links {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;gap:12px}
 .barq-workspace-links .barq-docs-link {white-space:normal;justify-content:space-between;font-size:13px;padding:10px 12px;gap:8px}
}

/* Compact disclosures keep secondary information close to the main content. */
.dashboard #content { grid-template-columns:minmax(0,1fr); }
.dashboard #content-related { grid-column:1 / -1; width:100%; }
#content-related .barq-recent-actions { padding:0; }
.barq-recent-actions > summary, #changelist-filter .barq-admin-filter-dropdown > summary { display:flex; align-items:center; gap:10px; list-style:none; cursor:pointer; padding:16px 18px; font-weight:600; color:var(--barq-color-charcoal); }
#changelist-filter .barq-admin-filter-dropdown > summary::before, #changelist-filter .barq-admin-filter-dropdown[open] > summary::before { content:none; }
.barq-recent-actions > summary::-webkit-details-marker, .barq-admin-filter-dropdown > summary::-webkit-details-marker { display:none; }
.barq-recent-actions > summary::after, .barq-admin-filter-dropdown > summary::after { content:""; width:7px; height:7px; border-right:2px solid var(--barq-color-shade-021); border-bottom:2px solid var(--barq-color-shade-021); transform:rotate(45deg); margin-left:auto; transition:transform .15s; }
.barq-recent-actions[open] > summary::after, .barq-admin-filter-dropdown[open] > summary::after { transform:rotate(225deg); }
.barq-recent-actions > summary { background:var(--barq-color-warm); font-size:14px; }
.barq-recent-empty { padding:0 18px 18px; }
#content-related .barq-recent-actions .actionlist { margin:0; padding:8px 24px 12px; display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:12px 24px; }
#content-related .barq-recent-actions .actionlist li { padding:12px 0 12px 20px; border-top:1px solid var(--barq-color-shade-019); margin:0; background-position:0 16px; }
#changelist.filtered { flex-wrap:wrap; }
#changelist.filtered .changelist-form-container { order:2; width:100%; min-width:0; }
#changelist #changelist-filter { position:static; order:1; width:100%; flex-basis:100%; border:0; border-bottom:1px solid var(--barq-color-shade-011); margin:0; background:var(--barq-color-shade-113); }
.barq-admin-filter-dropdown > summary { font-size:14px; }
.barq-admin-filter-body { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:16px; padding:4px 18px 20px; }
.barq-admin-filter { display:flex; flex-direction:column; gap:8px; margin:0; padding:0; font-size:12px; font-weight:500; color:var(--barq-color-shade-012); }
.barq-admin-filter select { box-sizing:border-box; width:100%; min-height:44px; padding:10px 12px; border:1px solid var(--barq-color-shade-110); border-radius:8px; background:var(--barq-color-white); color:var(--barq-color-charcoal); font:400 13px Geist,Arial,sans-serif; }
.barq-filter-active { padding:3px 7px; border-radius:5px; background:var(--barq-color-shade-114); color:var(--barq-color-red); font-size:11px; }
.barq-filter-links { display:flex; gap:16px; align-items:center; flex-wrap:wrap; grid-column:1 / -1; font-size:12px; }
#changelist #toolbar { padding:16px 18px; }
#toolbar form { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
#toolbar form > div { display:flex; align-items:center; gap:10px; flex:1 1 100%; min-width:0; }
#toolbar #searchbar { box-sizing:border-box; flex:1 1 240px; min-width:0; max-width:560px; width:auto; min-height:42px; border-radius:8px; padding:10px 12px; }
#toolbar input[type="submit"] { flex-shrink:0; min-height:42px; padding:10px 16px; margin:0; border-radius:8px; }
#changelist .actions { padding:12px 18px; display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
#changelist .actions label { display:inline-flex; align-items:center; gap:8px; margin:0; }
#changelist .actions select, #changelist .actions .button { margin:0; min-height:38px; box-sizing:border-box; }
#header #user-tools .barq-notification-icon-button { width:36px; height:36px; padding:0; border-color:transparent; border-radius:8px; color:var(--barq-color-shade-015); }
#header .barq-notification-panel a:link, #header .barq-notification-panel a:visited { color:var(--barq-color-charcoal); border-bottom:0; }
#header .barq-notification-description, #header .barq-notification-status { margin:0; }
#content .barq-welcome h2 { margin-top:0; }
.barq-workspace-links { align-items:stretch; }
@media(max-width:767px) {
 #header { flex-direction:column; align-items:center; justify-content:center; gap:16px; padding:20px 16px; }
 #branding { width:100%; justify-content:center; }
 .barq-brand { justify-content:center; gap:14px; }
 #user-tools.barq-admin-tools { display:flex; justify-content:center; align-items:center; width:100%; padding:0; margin:0; gap:12px; }
 .barq-admin-tools > span { flex-basis:100%; text-align:center; line-height:1.5; }
 #user-tools.barq-admin-tools form { margin:0; }
 #user-tools.barq-admin-tools .barq-admin-signout { min-height:44px; padding:10px 14px; border-radius:8px; }
 #user-tools.barq-admin-tools > a { font-size:11px; letter-spacing:0; }
 #content { padding:24px 16px; }
 .barq-welcome { padding:24px 20px; gap:20px; }
 .barq-welcome h2 { font-size:25px; line-height:1.25; }
 .barq-workspace-links { align-items:stretch; }
 #changelist #toolbar, #changelist .actions { padding:14px; }
 #toolbar #searchbar { flex:1; width:auto; min-width:0; }
 .barq-admin-filter-body { padding:4px 14px 16px; gap:14px; }
 .form-row { padding:16px 14px; }
 .barq-brand-title { font-size:22px; padding:0; }
}
@media(max-width:400px) { .barq-brand-logo .barq-identity-logo {width:140px;} .barq-brand-title {font-size:20px;} .barq-brand {gap:12px;} }

/* Light is the default; the explicit Dark option controls the dark palette. */
#header { position:relative; background:var(--barq-surface); color:var(--body-fg); }
.barq-brand-title { color:var(--body-fg); }
#header a:link, #header a:visited { color:var(--link-fg); }
#user-tools .theme-toggle { display:inline-flex; align-items:center; justify-content:center; width:36px; height:36px; padding:8px; border:1px solid var(--hairline-color); border-radius:8px; background:var(--barq-surface); color:var(--body-fg); }
.login .barq-admin-theme-tools { position:absolute; top:14px; right:14px; margin:0; padding:0; }
.login .barq-login-intro { margin-bottom:24px; }
.login .barq-site-footer { display:flex; flex-direction:column; justify-content:center; align-items:center; gap:10px; padding:20px; text-align:center; background:var(--barq-surface); color:var(--body-quiet-color); border-color:var(--hairline-color); }
.login .barq-site-footer > * { flex:0 0 auto; width:100%; min-width:0; order:0; }
.login .barq-footer-brand { color:var(--body-fg); }
.login .barq-footer-contact { align-items:center; text-align:center; }

/* Action links keep Django's native destinations and use Barq's palette. */
.module a.addlink, .module a.changelink, .module a.viewlink {
 display:inline-flex; align-items:center; justify-content:center; gap:6px;
 padding:6px 9px; border:1px solid var(--border-color); border-radius:6px;
 background:var(--barq-surface); background-image:none; color:var(--link-fg);
 font-size:12px; font-weight:550; line-height:1.4; white-space:nowrap;
}
.module a.addlink:hover, .module a.changelink:hover, .module a.viewlink:hover { background:var(--selected-row); border-color:var(--link-fg); }
.module a.addlink::before, .module a.changelink::before, .module a.viewlink::before {
 content:""; width:13px; height:13px; background:currentColor;
 mask:var(--barq-action-icon) center / contain no-repeat;
 -webkit-mask:var(--barq-action-icon) center / contain no-repeat;
}
.module a.addlink { --barq-action-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4v16M4 12h16' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E"); }
.module a.changelink { --barq-action-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m16 3 5 5-12 12-6 1 1-6ZM13 6l5 5' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.module a.viewlink { --barq-action-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12Z' fill='none' stroke='black' stroke-width='2'/%3E%3Ccircle cx='12' cy='12' r='3' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E"); }
#content table tbody td:not(.original), #content table tbody th { padding:14px 16px; line-height:1.6; vertical-align:middle; }
#content #result_list tbody td, #content #result_list tbody th { padding:14px 16px; }
#content #result_list thead th { padding:12px 16px; vertical-align:middle; }
#content #result_list thead th .text a, #content #result_list thead th .text span { padding:0; }
#content #result_list .action-checkbox, #content #result_list .action-checkbox-column { width:24px; padding-left:10px; padding-right:10px; }
#nav-sidebar .module th, #nav-sidebar .module td { padding:10px 8px; vertical-align:middle; }

html[data-theme="dark"] #nav-sidebar { background:var(--barq-surface); border-color:var(--hairline-color); }
html[data-theme="dark"] .barq-brand-title .barq-wordmark-accent { color:var(--barq-brand-accent); }
html[data-theme="dark"] #nav-sidebar .module caption { background:var(--darkened-bg); }
html[data-theme="dark"] #nav-sidebar .module caption a, html[data-theme="dark"] #nav-sidebar th a { color:var(--body-fg); }
html[data-theme="dark"] #nav-sidebar td a { color:var(--link-fg); }
html[data-theme="dark"] #nav-sidebar tbody tr:nth-child(odd) { background:var(--barq-surface); }
html[data-theme="dark"] #nav-sidebar tbody tr:nth-child(even) { background:var(--darkened-bg); }
html[data-theme="dark"] #nav-sidebar tbody tr:hover, html[data-theme="dark"] #nav-sidebar tbody tr.current-model { background:var(--selected-row); }
html[data-theme="dark"] #nav-filter { background:var(--barq-surface); color:var(--body-fg); border-color:var(--border-color); }
html[data-theme="dark"] .barq-welcome h2, html[data-theme="dark"] .barq-admin-filter-dropdown > summary, html[data-theme="dark"] .barq-recent-actions > summary { color:var(--body-fg); }
html[data-theme="dark"] #changelist #changelist-filter, html[data-theme="dark"] .barq-recent-actions > summary { background:var(--darkened-bg); }
html[data-theme="dark"] .barq-admin-filter select { background:var(--barq-surface); color:var(--body-fg); border-color:var(--border-color); }
@media(max-width:767px) {
 #content table tbody td:not(.original), #content table tbody th, #content #result_list tbody td, #content #result_list tbody th { padding:12px; }
 #content #result_list thead th { padding:12px; }
 .dashboard .module a.addlink, .dashboard .module a.changelink, .dashboard .module a.viewlink { padding:7px 8px; }
 .login #user-tools.barq-admin-theme-tools { width:auto; top:12px; right:12px; }
}
/* Task-oriented management and a permission-scoped dashboard. */
.barq-dashboard-metrics { display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:16px; margin:24px 0; }
.barq-metric { display:flex; flex-direction:column; gap:8px; padding:20px; background:var(--body-bg); border:1px solid var(--hairline-color); border-radius:8px; }
.barq-metric strong { font-size:28px; }
.barq-metric span { font-size:14px; color:var(--body-fg); }
.barq-activity table { width:100%; }
.barq-activity td,.barq-activity th { padding:12px 16px; }
.barq-management-menu > summary { min-height:44px; padding:12px; cursor:pointer; font-size:16px; font-weight:600; }
.barq-task-group { margin-bottom:16px; }
.barq-model-row { display:flex; align-items:center; border-bottom:1px solid var(--hairline-color); }
.barq-model-main { flex:1; display:block; min-height:44px; padding:12px 16px; font-size:14px; }
.barq-model-row .addlink { min-height:44px; padding:12px 16px; color:var(--barq-brand-accent); }
#user-tools { text-transform:none; letter-spacing:normal; }
.theme-toggle { min-width:44px; min-height:44px; }
.barq-theme-toggle svg { width:20px; height:20px; }
.theme-toggle svg.barq-theme-sun { display:block; }
.barq-theme-toggle .barq-theme-moon { display:none; }
.barq-theme-toggle[data-dark=true] .barq-theme-sun { display:none; }
.barq-theme-toggle[data-dark=true] .barq-theme-moon { display:block; }
#nav-sidebar .barq-model-row[hidden],#nav-sidebar .barq-task-group[hidden] { display:none; }
.login input { border-radius:8px; padding:12px; font-family:Geist,Arial,sans-serif; }
body:not(.login) { overflow:hidden; }
body:not(.login) #container { height:100dvh; min-width:0; display:flex; flex-direction:column; }
body:not(.login) #header,body:not(.login) #footer,body:not(.login) .breadcrumbs { flex-shrink:0; }
body:not(.login) #main { flex:1; min-height:0; overflow:hidden; }
body:not(.login) #main > .content { min-width:0; min-height:0; overflow:auto; scrollbar-width:thin; }
body:not(.login) #nav-sidebar { height:100%; max-height:100%; min-height:0; overflow:auto; scrollbar-width:thin; }
.barq-dashboard-metrics { grid-template-columns:repeat(auto-fit,minmax(144px,1fr)); }
.barq-model-row { position:relative; }
.barq-model-main::after { content:""; position:absolute; inset:0; }
.barq-model-row .addlink { position:relative; z-index:1; }

/* Theme stays in a predictable corner, independent of account actions. */
#header { padding-right:84px; }
.barq-admin-theme-control { position:absolute; top:50%; right:20px; transform:translateY(-50%); display:flex; }
.barq-admin-theme-control .theme-toggle { display:inline-flex; align-items:center; justify-content:center; width:44px; height:44px; padding:8px; border:1px solid var(--hairline-color); border-radius:8px; background:var(--barq-surface); color:var(--body-fg); cursor:pointer; }
.barq-admin-theme-control .theme-toggle:hover { background:var(--selected-row); }
.login .barq-admin-theme-control { position:fixed; top:16px; right:16px; transform:none; z-index:50; }
.login #container { border-radius:8px; margin:80px auto 32px; }
.login #header { padding:24px; border-radius:8px 8px 0 0; }
.login #branding,.login .barq-brand { width:100%; justify-content:center; }
.login .barq-brand-logo img { display:block; margin:auto; }
.login .barq-login-intro { margin:0 0 16px; text-align:center; }
.login .barq-login-intro h1 { margin:0 !important; line-height:1.3; }
.login #login-form .form-row { padding:8px 0; }
.login .form-row label { display:block; width:100%; text-align:left; margin-bottom:8px; }
.login .form-row #id_username,.login .form-row #id_password { box-sizing:border-box; width:100%; min-height:44px; padding:12px; }
.login .barq-password-field { position:relative; }
.login .barq-password-field #id_password { padding-right:52px; }
.login .barq-password-toggle { position:absolute; right:2px; top:50%; transform:translateY(-50%); display:inline-flex; align-items:center; justify-content:center; width:44px; height:44px; padding:10px; border:0; border-radius:8px; background:transparent; color:var(--body-fg); cursor:pointer; }
.login .barq-password-toggle[hidden] { display:none; }
.barq-password-toggle svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.barq-password-toggle .barq-eye-off { display:none; }.barq-password-toggle[aria-pressed=true] .barq-eye-off { display:block; }
.login .password-reset-link { margin:0; text-align:center; }
.login .password-reset-link a { display:inline-flex; min-height:44px; align-items:center; justify-content:center; }
.login .submit-row { margin:0; padding:4px 0 0; }
.button,input[type=submit],input[type=button],.submit-row input,.barq-admin-signout,.module a.addlink,.module a.changelink,.module a.viewlink { border-radius:var(--barq-control-radius); min-height:var(--barq-control-height); box-sizing:border-box; font-weight:600; transition:background .15s,border-color .15s; }
div.barq-email-categories { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr)); gap:4px 20px; max-width:900px; padding:12px; border:1px solid var(--hairline-color); border-radius:8px; background:var(--barq-surface); }
div.barq-email-categories > div { margin:0; padding:0; border:0; background:transparent; }
.aligned .barq-email-categories label { display:flex; float:none; width:auto; min-height:40px; gap:8px; align-items:center; padding:0; font-weight:400; line-height:1.4; }
.barq-email-categories input[type=checkbox] { flex:none; width:18px; height:18px; accent-color:var(--primary); }
#content input[type=submit],#content input[type=button],#changelist .actions .button { padding:10px 16px; }
@media(max-width:767px) {
 #header { padding:20px 64px; }
 .barq-admin-theme-control { top:16px; right:12px; transform:none; }
 .login #header { padding:24px; }
 .login #content { padding:24px; }
 .login .form-row label { text-align:center; }
 .login .barq-login-intro h1 { font-size:26px !important; }
}
