/* 默认母版（base.html）样式：模仿 GitHub 的灰色极简风格。
   仅服务于通用页（首页、登录、404、搜索等）；登录页另有 erp.css 补充样式。 */

:root {
    --gh-bg: #f6f8fa;
    --gh-surface: #ffffff;
    --gh-border: #d0d7de;
    --gh-border-muted: #d8dee4;
    --gh-text: #1f2328;
    --gh-text-muted: #59636e;
    --gh-accent: #0969da;
    --gh-radius: 6px;
    --gh-shadow: 0 1px 0 rgba(31, 35, 40, 0.04);

    /* 全站字体：中文优先系统黑体，西文回落到系统 UI 字体 */
    --font-sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei",
        "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, sans-serif;
    --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

html {
    -webkit-text-size-adjust: 100%;
}

body.gh-body {
    margin: 0;
    background-color: var(--gh-bg);
    color: var(--gh-text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.7;
    letter-spacing: 0.012em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* 标题统一字重与字距，避免浏览器默认的松散/紧排 */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    letter-spacing: -0.005em;
}

/* 表单控件默认不继承正文字体，统一后避免中文回落到宋体 */
button,
input,
optgroup,
select,
textarea {
    font-family: inherit;
    letter-spacing: inherit;
}

::selection {
    background-color: rgba(3, 78, 255, 0.16);
}

a {
    color: var(--gh-accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* 容器：GitHub 正文宽度 */
.gh-container {
    width: 100%;
    max-width: 1012px;
    margin: 0 auto;
    padding: 0 16px;
    box-sizing: border-box;
}

/* 顶栏 */
.gh-header {
    background-color: var(--gh-surface);
    border-bottom: 1px solid var(--gh-border);
}

.gh-header-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 62px;
}

.gh-brand {
    color: var(--gh-text);
    font-size: 16px;
    font-weight: 600;
}

.gh-brand:hover {
    color: var(--gh-accent);
    text-decoration: none;
}

.gh-page-title {
    color: var(--gh-text-muted);
    font-size: 14px;
}

/* 导航：由站点一级栏目自动生成 */
.gh-nav {
    display: flex;
    align-items: center;
    margin-left: 6px;
}

.gh-nav-menu {
    display: flex;
    align-items: center;
}

.gh-nav-link {
    position: relative;
    padding: 0 10px;
    line-height: 62px;
    font-size: 14px;
    color: var(--gh-text-muted);
}

.gh-nav-link:hover {
    color: var(--gh-accent);
    text-decoration: none;
}

.gh-nav-link.is-active {
    color: var(--gh-text);
    font-weight: 600;
}

.gh-nav-link.is-active::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 0;
    height: 3px;
    border-radius: 2px 2px 0 0;
    background-color: var(--gh-accent);
}

.gh-header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.gh-user {
    color: var(--gh-text-muted);
    font-size: 14px;
}

/* 按钮：GitHub 中性按钮 */
.gh-btn {
    display: inline-block;
    padding: 5px 16px;
    background-color: var(--gh-bg);
    border: 1px solid var(--gh-border);
    border-radius: var(--gh-radius);
    color: var(--gh-text);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    cursor: pointer;
}

.gh-btn:hover {
    background-color: #eef1f4;
    border-color: #afb8c1;
    text-decoration: none;
}

.gh-btn-primary {
    border-color: var(--gh-accent);
    background-color: var(--gh-accent);
    color: #ffffff;
}

.gh-btn-primary:hover {
    border-color: #0860ca;
    background-color: #0860ca;
    color: #ffffff;
}

/* ===== 账号菜单：登录后合并为「头像 + 用户名 + 下拉」 ===== */
.gh-account {
    position: relative;
}

.gh-account-trigger {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 4px 10px 4px 4px;
    border: 1px solid var(--gh-border);
    border-radius: 999px;
    background-color: var(--gh-surface);
    cursor: pointer;
    list-style: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.gh-account-trigger::-webkit-details-marker {
    display: none;
}

.gh-account-trigger:hover {
    border-color: #afb8c1;
    box-shadow: 0 1px 3px rgba(31, 35, 40, 0.08);
}

.gh-account-trigger:focus-visible {
    outline: 2px solid rgba(3, 78, 255, 0.4);
    outline-offset: 2px;
}

.gh-account-avatar {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #034eff, #2f7bff);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

.gh-account-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.2;
}

.gh-account-name {
    max-width: 140px;
    overflow: hidden;
    font-size: 13px;
    font-weight: 600;
    color: var(--gh-text);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gh-account-role {
    font-size: 10.5px;
    letter-spacing: 0.04em;
    color: var(--gh-text-muted);
}

.gh-account-caret {
    flex: none;
    color: var(--gh-text-muted);
    transition: transform 0.18s ease;
}

.gh-account[open] .gh-account-caret {
    transform: rotate(180deg);
}

.gh-account-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 60;
    display: grid;
    gap: 2px;
    min-width: 218px;
    padding: 8px;
    border: 1px solid var(--gh-border);
    border-radius: 12px;
    background-color: var(--gh-surface);
    box-shadow: 0 18px 40px -20px rgba(16, 30, 70, 0.45);
}

.gh-account-menu-head {
    display: grid;
    gap: 2px;
    margin-bottom: 4px;
    padding: 8px 10px 10px;
    border-bottom: 1px solid var(--gh-border-muted);
}

.gh-account-menu-head strong {
    overflow: hidden;
    font-size: 13.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gh-account-menu-head span {
    overflow: hidden;
    font-size: 12px;
    color: var(--gh-text-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gh-account-item {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background-color: transparent;
    font-family: inherit;
    font-size: 13px;
    color: var(--gh-text);
    text-align: left;
    cursor: pointer;
}

.gh-account-item:hover {
    background-color: #f3f5f8;
    text-decoration: none;
}

.gh-account-item-danger {
    color: #c5221f;
}

.gh-account-item-danger:hover {
    background-color: #fff1f1;
}

.gh-account-logout {
    margin: 0;
}

@media (max-width: 620px) {
    .gh-account-text {
        display: none;
    }

    .gh-account-trigger {
        gap: 6px;
        padding: 4px 8px 4px 4px;
    }
}

/* 主体与页脚 */
.gh-main {
    padding: 24px 0 8px;
    min-height: calc(100vh - 62px - 90px);
}

.gh-footer {
    margin-top: 24px;
    padding: 24px 0;
    border-top: 1px solid var(--gh-border-muted);
    color: var(--gh-text-muted);
    font-size: 12px;
}

/* 页脚一行信息：版权 · 口号 · 备案号 */
.gh-footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px 8px;
}

.gh-footer-inner a {
    color: inherit;
}

.gh-footer-inner a:hover {
    color: var(--gh-text);
    text-decoration: underline;
}

/* 提示条 */
.gh-flash {
    margin-bottom: 16px;
    padding: 12px 16px;
    background-color: var(--gh-surface);
    border: 1px solid var(--gh-border);
    border-radius: var(--gh-radius);
    box-shadow: var(--gh-shadow);
}

/* 让通用页里的 Bootstrap 卡片/表单贴近 GitHub 灰风格 */
.gh-main .card {
    background-color: var(--gh-surface);
    border: 1px solid var(--gh-border);
    border-radius: var(--gh-radius);
    box-shadow: var(--gh-shadow);
}

.gh-main .card-header {
    background-color: var(--gh-bg);
    border-bottom: 1px solid var(--gh-border);
}

.gh-main .form-control:focus {
    border-color: var(--gh-accent);
    box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.3);
}

.gh-main .btn-primary {
    background-color: var(--gh-accent);
    border-color: var(--gh-accent);
}

.gh-main .btn-primary:hover {
    background-color: #0860ca;
    border-color: #0860ca;
}
