/* static/css/theme.css - 墨小申(申报AI) 主题样式（设计令牌移植自交互 Demo theme.css + 后台组件扩展） */

/* ==================== 设计令牌（Design Tokens） ==================== */
:root {
    color-scheme: light;
    --color-primary: #123f3a;
    --color-primary-deep: #0d312d;
    --color-primary-soft: #e7efec;
    --color-accent: #b08d3f;
    --color-accent-soft: #f4eddc;
    --color-background: #f6f5f0;
    --color-surface: #ffffff;
    --color-surface-alt: #fbfbf8;
    --color-text: #20261f;
    --color-muted-text: #667069;
    --color-border: #e4e2d8;
    --color-border-strong: #d3d0c2;
    --color-border-soft: #eeece3;
    --color-focus: #40618c;
    --color-success: #2f7d55;
    --color-success-soft: #e5f2ea;
    --color-warning: #c77b2a;
    --color-warning-soft: #f9efe1;
    --color-danger: #c0523a;
    --color-danger-soft: #f8e9e5;
    --color-info: #40618c;
    --color-info-soft: #e8eef5;
    --font-body: ui-sans-serif, system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-display: Georgia, "Songti SC", "SimSun", "STSong", serif;
    --font-mono: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-full: 999px;
    --space-unit: 0.25rem;
    --shadow-sm: 0 1px 2px rgba(18, 63, 58, 0.06);
    --shadow-md: 0 4px 16px rgba(18, 63, 58, 0.08);
    --shadow-lg: 0 10px 32px rgba(18, 63, 58, 0.12);
    --sidebar-w: 16.5rem;
    --content-width: 76rem;
}

* { box-sizing: border-box; }

html {
    background: var(--color-background);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
}

body { margin: 0; min-height: 100dvh; }

button, input, select, textarea { font: inherit; }

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }

.skip-link {
    left: 1rem;
    position: fixed;
    top: 1rem;
    transform: translateY(-200%);
    z-index: 100;
}
.skip-link:focus { transform: translateY(0); }

/* ==================== 布局壳层 ==================== */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100dvh;
}

/* ==================== 侧边栏 ==================== */
.sidebar {
    background: var(--color-primary);
    color: #e8efec;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100dvh;
    padding: 1.25rem 0.9rem;
    gap: 0.35rem;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.25rem 0.5rem 1.1rem;
    border-bottom: 1px solid rgba(232, 239, 236, 0.14);
    margin-bottom: 0.6rem;
}

.brand-mark {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, var(--color-accent), #d9b25f);
    display: grid;
    place-items: center;
    color: var(--color-primary-deep);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    flex: 0 0 auto;
}

.brand-name {
    font-family: var(--font-display);
    font-size: 1.02rem;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.brand-sub {
    font-size: 0.72rem;
    color: rgba(232, 239, 236, 0.62);
    letter-spacing: 0.06em;
}

.nav { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; }

.nav-group { display: flex; flex-direction: column; gap: 0.15rem; }

.nav-label {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: rgba(232, 239, 236, 0.5);
    padding: 0.9rem 0.6rem 0.35rem;
    text-transform: uppercase;
}

/* 父级菜单带 URL 时的可点击分组标题（menu_url 为空时渲染为不可点击的 .nav-label） */
.nav-label-link { display: block; text-decoration: none; color: rgba(232, 239, 236, 0.72); }
.nav-label-link:hover { color: #fff; text-decoration: none; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.7rem;
    border-radius: 0.5rem;
    color: #cdd9d4;
    font-size: 0.88rem;
    text-decoration: none;
}

.nav-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }

.nav-link.active { background: rgba(255, 255, 255, 0.12); color: #fff; font-weight: 600; }

.nav-dot {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.5;
    flex: 0 0 auto;
}

.sidebar-foot {
    padding: 0.8rem 0.6rem 0.3rem;
    border-top: 1px solid rgba(232, 239, 236, 0.14);
    font-size: 0.76rem;
    color: rgba(232, 239, 236, 0.66);
}
.sidebar-foot .ver { margin-top: 0.2rem; font-size: 0.68rem; letter-spacing: 0.04em; }

/* ==================== 主区与顶栏 ==================== */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: color-mix(in srgb, var(--color-background) 94%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.7rem 1.6rem;
}

.topbar-title {
    font-family: var(--font-display);
    font-size: 1.02rem;
    color: var(--color-primary);
    font-weight: 600;
    white-space: nowrap;
}

.topbar-search { flex: 1; max-width: 26rem; position: relative; }

.topbar-search input {
    width: 100%;
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-surface);
    font-size: 0.85rem;
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 0.6rem; }

.user-menu { position: relative; display: flex; align-items: center; }
.user-detail { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.user-name { font-size: 0.84rem; font-weight: 600; }
.user-role { font-size: 0.72rem; color: var(--color-muted-text); }

/* 用户菜单触发按钮 */
.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.28rem 0.5rem;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    background: transparent;
    cursor: pointer;
    color: inherit;
}
.user-menu-toggle:hover { background: var(--color-primary-soft); border-color: var(--color-border); }
.user-menu-caret {
    width: 0.85rem;
    height: 0.85rem;
    color: var(--color-muted-text);
    flex: 0 0 auto;
    transition: transform 0.15s ease;
}
.user-menu.open .user-menu-caret { transform: rotate(180deg); }

/* 用户下拉面板 */
.user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    min-width: 15rem;
    max-width: 21rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.35rem;
    z-index: 80;
    display: none;
}
.user-menu.open .user-dropdown { display: block; }

.dropdown-head {
    padding: 0.6rem 0.7rem 0.7rem;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 0.3rem;
}
.dropdown-name {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-primary-deep);
}
.dropdown-meta {
    font-size: 0.75rem;
    color: var(--color-muted-text);
    margin-top: 0.1rem;
    word-break: break-all;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.5rem 0.7rem;
    border-radius: var(--radius-sm);
    font-size: 0.86rem;
    color: var(--color-text);
    cursor: pointer;
    text-decoration: none;
}
.dropdown-item:hover { background: var(--color-primary-soft); text-decoration: none; }
.dropdown-item:focus-visible { outline: 3px solid var(--color-focus); outline-offset: -2px; }
.dropdown-icon {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: var(--radius-sm);
    background: var(--color-primary-soft);
    color: var(--color-primary);
    display: grid;
    place-items: center;
    font-size: 0.72rem;
    font-weight: 700;
    flex: 0 0 auto;
}
.dropdown-divider { height: 1px; background: var(--color-border); margin: 0.3rem 0.35rem; }
.dropdown-danger { color: var(--color-danger); }
.dropdown-danger .dropdown-icon { background: var(--color-danger-soft); color: var(--color-danger); }
.dropdown-danger:hover { background: var(--color-danger-soft); }

.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--color-border);
}

.avatar {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex: 0 0 auto;
}

.content {
    padding: 1.5rem 1.6rem 3rem;
    width: 100%;
    max-width: var(--content-width);
    margin: 0 auto;
}

.page-head { margin-bottom: 1.2rem; }
.page-head h1 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.55rem;
    margin: 0 0 0.3rem;
    color: var(--color-primary-deep);
}
.page-head .lede { color: var(--color-muted-text); font-size: 0.92rem; max-width: 52rem; }

/* ==================== 卡片与栅格 ==================== */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.1rem 1.2rem;
}
.card + .card { margin-top: 1rem; }

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}
.card-head h2, .card-head h3 {
    font-family: var(--font-display);
    margin: 0;
    font-size: 1.02rem;
    color: var(--color-primary-deep);
}
.card-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.grid { display: grid; gap: 1rem; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ==================== 统计与进度 ==================== */
.stat { display: flex; flex-direction: column; gap: 0.25rem; }
.stat .stat-label { font-size: 0.8rem; color: var(--color-muted-text); }
.stat .stat-value {
    font-family: var(--font-display);
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--color-primary-deep);
    line-height: 1.1;
}
.stat .stat-delta { font-size: 0.78rem; }
.delta-up { color: var(--color-success); }
.delta-down { color: var(--color-danger); }

.bar-track {
    height: 0.5rem;
    border-radius: var(--radius-full);
    background: var(--color-border);
    overflow: hidden;
    display: inline-block;
    width: 100%;
}
.bar-fill { display: block; height: 100%; border-radius: var(--radius-full); background: var(--color-primary); }
.bar-fill.accent { background: var(--color-accent); }
.bar-fill.success { background: var(--color-success); }
.bar-fill.warning { background: var(--color-warning); }
.bar-fill.danger { background: var(--color-danger); }

.progress-bars { display: flex; flex-direction: column; gap: 0.8rem; }
.progress-row {
    display: grid;
    grid-template-columns: 8rem 1fr auto;
    align-items: center;
    gap: 0.7rem;
    font-size: 0.85rem;
}

.score-ring {
    --p: 0;
    width: 4.6rem;
    height: 4.6rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: conic-gradient(var(--color-primary) calc(var(--p) * 1%), var(--color-border) 0);
    position: relative;
    margin: 0 auto;
}
.score-ring::before {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    background: var(--color-surface);
}
.score-ring span { position: relative; font-weight: 700; font-size: 1.2rem; color: var(--color-primary-deep); }

