:root {
    --ywz-primary: #0f766e;
    --ywz-primary-hover: #0b5f59;
    --ywz-primary-soft: #e8f5f2;
    --ywz-info: #2563eb;
    --ywz-success: #15803d;
    --ywz-warning: #b45309;
    --ywz-danger: #b42318;
    --ywz-danger-hover: #8f1c13;
    --ywz-ink: #17212b;
    --ywz-text: #334155;
    --ywz-muted: #64748b;
    --ywz-border: #d8e0e7;
    --ywz-border-strong: #b6c4ce;
    --ywz-canvas: #f3f6f8;
    --ywz-surface: #ffffff;
    --ywz-surface-muted: #f8fafb;
    --ywz-focus: rgba(37, 99, 235, 0.28);
    --ywz-radius-control: 6px;
    --ywz-radius-surface: 8px;
    --ywz-shadow-surface: 0 8px 24px rgba(15, 23, 42, 0.08);
    --ywz-shadow-action: 0 4px 14px rgba(15, 118, 110, 0.18);
}

html {
    box-sizing: border-box;
    background: var(--ywz-canvas);
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

body {
    min-width: 0;
    margin: 0;
    background: var(--ywz-canvas);
    color: var(--ywz-text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    letter-spacing: 0;
}

#container {
    min-height: 100vh;
}

a:link,
a:visited {
    color: var(--ywz-primary);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.button:focus-visible {
    outline: 3px solid var(--ywz-focus);
    outline-offset: 2px;
}

a:hover,
a:focus {
    color: var(--ywz-primary-hover);
}

h1,
h2,
h3,
h4,
h5 {
    color: var(--ywz-ink);
    font-family: inherit;
    letter-spacing: 0;
}

h1 {
    margin: 0 0 20px;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.35;
}

h2 {
    font-size: 18px;
    font-weight: 700;
}

h3 {
    font-size: 15px;
    font-weight: 600;
}

/* Header and account navigation */

#header {
    min-height: 68px;
    height: auto;
    padding: 0 32px;
    border-bottom: 1px solid var(--ywz-border);
    background: var(--ywz-surface);
    color: var(--ywz-text);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

#branding,
#branding h1 {
    float: none;
    margin: 0;
    padding: 0;
}

#branding h1,
#branding h1 a:link,
#branding h1 a:visited {
    color: var(--ywz-ink);
    font-size: 18px;
    font-weight: 700;
}

.ywz-brand {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.ywz-brand-mark {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: var(--ywz-radius-surface);
    background: var(--ywz-primary);
    color: #fff;
    display: inline-grid;
    place-items: center;
    font-size: 25px;
    font-weight: 500;
    line-height: 1;
}

.ywz-brand-text {
    white-space: nowrap;
}

#user-tools {
    position: static;
    float: none;
    margin: 0;
    padding: 0;
    color: var(--ywz-muted);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
}

#user-tools strong {
    color: var(--ywz-ink);
    font-weight: 600;
}

#header a:link,
#header a:visited {
    color: var(--ywz-text);
}

#header a:hover,
#header a:focus {
    color: var(--ywz-primary);
}

#branding .ywz-brand:hover .ywz-brand-text {
    color: var(--ywz-primary);
}

div.breadcrumbs {
    min-height: 42px;
    padding: 10px 32px;
    border-bottom: 1px solid var(--ywz-border);
    background: var(--ywz-surface-muted);
    color: var(--ywz-muted);
    font-size: 13px;
    line-height: 22px;
}

div.breadcrumbs a:link,
div.breadcrumbs a:visited {
    color: var(--ywz-text);
    font-weight: 600;
}

/* Main workspace */

#content {
    width: auto;
    max-width: 1600px;
    margin: 0 auto;
    padding: 28px 32px 48px;
}

.dashboard #content {
    width: auto;
}

#content-main {
    min-width: 0;
}

.dashboard #content-main {
    width: calc(100% - 340px);
}

