:root {
    color-scheme: light;
    --hs-surface: #fff;
    --hs-sidebar: #f3f5f8;
    --hs-topbar: #182337;
    --hs-topbar-line: #3e4a60;
    --hs-topbar-text: #f2f5fb;
    --hs-topbar-muted: #c3cddd;
    --hs-topbar-height: 56px;
    --hs-soft: #f7f7f8;
    --hs-line: #e9eaec;
    --hs-border: #d6dae0;
    --hs-text: #24262a;
    --hs-muted: #5f636a;
    --hs-blue: #245ab0;
    --hs-blue-strong: #1a4589;
    --hs-blue-soft: #eaf2ff;
    --hs-success: #186448;
    --hs-danger: #a12f35;
    --hs-warning: #875a21;
    --hs-radius: 14px;
    --hs-mono: Consolas, "Cascadia Code", monospace;
    --font-family-primary: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", "Segoe UI", sans-serif;
    --font-family-monospace: var(--hs-mono);
    --primary: var(--hs-blue);
    --secondary: var(--hs-blue-strong);
    --accent: var(--hs-text);
    --primary-fg: #fff;
    --body-fg: var(--hs-text);
    --body-bg: var(--hs-surface);
    --body-quiet-color: var(--hs-muted);
    --body-loud-color: var(--hs-text);
    --header-color: var(--hs-text);
    --header-branding-color: var(--hs-topbar-text);
    --header-bg: var(--hs-surface);
    --header-link-color: var(--hs-topbar-muted);
    --breadcrumbs-fg: var(--hs-muted);
    --breadcrumbs-link-fg: var(--hs-blue);
    --breadcrumbs-bg: var(--hs-sidebar);
    --link-fg: var(--hs-blue);
    --link-hover-color: var(--hs-blue-strong);
    --link-selected-fg: var(--hs-blue-strong);
    --hairline-color: var(--hs-line);
    --border-color: var(--hs-border);
    --error-fg: var(--hs-danger);
    --message-success-bg: #eaf6ef;
    --message-warning-bg: #fff5e6;
    --message-error-bg: #fff0f1;
    --darkened-bg: var(--hs-soft);
    --selected-bg: #eef0f3;
    --selected-row: var(--hs-blue-soft);
    --button-bg: var(--hs-blue);
    --button-hover-bg: var(--hs-blue-strong);
    --default-button-bg: var(--hs-blue);
    --default-button-hover-bg: var(--hs-blue-strong);
    --close-button-bg: var(--hs-muted);
    --delete-button-bg: var(--hs-danger);
    --object-tools-bg: var(--hs-blue);
    --object-tools-hover-bg: var(--hs-blue-strong);
}

body { background: var(--hs-surface); }
html { scroll-padding-top: var(--hs-topbar-height); }
body, input, button, textarea, select { font-family: var(--font-family-primary); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex="0"]:focus-visible {
    outline: 2px solid var(--hs-blue);
    outline-offset: 2px;
}

#header {
    box-sizing: border-box;
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: var(--hs-topbar-height);
    padding: 8px clamp(12px, 2vw, 24px);
    gap: 12px;
    background: var(--hs-topbar);
    border-bottom: 1px solid var(--hs-topbar-line);
}
#site-name, .hs-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--hs-topbar-text);
}
#site-name { gap: 14px; margin: 0; }
#header #site-name .hs-brand {
    color: var(--hs-topbar-text);
    font-size: 18px;
    font-weight: 750;
    letter-spacing: -.02em;
}
.hs-brand img { flex: none; image-rendering: auto; }
#header a.hs-brand img { padding: 2px; background: var(--hs-surface); border-radius: 4px; }
.hs-brand-section {
    padding-inline-start: 14px;
    border-inline-start: 1px solid var(--hs-topbar-line);
    color: var(--hs-topbar-muted);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}
#user-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    padding: 0;
    font-size: 13px;
    text-transform: none;
    letter-spacing: normal;
}
.hs-account { color: var(--hs-topbar-text); font-weight: 700; overflow-wrap: anywhere; }
#user-tools a, #logout-form button {
    color: var(--hs-topbar-muted);
    border: 0;
    text-decoration: none;
}
#user-tools a:hover, #logout-form button:hover { color: var(--hs-topbar-text); text-decoration: underline; }
#header :focus-visible { outline-color: #9dbdff; }

#main {
    max-width: none;
    width: 100%;
    min-height: calc(100vh - var(--hs-topbar-height));
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    gap: 0;
}
#main #content-start {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    border: 0;
    border-radius: 0;
    background: var(--hs-surface);
}
#content { padding: 20px clamp(16px, 2vw, 32px) 28px; }
#content h1 { margin: 0 0 18px; font-size: 22px; font-weight: 720; color: var(--hs-text); }
#content h2 { font-weight: 650; color: var(--hs-text); }
#content-main, .changelist-form-container, #changelist-form { min-width: 0; }
#changelist .results { overflow-x: auto; }
#result_list td.field-username { white-space: nowrap; }