/* ==================== 徽标与提示 ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.16rem 0.55rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}
.badge-success { background: var(--color-success-soft); color: var(--color-success); }
.badge-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.badge-info { background: var(--color-info-soft); color: var(--color-info); }
.badge-accent { background: var(--color-accent-soft); color: #8a6a28; }
.badge-neutral { background: var(--color-primary-soft); color: var(--color-primary); }

.alert {
    border-radius: var(--radius-md);
    padding: 0.7rem 0.9rem;
    font-size: 0.86rem;
    margin-top: 0.8rem;
    border: 1px solid transparent;
}
.alert-danger { background: var(--color-danger-soft); color: var(--color-danger); border-color: #f0d3cc; }
.alert-warning { background: var(--color-warning-soft); color: var(--color-warning); border-color: #eeddbf; }
.alert-info { background: var(--color-info-soft); color: var(--color-info); border-color: #d3e0ee; }
.alert-success { background: var(--color-success-soft); color: var(--color-success); border-color: #cfe6da; }

/* ==================== 按钮 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface);
    color: var(--color-primary);
    padding: 0.45rem 0.95rem;
    border-radius: var(--radius-md);
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--color-primary-soft); text-decoration: none; }
.btn-primary { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-deep); }
.btn-accent { background: var(--color-accent); border-color: var(--color-accent); color: #fff; }
.btn-accent:hover { background: #9c7b33; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--color-muted-text); }
.btn-ghost:hover { background: var(--color-primary-soft); color: var(--color-primary); }
.btn-block { width: 100%; margin-top: 0.4rem; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ==================== 表单 ==================== */
.field { display: flex; flex-direction: column; gap: 0.32rem; margin-bottom: 0.7rem; }
.field label { font-size: 0.8rem; font-weight: 600; color: var(--color-text); }
.field input, .field select, .field textarea {
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    font-size: 0.88rem;
    color: var(--color-text);
    width: 100%;
}
.field textarea { font-family: var(--font-mono); line-height: 1.5; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(18, 63, 58, 0.12);
}
.field .hint { font-size: 0.75rem; color: var(--color-muted-text); }

/* 日期/年月/时间段控件（templates/common/date_range.html 生成，见 static/js/common.js）
   背景：这些字段原先都是纯文本框，用户要求改为真正的日期类控件。
   这里只负责"起止并排"的排版：两段控件的值合成一个中文明文写回隐藏域，
   因此视觉上仍是一个字段，不会打乱既有栅格布局。 */
.range-inline {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.range-inline input[type="month"],
.range-inline input[type="date"],
.range-inline input[type="datetime-local"] {
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    font-size: 0.88rem;
    color: var(--color-text);
    flex: 1 1 0;
    min-width: 0;
}
.range-inline input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(18, 63, 58, 0.12);
}
.range-inline .range-sep {
    color: var(--color-muted-text);
    font-size: 0.85rem;
    flex: 0 0 auto;
}
/* ★2026-10-07 修复「建设周期与企业规模互相盖住」（用户反馈）：
   原规则 `[data-date-range] input{min-width:8.5rem}` 本意是"窄容器里别把
   年/月控件压扁"，但它的**选择器优先级高于** `.range-inline input{min-width:0}`，
   于是"起止并排"的区间控件被强行撑到 2×8.5rem + 分隔符 ≈ 287px。
   在 `.grid-cols-2` 两列布局里每列只有 156~243px（实测 1600px 视口下每列 242.75px），
   区间块因此**横向溢出 20~100px**，结束月份输入直接压在右列「企业规模」上 ——
   这正是用户看到的"互相盖住"。
   修法：区间内输入允许收缩（basis 取 0 + min-width 0，flex 才能生效），
   并允许换行 → 列太窄时两个月份上下排，而不是越界压住邻居。 */
.range-inline { flex-wrap: wrap; }
[data-date-range] input[type="month"],
[data-date-range] input[type="date"],
[data-date-range] input[type="datetime-local"] {
    min-width: 0;
    flex: 1 1 6.5rem;
}

.checkbox-line {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.84rem;
    color: var(--color-muted-text);
    cursor: pointer;
    width: auto;
}
/* 复选框必须显式限定尺寸：input 默认无固定宽高，在 flex 容器中会被 align-items:stretch 拉长 */
.checkbox-line input[type="checkbox"] {
    width: 0.95rem;
    height: 0.95rem;
    min-width: 0.95rem;
    max-width: 0.95rem;
    padding: 0;
    margin: 0;
    border-radius: 0.2rem;
    accent-color: var(--color-primary);
    flex: 0 0 auto;
    align-self: center;
}

.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.7rem; }
.filter-bar .field { margin-bottom: 0; min-width: 9rem; }

.chip-group { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
    padding: 0.28rem 0.72rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-full);
    background: var(--color-surface);
    font-size: 0.8rem;
    color: var(--color-muted-text);
    cursor: pointer;
}
.chip.active {
    background: var(--color-primary-soft);
    border-color: var(--color-primary);
    color: var(--color-primary);
    font-weight: 600;
}

/* ==================== 表格 ==================== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.table th {
    text-align: left;
    color: var(--color-muted-text);
    font-weight: 600;
    font-size: 0.78rem;
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
    background: var(--color-surface-alt);
}
.table td {
    padding: 0.62rem 0.6rem;
    border-bottom: 1px solid var(--color-border-soft);
    color: var(--color-text);
    vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--color-surface-alt); }

/* 行内操作列：不允许按钮/“去处理”被挤成竖排。
   窄屏由 .table-wrap 横向滚动兜底，不把表格压成多行。 */
.table td.record-actions {
    white-space: nowrap;
    min-width: 10.5rem;
}
.table td.record-actions .btn {
    margin: 0 0.25rem 0.15rem 0;
    padding: 0.3rem 0.5rem;
    font-size: 0.78rem;
}
.table td.record-actions .btn:last-child { margin-right: 0; }

.table .record-date { white-space: nowrap; }

/* 材料表 11 列，不能为了塞进一屏把项目/名称/时间压成竖排；
   允许 .table-wrap 横向滚动，保证每列可读。 */
#materialTable th:nth-child(1), #materialTable td:nth-child(1) {
    min-width: 8rem; white-space: nowrap;
}
#materialTable th:nth-child(2), #materialTable td:nth-child(2) { min-width: 11rem; }
#materialTable th:nth-child(3), #materialTable td:nth-child(3) { min-width: 11rem; }
#materialTable th:nth-child(4), #materialTable td:nth-child(4),
#materialTable th:nth-child(5), #materialTable td:nth-child(5),
#materialTable th:nth-child(6), #materialTable td:nth-child(6) {
    min-width: 5.5rem; white-space: nowrap;
}
#materialTable th:nth-child(7), #materialTable td:nth-child(7) {
    min-width: 11rem; white-space: nowrap;
}
#materialTable th:nth-child(8), #materialTable td:nth-child(8) { min-width: 5rem; }
#materialTable th:nth-child(9), #materialTable td:nth-child(9) {
    min-width: 7rem; white-space: nowrap;
}
#materialTable th:nth-child(10), #materialTable td:nth-child(10) {
    min-width: 9rem; white-space: nowrap;
}
#materialTable th:nth-child(11), #materialTable td:nth-child(11) { min-width: 9rem; }

/* 材料表列多，横向滚动时把操作列固定在右侧，
   避免用户必须滚到最右才能看到“查看/编辑/下载/删除”。 */
#materialTable th:last-child,
#materialTable td.record-actions {
    position: sticky;
    right: 0;
    z-index: 2;
    background: var(--color-surface);
    box-shadow: -4px 0 8px rgba(0, 0, 0, .06);
}
#materialTable th:last-child {
    z-index: 3;
    background: var(--color-surface-alt);
}

/* 政策检索最长实测约 20 秒；用可见进度条说明“在跑”，
   避免用户以为按钮没反应。 */
.search-progress {
    margin: 0 0 .8rem;
    padding: .65rem .8rem;
    border: 1px solid var(--color-border-soft);
    border-radius: 8px;
    background: var(--color-surface-alt);
}
.search-progress-track {
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: #eadfe2;
}
.search-progress-bar {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #8f1727, #c04b5f);
    transition: width .45s ease;
}
.search-progress-meta {
    display: flex;
    justify-content: space-between;
    gap: .8rem;
    margin-top: .4rem;
    color: var(--color-muted-text);
    font-size: .78rem;
}

/* 公文生成按钮：固定单行，避免窄宽度下文字换行/视觉重叠。 */
#openGenerateModal { white-space: nowrap; }

/* 公文草稿列表：4 个操作按钮一行；同名折叠开关单独占一行。 */
.draft-list-filter {
    padding: 0 .1rem;
}
#govdocDraftTable th:nth-child(1), #govdocDraftTable td:nth-child(1) {
    min-width: 8rem; white-space: nowrap;
}
#govdocDraftTable th:nth-child(2), #govdocDraftTable td:nth-child(2) { min-width: 16rem; }
#govdocDraftTable th:nth-child(3), #govdocDraftTable td:nth-child(3) { min-width: 4.5rem; white-space: nowrap; }
#govdocDraftTable th:nth-child(4), #govdocDraftTable td:nth-child(4) { min-width: 3rem; white-space: nowrap; }
#govdocDraftTable th:nth-child(5), #govdocDraftTable td:nth-child(5) { min-width: 8rem; white-space: nowrap; }
#govdocDraftTable td:last-child {
    min-width: 11rem;
    white-space: nowrap;
}
#govdocDraftTable td:last-child .card-actions { flex-wrap: nowrap; }
#govdocDraftTable td:last-child .btn {
    padding: 0.3rem 0.45rem;
    font-size: 0.78rem;
    margin: 0 0.15rem 0 0;
}