#content-related {
    width: 312px;
    margin-right: 0;
    color: var(--ywz-text);
    background: transparent;
}

#content-related .module {
    border: 1px solid var(--ywz-border);
    border-radius: var(--ywz-radius-surface);
    background: var(--ywz-surface);
    overflow: hidden;
}

#content-related .module h2 {
    padding: 14px 16px;
    border-bottom: 1px solid var(--ywz-border);
    background: var(--ywz-surface-muted);
    color: var(--ywz-ink);
    font-size: 15px;
    font-weight: 700;
}

#content-related .module h3 {
    padding: 14px 16px 4px;
    color: var(--ywz-text);
    font-size: 13px;
    font-weight: 600;
}

#content-related .actionlist {
    padding: 0 16px 12px;
}

#content-related .actionlist li {
    padding: 8px 0 8px 24px;
    border-bottom: 1px solid #edf1f4;
    line-height: 1.45;
}

#content-related .actionlist li:last-child {
    border-bottom: 0;
}

.module {
    margin-bottom: 20px;
    border: 1px solid var(--ywz-border);
    border-radius: var(--ywz-radius-surface);
    background: var(--ywz-surface);
}

.module h2,
.module caption,
.inline-group h2 {
    padding: 12px 16px;
    border-bottom: 1px solid var(--ywz-border);
    border-radius: var(--ywz-radius-surface) var(--ywz-radius-surface) 0 0;
    background: var(--ywz-primary-soft);
    color: var(--ywz-ink);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.45;
    letter-spacing: 0;
    text-transform: none;
}

.module caption a:link,
.module caption a:visited {
    color: var(--ywz-ink);
}

.module table {
    border-collapse: collapse;
}

table thead th {
    background: var(--ywz-surface-muted);
    color: var(--ywz-text);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

td,
th {
    border-bottom-color: #e7edf1;
}

tbody tr:hover {
    background: #f4faf8;
}

.dashboard .module {
    overflow: hidden;
}

.dashboard .module table th,
.dashboard .module table td {
    padding: 12px 16px;
    border-bottom: 1px solid #edf1f4;
    vertical-align: middle;
}

.dashboard .module table tr:last-child th,
.dashboard .module table tr:last-child td {
    border-bottom: 0;
}

.dashboard .module table th a {
    color: var(--ywz-text);
    font-weight: 600;
}

.dashboard .module table td {
    width: 1%;
    font-size: 12px;
}

.addlink,
.changelink,
.deletelink,
.viewlink {
    font-weight: 600;
}

/* Controls */

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="date"],
input[type="time"],
select,
textarea {
    min-height: 40px;
    max-width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--ywz-border);
    border-radius: var(--ywz-radius-control);
    background: var(--ywz-surface);
    color: var(--ywz-ink);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    letter-spacing: 0;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

textarea {
    min-height: 112px;
    resize: vertical;
}

select[multiple] {
    min-height: 140px;
}

input[type="text"]:hover,
input[type="password"]:hover,
input[type="email"]:hover,
input[type="url"]:hover,
input[type="number"]:hover,
input[type="search"]:hover,
select:hover,
textarea:hover {
    border-color: var(--ywz-border-strong);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
    border-color: var(--ywz-primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
    outline: none;
}

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--ywz-primary);
}

input[disabled],
select[disabled],
textarea[disabled],
.form-row .readonly {
    background: #edf1f4;
    color: var(--ywz-muted);
}

