html[data-theme], :root {
  color-scheme: light;
  --primary: #6669db; --secondary: #191e2d; --accent: #fff;
  --primary-fg: #fff; --body-fg: #293247; --body-bg: #f2f4f9;
  --body-quiet-color: #616d83; --body-loud-color: #222a3b;
  --header-color: #fff; --header-branding-color: #fff; --header-bg: #151926;
  --breadcrumbs-fg: #69758b; --breadcrumbs-link-fg: #414c68; --breadcrumbs-bg: #f2f4f9;
  --link-fg: #5055c8; --link-hover-color: #373b9f; --link-selected-fg: #373b9f;
  --hairline-color: #e6e9f2; --border-color: #dce1ed;
  --darkened-bg: #f5f6fa; --selected-bg: #eeeffb; --selected-row: #f0f0ff;
  --button-bg: #585ccd; --button-hover-bg: #4448b8;
  --default-button-bg: #585ccd; --default-button-hover-bg: #4448b8;
  --close-button-bg: #525e75; --close-button-hover-bg: #414a60;
}
body { font-family: system-ui, "Microsoft YaHei", sans-serif; }
#header { min-height: 64px; padding: 10px 24px; box-sizing: border-box; }
#site-name a { display: flex; align-items: center; gap: 12px; font-size: 19px; font-weight: 700; }
.console-mark, .console-card-icon {
  display: inline-grid; place-items: center; border-radius: 11px; width: 36px; height: 36px;
  background: #eaeaff; color: #4f54c7; font-weight: 750;
}
.console-mark { color: white; background: linear-gradient(135deg, #8789f6, #5b54c9); }
#user-tools { font-size: 12px; }
#main { align-items: stretch; }
.console-sidebar {
  box-sizing: border-box; flex: 0 0 220px; min-width: 0; padding: 24px 12px;
  background: #151926; color: #adb6ca;
}
.console-nav-label { font-size: 12px; padding: 0 12px 12px; color: #a0a9be; }
.console-home, .console-sidebar a:link, .console-sidebar a:visited { color: #cbd1df; }
.console-home { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 9px; margin-bottom: 16px; }
.console-sidebar .module { background: transparent; border: none; margin-bottom: 18px; }
.console-sidebar table, .console-sidebar th { width: 100%; }
.console-sidebar caption { background: transparent; padding: 8px 12px; }
.console-sidebar caption a:link, .console-sidebar caption a:visited { color: #a0a9be; }
.console-sidebar tbody th, .console-sidebar tbody td { padding: 0; border: 0; background: transparent; }
.console-sidebar tbody a { display: block; padding: 11px 12px; border-radius: 9px; font-size: 14px; }
.console-sidebar tbody td { display: none; }
.console-sidebar a:hover, .console-sidebar .is-current, .console-sidebar .current-model a {
  background: #2a3147; color: white; box-shadow: inset 3px 0 #8588ff;
}
#content { box-sizing: border-box; padding: 26px clamp(16px, 3vw, 42px); }
.dashboard #content { width: auto; }
div.breadcrumbs { padding: 12px 24px; border-bottom: 1px solid var(--border-color); }
#content h1 { font-weight: 750; }
.console-hero {
  padding: 28px; border-radius: 17px; margin-bottom: 22px;
  background: linear-gradient(115deg, #191f34, #272e48); color: #d6dbeb;
}
.console-hero h1 { color: #fff; margin: 9px 0 5px; }
.console-hero p { margin: 0; }
.console-kicker { color: #b5b9ff; font-size: 11px; font-weight: 700; letter-spacing: .13em; }
.console-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 16px; }
.console-card, #changelist, .change-form fieldset, .submit-row {
  background: #fff; border: 1px solid var(--border-color); border-radius: 14px;
}
.console-card { padding: 20px; }
.console-card h2 { margin: 12px 0; font-size: 16px; color: var(--body-fg); }
.console-card-actions { display: flex; flex-wrap: wrap; gap: 16px; }
#changelist { padding: 16px; box-sizing: border-box; }
#changelist .results { border: 1px solid var(--hairline-color); border-radius: 10px; }
#changelist table thead th { background: #f5f6fa; }
#changelist table td, #changelist table th { padding: 12px 10px; }
#toolbar, #changelist-filter { border: 1px solid var(--hairline-color); border-radius: 10px; }
#changelist-filter h2, .module h2, .module caption, .inline-group h2 { background: #272e48; }
.object-tools a.addlink:link, .object-tools a.addlink:visited { background-color: #585ccd; border-radius: 9px; }
input, select, textarea, .button, input[type=submit] { border-radius: 8px; }
.console-footer { padding: 14px 24px; border-top: 1px solid var(--hairline-color); color: #616d83; font-size: 12px; }
.login #container { border: 1px solid var(--border-color); border-radius: 16px; overflow: hidden; box-shadow: 0 14px 45px #222a3b14; }
.login .console-footer { display: none; }
@media (max-width: 850px) {
  .console-sidebar { flex-basis: 170px; }
  #content { padding: 18px; }
}
@media (max-width: 640px) {
  #main { flex-direction: column; }
  .console-sidebar { flex: auto; padding: 10px 12px; }
  .console-nav-label { display: none; }
  .console-home { margin-bottom: 4px; }
  .console-sidebar .module { margin-bottom: 2px; }
  .console-sidebar table, .console-sidebar tbody { display: flex; flex-wrap: wrap; }
  .console-sidebar caption { display: none; }
  .console-sidebar tbody th { width: auto; }
  .console-sidebar tbody a { padding: 8px; }
}

/* Keep the account controls aligned and remove Django row striping from the sidebar. */
#header { align-items: center; gap: 12px; flex-wrap: wrap; }
#user-tools { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 0; }
#user-tools a, #user-tools button { color: #eef0fb; }
#user-tools form { margin: 0; }
#user-tools button { border: 0; background: transparent; padding: 0; font: inherit; cursor: pointer; }
.console-sidebar tbody tr { background: transparent; }
.console-sidebar .current-model a:link, .console-sidebar .current-model a:visited { color: #fff; }
@media (max-width: 640px) {
  #user-tools { justify-content: flex-start; }
}

#content-start, #content-main, #changelist .changelist-form-container { min-width: 0; }
#content-start { flex: 1 1 0; }
#content { max-width: 100%; }
#changelist .results, .inline-group .tabular { overflow-x: auto; }
#toolbar form input[type="text"] { min-width: 0; }
.change-form fieldset { min-width: 0; }
.change-form .form-row input:not([type="checkbox"]), .change-form .form-row textarea {
  max-width: 100%;
  box-sizing: border-box;
}
@media (min-width: 641px) and (max-width: 1024px) {
  #header { flex-direction: row; justify-content: space-between; }
}
@media (max-width: 640px) {
  #header { padding-inline: 12px; }
  #user-tools { width: auto; max-width: 100%; margin: 0; }
  #changelist { flex-direction: column; }
  #changelist-filter { width: auto; flex-basis: auto; margin: 12px 0 0; }
}
@media (max-width: 640px) {
  #header { flex-direction: column; align-items: flex-start; }
  #header #user-tools { position: static; align-self: flex-start; width: auto; margin: 0; }
}
#container > #header { display: flex; }
@media (max-width: 640px) {
  #container > #header { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 640px) {
  #container > #header { height: auto; flex-wrap: nowrap; }
}
.console-sidebar, .console-sidebar .console-nav-label,
.console-sidebar a:link, .console-sidebar a:visited,
.console-sidebar caption a:link, .console-sidebar caption a:visited {
  color: #fff;
}

/* Shared layout for admin create, edit, and password forms. */
.change-form #content { max-width: 1140px; }
.change-form #content > h1 { margin-bottom: 20px; }
.change-form fieldset { padding: 12px 20px; margin-bottom: 18px; }
.change-form fieldset .form-row { padding: 14px 0; border-color: #edf0f6; }
.change-form fieldset .form-row:last-child { border-bottom: 0; }
.change-form fieldset .form-row[hidden] { display: none; }
.change-form .aligned .form-row label { font-weight: 600; color: #364159; }
.change-form .aligned .form-row .help { color: #616d83; }
.change-form .form-row input:not([type="checkbox"]), .change-form .form-row textarea,
.change-form .form-row select { background: #fff; border-color: #ccd3e3; }
.change-form .form-row :is(input, textarea, select):focus-visible {
  outline: 2px solid #777bec; outline-offset: 2px;
}
.change-form .form-row textarea { width: min(100%, 500px); }
.change-form .submit-row { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 18px; }
.change-form .submit-row > * { margin: 0; }
.domain-preview { min-width: 0; padding: 12px; border: 1px solid #e0e4f0; border-radius: 10px; background: #f7f8fd; }
.domain-preview button { padding: 6px 12px; border: 1px solid #cbd0ea; border-radius: 8px; color: #464ab1; background: #fff; cursor: pointer; }
.domain-preview button:disabled { opacity: .55; cursor: default; }
.domain-preview ul { max-height: 230px; overflow: auto; overflow-wrap: anywhere; padding-inline-start: 18px; }
.domain-preview p { margin-bottom: 0; color: #616d83; }
@media (max-width: 700px) {
  .change-form fieldset { padding-inline: 12px; }
  .change-form .aligned .form-row .flex-container:not(.checkbox-row) { flex-wrap: wrap; }
  .change-form .aligned .form-row .flex-container:not(.checkbox-row) > label { width: 100%; }
}

/* Console theme */
html[data-theme], :root {
  --body-bg: #f4f6fa; --body-fg: #243047; --body-quiet-color: #59677f;
  --header-bg: #141d2e; --border-color: #dce3ee; --hairline-color: #e8edf5;
  --button-bg: #4d54c8; --button-hover-bg: #3d43ac;
  --default-button-bg: #4d54c8; --default-button-hover-bg: #3d43ac;
}
#container > #header { background: #141d2e; border-bottom: 1px solid #313b51; }
.console-sidebar { background: #141d2e; padding: 20px 14px; flex-basis: 224px; }
.console-nav-label, .console-nav-group h2 { color: #fff; opacity: .78; font-size: 12px; font-weight: 650; }
.console-nav-group { margin: 18px 0; }
.console-nav-group h2 { margin: 0 0 6px; padding: 0 12px; }
.console-nav-group a { display: block; padding: 10px 12px; border-radius: 8px; margin: 2px 0; }
.console-sidebar .is-current { background: #303b62; box-shadow: inset 3px 0 #a3a8ff; }
div.breadcrumbs { background: #fff; border-color: var(--hairline-color); }
#content > h1 { font-size: clamp(21px, 2vw, 28px); margin-bottom: 20px; letter-spacing: -.02em; }
.console-hero { background: linear-gradient(120deg, #19253f, #32396e); }
.console-card, #changelist, .change-form fieldset, .submit-row { box-shadow: 0 2px 8px #27385308; }
.console-card:hover { border-color: #aab3ed; }
.change-list #content-main > .object-tools { margin-top: 0; }
.change-list #changelist { display: block; padding: 16px; }
.change-list #changelist .changelist-form-container { width: 100%; }
.change-list #changelist .results { margin: 0; }
.change-list #changelist table thead th { background: #f0f3f9; }
.change-list #changelist tbody tr:hover :is(td, th) { background: #f0f2ff; }
.admin-search-panel {
  margin: 0 0 16px; padding: 12px 14px; display: flex; flex-wrap: wrap;
  align-items: end; gap: 12px 16px; border: 1px solid var(--border-color);
  border-radius: 10px; background: #f8f9fc;
}
.admin-search-panel #toolbar { padding: 0; margin: 0; background: transparent; border: 0; flex: 1 1 260px; }
.admin-search-panel #toolbar form > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.admin-search-panel #toolbar form input[type="text"] { flex: 1 1 120px; margin: 0; min-height: 36px; }
.admin-search-panel #toolbar form input[type="submit"] { margin: 0; min-height: 36px; }
.admin-search-filters { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; }
.admin-filter { display: grid; gap: 4px; font-size: 12px; font-weight: 600; }
.admin-filter select { min-height: 36px; max-width: 100%; background: #fff; }
.admin-reset { padding: 8px 2px; }
.change-form fieldset { border-radius: 14px; }
.change-form fieldset .form-row { padding-block: 15px; }
.change-form .submit-row { background: #fff; }
.change-form .form-row :is(input:not([type="checkbox"]), textarea, select) { border-radius: 8px; }
@media (max-width: 900px) { .console-sidebar { flex-basis: 176px; } }
@media (max-width: 640px) {
  .console-sidebar { flex: auto; padding: 8px 12px; }
  .console-nav-group { display: flex; flex-wrap: wrap; gap: 3px; margin: 5px 0; }
  .console-nav-group h2 { display: none; }
  .console-nav-group a { padding: 6px 9px; }
  .change-list #changelist { padding: 10px; }
  .admin-search-panel { padding: 10px; }
}

#content > .console-breadcrumbs:empty { display: none; }
.console-breadcrumbs > .breadcrumbs {
  padding: 0; margin: 0 0 14px; border: 0; background: transparent;
  line-height: 1.65; overflow-wrap: anywhere;
}
.console-list-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 20px; margin-bottom: 16px; }
.console-list-heading h1 { margin: 0; font-size: clamp(21px, 2vw, 28px); font-weight: 750; }
.console-list-heading > .object-tools { float: none; margin: 0 0 0 auto; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.console-list-heading > .object-tools:empty { display: none; }
.console-list-heading > .object-tools li { float: none; margin: 0; height: auto; }
.change-list #content-main { float: none; display: flow-root; }
.change-list #changelist { margin-bottom: 0; min-height: 0; }
.change-list #changelist-form { display: flow-root; min-width: 0; }
.change-list #changelist-form .actions {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 12px; margin: 0 0 12px;
  background: #f7f8fc; border: 1px solid var(--hairline-color); border-radius: 9px;
}
.change-list #changelist-form .actions :is(label, .action-counter, .all, .question, .clear) { margin: 0; }
.change-list #changelist-form .results { box-sizing: border-box; }
.change-list #changelist .paginator {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin: 12px 0 0; padding: 10px 12px; border: 1px solid var(--hairline-color); border-radius: 9px;
  background: #f7f8fc; min-height: 0;
}
@media (max-width: 640px) {
  .console-list-heading > .object-tools { margin-left: 0; }
}

.change-list #changelist-form .actions {
  box-sizing: border-box; width: 100%; max-width: 100%; margin: 12px 0 0;
}
.console-pagination {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px;
  box-sizing: border-box; max-width: 100%; margin-top: 12px; padding: 10px 12px;
  background: #f7f8fc; border: 1px solid var(--hairline-color); border-radius: 9px;
}
.console-pagination label, .console-page-jump { display: flex; align-items: center; gap: 6px; }
.console-pagination [aria-disabled="true"] { color: #687287; }
.console-pagination select, .console-pagination button, .console-pagination input { min-height: 34px; box-sizing: border-box; }
.console-pagination input[type="number"] { width: 64px; }
.console-pagination button { border: 1px solid var(--border-color); background: #fff; color: var(--link-fg); padding: 0 10px; cursor: pointer; }