#nav-sidebar {
    flex: 0 0 208px;
    position: sticky;
    top: var(--hs-topbar-height);
    left: auto;
    align-self: flex-start;
    height: calc(100vh - var(--hs-topbar-height));
    max-height: calc(100vh - var(--hs-topbar-height));
    box-sizing: border-box;
    margin: 0;
    padding: 16px 12px;
    border: 0;
    border-inline-end: 1px solid var(--hs-border);
    background: var(--hs-sidebar);
}
#main:not(.shifted) > #nav-sidebar { display: none; }
#main.shifted > #nav-sidebar { margin: 0; }
#toggle-nav-sidebar {
    position: static;
    box-sizing: border-box;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border: 1px solid var(--hs-topbar-line);
    border-radius: 5px;
    background: transparent;
    color: var(--hs-topbar-text);
}
#toggle-nav-sidebar::before {
    content: "";
    width: 14px;
    height: 14px;
    background: linear-gradient(currentColor 0 2px, transparent 2px 6px,
                                currentColor 6px 8px, transparent 8px 12px, currentColor 12px);
}
#toggle-nav-sidebar:hover { background: var(--hs-topbar-line); }
.hs-nav-heading { margin: 0 9px 8px; font-size: 13px; font-weight: 650; color: var(--hs-muted); }
#nav-filter { margin: 0 0 12px; padding: 8px; border-radius: 7px; background: var(--hs-surface); }
#nav-sidebar .module, #nav-sidebar table { background: transparent; }
#nav-sidebar .module caption {
    padding: 6px 8px;
    background: transparent;
    color: var(--hs-muted);
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0;
}
#nav-sidebar .module caption a { color: var(--hs-muted); font-weight: 650; }
#nav-sidebar .module th { padding: 0; border: 0; }
#nav-sidebar .module tr { background: transparent; }
#nav-sidebar .module th a {
    display: block;
    padding: 9px 6px;
    border-inline-start: 3px solid transparent;
    border-radius: 3px;
    color: var(--hs-text);
    font-weight: 500;
}
#nav-sidebar .module th a:hover { background: #e9eaec; }
#nav-sidebar .current-model th a, #nav-sidebar .module th a[aria-current="page"] {
    background: var(--hs-blue-soft);
    border-inline-start-color: var(--hs-blue);
    color: var(--hs-blue-strong);
    font-weight: 700;
}

#toolbar, #changelist-filter, .actions, .submit-row, .module {
    border-radius: 9px;
}
#changelist-filter { border: 1px solid var(--hs-line); }
#changelist-filter h2, .module h2, .module caption { font-weight: 650; }
input[type="text"], input[type="password"], input[type="search"], input[type="email"],
input[type="url"], input[type="number"], select, textarea { border-radius: 7px; }
.button, input[type="submit"], .object-tools a { border-radius: 7px; font-weight: 620; }
ul.messagelist li { margin-inline: 15px; border-radius: 8px; }

.hs-panel {
    padding: 16px;
    border: 1px solid var(--hs-line);
    border-radius: 8px;
    background: var(--hs-surface);
}
.hs-panel > h2 { margin: 0 0 12px; font-size: 15px; }
.hs-dashboard-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 31%); gap: 18px; }
.hs-dashboard-apps { display: grid; gap: 16px; }
.hs-model-list, .hs-recent-list { list-style: none; padding: 0; margin: 0; }
.hs-model-list li, .hs-recent-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 42px;
    padding: 4px 0;
    border-top: 1px solid var(--hs-line);
    list-style: none;
}
.hs-model-list li > a:first-child { font-weight: 650; }
.hs-recent { align-self: start; }
.hs-recent-list li { color: var(--hs-muted); align-items: baseline; padding-block: 10px; }
.hs-recent-list li > :first-child { overflow-wrap: anywhere; }
.hs-recent-list time { white-space: nowrap; font-variant-numeric: tabular-nums; }