.button,
input[type="submit"],
input[type="button"],
.submit-row input,
a.button {
    min-height: 40px;
    height: auto;
    padding: 9px 16px;
    border: 1px solid var(--ywz-border);
    border-radius: var(--ywz-radius-control);
    background: var(--ywz-surface);
    box-shadow: none;
    color: var(--ywz-text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 20px;
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
a.button:hover {
    border-color: var(--ywz-border-strong);
    background: var(--ywz-surface-muted);
    color: var(--ywz-ink);
}

.button.default,
input[type="submit"].default,
.submit-row input.default {
    border-color: var(--ywz-primary);
    background: var(--ywz-primary);
    color: #fff;
}

.button.default:hover,
input[type="submit"].default:hover,
.submit-row input.default:hover,
.button.default:focus,
input[type="submit"].default:focus {
    border-color: var(--ywz-primary-hover);
    background: var(--ywz-primary-hover);
    color: #fff;
    box-shadow: var(--ywz-shadow-action);
}

/* Forms and edit pages */

.form-row {
    padding: 16px 18px;
    border-bottom: 1px solid #e7edf1;
    font-size: 14px;
}

.form-row:last-child {
    border-bottom: 0;
}

label {
    color: var(--ywz-text);
    font-size: 13px;
    font-weight: 500;
}

.required label,
label.required {
    color: var(--ywz-ink);
    font-weight: 700;
}

.aligned label {
    width: 190px;
    padding-right: 20px;
    line-height: 1.35;
}

.aligned label + p,
.aligned label + div.help,
.aligned label + div.readonly {
    margin-left: 200px;
}

form .aligned ul,
form .aligned p.help,
form .aligned div.help,
form .aligned input + p.help,
form .aligned textarea + p.help,
form .aligned select + p.help,
form .aligned input + div.help,
form .aligned textarea + div.help,
form .aligned select + div.help {
    margin-left: 190px;
    padding-left: 10px;
}

form .aligned label + p.help,
form .aligned label + div.help {
    margin-left: 0;
    padding-left: 0;
}

.help,
p.help,
form p.help,
div.help {
    color: var(--ywz-muted);
    font-size: 12px;
    line-height: 1.55;
}

.errornote,
ul.errorlist {
    border: 1px solid #f2b8b5;
    border-radius: var(--ywz-radius-control);
    background: #fff1f1;
    color: var(--ywz-danger);
}

.form-row.errors {
    border-bottom-color: #f2b8b5;
    background: #fff8f7;
}

.form-row.errors input,
.form-row.errors select,
.form-row.errors textarea {
    border-color: var(--ywz-danger);
}

.submit-row {
    position: sticky;
    z-index: 20;
    bottom: 12px;
    margin: 20px 0 0;
    padding: 12px 14px;
    border: 1px solid var(--ywz-border);
    border-radius: var(--ywz-radius-surface);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--ywz-shadow-surface);
}

.submit-row input {
    margin-left: 8px;
}

.submit-row p.deletelink-box {
    margin: 0;
}

.submit-row a.deletelink {
    min-height: 40px;
    padding: 9px 16px;
    border-radius: var(--ywz-radius-control);
    background: var(--ywz-danger);
    color: #fff;
    font-weight: 600;
    line-height: 22px;
}

.submit-row a.deletelink:hover,
.submit-row a.deletelink:focus,
.submit-row a.deletelink:active {
    background: var(--ywz-danger-hover);
}

.inline-group {
    border: 1px solid var(--ywz-border);
    border-radius: var(--ywz-radius-surface);
    background: var(--ywz-surface);
    overflow: hidden;
}

.inline-related h3,
.inline-group div.add-row,
.inline-group .tabular tr.add-row td {
    border-color: var(--ywz-border);
    background: var(--ywz-surface-muted);
    color: var(--ywz-text);
}

.selector {
    max-width: 100%;
}

/* Page actions and messages */

.object-tools {
    margin-top: -52px;
}

.object-tools li {
    height: auto;
}

.object-tools a:link,
.object-tools a:visited {
    min-height: 40px;
    padding: 9px 14px;
    border-radius: var(--ywz-radius-control);
    background-color: var(--ywz-primary);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 22px;
    letter-spacing: 0;
    text-transform: none;
}

.object-tools a.addlink {
    padding-left: 34px;
    background-position: 13px center;
}

.object-tools a:hover,
.object-tools a:focus {
    background-color: var(--ywz-primary-hover);
    color: #fff;
}

ul.messagelist {
    max-width: 1600px;
    margin: 18px auto 0;
    padding: 0 32px;
}

ul.messagelist li {
    min-height: 44px;
    padding: 11px 16px 11px 42px;
    border: 1px solid #a7d9c1;
    border-radius: var(--ywz-radius-control);
    background-color: #effaf4;
    background-position: 16px 14px;
    color: #166534;
    font-size: 13px;
}

ul.messagelist li.warning {
    border-color: #f2cf93;
    background-color: #fff8e8;
    color: var(--ywz-warning);
}

ul.messagelist li.error {
    border-color: #f2b8b5;
    background-color: #fff1f1;
    color: var(--ywz-danger);
}

/* List pages, search, filters, tables, and pagination */

#changelist {
    min-width: 0;
}