/* 个人材料列表只保留关键列：项目、名称、类别、状态、文件、操作。
   材料ID/是否必备/评审结果/上传人/创建时间收进「查看」详情，
   避免 11 列在 1399 视口下被迫横向滚动。政务/机构/平台版不受影响。 */
body[data-page-id="personal-material"] #materialTable th:nth-child(1),
body[data-page-id="personal-material"] #materialTable td:nth-child(1),
body[data-page-id="personal-material"] #materialTable th:nth-child(5),
body[data-page-id="personal-material"] #materialTable td:nth-child(5),
body[data-page-id="personal-material"] #materialTable th:nth-child(8),
body[data-page-id="personal-material"] #materialTable td:nth-child(8),
body[data-page-id="personal-material"] #materialTable th:nth-child(9),
body[data-page-id="personal-material"] #materialTable td:nth-child(9),
body[data-page-id="personal-material"] #materialTable th:nth-child(10),
body[data-page-id="personal-material"] #materialTable td:nth-child(10) {
    display: none;
}

/* 机构客户表：10 列，允许内部横向滚动，但字段/操作不再逐字竖排。 */
#agencyCustomerTable th:nth-child(2), #agencyCustomerTable td:nth-child(2) { min-width: 9rem; }
#agencyCustomerTable th:nth-child(3), #agencyCustomerTable td:nth-child(3) { min-width: 9rem; white-space: nowrap; }
#agencyCustomerTable th:nth-child(4), #agencyCustomerTable td:nth-child(4) { min-width: 7rem; }
#agencyCustomerTable th:nth-child(5), #agencyCustomerTable td:nth-child(5) { min-width: 4rem; white-space: nowrap; }
#agencyCustomerTable th:nth-child(6), #agencyCustomerTable td:nth-child(6) { min-width: 5rem; white-space: nowrap; }
#agencyCustomerTable th:nth-child(7), #agencyCustomerTable td:nth-child(7),
#agencyCustomerTable th:nth-child(8), #agencyCustomerTable td:nth-child(8) {
    min-width: 3.2rem; white-space: nowrap;
}
#agencyCustomerTable th:nth-child(9), #agencyCustomerTable td:nth-child(9) { min-width: 6rem; white-space: nowrap; }
#agencyCustomerTable td.agency-customer-actions {
    min-width: 13.5rem;
    white-space: nowrap;
}
#agencyCustomerTable td.agency-customer-actions .card-actions {
    flex-wrap: nowrap;
}
#agencyCustomerTable td.agency-customer-actions .btn {
    padding: 0.3rem 0.45rem;
    font-size: 0.78rem;
    margin: 0 0.15rem 0 0;
}

/* 机构知识库：操作列 6 个动作改为横排并固定在右侧，
   行高不再被六个竖排按钮撑到 150px。 */
#agencyKnowledgeTable td:last-child {
    white-space: nowrap;
    min-width: 16.5rem;
    position: sticky;
    right: 0;
    z-index: 2;
    background: var(--color-surface);
    box-shadow: -4px 0 8px rgba(0, 0, 0, .06);
}
#agencyKnowledgeTable th:last-child {
    position: sticky;
    right: 0;
    z-index: 3;
    background: var(--color-surface-alt);
}
#agencyKnowledgeTable td:last-child .card-actions { flex-wrap: nowrap; }
#agencyKnowledgeTable td:last-child .btn {
    padding: 0.3rem 0.45rem;
    font-size: 0.78rem;
    margin: 0 0.15rem 0 0;
}
#agencyKnowledgeTable th:nth-child(1), #agencyKnowledgeTable td:nth-child(1) {
    min-width: 7rem; white-space: nowrap;
}
#agencyKnowledgeTable th:nth-child(2), #agencyKnowledgeTable td:nth-child(2) { min-width: 12rem; }
#agencyKnowledgeTable th:nth-child(3), #agencyKnowledgeTable td:nth-child(3),
#agencyKnowledgeTable th:nth-child(4), #agencyKnowledgeTable td:nth-child(4) {
    min-width: 6rem;
}
#agencyKnowledgeTable th:nth-child(5), #agencyKnowledgeTable td:nth-child(5) { min-width: 16rem; }
#agencyKnowledgeTable th:nth-child(6), #agencyKnowledgeTable td:nth-child(6) { min-width: 10rem; }
#agencyKnowledgeTable th:nth-child(7), #agencyKnowledgeTable td:nth-child(7) { min-width: 5rem; white-space: nowrap; }
#agencyKnowledgeTable th:nth-child(8), #agencyKnowledgeTable td:nth-child(8) { min-width: 6rem; white-space: nowrap; }
#agencyKnowledgeTable th:nth-child(9), #agencyKnowledgeTable td:nth-child(9) { min-width: 8rem; white-space: nowrap; }

/* 机构知识库主表只保留：标题 / 分类 / 摘要 / 状态 / 操作。
   知识ID、标签、来源、维护人、更新时间收进「详情」，
   既消除窄列竖排，也避免宽表必须横向滚动。 */
body[data-page-id="agency-knowledge"] #agencyKnowledgeTable th:nth-child(1),
body[data-page-id="agency-knowledge"] #agencyKnowledgeTable td:nth-child(1),
body[data-page-id="agency-knowledge"] #agencyKnowledgeTable th:nth-child(4),
body[data-page-id="agency-knowledge"] #agencyKnowledgeTable td:nth-child(4),
body[data-page-id="agency-knowledge"] #agencyKnowledgeTable th:nth-child(6),
body[data-page-id="agency-knowledge"] #agencyKnowledgeTable td:nth-child(6),
body[data-page-id="agency-knowledge"] #agencyKnowledgeTable th:nth-child(8),
body[data-page-id="agency-knowledge"] #agencyKnowledgeTable td:nth-child(8),
body[data-page-id="agency-knowledge"] #agencyKnowledgeTable th:nth-child(9),
body[data-page-id="agency-knowledge"] #agencyKnowledgeTable td:nth-child(9) {
    display: none;
}

/* 机构企业画像：主表保留名称/信用代码/行业/规模/区县/资质/项目/操作，
   企业ID、所属租户、建档时间收进「查看详情」，避免窄列逐字换行。 */
body[data-page-id="agency-enterprise"] #enterpriseTable th:nth-child(1),
body[data-page-id="agency-enterprise"] #enterpriseTable td:nth-child(1),
body[data-page-id="agency-enterprise"] #enterpriseTable th:nth-child(9),
body[data-page-id="agency-enterprise"] #enterpriseTable td:nth-child(9),
body[data-page-id="agency-enterprise"] #enterpriseTable th:nth-child(10),
body[data-page-id="agency-enterprise"] #enterpriseTable td:nth-child(10) {
    display: none;
}
body[data-page-id="agency-enterprise"] #enterpriseTable th:nth-child(2),
body[data-page-id="agency-enterprise"] #enterpriseTable td:nth-child(2) { min-width: 10rem; }
body[data-page-id="agency-enterprise"] #enterpriseTable th:nth-child(3),
body[data-page-id="agency-enterprise"] #enterpriseTable td:nth-child(3) { min-width: 9rem; white-space: nowrap; }
body[data-page-id="agency-enterprise"] #enterpriseTable th:nth-child(4),
body[data-page-id="agency-enterprise"] #enterpriseTable td:nth-child(4) { min-width: 7rem; }
body[data-page-id="agency-enterprise"] #enterpriseTable th:nth-child(5),
body[data-page-id="agency-enterprise"] #enterpriseTable td:nth-child(5) { min-width: 4rem; white-space: nowrap; }
body[data-page-id="agency-enterprise"] #enterpriseTable th:nth-child(6),
body[data-page-id="agency-enterprise"] #enterpriseTable td:nth-child(6) { min-width: 4.5rem; white-space: nowrap; }
body[data-page-id="agency-enterprise"] #enterpriseTable th:nth-child(7),
body[data-page-id="agency-enterprise"] #enterpriseTable td:nth-child(7) { min-width: 8rem; }
body[data-page-id="agency-enterprise"] #enterpriseTable th:nth-child(8),
body[data-page-id="agency-enterprise"] #enterpriseTable td:nth-child(8) { min-width: 4rem; white-space: nowrap; }
body[data-page-id="agency-enterprise"] #enterpriseTable td:last-child { min-width: 12rem; }
body[data-page-id="agency-enterprise"] #enterpriseTable td:last-child .btn {
    padding: 0.3rem 0.45rem;
    font-size: 0.78rem;
    margin: 0 0.15rem 0 0;
}

/* 机构材料文件列：主表隐藏材料ID/是否必备（收进详情），
   给文件列留足宽度，完整显示文件名和扩展名。 */
body[data-page-id="agency-material"] #materialTable th:nth-child(1),
body[data-page-id="agency-material"] #materialTable td:nth-child(1),
body[data-page-id="agency-material"] #materialTable th:nth-child(5),
body[data-page-id="agency-material"] #materialTable td:nth-child(5),
body[data-page-id="agency-material"] #materialTable th:nth-child(8),
body[data-page-id="agency-material"] #materialTable td:nth-child(8),
body[data-page-id="agency-material"] #materialTable th:nth-child(9),
body[data-page-id="agency-material"] #materialTable td:nth-child(9),
body[data-page-id="agency-material"] #materialTable th:nth-child(10),
body[data-page-id="agency-material"] #materialTable td:nth-child(10) {
    display: none;
}
body[data-page-id="agency-material"] #materialTable td:nth-child(7) {
    min-width: 10.5rem;
    white-space: nowrap;
}
body[data-page-id="agency-material"] #materialTable td:nth-child(2),
body[data-page-id="agency-material"] #materialTable td:nth-child(3) {
    min-width: 9rem;
}
body[data-page-id="agency-material"] #materialTable td:nth-child(11) {
    min-width: 9rem;
}
body[data-page-id="agency-material"] #materialTable td:nth-child(7) .record-filename {
    display: inline-block;
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
}