.hs-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 16px; }
.hs-button, a.hs-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 40px;
    padding: 7px 13px;
    border: 1px solid transparent;
    border-radius: 8px;
    font: inherit;
    font-size: 13px;
    font-weight: 660;
    line-height: 1.35;
    cursor: pointer;
    text-decoration: none;
}
.hs-button-primary, a.hs-button-primary { background: var(--hs-blue); color: #fff; }
.hs-button-primary:hover, a.hs-button-primary:hover { background: var(--hs-blue-strong); color: #fff; }
.hs-button-secondary, a.hs-button-secondary { background: var(--hs-soft); border-color: var(--hs-line); color: var(--hs-text); }
.hs-button-secondary:hover, a.hs-button-secondary:hover { background: #e9eaec; color: var(--hs-text); }
.hs-button-danger { background: var(--hs-danger); color: #fff; }
.hs-button-danger:hover { background: #85272c; }

.hs-summary { margin-bottom: 16px; }
.hs-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 20px; margin: 0; }
.hs-summary-grid > div { min-width: 0; }
.hs-summary-grid dt { margin-bottom: 5px; color: var(--hs-muted); font-size: 12px; font-weight: 650; }
.hs-summary-grid dd { margin: 0; overflow-wrap: anywhere; font-size: 14px; }
.hs-summary-grid code { color: var(--hs-text); }
.hs-summary-id { grid-column: span 2; }
.hs-summary-wide { grid-column: 1 / -1; }
.hs-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    background: #eef0f3;
    color: var(--hs-text);
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
}
.hs-status[data-state="active"], .hs-status[data-state="TX"] { color: var(--hs-blue-strong); background: var(--hs-blue-soft); }
.hs-status[data-state="complete"], .hs-status[data-state="RX"] { color: var(--hs-success); background: #eaf6ef; }
.hs-status[data-state="failed"], .hs-status[data-state="revoked"] { color: var(--hs-danger); background: #fff0f1; }
.hs-status[data-state="expired"], .hs-status[data-state="cancelled"] { color: var(--hs-warning); background: #fff5e6; }
.hs-notice { padding: 12px 14px; border-radius: 9px; background: var(--hs-blue-soft); color: var(--hs-blue-strong); }
.hs-notice-error, .hs-form-errors { background: #fff0f1; color: var(--hs-danger); }

.hs-table-scroll { max-width: 100%; overflow: auto; border: 1px solid var(--hs-line); border-radius: 10px; }
.hs-data-table { width: 100%; min-width: 650px; }
.hs-data-table th, .hs-data-table td { padding: 10px 12px; vertical-align: middle; font-size: 13px; }
.hs-data-table thead th { background: var(--hs-soft); color: var(--hs-muted); font-weight: 650; white-space: nowrap; }
.hs-data-table tbody tr:last-child td { border-bottom: 0; }
.hs-data-table code { color: inherit; white-space: nowrap; font-size: 12px; }
.hs-packet-fields { min-width: 460px; }
.hs-packet-fields td:last-child { overflow-wrap: anywhere; }
.hs-raw-title { margin: 18px 0 8px; }
.hs-raw {
    box-sizing: border-box;
    max-height: 480px;
    overflow: auto;
    padding: 14px;
    background: var(--hs-soft);
    color: var(--hs-text);
    border: 1px solid var(--hs-line);
    border-radius: 9px;
    font: 13px/1.55 var(--hs-mono);
}

.hs-auth { background: var(--hs-sidebar); }
.hs-auth #container { min-width: 0; }
.hs-auth #header { position: static; justify-content: center; border: 0; background: transparent; padding-top: clamp(32px, 7vh, 80px); }
.hs-auth #header #site-name .hs-brand { color: var(--hs-text); }
.hs-auth #main { flex: 0 0 auto; min-height: 0; max-width: 470px; margin-inline: auto; padding: 8px 12px 24px; }
.hs-auth #main #content-start { border: 1px solid var(--hs-line); border-radius: var(--hs-radius); }
.hs-auth #content { padding: clamp(22px, 5vw, 32px); }
.hs-auth #content h1 { margin-bottom: 20px; }
.hs-auth-form { display: grid; gap: 16px; }
.hs-auth-form > .hs-button { min-height: 44px; justify-self: stretch; }
.hs-form-field { display: grid; gap: 6px; min-width: 0; }
.hs-form-field label { color: var(--hs-text); font-size: 13px; font-weight: 650; }
.hs-form-field input {
    box-sizing: border-box;
    width: 100%;
    min-height: 44px;
    padding: 9px 11px;
    background: var(--hs-soft);
    font-size: 15px;
}
.hs-form-field input:focus {
    border-color: var(--hs-blue);
    outline: 2px solid var(--hs-blue);
    outline-offset: 2px;
}
.hs-form-field .help { padding: 0; margin: 0; color: var(--hs-muted); overflow-wrap: anywhere; }
.hs-form-field .help li { margin-top: 4px; }
.hs-form-errors { padding: 9px 12px; margin-bottom: 12px; border-radius: 7px; }
.hs-form-errors .errorlist, .hs-form-field .errorlist { margin: 0; padding: 0; }
.hs-form-errors .errorlist li, .hs-form-field .errorlist li { list-style: none; padding: 0; }
.hs-account-name { font-size: 16px; overflow-wrap: anywhere; }
.hs-scope-list { margin-bottom: 16px; }

@media (max-width: 1050px) {
    #nav-sidebar { flex-basis: 160px; }
    .hs-dashboard-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
    #header { justify-content: space-between; min-height: 58px; }
    #main #nav-sidebar, #header #toggle-nav-sidebar { display: none; }
    #content { padding: 16px; }
    .hs-button, a.hs-button { min-height: 44px; }
    .hs-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 450px) {
    #header { align-items: flex-start; }
    #site-name { gap: 8px; }
    .hs-brand-section { display: none; }
    #user-tools { justify-content: flex-end; }
}