#changelist #toolbar {
    margin: 0 0 16px;
    padding: 12px;
    border: 1px solid var(--ywz-border);
    border-radius: var(--ywz-radius-surface);
    background: var(--ywz-surface);
    color: var(--ywz-muted);
}

#changelist #toolbar form {
    display: flex;
    align-items: center;
    gap: 8px;
}

#changelist #toolbar form #searchbar {
    width: min(420px, 48vw);
    height: 40px;
    margin: 0;
    padding: 9px 11px;
    border: 1px solid var(--ywz-border);
    border-radius: var(--ywz-radius-control);
    font-size: 14px;
}

#changelist #toolbar form input[type="submit"] {
    min-height: 40px;
    padding: 9px 16px;
    border: 1px solid var(--ywz-primary);
    border-radius: var(--ywz-radius-control);
    background: var(--ywz-primary);
    box-shadow: none;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

#changelist #toolbar form input[type="submit"]:hover,
#changelist #toolbar form input[type="submit"]:focus {
    border-color: var(--ywz-primary-hover);
    background: var(--ywz-primary-hover);
}

#changelist-form .results {
    max-width: 100%;
    border: 1px solid var(--ywz-border);
    border-radius: var(--ywz-radius-surface) var(--ywz-radius-surface) 0 0;
    background: var(--ywz-surface);
    overflow-x: auto;
}

#changelist table {
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
}

#changelist table thead th {
    position: sticky;
    z-index: 2;
    top: 0;
    padding: 0;
    border-bottom: 1px solid var(--ywz-border);
    background: var(--ywz-surface-muted);
    vertical-align: middle;
}

#changelist table thead th > div,
#changelist table thead th > div.text {
    padding: 11px 10px;
}

#changelist table tbody th,
#changelist table tbody td {
    padding: 11px 10px;
    border-bottom: 1px solid #e7edf1;
    color: var(--ywz-text);
    vertical-align: middle;
}

#changelist table tbody th {
    color: var(--ywz-ink);
    font-weight: 600;
}

#changelist table tbody tr:nth-child(even) {
    background: #fbfcfd;
}

#changelist table tbody tr:hover,
#changelist table tbody tr:nth-child(even):hover {
    background: #f0f8f6;
}

#changelist table tbody tr.selected {
    background: #e6f4ef;
}

#changelist .actions {
    min-height: 58px;
    padding: 9px 12px;
    border: 1px solid var(--ywz-border);
    border-bottom: 0;
    border-radius: var(--ywz-radius-surface) var(--ywz-radius-surface) 0 0;
    background: var(--ywz-surface);
    color: var(--ywz-muted);
    line-height: 40px;
}

#changelist .actions select {
    min-height: 40px;
    margin-left: 8px;
    padding: 8px 32px 8px 10px;
    border-color: var(--ywz-border);
    background: var(--ywz-surface);
    color: var(--ywz-ink);
}

#changelist .actions .button {
    min-height: 40px;
    margin-left: 6px;
    padding: 9px 14px;
    border: 1px solid var(--ywz-border);
    background: var(--ywz-surface-muted);
    box-shadow: none;
    color: var(--ywz-text);
}