/* 政务材料表：隐藏材料ID/是否必备，给文件列留足宽度，完整显示扩展名。 */
body[data-page-id="gov-material"] #materialTable th:nth-child(1),
body[data-page-id="gov-material"] #materialTable td:nth-child(1),
body[data-page-id="gov-material"] #materialTable th:nth-child(5),
body[data-page-id="gov-material"] #materialTable td:nth-child(5),
body[data-page-id="gov-material"] #materialTable th:nth-child(8),
body[data-page-id="gov-material"] #materialTable td:nth-child(8),
body[data-page-id="gov-material"] #materialTable th:nth-child(9),
body[data-page-id="gov-material"] #materialTable td:nth-child(9),
body[data-page-id="gov-material"] #materialTable th:nth-child(10),
body[data-page-id="gov-material"] #materialTable td:nth-child(10) {
    display: none;
}
body[data-page-id="gov-material"] #materialTable td:nth-child(7) {
    min-width: 12rem;
    white-space: nowrap;
}
body[data-page-id="gov-material"] #materialTable td:nth-child(7) .record-filename {
    display: inline-block;
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
}

.text-muted { color: var(--color-muted-text); }

/* ==================== 分页 ==================== */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    justify-content: flex-end;
    margin-top: 0.9rem;
}
.pagination button {
    min-width: 2.1rem;
    height: 2.1rem;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.82rem;
    padding: 0 0.5rem;
}
.pagination button:hover { background: var(--color-primary-soft); }
.pagination button.current { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ==================== 列表 ==================== */
.list-plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; font-size: 0.87rem; }
.list-plain li { padding-left: 0.9rem; position: relative; }
.list-plain li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.6em;
    width: 0.32rem;
    height: 0.32rem;
    border-radius: 50%;
    background: var(--color-accent);
}

.list-row-group { list-style: none; margin: 0; padding: 0; }
.list-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-border-soft);
}
.list-row:last-child { border-bottom: none; }
.list-row-main { flex: 1; min-width: 0; }
.list-row-main .title { font-weight: 600; font-size: 0.92rem; color: var(--color-primary-deep); margin-bottom: 0.15rem; }
.list-row-main .meta {
    font-size: 0.79rem;
    color: var(--color-muted-text);
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.9rem;
}