#changelist .paginator {
    min-height: 52px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--ywz-border);
    border-top: 0;
    border-radius: 0 0 var(--ywz-radius-surface) var(--ywz-radius-surface);
    background: var(--ywz-surface);
    color: var(--ywz-muted);
}

.paginator a:link,
.paginator a:visited,
.paginator .this-page {
    display: inline-grid;
    min-width: 32px;
    min-height: 32px;
    margin: 0 2px;
    padding: 5px 9px;
    border: 1px solid var(--ywz-border);
    border-radius: var(--ywz-radius-control);
    place-items: center;
    background: var(--ywz-surface);
    color: var(--ywz-text);
    font-size: 13px;
    font-weight: 600;
}

.paginator .this-page,
.paginator a:hover,
.paginator a:focus {
    border-color: var(--ywz-primary);
    background: var(--ywz-primary);
    color: #fff;
}

.paginator a.showall,
.paginator a.showall:hover,
.paginator a.showall:focus {
    display: inline;
    min-width: 0;
    min-height: 0;
    border: 0;
    background: transparent;
    color: var(--ywz-primary);
}

#changelist-filter {
    width: 252px;
    margin: 0;
    border: 1px solid var(--ywz-border);
    border-radius: var(--ywz-radius-surface);
    background: var(--ywz-surface);
    overflow: hidden;
}

#changelist-filter h2 {
    margin: 0;
    padding: 12px 14px;
    border-bottom: 1px solid var(--ywz-border);
    background: var(--ywz-surface-muted);
    color: var(--ywz-ink);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

#changelist-filter h3 {
    margin: 0;
    padding: 14px 14px 6px;
    color: var(--ywz-text);
    font-size: 13px;
    font-weight: 700;
}

#changelist-filter ul {
    margin: 0;
    padding: 0 14px 12px;
    border-bottom: 1px solid #edf1f4;
}

#changelist-filter li {
    margin: 0;
    padding: 0;
}

#changelist-filter a {
    min-height: 32px;
    padding: 6px 8px;
    border-radius: 4px;
    color: var(--ywz-muted);
    line-height: 20px;
}

#changelist-filter li.selected {
    margin: 0;
    padding: 0;
    border-left: 0;
}

#changelist-filter li.selected a {
    background: var(--ywz-primary-soft);
    color: var(--ywz-primary-hover);
    font-weight: 700;
}

#changelist-filter a:hover,
#changelist-filter a:focus,
#changelist-filter li.selected a:hover,
#changelist-filter li.selected a:focus {
    background: #f0f4f6;
    color: var(--ywz-ink);
}

.change-list .filtered .results,
.change-list .filtered .paginator,
.filtered #toolbar,
.filtered div.xfull,
.filtered .actions {
    width: auto;
    margin-right: 276px;
}

/* Authentication */

body.login {
    min-height: 100vh;
    padding: 0 16px;
    background: #edf4f2;
    display: grid;
    place-items: center;
}

.login #container {
    width: 420px;
    max-width: 100%;
    min-height: 0;
    margin: 32px auto;
    border: 1px solid var(--ywz-border);
    border-radius: var(--ywz-radius-surface);
    background: var(--ywz-surface);
    box-shadow: var(--ywz-shadow-surface);
    overflow: hidden;
}

.login #header {
    min-height: 80px;
    padding: 18px 28px;
    border: 0;
    background: var(--ywz-surface);
    box-shadow: none;
    justify-content: center;
}

.login .ywz-brand-mark {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
}

.login #content {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 24px 32px 32px;
    border-top: 1px solid var(--ywz-border);
}

.login #content-main {
    float: none;
}

.login .form-row {
    padding: 0 0 18px;
    border: 0;
}

.login .form-row label {
    display: block;
    width: auto;
    margin: 0 0 7px;
    padding: 0;
    color: var(--ywz-text);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
}