/* ==================== 标签页与面板 ==================== */
.tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 1rem;
    overflow-x: auto;
}
.tab {
    padding: 0.5rem 0.9rem;
    border: none;
    background: transparent;
    font-size: 0.88rem;
    color: var(--color-muted-text);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.tab.active { color: var(--color-primary); font-weight: 600; border-bottom-color: var(--color-primary); }
.panel[hidden] { display: none; }

/* ★2026-10-07 全局 [hidden] 兜底（补既有缺陷）
   为什么需要：`[hidden]` 的 UA 规则是 `display:none`，但**任何显式 display 声明都会
   覆盖它**（同优先级下后声明的胜出，且类选择器权重高于属性选择器？—— 实测本项目
   .field{display:flex} 就压过了 [hidden]）。本项目此前只在 .panel / .modal-mask /
   .modal-error / .loading-mask 上逐个补了 [hidden] 规则，**其它元素一律失效**：
   实测 `gov/project_review_modal.html` 里 `<div class="field" id="rvReviseWrap" hidden>`
   在页面上照常显示（"修改要求"字段本该只在选「退回修改」时出现）。
   这里加一条全局规则一次性修好，避免以后再逐个打补丁。
   !important 是必要的：要与各类显式 display 声明竞争。 */
[hidden] { display: none !important; }

/* ==================== 项目评审：专家选择与分专家打分（2026-10-07） ====================
   用户要求补上专家库 + 分专家独立打分 + 回避规则，这里是对应的展示样式：
     .expert-item / .is-conflict  —— 专家勾选行；命中回避规则的整体置灰并标红原因
     .expert-score-card           —— 每位专家一组 5 维打分的卡片（一眼看清"谁打了什么分"）
     .chip / .chip-box            —— 可评审领域多选
   为什么置灰而不是隐藏：评审组需要看到"谁不能选、为什么"，
   隐藏会让人怀疑专家库不全，也不利于事后解释评审组构成。 */
.expert-pick {
    border: 1px solid var(--color-border, #e3e5e8);
    border-radius: 6px;
    padding: 0.6rem;
    margin-bottom: 0.8rem;
    max-height: 260px;
    overflow-y: auto;
}
.expert-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.34rem 0.2rem;
    border-bottom: 1px dashed var(--color-border, #eceef0);
    cursor: pointer;
    flex-wrap: wrap;
}
.expert-item:last-child { border-bottom: none; }
.expert-item .expert-name { font-weight: 600; min-width: 5.5rem; }
.expert-item.is-conflict {
    background: var(--color-danger-bg, #fdf0ef);
    cursor: not-allowed;
    opacity: 0.85;
}
.conflict-tag {
    color: var(--color-danger, #b3261e);
    font-size: 0.82rem;
    background: var(--color-danger-bg, #fdf0ef);
    border: 1px solid var(--color-danger-border, #f3c9c5);
    border-radius: 4px;
    padding: 0.05rem 0.35rem;
    white-space: normal;
}
.expert-score-card {
    border: 1px solid var(--color-border, #e3e5e8);
    border-radius: 6px;
    padding: 0.7rem;
    margin-bottom: 0.7rem;
}
.expert-score-head {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--color-border, #eceef0);
}
.expert-score-head .btn { margin-left: auto; }
.chip-box { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 1px solid var(--color-border, #d9dce0);
    border-radius: 14px;
    padding: 0.18rem 0.6rem;
    cursor: pointer;
    font-size: 0.9rem;
}
.chip:has(input:checked) {
    border-color: var(--color-primary);
    background: var(--color-primary-bg, #eef4fd);
    font-weight: 600;
}
.radio-row { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.radio-row .radio { display: inline-flex; align-items: flex-start; gap: 0.35rem; cursor: pointer; }
/* 说明文字另起一行，避免"（推荐：…可回避剔除）"把选项名挤成两三行（截图可见） */
.radio-row .radio > span { display: flex; flex-direction: column; line-height: 1.4; }
.radio-row .radio .text-muted { font-size: 0.86rem; }
.inline-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

/* ==================== 模态框 ==================== */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(13, 49, 45, 0.42);
    display: grid;
    place-items: center;
    z-index: 60;
    padding: 1.2rem;
}
.modal-mask[hidden] { display: none; }
.modal { width: 100%; max-width: 34rem; max-height: 88dvh; overflow-y: auto; }
/* 宽弹窗：公文生成（类型专属要素表单，含 grid-cols-2）与公文编辑（正文大文本域）用 */
.modal-wide { max-width: 48rem; }
/* 弹窗内表单校验提示（400 / 409 文案就地显示，不关弹窗、内容不丢） */
.modal-error {
    margin: 0 0 0.8rem;
    padding: 0.5rem 0.7rem;
    border-radius: var(--radius-sm);
    background: var(--color-danger-soft);
    color: var(--color-danger);
    font-size: 0.83rem;
}
.modal-error[hidden] { display: none; }

/* ==================== 确认弹窗（Common.confirm 用） ====================
   ★2026-10-09 用户要求：「退出登录时的提示，修改为好看点的」。
     原先退出登录走浏览器原生 window.confirm —— 样式由浏览器决定、与本站设计系统
     完全脱节（灰底白框、按钮是系统字体），且无法放图标/说明文字。
     现改为站点内统一的确认弹窗，本组样式供 Common.confirm() 生成的结构使用。
   ⚠️ 不复用 .card-head / .modal-foot：确认框是"窄、居中、无滚动"的小弹窗，
      与业务弹窗（表单、表格）的留白与标题字号不同，单独定义更可控。 */
.confirm-modal { max-width: 27rem; padding: 1.9rem 1.9rem 1.5rem; text-align: center; }
.confirm-icon {
    width: 3.4rem;
    height: 3.4rem;
    margin: 0 auto 1.05rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
    background: var(--color-primary-soft);
    color: var(--color-primary-deep);
}
/* 危险级（退出登录 / 删除 / 停用等不可逆或中断性操作）用警示色 */
.confirm-icon.is-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.confirm-icon.is-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.confirm-title {
    font-family: var(--font-display);
    margin: 0 0 0.7rem;
    font-size: 1.15rem;
    letter-spacing: 0.01em;
    color: var(--color-primary-deep);
}
.confirm-text {
    margin: 0;
    font-size: 0.93rem;
    color: var(--color-text);
    line-height: 1.6;
}
.confirm-hint {
    margin: 0.85rem 0 0;
    padding-top: 0.85rem;
    border-top: 1px solid var(--color-border-soft);
    font-size: 0.79rem;
    color: var(--color-muted-text);
    line-height: 1.6;
}
.confirm-actions {
    display: flex;
    gap: 0.7rem;
    justify-content: center;
    margin-top: 1.5rem;
}
/* 窄屏时按钮竖排铺满，避免两个按钮挤成一团 */
@media (max-width: 420px) {
    .confirm-actions { flex-direction: column-reverse; }
    .confirm-actions .btn { width: 100%; }
}

/* ==================== 申报日历（独立模块页 /calendar） ====================
   ★2026-10-09 新增（用户反馈「个人和机构中没有申报日历的菜单和对应的功能模块」）。
   纯 CSS Grid 月历：7 列等宽、星期表头、单元格内事件 chip。
   设计取向与本站一致：主色描边表示今天，暖金=政策截止，墨绿=项目节点，灰=已过期。 */
.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.3rem;
    margin-bottom: 0.35rem;
}
.cal-weekdays span {
    text-align: center;
    font-size: 0.74rem;
    color: var(--color-muted-text);
    padding: 0.2rem 0;
}
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.3rem;
}
.cal-cell {
    min-height: 4.6rem;
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-sm);
    padding: 0.32rem 0.36rem;
    background: var(--color-surface);
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    overflow: hidden;
}
/* 补位单元格（上月/下月）：淡出，不参与交互 */
.cal-cell.is-out { background: var(--color-surface-alt); border-color: transparent; }
.cal-cell.is-out .cal-day { color: var(--color-border-strong); }
/* 已过期：整体降饱和，避免与待办抢注意力 */
.cal-cell.is-past { background: var(--color-surface-alt); }
.cal-cell.is-past .cal-day { color: var(--color-muted-text); }
/* 今天：主色描边 + 浅底，是全页最强的视觉锚点 */
.cal-cell.is-today {
    border-color: var(--color-primary);
    box-shadow: inset 0 0 0 1px var(--color-primary);
    background: var(--color-primary-soft);
}
.cal-day { font-size: 0.8rem; font-weight: 600; color: var(--color-text); }
.cal-cell.is-today .cal-day { color: var(--color-primary-deep); }
.cal-chip {
    display: block;
    font-size: 0.68rem;
    line-height: 1.25;
    padding: 0.1rem 0.3rem;
    border-radius: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cal-chip.is-policy { background: var(--color-accent-soft); color: #8a6a28; }
.cal-chip.is-node { background: var(--color-primary-soft); color: var(--color-primary-deep); }
.cal-chip.is-more { background: var(--color-border-soft); color: var(--color-muted-text); }
.cal-legend {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.8rem;
    font-size: 0.76rem;
    color: var(--color-muted-text);
}
.cal-dot {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    display: inline-block;
    margin-left: 0.6rem;
}
.cal-dot.is-policy { background: var(--color-accent-soft); border: 1px solid var(--color-accent); }
.cal-dot.is-node { background: var(--color-primary-soft); border: 1px solid var(--color-primary); }
.cal-dot.is-today { background: var(--color-primary-soft); border: 1px solid var(--color-primary); }
.cal-dot.is-past { background: var(--color-surface-alt); border: 1px solid var(--color-border-strong); }
/* 窄屏：日历退化为紧凑格子（高度减小、chip 只留色块），保证 7 列不挤爆 */
@media (max-width: 900px) {
    .cal-cell { min-height: 3.4rem; }
    .cal-chip { font-size: 0.62rem; padding: 0.06rem 0.2rem; }
}
@media (max-width: 560px) {
    .cal-cell { min-height: 2.6rem; padding: 0.2rem; }
    .cal-chip { display: none; }          /* 极小屏只保留日期格，靠右侧清单看内容 */
    .cal-grid, .cal-weekdays { gap: 0.16rem; }
}

/* ==================== 消息提示 ==================== */
.toast-container {
    position: fixed;
    right: 1.2rem;
    top: 1.2rem;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 22rem;
}
.toast {
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    font-size: 0.85rem;
    background: var(--color-surface);
    border-left: 4px solid var(--color-primary);
    animation: toast-in 0.18s ease-out;
}
.toast-success { border-left-color: var(--color-success); }
.toast-error { border-left-color: var(--color-danger); }
.toast-warning { border-left-color: var(--color-warning); }
.toast-info { border-left-color: var(--color-info); }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(1rem); }
    to { opacity: 1; transform: translateX(0); }
}

/* ==================== 加载遮罩 ==================== */
.loading-mask {
    position: fixed;
    inset: 0;
    background: rgba(246, 245, 240, 0.6);
    display: grid;
    place-items: center;
    z-index: 80;
}
.loading-mask[hidden] { display: none; }
.loading-spinner {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== 代码与预格式 ==================== */
.pre-block {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.8rem;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 32rem;
    overflow: auto;
    margin: 0;
}

/* 政策详情正文：标题/段落结构化展示，不再整篇压成一段 */
.policy-fulltext {
    white-space: normal;
    word-break: break-word;
    font-size: 0.92rem;
    line-height: 1.85;
    color: var(--color-text);
    max-height: 70rem;
    overflow-y: auto;
    padding-right: 0.35rem;
}

.policy-fulltext .policy-h {
    margin: 1.1rem 0 0.45rem;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.6;
    color: var(--color-text);
}

.policy-fulltext .policy-p {
    margin: 0 0 0.65rem;
    line-height: 1.85;
    text-align: justify;
}

.policy-fulltext .policy-h:first-child,
.policy-fulltext .policy-p:first-child { margin-top: 0; }

/* ==================== 角色切换条 ==================== */
.role-switch-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.6rem 0.9rem;
    margin-bottom: 1rem;
    background: var(--color-accent-soft);
    border-color: #ecdfbf;
}
.role-switch-main { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; flex-wrap: wrap; }
.role-switch-actions { display: flex; gap: 0.5rem; }

/* ==================== 空状态 ==================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    color: var(--color-muted-text);
    text-align: center;
    font-size: 0.87rem;
}

/* ==================== 登录页 ==================== */
.login-page {
    background:
        radial-gradient(circle at 12% 18%, color-mix(in srgb, var(--color-accent) 16%, transparent), transparent 42%),
        radial-gradient(circle at 88% 82%, color-mix(in srgb, var(--color-primary) 18%, transparent), transparent 46%),
        var(--color-background);
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
}
.login-wrap { width: 100%; max-width: 26rem; }
.login-card { padding: 1.8rem 1.6rem; }
.login-brand { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.6rem; }
.login-brand .brand-mark {
    width: 3rem;
    height: 3rem;
    border-radius: 0.9rem;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-deep));
    color: var(--color-accent);
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
}
.login-brand .brand-name { font-family: var(--font-display); font-size: 1.16rem; color: var(--color-primary-deep); font-weight: 700; }
.login-brand .brand-sub { font-size: 0.74rem; color: var(--color-muted-text); letter-spacing: 0.05em; }
.login-lede { color: var(--color-muted-text); font-size: 0.85rem; letter-spacing: 0.14em; margin: 0.2rem 0 1.1rem; }

/* 图形验证码行：输入框自适应 + 图片固定尺寸（避免被 flex 拉伸） */
.captcha-row { display: flex; align-items: center; gap: 0.5rem; }
.captcha-row .captcha-input { flex: 1 1 auto; min-width: 0; }
.captcha-image {
    width: 8.25rem;
    height: 2.75rem;
    flex: 0 0 auto;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-background);
    cursor: pointer;
    display: block;
}
.captcha-image:hover { border-color: var(--color-primary); }
.captcha-refresh {
    flex: 0 0 auto;
    width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    font-size: 1.05rem;
    line-height: 1;
}
.login-remember { margin-bottom: 0.9rem; }
/* 单行勾选项不应继承 .field 的最小宽度（旧版 .field 的 min-width:9rem 会把"记住账号"撑开） */
.login-remember .checkbox-line { min-width: 0; }
.login-foot {
    display: flex;
    justify-content: space-between;
    margin-top: 1.1rem;
    font-size: 0.74rem;
    color: var(--color-muted-text);
}

/* ==================== 错误页 ==================== */
.error-page {
    display: grid;
    place-items: center;
    padding: 3rem 1rem;
    background: var(--color-background);
}
.error-wrap { max-width: 34rem; text-align: center; padding: 2.2rem 1.8rem; }
.error-code {
    font-family: var(--font-display);
    font-size: 3.4rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}
.error-title { font-family: var(--font-display); font-size: 1.3rem; margin: 0 0 0.5rem; color: var(--color-primary-deep); }
.error-desc { color: var(--color-muted-text); font-size: 0.9rem; }
.error-actions { display: flex; gap: 0.6rem; justify-content: center; margin-top: 1.2rem; }

/* ==================== 响应式 ==================== */
@media (max-width: 1024px) {
    .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        height: auto;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        padding: 0.7rem 0.9rem;
    }
    .brand { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
    .nav { flex-direction: row; flex-wrap: wrap; gap: 0.25rem; }
    .nav-label, .sidebar-foot { display: none; }
    .topbar { flex-wrap: wrap; padding: 0.6rem 1rem; }
    .topbar-search { order: 3; max-width: none; flex-basis: 100%; }
    .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; }
    .content { padding: 1.1rem 1rem 2.5rem; }
}

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

/* ==========================================================================
   版本差异对比（2026-09-28，方案版本对比功能）
   规范：样式集中在此处，模板里不写内联样式（.vd-* 语义类）。
   配色统一使用主题变量，避免硬编码色值在深色/浅色下失真。
   ========================================================================== */
.vd-summary {
    margin: 0.4rem 0;
    font-weight: 600;
}

.vd-stats,
.vd-note {
    margin: 0.3rem 0;
    font-size: 0.85rem;
}

.vd-error {
    margin: 0.4rem 0;
    color: var(--color-danger);
}

.vd-sec {
    margin: 0.7rem 0;
    padding-left: 0.6rem;
    border-left: 3px solid var(--color-border);
}

/* 左侧色条区分变更类型，扫一眼就能看出哪节是新增/删除/修改 */
.vd-sec-added {
    border-left-color: var(--color-success);
}

.vd-sec-removed {
    border-left-color: var(--color-danger);
}

.vd-sec-modified {
    border-left-color: var(--color-warning);
}

.vd-sec-head {
    margin-bottom: 0.25rem;
}

.vd-pre {
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0.35rem 0;
    font-size: 0.82rem;
    line-height: 1.5;
    max-height: 22rem;
    overflow: auto;
    /* ★逐行 diff 用等宽字体：中文与符号混排时不至于参差不齐 */
    font-family: var(--font-mono);
}

/* ★2026-09-29 修复「预览差异显示成一片重叠文字」：
   diff 的每一行是 <span class="vd-add|vd-del|vd-ctx">，而 span 默认是**行内元素** ——
   行内元素不占满整行、还会与源码里的 `\n` 一起按文字流折叠，
   视觉上多行挤成一团、背景色只覆盖文字部分。
   改为 display:block 后每行独占一行，行背景才能铺满，diff 才读得出来。 */
.vd-add,
.vd-del,
.vd-ctx {
    display: block;
    padding: 0 0.35rem;
    border-radius: 2px;
}

.vd-add {
    color: var(--color-success);
    background: var(--color-success-soft);
}

.vd-del {
    color: var(--color-danger);
    background: var(--color-danger-soft);
}

.vd-ctx {
    color: var(--color-muted-text);
}

/* 版本对比 / 润色预览里的小节标题（在 diff 块之前，标明这段差异属于哪一节） */
.vd-section-title {
    margin: 0.6rem 0 0.2rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
}

/* ==========================================================================
   按章节润色（2026-09-28）—— 复用 .vd-* 差异配色，这里只补弹窗内布局
   ========================================================================== */
.polish-result {
    margin-top: 0.8rem;
}

.polish-summary {
    margin: 0.4rem 0;
    font-weight: 600;
}

.polish-after {
    margin-top: 0.6rem;
}

.polish-after summary {
    cursor: pointer;
    color: var(--color-muted-text);
    font-size: 0.85rem;
}

/* ==========================================================================
   企业画像选择器（static/js/enterprise-picker.js）
   为什么需要：用户要求「所有用到企业画像的地方都不填写，从已填写的画像选择」。
   被选择器接管的字段一律只读，需要**看得出来**是只读、且不是"禁用不可提交"，
   否则用户会以为页面坏了。
   ========================================================================== */
.text-danger {
    color: var(--color-danger);
}

.enterprise-picker {
    margin-bottom: 0.8rem;
}

/* 只读观感：底色偏灰 + 光标默认，与真正 disabled 区分（disabled 不参与提交） */
[data-picker-locked] {
    background: var(--color-surface-alt);
    color: var(--color-muted-text);
    cursor: default;
}

[data-picker-locked]:focus {
    outline: none;
}

.enterprise-picker-status {
    margin: 0.3rem 0 0;
    font-size: 0.8rem;
    color: var(--color-muted-text);
}

/* ==========================================================================
   方案编辑器：章节可点选（选中的章节就是「AI 深化本章」的目标）
   为什么需要：原先"深化本章"读的是润色弹窗里的下拉，而弹窗**默认隐藏** →
   用户点按钮时目标为空、实际执行的是整篇深化，与按钮文案不符。
   改为"点章节即选中"，因此需要看得出可点、看得出选中。
   ========================================================================== */
.section-selectable {
    cursor: pointer;
}

.section-selectable:hover {
    background: var(--color-surface-alt);
}

#sectionList li.is-active {
    background: var(--color-surface-alt);
    border-left: 3px solid var(--color-primary);
    font-weight: 600;
}

/* ==========================================================================
   「本次 AI 参考了哪些知识库」面板（D94）
   --------------------------------------------------------------------------
   为什么需要独立样式：
     审计发现用户完全看不到 AI 有没有用知识库。这个面板要**低调但可见** ——
     用左侧色条 + 折叠明细，让"这次有没有依据"一眼可辨，
     又不至于在每个页面顶部占据大块版面。
   颜色沿用 theme.css 既有变量，避免与整体视觉冲突。
   ========================================================================== */
.kb-usage {
    border: 1px solid var(--color-border, #dfe5e3);
    border-left: 3px solid var(--color-primary, #123f3a);
    border-radius: 6px;
    padding: .6rem .8rem;
    margin: .6rem 0;
    background: var(--color-surface-alt, #f7faf9);
}

/* 未使用知识库时用中性色，避免"看起来像成功提示" */
.kb-usage[data-kb-used="false"] {
    border-left-color: var(--color-border, #dfe5e3);
}

.kb-usage .kb-usage-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.kb-usage .kb-usage-title {
    font-size: .9rem;
    color: var(--color-text);
}

.kb-usage-card .kb-usage-list {
    display: grid;
    gap: .5rem;
}

.kb-usage-card .kb-usage { margin: 0; }

.kb-usage .kb-usage-note {
    margin: .35rem 0 .2rem;
    font-size: .875rem;
    line-height: 1.5;
}

.kb-usage .kb-usage-body {
    margin-top: .5rem;
}

.kb-usage .kb-usage-body .table {
    margin-bottom: .4rem;
}

/* 明细表格在窄屏可横向滚动，避免撑破卡片 */
.kb-usage .kb-usage-body {
    overflow-x: auto;
}

/* ★2026-10-07 专家库表格列宽：多领域文本（如技术改造、数字化改造）此前与
   相邻列挤在一起（截图可见），给这几列最小宽度并允许换行显示。 */
#expertTable { table-layout: auto; }
#expertTable th, #expertTable td { vertical-align: top; }
#expertTable td:nth-child(1) { min-width: 8.5rem; white-space: nowrap; }
#expertTable td:nth-child(2) { min-width: 11rem; }
#expertTable td:nth-child(4) { min-width: 9rem; }
#expertTable td:nth-child(6) { white-space: nowrap; }
#expertTable td:nth-child(7) { white-space: nowrap; }

/* ★2026-10-07 专家库「可评审领域」每个领域独占一行：
   多领域用「、」连成一串时，在窄列里会折行并与相邻列视觉粘连
   （截图可见"数字化改造、研发项目 省级"糊在一起）。
   改为每个领域一个 <div> 后，列边界清楚，也更好扫读。 */
#expertTable .domain-line { line-height: 1.5; }

/* ★2026-10-10 生成方案结果弹窗的正文排版（政策匹配页）。
   方案正文 5000+ 字、6 个小节，需要可读的行距与层级；
   弹窗高度与滚动由 .modal（max-height: 88dvh; overflow-y: auto）承担。
   注：样式放全局 CSS 而非页面内联 <style> —— 这是本项目的既定约定
   （tests/test_match_service.py 与 tests/test_match_explain.py 都在守护它）。 */
.draft-body { font-size: .92rem; line-height: 1.85; }
.draft-body p { margin: 0 0 .7rem; }
.draft-body .draft-h {
    margin: 1.1rem 0 .45rem;
    font-size: .98rem;
    color: var(--color-primary);
    border-left: 3px solid var(--color-primary);
    padding-left: .5rem;
}
.draft-body .draft-h:first-child { margin-top: 0; }
/* 风险提示 / 数据来源：默认折叠，避免抢正文的注意力 */
.draft-extra {
    margin-top: 1rem;
    border-top: 1px dashed var(--color-border);
    padding-top: .6rem;
}
.draft-extra summary { cursor: pointer; font-weight: 600; margin-bottom: .4rem; }
#draftResultMeta { font-weight: 400; }

/* ★2026-10-10 政策详情页「AI 解读」的可读排版。
   原实现把整个接口响应 JSON.stringify 后塞进 <pre>，用户无法阅读
   （用户反馈「AI解读是Json的展示，客户无法解读」）；
   改为按语义分区展示后需要这些样式（同样放全局 CSS，遵守页面不内联 style 的约定）。 */
.pd-summary {
    background: var(--color-surface-alt, #f6f5f0);
    border-left: 3px solid var(--color-accent);
    padding: .6rem .75rem;
    margin: 0 0 1rem;
    line-height: 1.75;
}
.pd-sec { margin-bottom: 1.1rem; }
.pd-h {
    margin: 0 0 .45rem;
    font-size: .98rem;
    color: var(--color-primary);
    border-left: 3px solid var(--color-primary);
    padding-left: .5rem;
}
.pd-sec p { margin: 0 0 .5rem; line-height: 1.8; }
.pd-note { color: var(--color-danger, #a33); }
.pd-tech {
    margin-top: 1rem;
    border-top: 1px dashed var(--color-border);
    padding-top: .6rem;
}
.pd-tech summary { cursor: pointer; margin-bottom: .4rem; color: var(--color-muted-text); }

/* ★2026-10-19：政策匹配与组合（同页双标签） */
.hub-tabs { display:flex; gap:10px; margin-top:14px; }
.hub-tab { padding:9px 18px; border-radius:10px; border:1px solid #E3D5D7;
    background:#fff; color:#6E6366; font-size:14px; cursor:pointer; }
.hub-tab.active { background:#C21C31; border-color:#C21C31; color:#fff; font-weight:600; }
.hub-pane[hidden] { display:none !important; }

.ai-note { margin: .6rem 0 0; font-size: .82rem; line-height: 1.6; color: #8a7f81; }

/* ==========================================================================
   平台版侧边栏（2026-10-29）
   目标：分组、搜索、折叠、层级清晰；不改 menu_data，不影响权限。
   ========================================================================== */
.sidebar {
    background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-primary-deep) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    padding: 1.15rem 0.8rem 1rem;
    gap: 0.45rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.18) transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 99px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }

.sidebar .brand {
    padding: 0.15rem 0.45rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.10);
    margin-bottom: 0.35rem;
    gap: 0.65rem;
}
.sidebar .brand-mark {
    width: 2.35rem; height: 2.35rem;
    border-radius: 0.7rem;
    box-shadow: 0 0 0 3px rgba(176,141,63,.13);
    font-size: 1.02rem;
}
.sidebar .brand-copy { min-width: 0; }
.sidebar .brand-name {
    font-size: 0.98rem;
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar .brand-sub {
    margin-top: 0.15rem;
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    color: rgba(232,239,236,.48);
    white-space: nowrap;
}

.side-search {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.15rem 0.15rem 0.45rem;
    padding: 0.46rem 0.6rem;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 0.55rem;
    background: rgba(255,255,255,.045);
    color: rgba(232,239,236,.55);
}
.side-search:focus-within {
    border-color: rgba(176,141,63,.65);
    background: rgba(255,255,255,.075);
}
.side-search svg { width: 0.9rem; height: 0.9rem; flex: 0 0 auto; }
.side-search input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: #eef7f3;
    font-size: 0.76rem;
}
.side-search input::placeholder { color: rgba(232,239,236,.38); }
.side-search input::-webkit-search-cancel-button { filter: invert(1); opacity: .45; }

.side-section {
    border-top: 1px solid rgba(255,255,255,.065);
    padding-top: 0.32rem;
}
.side-section:first-of-type { border-top: 0; padding-top: 0; }
.side-section-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 2rem;
    padding: 0.32rem 0.45rem;
    border: 0;
    background: transparent;
    color: rgba(232,239,236,.58);
    cursor: pointer;
    text-align: left;
    border-radius: 0.4rem;
}
.side-section-toggle:hover { color: #fff; background: rgba(255,255,255,.045); }
.side-section-icon { display: inline-flex; width: 0.92rem; height: 0.92rem; flex: 0 0 auto; }
.side-section-icon svg { width: 100%; height: 100%; }
.side-section-label {
    flex: 1;
    font-size: 0.67rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}
.side-section-count {
    min-width: 1.25rem;
    padding: 0.05rem 0.3rem;
    border-radius: 99px;
    background: rgba(255,255,255,.075);
    color: rgba(232,239,236,.55);
    font-size: 0.61rem;
    text-align: center;
}
.side-chevron {
    width: 0.78rem; height: 0.78rem;
    flex: 0 0 auto;
    transition: transform .18s ease;
    opacity: .55;
}
.side-section.is-open .side-chevron { transform: rotate(180deg); }
.side-section-body { display: none; padding: 0.08rem 0 0.28rem; }
.side-section.is-open .side-section-body { display: block; }
.side-section.is-active .side-section-toggle { color: #f3e7c7; }
.side-section.is-active .side-section-label { color: #f3e7c7; }

.side-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.52rem;
    min-height: 2.12rem;
    margin: 0.08rem 0;
    padding: 0.38rem 0.58rem 0.38rem 0.72rem;
    border-radius: 0.44rem;
    color: #c8d7d1;
    font-size: 0.82rem;
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.side-link:hover {
    background: rgba(255,255,255,.065);
    color: #fff;
    text-decoration: none;
}
.side-link.active {
    background: linear-gradient(90deg, rgba(176,141,63,.22), rgba(176,141,63,.055));
    border-left-color: #d3b166;
    color: #fff;
    font-weight: 600;
}
.side-link.active .side-link-dot { background: #d3b166; opacity: 1; }
.side-link-dot {
    width: 0.28rem;
    height: 0.28rem;
    flex: 0 0 auto;
    border-radius: 50%;
    background: currentColor;
    opacity: .45;
}
.side-link-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.side-link.side-child { padding-left: 1.55rem; font-size: 0.79rem; }
.side-link.side-child .side-link-dot { width: .22rem; height: .22rem; opacity: .35; }
.side-parent-label {
    padding: 0.45rem 0.72rem 0.18rem 1.25rem;
    color: rgba(232,239,236,.42);
    font-size: 0.68rem;
    letter-spacing: .04em;
}
.side-subgroup { margin-bottom: 0.08rem; }
.side-subgroup-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    min-height: 1.85rem;
    padding: 0.28rem 0.58rem 0.28rem 1.25rem;
    border: 0;
    background: transparent;
    color: rgba(232,239,236,.5);
    cursor: pointer;
    text-align: left;
    border-radius: 0.38rem;
}
.side-subgroup-toggle:hover { color: #fff; background: rgba(255,255,255,.045); }
.side-subgroup-label {
    flex: 1;
    font-size: 0.71rem;
    letter-spacing: .04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.side-subgroup-toggle .side-chevron { width: .7rem; height: .7rem; }
.side-subgroup.is-open .side-subgroup-toggle .side-chevron { transform: rotate(180deg); }
.side-subgroup-body { display: none; }
.side-subgroup.is-open .side-subgroup-body { display: block; }
.side-nav-empty {
    padding: 1rem 0.6rem;
    color: rgba(232,239,236,.45);
    font-size: .76rem;
    text-align: center;
}

.sidebar-foot {
    padding: 0.75rem 0.55rem 0.2rem;
    border-top: 1px solid rgba(255,255,255,.09);
    font-size: 0.72rem;
    color: rgba(232,239,236,.55);
}
.sidebar-foot .sidebar-tenant {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: rgba(232,239,236,.72);
}
.sidebar-foot .ver { margin-top: .28rem; color: rgba(232,239,236,.34); font-size: .61rem; }

@media (max-width: 820px) {
    .sidebar {
        height: auto;
        max-height: 55vh;
        overflow-y: auto;
        flex-direction: column;
        align-items: stretch;
        padding: 0.7rem 0.8rem;
    }
    .sidebar .brand { padding-bottom: 0.6rem; }
    .side-search { display: none; }
    .side-section { border-top: 0; padding-top: 0; }
    .side-section-toggle { display: flex; }
    .side-section-body {
        display: none;
        flex-wrap: wrap;
        gap: 0.18rem;
        padding: 0.15rem 0;
    }
    .side-section.is-open .side-section-body { display: flex; }
    .side-subgroup { display: block; width: 100%; }
    .side-subgroup-toggle { padding-left: 0.6rem; }
    .side-link, .side-link.side-child {
        min-height: 1.9rem;
        padding: 0.28rem 0.52rem;
        font-size: 0.76rem;
        border-left: 0;
        border-radius: 0.38rem;
    }
    .side-link-dot, .side-parent-label { display: none; }
    .sidebar-foot { display: none; }
}
/* ==========================================================================
   后端换肤（2026-10-29）
   html[data-theme] 只影响配色令牌与少量硬编码组件；不改业务布局。
   ========================================================================== */
html[data-theme="vermilion"] {
    --color-primary: #8f1727;
    --color-primary-deep: #6d0f1c;
    --color-primary-soft: #f6e7e9;
    --color-accent: #b08d3f;
    --color-accent-soft: #f4eddc;
    --color-background: #f8f3ef;
    --color-surface: #fffdfb;
    --color-surface-alt: #fbf5f1;
    --color-text: #2b2021;
    --color-muted-text: #746466;
    --color-border: #eadbd6;
    --color-border-strong: #d8c3bd;
    --color-border-soft: #f1e5df;
    --color-focus: #8f1727;
    --shadow-sm: 0 1px 2px rgba(143, 23, 39, .06);
    --shadow-md: 0 4px 16px rgba(143, 23, 39, .08);
    --shadow-lg: 0 10px 32px rgba(143, 23, 39, .12);
}
html[data-theme="indigo"] {
    --color-primary: #1e3a5f;
    --color-primary-deep: #142945;
    --color-primary-soft: #e8eef6;
    --color-accent: #b08d3f;
    --color-accent-soft: #f4eddc;
    --color-background: #f3f6fa;
    --color-surface: #ffffff;
    --color-surface-alt: #f7f9fc;
    --color-text: #1d2733;
    --color-muted-text: #607085;
    --color-border: #dbe4ee;
    --color-border-strong: #c5d2e1;
    --color-border-soft: #e9eff6;
    --color-focus: #1e3a5f;
    --shadow-sm: 0 1px 2px rgba(30, 58, 95, .06);
    --shadow-md: 0 4px 16px rgba(30, 58, 95, .08);
    --shadow-lg: 0 10px 32px rgba(30, 58, 95, .12);
}
html[data-theme="ink"] {
    color-scheme: dark;
    --color-primary: #1b2a33;
    --color-primary-deep: #111a20;
    --color-primary-soft: #24343d;
    --color-accent: #c9a45c;
    --color-accent-soft: #3a3020;
    --color-background: #141a20;
    --color-surface: #1e2730;
    --color-surface-alt: #232e38;
    --color-text: #e9eef1;
    --color-muted-text: #a4b2ba;
    --color-border: #34434d;
    --color-border-strong: #465762;
    --color-border-soft: #2a3740;
    --color-focus: #8ab4f8;
    --color-success: #6fcf97;
    --color-success-soft: #1f3a2e;
    --color-warning: #e2b86b;
    --color-warning-soft: #3a2e1c;
    --color-danger: #ef8b7b;
    --color-danger-soft: #3c2523;
    --color-info: #8ab4f8;
    --color-info-soft: #223247;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .24);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, .30);
    --shadow-lg: 0 10px 32px rgba(0, 0, 0, .38);
}
html[data-theme="ink"] .topbar {
    background: rgba(20, 26, 32, .94);
    border-bottom-color: #2a3740;
}
html[data-theme="ink"] .card,
html[data-theme="ink"] .modal-box,
html[data-theme="ink"] .dropdown-menu,
html[data-theme="ink"] .table-wrap {
    background: var(--color-surface);
    color: var(--color-text);
}
html[data-theme="ink"] .table th {
    background: #232e38;
    color: #c7d3d9;
    border-color: #34434d;
}
html[data-theme="ink"] .table td { border-color: #2f3d47; color: #dce5e9; }
html[data-theme="ink"] .table tbody tr:hover { background: #26343d; }
html[data-theme="ink"] .field input,
html[data-theme="ink"] .field select,
html[data-theme="ink"] .field textarea,
html[data-theme="ink"] .topbar-search input,
html[data-theme="ink"] .form-row input,
html[data-theme="ink"] .form-row select,
html[data-theme="ink"] .form-row textarea {
    background: #182129;
    color: #e9eef1;
    border-color: #3a4a55;
}
html[data-theme="ink"] .field label,
html[data-theme="ink"] .form-row label { color: #cbd7dd; }
html[data-theme="ink"] .page-head h1,
html[data-theme="ink"] .card-head h2,
html[data-theme="ink"] .content h1,
html[data-theme="ink"] .content h2,
html[data-theme="ink"] .content h3 { color: #edf3f5; }
html[data-theme="ink"] .lede,
html[data-theme="ink"] .muted,
html[data-theme="ink"] .text-muted { color: var(--color-muted-text); }
html[data-theme="ink"] .modal-box { border: 1px solid #34434d; }
html[data-theme="ink"] .dropdown-item:hover { background: #26343d; }
html[data-theme="ink"] .user-menu-toggle:hover { background: #26343d; border-color: #3a4a55; }

/* 按钮别名：页面使用 .btn.primary / .btn.ghost */
.btn.primary,
.btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}
.btn.primary:hover,
.btn-primary:hover { background: var(--color-primary-deep); }
.btn.ghost,
.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--color-muted-text);
}
.btn.ghost:hover,
.btn-ghost:hover {
    background: var(--color-primary-soft);
    color: var(--color-primary);
}
.btn.danger,
.btn-danger {
    background: var(--color-danger);
    border-color: var(--color-danger);
    color: #fff;
}
.ops-tab.active,
.hub-tab.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}
/* ==========================================================================
   扩展主题（2026-10-29，共 12 套）
   每一套只覆盖设计令牌；布局与组件规则不变。
   ========================================================================== */
html[data-theme="ocean"] {
    --color-primary: #14506b;
    --color-primary-deep: #0d3a4f;
    --color-primary-soft: #e4f0f5;
    --color-accent: #b08d3f;
    --color-accent-soft: #f4eddc;
    --color-background: #f4f8fa;
    --color-surface: #ffffff;
    --color-surface-alt: #f8fbfc;
    --color-text: #1b2b33;
    --color-muted-text: #5d7280;
    --color-border: #d8e6ec;
    --color-border-strong: #c4d8e1;
    --color-border-soft: #e9f1f5;
    --color-focus: #14506b;
    --shadow-sm: 0 1px 2px rgba(20, 80, 107, .06);
    --shadow-md: 0 4px 16px rgba(20, 80, 107, .08);
    --shadow-lg: 0 10px 32px rgba(20, 80, 107, .12);
}
html[data-theme="jade"] {
    --color-primary: #2f5d50;
    --color-primary-deep: #203f36;
    --color-primary-soft: #e7f0eb;
    --color-accent: #b08d3f;
    --color-accent-soft: #f4eddc;
    --color-background: #f5f8f4;
    --color-surface: #ffffff;
    --color-surface-alt: #f9fbf8;
    --color-text: #22302a;
    --color-muted-text: #68786d;
    --color-border: #dce8df;
    --color-border-strong: #c8d9cd;
    --color-border-soft: #edf4ef;
    --color-focus: #2f5d50;
    --shadow-sm: 0 1px 2px rgba(47, 93, 80, .06);
    --shadow-md: 0 4px 16px rgba(47, 93, 80, .08);
    --shadow-lg: 0 10px 32px rgba(47, 93, 80, .12);
}
html[data-theme="plum"] {
    --color-primary: #6e2b45;
    --color-primary-deep: #511d32;
    --color-primary-soft: #f4e7ed;
    --color-accent: #c39a52;
    --color-accent-soft: #f4eddc;
    --color-background: #faf5f7;
    --color-surface: #ffffff;
    --color-surface-alt: #fcf8fa;
    --color-text: #2e2026;
    --color-muted-text: #7a6870;
    --color-border: #eadbe3;
    --color-border-strong: #d9c2cd;
    --color-border-soft: #f3e9ee;
    --color-focus: #6e2b45;
    --shadow-sm: 0 1px 2px rgba(110, 43, 69, .06);
    --shadow-md: 0 4px 16px rgba(110, 43, 69, .08);
    --shadow-lg: 0 10px 32px rgba(110, 43, 69, .12);
}
html[data-theme="amber"] {
    --color-primary: #7a4a1e;
    --color-primary-deep: #5c3514;
    --color-primary-soft: #f7eee3;
    --color-accent: #b08d3f;
    --color-accent-soft: #f4eddc;
    --color-background: #fbf7f1;
    --color-surface: #ffffff;
    --color-surface-alt: #fdfaf6;
    --color-text: #30251b;
    --color-muted-text: #7d6b59;
    --color-border: #eadfce;
    --color-border-strong: #ddcdb7;
    --color-border-soft: #f4ece1;
    --color-focus: #7a4a1e;
    --shadow-sm: 0 1px 2px rgba(122, 74, 30, .06);
    --shadow-md: 0 4px 16px rgba(122, 74, 30, .08);
    --shadow-lg: 0 10px 32px rgba(122, 74, 30, .12);
}
html[data-theme="slate"] {
    --color-primary: #37474f;
    --color-primary-deep: #26343a;
    --color-primary-soft: #e9eef0;
    --color-accent: #b08d3f;
    --color-accent-soft: #f4eddc;
    --color-background: #f4f6f7;
    --color-surface: #ffffff;
    --color-surface-alt: #f8fafb;
    --color-text: #202a2e;
    --color-muted-text: #68777d;
    --color-border: #dce3e6;
    --color-border-strong: #c9d4d8;
    --color-border-soft: #edf2f4;
    --color-focus: #37474f;
    --shadow-sm: 0 1px 2px rgba(55, 71, 79, .06);
    --shadow-md: 0 4px 16px rgba(55, 71, 79, .08);
    --shadow-lg: 0 10px 32px rgba(55, 71, 79, .12);
}
html[data-theme="forest"] {
    --color-primary: #275c3b;
    --color-primary-deep: #1a422a;
    --color-primary-soft: #e7f1e9;
    --color-accent: #c39a52;
    --color-accent-soft: #f4eddc;
    --color-background: #f4f8f3;
    --color-surface: #ffffff;
    --color-surface-alt: #f8fbf7;
    --color-text: #1f3025;
    --color-muted-text: #64786a;
    --color-border: #d9e6dc;
    --color-border-strong: #c5d9ca;
    --color-border-soft: #ebf3ec;
    --color-focus: #275c3b;
    --shadow-sm: 0 1px 2px rgba(39, 92, 59, .06);
    --shadow-md: 0 4px 16px rgba(39, 92, 59, .08);
    --shadow-lg: 0 10px 32px rgba(39, 92, 59, .12);
}
html[data-theme="violet"] {
    --color-primary: #4d3b6b;
    --color-primary-deep: #38294f;
    --color-primary-soft: #eeeaf6;
    --color-accent: #c39a52;
    --color-accent-soft: #f4eddc;
    --color-background: #f8f6fb;
    --color-surface: #ffffff;
    --color-surface-alt: #fbf9fd;
    --color-text: #2a2434;
    --color-muted-text: #746a83;
    --color-border: #e4ddf0;
    --color-border-strong: #d1c4e3;
    --color-border-soft: #f1ecf7;
    --color-focus: #4d3b6b;
    --shadow-sm: 0 1px 2px rgba(77, 59, 107, .06);
    --shadow-md: 0 4px 16px rgba(77, 59, 107, .08);
    --shadow-lg: 0 10px 32px rgba(77, 59, 107, .12);
}
html[data-theme="sand"] {
    --color-primary: #6b5134;
    --color-primary-deep: #4e3a23;
    --color-primary-soft: #f3eee5;
    --color-accent: #b08d3f;
    --color-accent-soft: #f4eddc;
    --color-background: #faf8f3;
    --color-surface: #ffffff;
    --color-surface-alt: #fcfaf6;
    --color-text: #312a20;
    --color-muted-text: #796d5d;
    --color-border: #e8dfd1;
    --color-border-strong: #d8cab5;
    --color-border-soft: #f3ede4;
    --color-focus: #6b5134;
    --shadow-sm: 0 1px 2px rgba(107, 81, 52, .06);
    --shadow-md: 0 4px 16px rgba(107, 81, 52, .08);
    --shadow-lg: 0 10px 32px rgba(107, 81, 52, .12);
}
.side-noscript-tip { margin: .5rem .6rem; padding: .5rem; border-radius: .4rem; background: rgba(255,255,255,.07); color: rgba(232,239,236,.7); font-size: .72rem; }

.nav-empty-copy { padding: 0 .75rem; font-size: .82rem; }