.login .form-row #id_username,
.login .form-row #id_password {
    width: 100%;
    min-height: 44px;
}

.login .submit-row {
    position: static;
    margin: 4px 0 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.login .submit-row input {
    width: 100%;
    min-height: 44px;
    margin: 0;
    border-color: var(--ywz-primary);
    background: var(--ywz-primary);
    color: #fff;
    font-size: 14px;
}

.login .submit-row input:hover,
.login .submit-row input:focus {
    border-color: var(--ywz-primary-hover);
    background: var(--ywz-primary-hover);
    color: #fff;
}

/* Responsive structure */

@media (max-width: 1024px) {
    #header,
    div.breadcrumbs {
        padding-left: 24px;
        padding-right: 24px;
    }

    #content {
        padding-left: 24px;
        padding-right: 24px;
    }

    .dashboard #content-main {
        width: calc(100% - 292px);
    }

    #content-related {
        width: 268px;
    }
}

@media (max-width: 767px) {
    body {
        font-size: 14px;
        overflow-x: hidden;
    }

    #header {
        min-height: 0;
        padding: 14px 16px;
        display: block;
    }

    #branding,
    #branding h1 {
        width: 100%;
    }

    .ywz-brand {
        width: 100%;
    }

    .ywz-brand-text {
        min-width: 0;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    #user-tools {
        width: 100%;
        margin-top: 12px;
        padding-top: 10px;
        border-top: 1px solid var(--ywz-border);
        text-align: left;
        line-height: 2;
    }

    div.breadcrumbs {
        min-height: 40px;
        padding: 8px 16px;
        white-space: nowrap;
        overflow-x: auto;
        scrollbar-width: thin;
    }

    #content {
        width: 100%;
        padding: 20px 16px 32px;
    }

    h1 {
        margin-bottom: 16px;
        font-size: 22px;
    }

    .dashboard #content-main,
    #content-main,
    #content-related {
        width: 100%;
        float: none;
        margin: 0;
    }

    #content-related {
        margin-top: 20px;
    }

    .module {
        margin-bottom: 16px;
    }

    .dashboard .module table th,
    .dashboard .module table td {
        padding: 11px 12px;
    }

    .object-tools {
        width: 100%;
        margin: 0 0 14px;
        padding: 0;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        float: none;
    }

    .object-tools li {
        flex: 1 1 auto;
        margin: 0;
    }

    .object-tools a:link,
    .object-tools a:visited {
        width: 100%;
        margin: 0;
        text-align: center;
    }

    ul.messagelist {
        margin-top: 12px;
        padding: 0 16px;
    }

    .aligned label,
    .wide label,
    .inline-group .aligned label {
        width: 100%;
        float: none;
        margin: 0 0 7px;
        padding: 0;
    }

    .aligned label::after {
        display: none;
    }

    .aligned label + p,
    .aligned label + div.help,
    .aligned label + div.readonly,
    form .aligned ul,
    form .aligned p.help,
    form .aligned div.help,
    form .aligned input + p.help,
    form .aligned textarea + p.help,
    form .aligned select + p.help,
    form .aligned input + div.help,
    form .aligned textarea + div.help,
    form .aligned select + div.help,
    form .wide p,
    form .wide input + p.help,
    form .wide input + div.help {
        margin-left: 0;
        padding-left: 0;
    }

    .form-row {
        padding: 14px;
        overflow: visible;
    }

    .change-form #content-main fieldset.module {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .aligned .form-row,
    .aligned .form-row > div:not([class]) {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .aligned .form-row input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
    .aligned .form-row select,
    .aligned .form-row textarea {
        width: 100%;
        min-height: 44px;
        max-width: 100%;
        padding: 9px 11px;
        flex: 1 1 100%;
    }

    fieldset .fieldBox {
        width: 100%;
        float: none;
        margin: 0 0 12px;
    }

    .vTextField,
    .vUUIDField,
    .vURLField,
    .vLargeTextField,
    .vXMLLargeTextField,
    .colM .aligned .vLargeTextField,
    .colM .aligned .vXMLLargeTextField,
    .colMS .aligned .vLargeTextField,
    .colMS .aligned .vXMLLargeTextField,
    textarea,
    select {
        width: 100%;
    }

    .related-widget-wrapper {
        max-width: 100%;
        float: none;
    }

    .related-widget-wrapper select {
        width: calc(100% - 78px);
    }

    .selector {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
    }

    .selector-available,
    .selector-chosen {
        width: 100%;
        float: none;
    }

    .selector-available input,
    .selector-chosen input,
    .selector select {
        width: 100%;
    }

    .selector ul.selector-chooser {
        width: 100%;
        margin: 8px 0;
        display: flex;
        justify-content: center;
        gap: 8px;
    }

    .submit-row {
        position: static;
        margin-top: 16px;
        padding: 12px;
        display: flex;
        flex-direction: column;
        gap: 10px;
        box-shadow: none;
    }

    .submit-row > *,
    .submit-row input,
    .submit-row input.default,
    .submit-row a,
    .submit-row a.closelink {
        width: 100%;
        margin: 0;
        float: none;
        text-align: center;
    }

    .submit-row p.deletelink-box {
        order: 10;
    }

    #changelist #toolbar form {
        align-items: stretch;
        flex-wrap: wrap;
    }

    #changelist #toolbar form #searchbar {
        width: calc(100% - 76px);
        flex: 1 1 200px;
    }

    #changelist #toolbar form input[type="submit"] {
        flex: 0 0 auto;
    }

    .change-list .filtered .results,
    .change-list .filtered .paginator,
    .filtered #toolbar,
    .filtered div.xfull,
    .filtered .actions {
        width: auto;
        margin-right: 0;
    }

    #changelist-filter {
        position: static;
        width: 100%;
        margin: 16px 0 0;
    }

    #changelist-filter ul {
        display: flex;
        max-width: 100%;
        gap: 4px;
        padding-bottom: 12px;
        overflow-x: auto;
        scrollbar-width: thin;
    }

    #changelist-filter li {
        flex: 0 0 auto;
    }

    #changelist-filter a {
        white-space: nowrap;
    }

    #changelist .actions {
        min-height: 0;
        line-height: 1.5;
    }

    #changelist .actions label {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 8px;
        align-items: center;
    }

    #changelist .actions select {
        width: 100%;
        margin: 0;
    }

    #changelist .actions .button {
        margin: 0;
    }

    #changelist-form .results {
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    #changelist .results table {
        min-width: 720px;
    }

    #changelist table tbody th,
    #changelist table tbody td {
        padding: 10px 9px;
    }

    #changelist .paginator {
        white-space: normal;
    }

    .calendarbox,
    .clockbox {
        max-width: calc(100vw - 24px);
    }

    body.login {
        padding: 16px;
    }

    .login #container {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
    }

    .login #header {
        padding: 18px 20px;
    }

    .login #content {
        padding: 22px 20px 24px;
    }

    .login #branding h1,
    .login #branding h1 a {
        font-size: 17px;
    }
}

@media (max-width: 480px) {
    #content {
        padding-left: 12px;
        padding-right: 12px;
    }

    #header {
        padding-left: 12px;
        padding-right: 12px;
    }

    .ywz-brand-mark {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
    }

    .ywz-brand-text {
        font-size: 16px;
    }

    ul.messagelist {
        padding-left: 12px;
        padding-right: 12px;
    }

    #changelist #toolbar form #searchbar {
        width: 100%;
        flex-basis: 100%;
    }

    #changelist #toolbar form input[type="submit"] {
        width: 100%;
    }

    #changelist .actions label {
        grid-template-columns: 1fr;
    }

    #changelist .actions .button {
        width: 100%;
    }

    .login #content {
        padding-left: 18px;
        padding-right: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
