/* ═══════════════════════════════════════════════════════
   铁路规章检索系统 — 精致现代样式
   ═══════════════════════════════════════════════════════ */

/* ── Reset & Variables ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-primary-light: #eff4ff;
    --color-success: #059669;
    --color-danger: #dc2626;
    --color-warning: #d97706;
    --color-bg: #f1f5f9;
    --color-surface: #ffffff;
    --color-text: #0f172a;
    --color-text-muted: #64748b;
    --color-text-light: #94a3b8;
    --color-border: #e2e8f0;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 999px;

    --shadow-xs: 0 1px 2px rgba(15,23,42,.04);
    --shadow-sm: 0 1px 3px rgba(15,23,42,.04), 0 1px 2px rgba(15,23,42,.03);
    --shadow: 0 1px 3px rgba(15,23,42,.04), 0 4px 12px rgba(15,23,42,.06);
    --shadow-md: 0 4px 6px rgba(15,23,42,.03), 0 8px 24px rgba(15,23,42,.08);
    --shadow-lg: 0 8px 16px rgba(15,23,42,.04), 0 16px 40px rgba(15,23,42,.10);

    --max-width: 960px;
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                  "Microsoft YaHei", sans-serif;
}

body {
    font-family: var(--font-stack);
    font-size: 15px;
    line-height: 1.7;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--color-primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--color-primary-dark); }
ul, ol { list-style: none; }

h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 1.05rem; font-weight: 600; }

/* ── PC Top Bar (slim) ──────────────────────────── */
.topbar {
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-inner {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 50px;
}
.topbar-brand {
    color: var(--color-primary);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -.01em;
    text-decoration: none;
    flex-shrink: 0;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.88rem;
}
.topbar-user {
    color: var(--color-text);
    font-weight: 600;
    font-size: 0.85rem;
}
.topbar-logout {
    color: var(--color-text-muted);
    font-size: 0.8rem;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    transition: all .2s;
}
.topbar-logout:hover {
    background: #fef2f2;
    color: var(--color-danger);
    text-decoration: none;
}

/* ── Sidebar ────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 51px;
    left: 0;
    bottom: 0;
    width: 224px;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    z-index: 90;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
}
.sidebar-section {
    padding: 0 10px;
    margin-bottom: 4px;
}
.sidebar-section + .sidebar-section {
    border-top: 1px solid var(--color-border);
    padding-top: 12px;
    margin-top: 4px;
}
.sidebar-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-text-light);
    padding: 6px 14px 8px;
}
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: all .2s;
    white-space: nowrap;
    font-weight: 500;
}
.sidebar-item:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
    text-decoration: none;
}
.sidebar-item.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 600;
}
.sidebar-icon { font-size: 1.1rem; width: 22px; text-align: center; flex-shrink: 0; opacity: .8; }
.sidebar-item.active .sidebar-icon,
.sidebar-item:hover .sidebar-icon { opacity: 1; }
.sidebar-spacer { flex: 1; }

body.has-sidebar { padding-left: 224px; }

@media (max-width: 768px) {
    .sidebar { display: none; }
    body.has-sidebar { padding-left: 0; }
    .topbar { display: none; }
}

/* ── Mobile Bottom Tab Bar ────────────────────────── */
.mobile-tabs {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--color-border);
    z-index: 100;
    justify-content: space-around;
    padding: 6px 0 max(6px, env(safe-area-inset-bottom));
}
.mobile-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 14px;
    color: var(--color-text-muted);
    font-size: 0.7rem;
    text-decoration: none;
    border-radius: var(--radius);
    transition: color .2s;
}
.mobile-tab .tab-icon { font-size: 1.3rem; line-height: 1; }
.mobile-tab.active { color: var(--color-primary); font-weight: 600; }
.mobile-tab:hover { text-decoration: none; color: var(--color-primary); }

@media (max-width: 768px) {
    .mobile-tabs { display: flex; }
    body { padding-bottom: 72px; }
    .navbar { display: none; }
}

/* ── Container ────────────────────────────────────── */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 28px 20px;
}

/* ── Buttons ──────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 22px;
    border: none;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    text-align: center;
    transition: all .2s;
    font-weight: 600;
    letter-spacing: .01em;
    line-height: 1.4;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); box-shadow: var(--shadow); transform: translateY(-1px); }
.btn-success { background: var(--color-success); color: #fff; }
.btn-success:hover { box-shadow: var(--shadow-md); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--color-text-muted); color: #fff; }
.btn-outline {
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    color: var(--color-text);
}
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-primary-light); }
.btn-sm { padding: 5px 14px; font-size: 0.8rem; }
.btn-text { background: none; color: var(--color-primary); padding: 4px 10px; }
.btn-text:hover { background: var(--color-primary-light); }

/* ── Forms ────────────────────────────────────────── */
.form-page { max-width: 440px; margin: 32px auto; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.88rem; color: var(--color-text); }
.form-input, select, textarea, .form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--color-surface);
    transition: all .2s;
    color: var(--color-text);
}
.form-input:focus, select:focus, textarea:focus, .form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.10);
}
.form-error { color: var(--color-danger); font-size: 0.82rem; margin-top: 4px; display: block; }
.form-hint { color: var(--color-text-muted); font-size: 0.82rem; }
.form-footer { text-align: center; margin-top: 20px; font-size: 0.9rem; color: var(--color-text-muted); }
input[type="file"] { font-size: 0.88rem; }

/* ── Flash Messages ───────────────────────────────── */
.flash-messages { margin-bottom: 20px; }
.flash {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}
.flash-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-info    { background: var(--color-primary-light); color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Tabs ─────────────────────────────────────────── */
.qa-tabs {
    display: inline-flex;
    background: #e8edf5;
    border-radius: var(--radius-full);
    padding: 4px;
    margin-bottom: 24px;
}
.qa-tab {
    padding: 8px 22px;
    border-radius: var(--radius-full);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: all .25s;
    letter-spacing: .01em;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    line-height: inherit;
}
.qa-tab:hover { color: var(--color-text); text-decoration: none; }
.qa-tab.active {
    background: #fff;
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}
.tab-panel { }
/* 班组的「循环规则」与题库的题型筛选都用 .tab-nav，但它此前没有定义：
   渲染出来就是一串裸链接，既看不出当前选中项，触摸目标也只有 ~25px。
   这里对齐 .qa-tabs 的观感，并把触摸高度抬到 44px。 */
.tab-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}
.tab-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 18px;
    border-radius: var(--radius-full);
    background: #e8edf5;
    color: var(--color-text-muted);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    transition: all .25s;
}
.tab-nav a:hover { color: var(--color-text); text-decoration: none; }
.tab-nav a.active {
    background: var(--color-primary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.qa-error {
    color: var(--color-danger);
    font-size: 0.85rem;
    margin-bottom: 8px;
    padding: 6px 10px;
    background: #fef2f2;
    border-radius: var(--radius-sm);
}

/* ── Capsule Search ───────────────────────────────── */
.search-form-top {
    display: flex;
    gap: 8px;
    max-width: 600px;
    margin-bottom: 24px;
}
.search-form-top .search-input {
    flex: 1;
    padding: 13px 20px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-full);
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--color-surface);
    transition: all .25s;
}
.search-form-top .search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(37,99,235,.08);
}
.search-form-top .btn { padding: 13px 28px; }

@media (max-width: 768px) {
    .search-form-top { flex-direction: column; }
    .search-form-top .btn { width: 100%; }
}

/* ── Search Layout ────────────────────────────────── */
.search-layout { display: flex; gap: 28px; }
.search-filters { width: 210px; flex-shrink: 0; }
.search-results { flex: 1; min-width: 0; }

@media (max-width: 768px) {
    .search-layout { flex-direction: column; }
    .search-filters { width: 100%; }
}

.filter-group { margin-bottom: 18px; }
.filter-group h4 { font-size: 0.82rem; font-weight: 700; margin-bottom: 6px; color: var(--color-text); letter-spacing: .02em; text-transform: uppercase; }
.checkbox-label {
    display: block;
    padding: 4px 0;
    font-size: 0.88rem;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: color .15s;
}
.checkbox-label:hover { color: var(--color-text); }
.count { color: var(--color-text-light); font-size: 0.78rem; }
.filter-sort { margin-top: 16px; }
.filter-sort select {
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--color-border);
    font-size: 0.85rem;
    background: var(--color-surface);
}

/* ── Result Cards ─────────────────────────────────── */
.result-count {
    color: var(--color-text-muted);
    margin-bottom: 16px;
    font-size: 0.88rem;
}
.search-syntax-hint { font-size: 0.78rem; color: var(--color-text-light); margin-left: 10px; }
.search-syntax { margin: -6px 0 16px; font-size: 0.82rem; color: var(--color-text-muted); }
.search-syntax summary { cursor: pointer; color: var(--color-primary); font-weight: 600; font-size: 0.82rem; user-select: none; }
.search-syntax p { margin: 8px 0 0; color: var(--color-text-muted); }
.search-syntax code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 0.78rem; }
.search-syntax-hint code {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
}

.result-item {
    background: var(--color-surface);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xs);
    margin-bottom: 14px;
    transition: all .25s;
}
.result-item:hover {
    box-shadow: var(--shadow);
    border-color: #d1dbe8;
    transform: translateY(-1px);
}

.result-layer-doc {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--color-border);
}
.result-layer-doc a { color: var(--color-primary-dark); }

.result-number { font-size: 0.78rem; color: var(--color-text-light); margin-left: 4px; }
.result-layer-path { font-size: 0.8rem; color: var(--color-text-light); margin-bottom: 6px; }
.result-layer-path .path-sep { color: #cbd5e1; margin: 0 4px; }
.result-layer-article { margin-bottom: 12px; }
.result-article-heading {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 6px;
}

.result-content {
    font-size: 0.9rem;
    color: var(--color-text);
    line-height: 1.85;
    white-space: pre-line;
}
.result-content em {
    background: #fef3c7;
    color: #92400e;
    font-style: normal;
    padding: 1px 5px;
    border-radius: 3px;
}

.result-footer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 14px;
    margin-top: 4px;
    border-top: 1px solid var(--color-border);
}

.result-article-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

/* ── PPT Badge ────────────────────────────────────── */
.ppt-badge {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 12px;
    border-radius: var(--radius-full);
    margin-right: 6px;
    vertical-align: middle;
}
.ppt-notice { color: var(--color-text-light); font-size: 0.85rem; font-style: italic; }

/* ── Tag ──────────────────────────────────────────── */
.tag {
    display: inline-block;
    padding: 3px 12px;
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
}

/* ── Bookmark Icon ────────────────────────────────── */
.bookmark-icon { color: #f59e0b; font-size: 1.1rem; }

/* ── Empty State ──────────────────────────────────── */
.empty-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-muted);
}
.empty-results p { margin-bottom: 12px; font-size: 0.95rem; }

/* ── Pagination ───────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 28px;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

/* ── AI Mode Banner ───────────────────────────────── */
.ai-mode-banner {
    background: var(--color-primary-light);
    border-left: 4px solid var(--color-primary);
    padding: 12px 18px;
    margin-bottom: 20px;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.86rem;
    color: var(--color-primary-dark);
}
.ai-badge {
    display: inline-block;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 12px;
    border-radius: var(--radius-full);
    letter-spacing: .5px;
}
.ai-scope-note { font-size: 0.78rem; color: var(--color-text-muted); }

/* ── AI Answer Box ────────────────────────────────── */
.ai-answer-box {
    background: linear-gradient(135deg, #f8faff, #f0f7ff);
    border: 1px solid #d0dff8;
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}
.ai-answer-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.ai-disclaimer { font-size: 0.75rem; color: var(--color-text-muted); }
.ai-answer-content { font-size: 0.95rem; line-height: 1.85; color: var(--color-text); }

/* ── AI Q&A Chat ──────────────────────────────────── */
.qa-page { max-width: 720px; margin: 0 auto; }
.qa-header { margin-bottom: 24px; }
.qa-header h1 { font-size: 1.35rem; margin-bottom: 6px; }
.qa-desc { color: var(--color-text-muted); font-size: 0.9rem; }
.qa-quota { font-size: 0.85rem; color: var(--color-text-muted); }
.qa-quota.unlimited { color: var(--color-success); }

.qa-chat { margin-bottom: 28px; }
.qa-chat .qa-quota { text-align: center; margin-bottom: 20px; }

.qa-input-area { margin-bottom: 28px; }
.qa-input-area textarea {
    width: 100%;
    padding: 16px;
    font-size: 0.95rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    resize: vertical;
    font-family: inherit;
    transition: all .25s;
    line-height: 1.7;
}
.qa-input-area textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(37,99,235,.06);
}
.qa-input-area .btn { margin-top: 12px; }
.qa-input-area .alert { color: var(--color-danger); font-size: 0.85rem; margin-top: 8px; }

.qa-answer-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}
.qa-answer-card .qa-answer-header {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--color-border);
}
.qa-meta { font-size: 0.8rem; color: var(--color-text-light); }
.qa-answer-body { font-size: 0.95rem; line-height: 1.9; }
.qa-answer-body p { margin-bottom: 10px; }

/* Citations */
.qa-citations { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--color-border); }
.qa-citations h3 { font-size: 0.92rem; margin-bottom: 14px; color: var(--color-text); font-weight: 700; }
.qa-citation-item {
    display: flex;
    gap: 14px;
    margin-bottom: 12px;
    padding: 16px;
    background: #f8fafc;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    transition: box-shadow .2s;
}
.qa-citation-item:hover { box-shadow: var(--shadow-xs); }
.citation-index {
    font-weight: 700;
    color: var(--color-primary);
    min-width: 28px;
    font-size: 0.92rem;
}
.citation-content { flex: 1; min-width: 0; }
.citation-doc { font-size: 0.9rem; font-weight: 600; margin-bottom: 6px; }
.citation-excerpt { font-size: 0.86rem; color: var(--color-text-muted); white-space: pre-wrap; margin-bottom: 8px; line-height: 1.7; }
.citation-expand-btn {
    color: var(--color-primary);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.82rem;
    padding: 2px 0;
    margin-bottom: 8px;
    font-weight: 500;
}
.citation-expand-btn:hover { color: var(--color-primary-dark); }
.citation-full-text {
    font-size: 0.9rem;
    line-height: 1.85;
    white-space: pre-wrap;
    padding: 16px;
    background: var(--color-primary-light);
    border-left: 3px solid var(--color-primary);
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-bottom: 8px;
}
.citation-actions { display: flex; gap: 8px; }

@media (max-width: 768px) {
    .qa-citation-item { flex-direction: column; }
    .qa-page { padding: 0 4px; }
}

/* ── Citations Inline ─────────────────────────────── */
cite.ai-citation {
    font-style: normal;
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* ── Profile Page ─────────────────────────────────── */
.profile-page { max-width: 480px; margin: 0 auto; }
.profile-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow);
    text-align: center;
    margin-bottom: 24px;
}
.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    box-shadow: 0 4px 14px rgba(37,99,235,.3);
}
.profile-name { font-size: 1.2rem; font-weight: 700; margin-bottom: 2px; }
.profile-role {
    display: inline-block;
    padding: 3px 14px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    margin-top: 8px;
}
.role-admin { background: #fef3c7; color: #92400e; }
.role-reviewer { background: #dbeafe; color: #1e40af; }
.role-uploader { background: #d1fae5; color: #065f46; }
.role-user { background: #f3f4f6; color: #374151; }

.profile-menu {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.profile-menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 16px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xs);
    text-decoration: none;
    color: var(--color-text);
    transition: all .25s;
}
.profile-menu-item:hover {
    box-shadow: var(--shadow);
    transform: translateY(-3px);
    text-decoration: none;
    border-color: #d1dbe8;
}
.profile-menu-item .menu-icon { font-size: 1.5rem; color: var(--color-primary); }
.profile-menu-item .menu-label { font-size: 0.84rem; font-weight: 600; }

/* ── Document Detail ──────────────────────────────── */
.doc-detail { max-width: 800px; margin: 0 auto; }
.doc-header { margin-bottom: 28px; }
.doc-header h1 { font-size: 1.4rem; margin-bottom: 10px; }
.doc-number { color: var(--color-text-muted); font-size: 0.9rem; }
.doc-meta { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; align-items: center; }
.doc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.doc-toc {
    background: var(--color-surface);
    padding: 22px 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xs);
    margin-bottom: 24px;
}
.doc-toc h2 { font-size: 1.05rem; margin-bottom: 12px; }
.toc-tree { padding-left: 0; }
.toc-tree li { padding: 5px 0; }
.toc-tree li ul { padding-left: 22px; }
.toc-章 > a { font-weight: 700; }
.toc-节 > a { font-weight: 600; }

.article-item { margin-bottom: 20px; }
.article-chapter {
    font-size: 1.18rem;
    margin: 28px 0 14px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--color-primary);
    color: var(--color-text);
    font-weight: 700;
}
.article-section { font-size: 1.05rem; margin: 20px 0 10px; color: var(--color-primary-dark); font-weight: 600; }
.article-main { padding: 6px 0; line-height: 1.85; }
.article-main strong { color: var(--color-primary-dark); }
.article-paragraph { padding: 3px 0; color: #475569; line-height: 1.8; }

.article-item:target, .article-target {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 12px 18px;
    border-radius: 0 var(--radius) var(--radius) 0;
}

/* ── Article View Page ────────────────────────────── */
.article-view-page { max-width: 800px; margin: 0 auto; }
.article-doc-link {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--color-border);
}
.article-breadcrumb {
    font-size: 0.86rem;
    color: var(--color-text-muted);
    margin-bottom: 20px;
    padding: 10px 18px;
    background: #f8fafc;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}
.article-breadcrumb .breadcrumb-sep { color: #cbd5e1; margin: 0 5px; }

.target-article {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 20px 24px;
    margin: 16px 0 24px;
    border-radius: 0 var(--radius) var(--radius) 0;
    box-shadow: var(--shadow-sm);
}
.target-heading { font-size: 1.08rem; font-weight: 700; color: var(--color-primary-dark); margin-bottom: 10px; }
.target-content { font-size: 0.95rem; line-height: 1.95; white-space: pre-line; }
.target-content em {
    background: #fef3c7;
    color: #92400e;
    font-style: normal;
    padding: 1px 5px;
    border-radius: 3px;
}

.nearby-article {
    background: var(--color-surface);
    padding: 16px 20px;
    margin-bottom: 8px;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    opacity: .88;
    transition: opacity .2s;
}
.nearby-article:hover { opacity: 1; }
.nearby-heading { font-size: 0.9rem; font-weight: 600; color: var(--color-primary); }
.nearby-content { font-size: 0.88rem; line-height: 1.8; white-space: pre-line; color: #475569; }
.nearby-content em {
    background: #fef3c7;
    color: #92400e;
    font-style: normal;
    padding: 1px 4px;
    border-radius: 2px;
}
.bottom-actions { display: flex; gap: 10px; margin-top: 20px; }

/* ── Document Viewer (双栏) ───────────────────────── */
.viewer-back { display: inline-block; margin-bottom: 10px; font-size: 0.9rem; color: var(--color-text-muted); }
.viewer-header { margin-bottom: 20px; }
.viewer-header h1 { font-size: 1.35rem; margin-bottom: 6px; }
.viewer-meta { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; align-items: center; }
.viewer-actions { display: flex; gap: 8px; margin-bottom: 16px; }

.viewer-top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 8px;
}
.viewer-nav-btns { display: flex; gap: 8px; }

.viewer-location {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: var(--radius);
    padding: 10px 18px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    font-weight: 500;
}

.viewer-layout {
    display: flex;
    gap: 16px;
    height: calc(100vh - 320px);
    min-height: 500px;
}
.viewer-left, .viewer-right {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xs);
}
.viewer-left-header, .viewer-right-header {
    padding: 10px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    background: #f8fafc;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}
.viewer-left-body {
    flex: 1;
    display: flex;
    min-height: 0;
}
.viewer-toc {
    width: 220px;
    flex-shrink: 0;
    overflow-y: auto;
    border-right: 1px solid var(--color-border);
    background: #fafbfc;
    padding: 8px 0;
}
.toc-title {
    padding: 6px 12px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #8896a4;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.toc-item {
    margin: 0;
}
.toc-link {
    display: flex;
    align-items: baseline;
    gap: 4px;
    padding: 3px 12px;
    font-size: 0.8rem;
    color: #2c3e50;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.toc-link:hover {
    background: #edf2f7;
    border-left-color: var(--color-border);
}
.toc-depth-0 > .toc-link {
    font-weight: 700;
    font-size: 0.85rem;
    padding-top: 6px;
    padding-bottom: 5px;
    color: #1a1a2e;
}
.toc-depth-1 > .toc-link {
    font-weight: 600;
    font-size: 0.82rem;
    padding-left: 20px;
}
.toc-depth-2 > .toc-link {
    padding-left: 28px;
}
.toc-depth-3 > .toc-link {
    padding-left: 36px;
    font-size: 0.77rem;
    color: #5a6a7a;
}
.toc-current > .toc-link {
    background: #e8f0fe;
    border-left-color: var(--color-primary, #1a73e8);
    color: var(--color-primary, #1a73e8);
    font-weight: 600;
}
.toc-num {
    flex-shrink: 0;
    white-space: nowrap;
}
.toc-label {
    overflow: hidden;
    text-overflow: ellipsis;
    color: #5a6a7a;
    font-weight: 400;
}
.toc-current > .toc-link .toc-label {
    color: var(--color-primary, #1a73e8);
}
.toc-children {
    list-style: none;
    margin: 0;
    padding: 0;
}
.viewer-text, .viewer-right-text {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    white-space: pre-wrap;
    font-family: "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
    font-size: 0.95rem;
    line-height: 1.95;
}
.viewer-pdf-container { flex: 1; border: none; overflow: hidden; }
.viewer-pdf-iframe { width: 100%; height: 100%; border: none; }
.viewer-right-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.viewer-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 24px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}
.viewer-placeholder-icon {
    color: var(--color-text-light);
    margin-bottom: 4px;
}
.viewer-placeholder-hint {
    font-size: 0.82rem;
    color: var(--color-text-light);
    max-width: 260px;
    line-height: 1.6;
}
.viewer-bottom-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

@media (max-width: 768px) {
    .viewer-layout { flex-direction: column; height: auto; }
    .viewer-left, .viewer-right { height: 50vh; min-height: 350px; }
}

/* ── Tables ───────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xs);
}
.data-table th, .data-table td {
    padding: 13px 18px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.9rem;
}
.data-table th {
    background: #f8fafc;
    font-weight: 700;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: .6px;
}
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr:last-child td { border-bottom: none; }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-lg); }

/* ── Badges ───────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: .01em;
}
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }

/* ── Stats ────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--color-surface);
    padding: 26px 22px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xs);
    text-align: center;
    transition: all .25s;
}
.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}
.stat-number {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--color-primary);
    letter-spacing: -.02em;
    line-height: 1.2;
}
.stat-label { font-size: 0.85rem; color: var(--color-text-muted); margin-top: 6px; font-weight: 500; }

/* ── Category Sections ────────────────────────────── */
.cat-section {
    background: var(--color-surface);
    padding: 22px 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xs);
    margin-bottom: 18px;
}
.cat-section h3 { margin-bottom: 12px; font-size: 1rem; font-weight: 700; }
.cat-section li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}
.category-checkboxes { display: flex; flex-direction: column; gap: 10px; }
.cat-fieldset {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.cat-fieldset legend { font-weight: 700; padding: 0 6px; font-size: 0.9rem; }

/* ── Doc List ─────────────────────────────────────── */
.doc-list-item {
    background: var(--color-surface);
    padding: 22px 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xs);
    margin-bottom: 12px;
    transition: all .25s;
}
.doc-list-item:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
    border-color: #d1dbe8;
}
.doc-list-item h3 { margin-bottom: 6px; font-size: 1.02rem; }

/* ── Edit Form ────────────────────────────────────── */
.edit-form {
    margin-top: 16px;
    padding: 20px;
    background: #f8fafc;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}
.edit-form label { display: block; margin-bottom: 10px; font-size: 0.88rem; font-weight: 600; }
.edit-form .form-input {
    display: block;
    width: 100%;
    padding: 8px 12px;
    margin-top: 4px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}
.edit-form .btn { margin-top: 10px; margin-right: 8px; }

/* ── Inline Form ──────────────────────────────────── */
.inline-form { display: flex; gap: 10px; align-items: center; margin: 10px 0; }
.inline-form input[type="text"] { flex: 1; max-width: 320px; }

/* ── Draft Review ─────────────────────────────────── */
.draft-review-page { max-width: 900px; margin: 0 auto; }
.draft-header { margin-bottom: 1.5rem; }
.draft-meta { display: flex; gap: 1.5rem; color: var(--color-text-muted); font-size: 0.9rem; margin-top: 0.5rem; }
.draft-action-bar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    flex-wrap: wrap;
}
.draft-action-bar .hint { color: var(--color-text-light); font-size: 0.85rem; }
.draft-block {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    background: var(--color-surface);
    transition: box-shadow .2s;
}
.draft-block:hover { box-shadow: var(--shadow-xs); }
.draft-block.block-kept { border-left: 4px solid var(--color-success); }
.draft-block.block-pending { border-left: 4px solid var(--color-warning); }
.draft-block.block-excluded { border-left: 4px solid var(--color-danger); opacity: 0.72; }
.block-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.block-index { font-weight: 700; color: var(--color-text); }
.block-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.block-ai-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.5rem; font-size: 0.8rem; }
.ai-tag { padding: 2px 10px; border-radius: var(--radius-full); font-weight: 600; font-size: 0.75rem; }
.tag-正文 { background: #d1fae5; color: #065f46; }
.tag-目录 { background: #fef3c7; color: #92400e; }
.tag-大纲 { background: #dbeafe; color: #1e40af; }
.tag-封面 { background: #fce7f3; color: #9d174d; }
.tag-页眉页脚 { background: #e5e7eb; color: #4b5563; }
.tag-修订记录 { background: #fee2e2; color: #991b1b; }
.tag-培训说明 { background: #e0e7ff; color: #3730a3; }
.tag-不确定 { background: #fef3c7; color: #92400e; }
.ai-confidence { color: var(--color-text-muted); }
.ai-suggestion { font-weight: 600; }
.suggestion-保留 { color: var(--color-success); }
.suggestion-排除 { color: var(--color-danger); }
.suggestion-人工确认 { color: var(--color-warning); }
.suggestion-合并 { color: #3b82f6; }
.suggestion-拆分 { color: #8b5cf6; }
.ai-reason { color: var(--color-text-muted); font-style: italic; }
.block-content-textarea {
    width: 100%;
    font-family: var(--font-stack);
    font-size: 0.95rem;
    line-height: 1.75;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    resize: vertical;
    transition: border-color .2s;
}
.block-content-textarea:focus { outline: none; border-color: var(--color-primary); }
.block-content-preview { font-size: 0.85rem; color: var(--color-text-muted); max-height: 80px; overflow-y: auto; }
.excluded-section { margin-top: 2rem; border-top: 2px solid var(--color-danger); padding-top: 1rem; }
.excluded-section summary { cursor: pointer; color: var(--color-danger); font-weight: 600; margin-bottom: 0.5rem; }
.toggle-header { cursor: pointer; color: var(--color-danger); user-select: none; }
.toggle-arrow { font-size: 0.8rem; }
.merge-select { font-size: 0.8rem; padding: 2px 4px; }

/* ── Draft Review Page ───────────────────────────────── */
.draft-review-page { max-width: 960px; margin: 0 auto; }
.draft-review-header { margin-bottom: 1.5rem; }
.draft-review-header h1 { margin-bottom: 0.25rem; }

.draft-rejection-notice {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #92400e;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.draft-threshold-warning {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.draft-blocks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.draft-blocks-header h2 { margin: 0; font-size: 1.1rem; }
.draft-blocks-legend { display: flex; gap: 16px; font-size: 0.8rem; }
.legend-item { display: flex; align-items: center; gap: 4px; color: var(--color-text-muted); }
.legend-dot {
    width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}
.legend-dot.kept { background: var(--color-success); }
.legend-dot.excluded { background: var(--color-danger); }
.legend-dot.modified { background: #3b82f6; }
.legend-dot.pending { background: var(--color-warning); }

.draft-block-card {
    display: flex;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    overflow: hidden;
    background: var(--color-surface);
    transition: box-shadow 0.2s;
}
.draft-block-card:hover { box-shadow: var(--shadow-sm); }
.block-status-bar {
    width: 4px; flex-shrink: 0;
}
.block-status-kept .block-status-bar { background: var(--color-success); }
.block-status-excluded .block-status-bar { background: var(--color-danger); }
.block-status-modified .block-status-bar { background: #3b82f6; }
.block-status-merged .block-status-bar { background: #8b5cf6; }
.block-status-split .block-status-bar { background: #f59e0b; }
.block-status-pending .block-status-bar { background: var(--color-warning); }
.block-status-excluded .block-main { opacity: 0.6; }

.block-main { flex: 1; padding: 12px 16px; min-width: 0; }

.block-ai-info {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    font-size: 0.82rem;
}
.ai-tag-badge {
    padding: 2px 10px; border-radius: var(--radius-full);
    font-weight: 600; font-size: 0.75rem; white-space: nowrap;
}

.block-ai-reason {
    font-size: 0.82rem; color: var(--color-text-muted);
    margin: 4px 0 8px; font-style: italic;
}

.block-content-wrap { margin: 8px 0; }
.block-content {
    font-size: 0.9rem; line-height: 1.65; white-space: pre-wrap;
    font-family: "Noto Serif CJK SC", "SimSun", serif;
    margin: 0; padding: 8px; background: #fafbfc;
    border-radius: var(--radius-sm);
    max-height: 180px; overflow-y: auto;
}
.block-content-editor {
    width: 100%; min-height: 100px; font-size: 0.9rem;
    font-family: "Noto Serif CJK SC", "SimSun", serif;
    padding: 8px; border: 1px solid var(--color-primary);
    border-radius: var(--radius-sm); resize: vertical;
}

.btn-success-draft {
    background: var(--color-success); color: #fff;
    border: none; cursor: pointer;
}
.btn-success-draft:hover { filter: brightness(0.9); }
.btn-warning-draft {
    background: #f59e0b; color: #fff;
    border: none; cursor: pointer;
}
.btn-warning-draft:hover { filter: brightness(0.9); }

.draft-excluded-section {
    margin-top: 2rem;
    border-top: 2px solid var(--color-danger);
    padding-top: 1rem;
}
.excluded-toggle {
    cursor: pointer; color: var(--color-danger); font-weight: 600;
    background: none; border: none; font-size: 0.95rem; padding: 0;
    display: flex; align-items: center; gap: 4px;
}
.excluded-mini .block-main { padding: 8px 12px; }
.excluded-mini .block-content { max-height: 60px; font-size: 0.82rem; }

.draft-review-actions {
    margin-top: 2rem;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.review-actions-left, .review-actions-right {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}

@media (max-width: 768px) {
    .draft-review-page { padding: 0 4px; }
    .draft-blocks-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .draft-blocks-legend { flex-wrap: wrap; gap: 8px; }
    .block-ai-info { flex-direction: column; align-items: flex-start; gap: 2px; }
    .draft-review-actions { flex-direction: column; }
    .review-actions-left, .review-actions-right { width: 100%; justify-content: center; }
    .draft-block-card { flex-direction: column; }
    .block-status-bar { width: 100%; height: 3px; }
}

/* ── Article Editor ────────────────────────────────── */
.article-editor-page { max-width: 960px; margin: 0 auto; }

/* ── Delimiter Text Editor ─────────────────────────── */
.delimiter-editor-help {
    background: #f0f7ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    color: var(--color-text);
    line-height: 1.7;
}
.delimiter-editor-help p { margin-bottom: .5rem; }
.delimiter-editor-help ul { margin-left: 1.25rem; list-style: disc; }
.delimiter-editor-help ul li { margin-bottom: .25rem; }
.delimiter-editor-help code {
    background: #e2e8f0;
    padding: 1px 6px;
    border-radius: 4px;
    font-family: "Cascadia Code", Consolas, "Courier New", monospace;
    font-size: .88em;
}

.delimiter-editor-textarea {
    width: 100%;
    min-height: 60vh;
    padding: 1.25rem;
    font-family: "Cascadia Code", Consolas, "Courier New", monospace;
    font-size: .95rem;
    line-height: 1.85;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    background: #fafbfc;
    color: var(--color-text);
    resize: vertical;
    transition: border-color .2s, box-shadow .2s;
    tab-size: 4;
}
.delimiter-editor-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(37,99,235,.08);
    background: var(--color-surface);
}

@media (max-width: 768px) {
    .delimiter-editor-textarea {
        font-size: .82rem;
        padding: .75rem;
        min-height: 50vh;
    }
    .delimiter-editor-help {
        font-size: .82rem;
        padding: .75rem 1rem;
    }
    .delimiter-editor-help ul { margin-left: 1rem; }
}

/* ── Toast Notifications ──────────────────────────── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateX(40px);
    transition: opacity .25s, transform .25s;
    max-width: 380px;
}
.toast-show { opacity: 1; transform: translateX(0); }
.toast-success { background: #16a34a; }
.toast-error { background: #dc2626; }

.review-actions { display: flex; gap: 16px; align-items: flex-start; margin-top: 28px; flex-wrap: wrap; }
.reject-group { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.reject-group textarea { width: 320px; max-width: 100%; }

/* ── Review Panel ─────────────────────────────────── */
.review-panel { max-width: 800px; }
.review-info {
    background: var(--color-surface);
    padding: 22px 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xs);
    margin-bottom: 24px;
}
.review-art-item { padding: 10px 16px; border-left: 3px solid var(--color-border); margin-bottom: 10px; transition: border-color .2s; }
.review-art-item:hover { border-color: #94a3b8; }
.art-type-badge {
    display: inline-block;
    padding: 2px 10px;
    background: var(--color-primary);
    color: #fff;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-right: 6px;
}
.art-content-preview { font-size: 0.85rem; color: var(--color-text-muted); margin-top: 6px; line-height: 1.7; }

/* ── Settings Form ────────────────────────────────── */
.settings-form {
    max-width: 600px;
    background: var(--color-surface);
    padding: 28px 32px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xs);
}
.settings-form .form-group { margin-bottom: 24px; }
.settings-form .form-group label { font-size: 0.92rem; margin-bottom: 8px; font-weight: 600; }
.settings-form small { display: block; margin-top: 6px; color: var(--color-text-muted); font-size: 0.8rem; line-height: 1.6; }
.settings-form select, .settings-form input { max-width: 420px; }

/* ── AI Score Badge ───────────────────────────────── */
.ai-score-badge {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    margin-left: 6px;
}

/* ── QA History ───────────────────────────────────── */
.qa-history-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-xs);
    transition: all .25s;
}
.qa-history-item:hover { box-shadow: var(--shadow); }
.qa-history-meta {
    display: flex;
    gap: 14px;
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-bottom: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.qa-history-user { font-weight: 600; color: var(--color-text); }
.qa-history-rounds { color: var(--color-text-muted); }
.qa-has-basis {
    background: #d1fae5;
    color: #065f46;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}
.qa-no-basis {
    background: #fee2e2;
    color: #991b1b;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}
.qa-history-q { margin-bottom: 8px; font-weight: 600; font-size: 0.95rem; }
.qa-history-a { font-size: 0.9rem; line-height: 1.75; color: var(--color-text); }
.qa-history-keywords { font-size: 0.8rem; color: var(--color-text-light); margin-top: 8px; }
.qa-history-link { margin-top: 24px; text-align: center; }
.qa-history-meta .btn-sm { font-size: 0.75rem; padding: 3px 10px; }

/* ── QA Detail ────────────────────────────────────── */
.qa-detail { max-width: 900px; }
.qa-detail-section {
    margin-bottom: 18px;
    padding: 20px 24px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xs);
}
.qa-detail-section h3 { font-size: 0.88rem; color: var(--color-text-muted); margin-bottom: 10px; font-weight: 700; }
.qa-detail-question { font-size: 1.12rem; font-weight: 600; line-height: 1.7; }
.qa-detail-answer { font-size: 0.95rem; line-height: 1.85; }
.qa-detail-meta {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    font-size: 0.84rem;
    color: var(--color-text-light);
    margin-bottom: 14px;
}
.qa-detail-error { background: #fef2f2; border-color: #fecaca; }
.qa-detail-error pre { font-size: 0.8rem; color: #991b1b; white-space: pre-wrap; }
.qa-candidate-item { padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.qa-candidate-item:last-child { border-bottom: none; }
.qa-detail-citation { padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.qa-detail-citation:last-child { border-bottom: none; }

/* ── Modal ────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-box {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 460px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}
.modal-box h3 { font-size: 1.12rem; margin-bottom: 10px; font-weight: 700; }
.modal-box .modal-body { font-size: 0.9rem; color: var(--color-text-muted); margin-bottom: 20px; line-height: 1.7; }
.modal-box .modal-body .impact-list { margin: 10px 0; padding-left: 20px; }
.modal-box .modal-body .impact-list li { list-style: disc; margin-bottom: 4px; font-size: 0.88rem; }
.modal-box textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    margin-bottom: 20px;
    transition: all .2s;
}
.modal-box textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.08); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Homepage Hero ────────────────────────────────── */
.search-hero {
    text-align: center;
    padding: 60px 20px 48px;
}
.search-hero h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 28px;
    letter-spacing: -.02em;
}
.search-hero .search-form {
    display: flex;
    gap: 8px;
    max-width: 560px;
    margin: 0 auto;
}
.search-hero .search-input {
    flex: 1;
    padding: 14px 22px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-family: inherit;
    background: var(--color-surface);
    transition: all .25s;
    box-shadow: var(--shadow-sm);
}
.search-hero .search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(37,99,235,.08);
}
.search-hero .btn { padding: 14px 32px; font-size: 1rem; }
.search-hero .search-hint {
    margin-top: 14px;
    font-size: 0.85rem;
    color: var(--color-text-light);
}

@media (max-width: 768px) {
    .search-hero { padding: 40px 16px 32px; }
    .search-hero h1 { font-size: 1.4rem; margin-bottom: 20px; }
    .search-hero .search-form { flex-direction: column; }
    .search-hero .btn { width: 100%; }
}

/* ── Mobile Responsive ────────────────────────────── */
@media (max-width: 768px) {
    .container { padding: 14px 12px; }
    .btn { font-size: 0.88rem; }
    .qa-tabs { width: 100%; justify-content: center; }
    .qa-tab { padding: 6px 16px; font-size: 0.84rem; }
    .result-item { padding: 18px; }
    .result-footer-actions { flex-wrap: wrap; gap: 6px; }
    .result-footer-actions .btn { font-size: 0.8rem; padding: 4px 10px; }
    .data-table { font-size: 0.82rem; }
    .data-table th, .data-table td { padding: 10px 8px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 18px 14px; }
    .stat-number { font-size: 1.6rem; }
    .profile-menu { grid-template-columns: 1fr 1fr; gap: 10px; }
    .profile-menu-item { padding: 18px 12px; }
    .pagination { flex-wrap: wrap; gap: 8px; }
    .review-actions { flex-direction: column; }
    .reject-group { flex-direction: column; width: 100%; }
    .reject-group textarea { width: 100%; }
    .draft-meta { flex-direction: column; gap: 0.25rem; }
    .draft-block { padding: 0.75rem; }
    .doc-detail { padding: 0 4px; }
    .settings-form { padding: 18px; }
    .settings-form select, .settings-form input { max-width: 100%; }
    .cat-section { padding: 16px; }
    /* Viewer TOC hidden on mobile */
    .viewer-toc { display: none; }
    .viewer-left-body .viewer-text { width: 100%; }
    /* Search result article actions stack */
    .result-article-actions { flex-direction: column; gap: 4px; }
    .result-article-actions .btn { width: 100%; text-align: center; font-size: 0.82rem; padding: 6px 12px; }
    /* Doc actions row */
    .doc-actions { flex-wrap: wrap; gap: 6px; }
    .doc-actions .btn { font-size: 0.82rem; padding: 6px 14px; }
    /* Auth card full width */
    .auth-card { margin: 12px; max-width: 100%; }
    /* Viewer header actions */
    .viewer-actions { flex-wrap: wrap; gap: 6px; }
    .viewer-actions .btn { font-size: 0.8rem; padding: 5px 12px; }
    /* Viewer top nav */
    .viewer-top-nav { flex-direction: column; gap: 8px; align-items: stretch; }
    .viewer-nav-btns { justify-content: space-between; }
    /* Table horizontal scroll */
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    /* Draft/article editor */
    .draft-action-bar { flex-wrap: wrap; gap: 8px; }
    .draft-action-bar .btn, .draft-action-bar .hint { font-size: 0.82rem; }
    /* AI QA input area */
    .qa-input-area textarea { font-size: 0.9rem; }
    .qa-input-area .btn { width: 100%; }
    /* Doc header meta */
    .doc-meta { flex-direction: column; gap: 4px; }
    .viewer-meta { flex-direction: column; gap: 4px; }
    .viewer-header h1 { font-size: 1.15rem; }
    /* Modal mobile */
    .modal-box { width: 92vw; margin: 10vh auto; padding: 20px; }
    /* Action cell in tables */
    .action-cell { display: flex; flex-wrap: wrap; gap: 4px; }
    /* Admin document management */
    .admin-filters { flex-wrap: wrap; gap: 6px; }
    /* Upload form */
    .upload-form { padding: 16px; }
    .form-page { margin: 16px auto; padding: 0 12px; }
    /* 手机上「误触放大/缩小」的两个来源：
       ① iOS 聚焦字号 <16px 的输入框会自动放大页面——之前只覆盖了
          .form-input / select / textarea，漏了 .form-control、搜索框、
          input[type=file] 等，换一个字段就放大一次；
       ② 双击缩放——用 touch-action: manipulation 关掉双击缩放，
          但**不**关闭双指缩放（保留无障碍的放大能力）。 */
    input, select, textarea { font-size: 16px !important; }
    a, button, .btn, label, input, select, textarea, summary, .calg-cell {
        touch-action: manipulation;
    }
    /* Article editor textarea full width */
    .article-editor-page { padding: 0 4px; }
    /* Delete modal reason textarea */
    #deleteModalReason { width: 100%; }
    /* Viewer location breadcrumb */
    .viewer-location { font-size: 0.78rem; flex-wrap: wrap; }
    .loc-sep { margin: 0 2px; }
    /* Inline forms (选人 / 选组 / 日期 + 按钮) 必须换行。
       .inline-form 是 flex 且默认 nowrap：assignments.html 一行 8 个控件、
       leaves.html 6 个，在 351px 的内容宽里会被压成几十像素宽、文字全截断。
       只把「文本类控件 + 按钮」拉满行，checkbox 与短标签保持行内。 */
    .inline-form { flex-wrap: wrap; }
    .inline-form input[type="text"], .inline-form input[type="date"],
    .inline-form input[type="number"], .inline-form input[type="password"],
    .inline-form input[type="search"], .inline-form select,
    .inline-form textarea {
        flex: 1 1 100%; max-width: none;
    }
    .inline-form .btn { flex: 1 1 100%; width: 100%; }
    .inline-form input[type="checkbox"] { flex: 0 0 auto; }
    .inline-form label { flex: 0 0 auto; }
    /* 「→」「至」这类连接符在竖排里单独占一行、居中显示，语义不丢 */
    .inline-form > .inline-form-sep {
        flex: 1 1 100%;
        text-align: center;
        color: var(--color-text-muted);
        font-size: 0.8rem;
    }
}

/* ── Admin data tables → mobile card lists ────────── */
@media (max-width: 768px) {
    .data-table--cards { display: block; background: none; border: none; box-shadow: none; }
    .data-table--cards thead { display: none; }
    .data-table--cards tbody { display: block; }
    .data-table--cards tr {
        display: block;
        margin-bottom: 12px;
        padding: 8px 0;
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-xs);
    }
    .data-table--cards td {
        display: block;
        padding: 8px 16px;
        border-bottom: 1px solid #f1f5f9;
    }
    .data-table--cards td:last-child { border-bottom: none; }
    .data-table--cards td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.72rem;
        font-weight: 700;
        color: var(--color-text-muted);
        text-transform: uppercase;
        letter-spacing: .4px;
        margin-bottom: 3px;
    }
    .data-table--cards td .btn { min-height: 40px; }
    /* 「暂无记录」这类整行空状态没有字段名，别渲染出一个空标签行 */
    .data-table--cards td[colspan]::before { content: none; }
}

/* ── Install Guide (Add to Home Screen) ─────────────── */
.install-guide {
    max-width: 640px;
    margin: 16px auto 0;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    padding: 16px 20px;
    position: relative;
}
.install-guide-content strong {
    display: block;
    margin-bottom: 12px;
    color: var(--color-primary-dark);
    font-size: 0.95rem;
}
.install-guide-close {
    position: absolute;
    top: 8px;
    right: 14px;
    font-size: 1.3rem;
    color: #93c5fd;
    cursor: pointer;
    line-height: 1;
}
.install-guide-close:hover { color: var(--color-primary); }
.install-steps { display: flex; flex-direction: column; gap: 8px; }
.install-step {
    display: none;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    color: var(--color-text);
}
.install-step:last-of-type { display: flex; }
.step-num {
    width: 22px; height: 22px;
    background: var(--color-primary);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

/* ── 首页 ──────────────────────────────────────────── */
.home { max-width: 720px; margin: 0 auto; }
.home-hero { text-align: center; padding: 32px 16px 24px; }
.home-title { font-size: 1.6rem; margin: 0 0 4px; }
.home-sub { color: var(--color-text-muted); margin: 0 0 16px; font-size: 0.9rem; }
.home-search { display: flex; gap: 8px; max-width: 520px; margin: 0 auto; }
.home-search-input { flex: 1; padding: 12px 16px; border: 1px solid var(--color-border); border-radius: var(--radius-lg); font-size: 1rem; }
.home-search-btn { padding: 12px 20px; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.home-today { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.home-today-item {
    display: flex; align-items: center; gap: 12px;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow-xs);
}
.home-today-icon { color: var(--color-primary); display: flex; }
.home-today-label { font-size: 0.8rem; color: var(--color-text-muted); }
.home-today-value { font-size: 1rem; font-weight: 600; }
.home-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.home-func {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 20px 8px; background: var(--color-surface);
    border: 1px solid var(--color-border); border-radius: var(--radius-lg);
    text-decoration: none; color: var(--color-text); font-size: 0.9rem;
    box-shadow: var(--shadow-xs); transition: transform .1s, border-color .1s;
}
.home-func:hover { border-color: var(--color-primary); transform: translateY(-2px); }
.home-func-icon { color: var(--color-primary); display: flex; }
.home-func-name { font-weight: 500; }
.home-myorders { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 16px 20px; margin-top: 16px; }
.home-section-title { font-size: 0.85rem; color: var(--color-text-muted); font-weight: 600; margin-bottom: 8px; }
.home-order-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.home-order-chip { background: var(--color-primary-light); color: var(--color-primary-dark); padding: 4px 10px; border-radius: var(--radius-full); font-size: 0.85rem; }
@media (max-width: 480px) { .home-today { grid-template-columns: 1fr; } .home-grid { grid-template-columns: repeat(2, 1fr); } }

/* ── SVG 图标对齐 ──────────────────────────────────── */
.icon { vertical-align: -0.15em; flex-shrink: 0; }

/* ── 报餐统计柱状图 ────────────────────────────────── */
.stats-chart { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 16px 20px; margin-bottom: 16px; }
.stats-chart-title { font-size: 0.85rem; color: var(--color-text-muted); font-weight: 600; margin-bottom: 8px; }
.stats-bar-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.stats-bar-label { width: 52px; font-size: 0.9rem; color: var(--color-text-muted); flex-shrink: 0; }
.stats-bar-track { flex: 1; background: var(--color-bg); border-radius: var(--radius-full); height: 14px; overflow: hidden; }
.stats-bar-fill { background: var(--color-primary); height: 100%; border-radius: var(--radius-full); transition: width .3s; }
.stats-bar-count { width: 48px; text-align: right; font-size: 0.9rem; font-weight: 600; flex-shrink: 0; }

/* ── 首页数据概览 ──────────────────────────────────── */
.home-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.home-stat { text-align: center; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 12px 8px; box-shadow: var(--shadow-xs); }
.home-stat-num { display: block; font-size: 1.4rem; font-weight: 700; color: var(--color-primary); line-height: 1.2; }
.home-stat-label { font-size: 0.8rem; color: var(--color-text-muted); }

/* ── 首页丰富数据 ──────────────────────────────────── */
.home-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 16px 20px; margin-bottom: 16px; box-shadow: var(--shadow-xs); }
.home-section-title { display: flex; align-items: center; gap: 6px; }
.home-section-title .icon { color: var(--color-primary); }
.home-menu-row { display: flex; gap: 10px; padding: 5px 0; font-size: 0.95rem; }
.home-menu-label { color: var(--color-text-muted); min-width: 40px; flex-shrink: 0; }
.home-menu-dishes { color: var(--color-text); }
.home-empty { color: var(--color-text-muted); font-size: 0.9rem; }
.home-repair { display: flex; justify-content: space-between; align-items: center; font-size: 0.95rem; }
.home-repair-status { background: var(--color-primary-light); color: var(--color-primary-dark); padding: 2px 10px; border-radius: var(--radius-full); font-size: 0.8rem; }

/* ── 刷题：错题重做与进度 ─────────────────────────── */
.quiz-wrong-link { text-decoration: none; color: inherit; display: block; margin-top: 16px; }
.quiz-wrong-card { display: flex; align-items: center; gap: 12px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 16px 20px; box-shadow: var(--shadow-xs); transition: border-color .15s; }
.quiz-wrong-link:hover .quiz-wrong-card { border-color: var(--color-danger); }
.quiz-wrong-icon { color: var(--color-danger); display: flex; }
.quiz-wrong-text { flex: 1; display: flex; flex-direction: column; }
.quiz-wrong-arrow { color: var(--color-text-muted); display: flex; }
.mistake-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.quiz-progress-chart { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 16px 20px; }

/* ── 刷题：题库列表 ────────────────────────────────── */
.bank-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.bank-item { display: flex; align-items: center; gap: 12px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 14px 16px; text-decoration: none; color: inherit; box-shadow: var(--shadow-xs); transition: border-color .15s; }
.bank-item:hover { border-color: var(--color-primary); }
.bank-icon { color: var(--color-primary); display: flex; }
.bank-text { flex: 1; display: flex; flex-direction: column; }
.bank-arrow { color: var(--color-text-muted); display: flex; }

/* ── 排班：日历工具/换班标记/自助值班 ───────────────── */
.cal-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.cal-swap { font-size: 0.72rem; color: #b45309; background: #fef3c7; border-radius: 4px; padding: 1px 4px; margin-top: 2px; }
.cal-duty-btn { font-size: 0.7rem; padding: 1px 6px; border: 1px solid var(--color-border); border-radius: 4px; background: var(--color-surface); color: var(--color-primary); cursor: pointer; margin-top: 3px; }
.cal-duty-btn.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ── 排班：班组矩阵日历 ─────────────────────────────── */
.cal-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.cal-matrix, .cal-table { border-collapse: collapse; width: 100%; font-size: 0.85rem; background: var(--color-surface); }
.cal-matrix th, .cal-matrix td, .cal-table th, .cal-table td { border: 1px solid var(--color-border); padding: 6px 8px; text-align: center; vertical-align: middle; }
.cal-matrix thead th, .cal-table thead th { background: var(--color-primary-light); color: var(--color-primary-dark); font-weight: 600; position: sticky; top: 0; }
.cal-date-head { min-width: 64px; }
.cal-date-cell { white-space: nowrap; background: #f8fafc; }
.cal-date { font-weight: 600; }
.cal-weekday { display: block; font-size: 0.7rem; color: var(--color-text-muted); }
.cal-chip { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 0.78rem; margin: 1px; white-space: nowrap; }
.cal-rest { color: var(--color-text-muted); font-size: 0.78rem; }
.cal-my-group { background: #eff6ff !important; }
.cal-my-row td { background: #eff6ff; }
.cal-name-cell { white-space: nowrap; text-align: left; font-weight: 600; }
.cal-pos-cell { white-space: nowrap; text-align: left; color: var(--color-text-muted); }
.cal-symbol { font-size: 0.9rem; font-weight: 600; text-align: center; position: relative; }
.symbol-legend-item { display: inline-block; margin: 2px 10px 2px 0; font-size: 0.82rem; white-space: nowrap; }
.cal-swap-cell { cursor: pointer; }
.cal-swap-cell:hover { background: #fef9c3; }
.cal-swap-badge { position: absolute; top: 1px; right: 1px; font-size: 0.58rem; line-height: 1; padding: 1px 3px; border-radius: 8px; color: #fff; font-weight: 600; }
.cal-swap-badge.st-pending { background: #f59e0b; }
.cal-swap-badge.st-confirmed { background: #3b82f6; }
.cal-swap-badge.st-approved { background: #10b981; }
.cal-swap-badge.st-rejected, .cal-swap-badge.st-cancelled { background: #9ca3af; }
.cal-sym-pending { color: #dc2626; font-weight: 700; }
.cal-sym-approved { color: #2563eb; font-weight: 700; }
/* 临时调入标记：行内小徽标，不能用 .cal-swap-badge（那是绝对定位、为格子角标设计的） */
.cal-temp-badge { display: inline-block; margin-left: 4px; font-size: 0.6rem; line-height: 1.2; padding: 1px 4px; border-radius: 8px; background: #10b981; color: #fff; font-weight: 600; vertical-align: middle; }
.cal-temp-row td { background: #f0fdf4; }
.cal-today-row td { border-top: 2px solid var(--color-primary); border-bottom: 2px solid var(--color-primary); }
.cal-today-row .cal-date { color: var(--color-primary); }
.cal-today-col { background: #fffbeb; border-left: 2px solid var(--color-primary); border-right: 2px solid var(--color-primary); }
.cal-today-col .cal-date { color: var(--color-primary); }
.cal-legend { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 14px 18px; margin-top: 16px; }
.cal-legend h3 { margin: 0 0 8px; font-size: 0.95rem; }

/* ── 首页待办 ──────────────────────────────────────── */
.home-todo-item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--color-border); font-size: 0.95rem; }
.home-todo-item:last-of-type { border-bottom: none; }

/* ═══════════════════════════════════════════════════════
   移动端设计系统补充（Phase 1）
   ═══════════════════════════════════════════════════════ */

/* ── 通用工具类（补全模板中已引用但此前未定义的类） ── */
.text-muted { color: var(--color-text-muted); }
.empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-muted);
    font-size: 0.92rem;
}
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── 提示块 ── */
/* 名册导入页与考勤对差页用的是 .alert/.alert-warning，但此前只有
   `.qa-input-area .alert` 这一条带作用域的规则——页面级警告渲染出来
   就是一行普通黑字。而「解析警告」「偏差警告」恰恰是必须先看的信息。 */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    background: #f8fafc;
    font-size: 0.9rem;
    margin-bottom: 16px;
}
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.alert-warning { background: #fffbeb; border-color: #fcd34d; color: #92400e; }
.alert-danger { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.alert-success { background: #f0fdf4; border-color: #86efac; color: #166534; }

/* ── 服务 / 管理中枢标题 ── */
.services { max-width: 720px; margin: 0 auto; }
.services-title { font-size: 1.4rem; font-weight: 700; margin: 0 0 4px; }
.services-sub { color: var(--color-text-muted); margin: 0 0 20px; font-size: 0.9rem; }
.hub-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-text-muted);
    margin: 24px 0 10px;
    letter-spacing: .02em;
}

/* ── 通用卡片 / 列表项（供移动端表格卡片化复用） ── */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--shadow-xs);
}
.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: 10px;
    box-shadow: var(--shadow-xs);
}
.list-item-body { flex: 1; min-width: 0; }
.list-item-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 2px; }
.list-item-meta { font-size: 0.82rem; color: var(--color-text-muted); }

/* ── 移动端触控与 5 Tab 优化 ── */
@media (max-width: 768px) {
    .btn { min-height: 44px; }
    .btn-sm { min-height: 36px; }
    .btn:active { transform: scale(0.97); }
    .mobile-tab { padding: 4px 6px; font-size: 0.66rem; }
    .mobile-tab .tab-icon { font-size: 1.2rem; }
}

/* ── 排班：文字班次标签（Phase 2b 符号 → 文字 + 颜色） ── */
.cal-chip { font-weight: 600; }
.cal-chip-day   { background: #dbeafe; color: #1e40af; }
.cal-chip-night { background: #fee2e2; color: #991b1b; }
.cal-chip-late  { background: #fef3c7; color: #92400e; }
.cal-chip-rest  { background: #f1f5f9; color: #64748b; }
.cal-chip-other { background: #e5e7eb; color: #374151; }

/* ── 我的排班：列表视图 ── */
.shift-list { display: flex; flex-direction: column; gap: 8px; }
.shift-item {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}
.shift-item.is-today { border-color: var(--color-primary); box-shadow: var(--shadow-xs); }
.shift-date { display: flex; flex-direction: column; align-items: center; min-width: 52px; }
.shift-day { font-size: 1.25rem; font-weight: 700; line-height: 1.1; }
.shift-weekday { font-size: 0.72rem; color: var(--color-text-muted); }
.shift-chips { flex: 1; display: flex; gap: 6px; flex-wrap: wrap; }
.shift-chips .cal-chip { font-size: 0.85rem; padding: 3px 10px; }

/* ── 排班日历：移动端「按日列表」 ──────────────────────
   桌面端是 31 列宽矩阵，在 375px 屏上要横滑 6~7 屏；手机上换成按日列表
   （见 templates/schedule/calendar.html 的 .cal-mobile）。 */
.cal-mobile { display: none; }
.cal-mobile-group {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    margin-bottom: 12px;
    padding: 0 14px;
}
.cal-mobile-group > summary {
    cursor: pointer;
    padding: 14px 0;
    font-weight: 600;
    font-size: 1rem;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.cal-mobile-count { font-size: 0.82rem; font-weight: 400; color: var(--color-text-muted); }
.cal-mobile-group .shift-list { padding-bottom: 14px; }
.cal-mobile-on { font-size: 0.86rem; color: var(--color-text-muted); align-self: center; }
.cal-mobile-rest { font-size: 0.9rem; color: var(--color-text-light); align-self: center; }
.cal-mobile-swap { flex: 0 0 auto; min-height: 40px; }

/* ── 手机端排班：7 列月历网格 ──────────────────────────
   整月 31 天折成 5~6 行 × 7 列，格子里是班次首字（白/夜/中/下/休）。
   桌面端那张 31 列宽表在手机上要横滑 6~7 屏，"看不见全局"；
   只给按日列表又要滚 31 行，同样看不见全局。 */
.calg { padding: 0 0 10px; }
.calg-head, .calg-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}
.calg-head { margin-bottom: 4px; }
.calg-head span {
    text-align: center;
    font-size: 0.7rem;
    color: var(--color-text-muted);
}
.calg-grid { margin-bottom: 4px; }
.calg-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    min-height: 44px;              /* 触摸目标 */
    padding: 2px 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
}
.calg-cell.is-empty { border: none; background: none; }
.calg-cell.is-today { border-color: var(--color-primary); background: #eff6ff; }
.calg-day { font-size: 0.66rem; line-height: 1; color: var(--color-text-muted); }
.calg-cell .calg-chip {
    font-size: 0.7rem;
    line-height: 1.35;
    padding: 0 3px;
    border-radius: 4px;
}
.calg-chip-rest { background: #f1f5f9; color: #94a3b8; }
.calg-detail > summary {
    cursor: pointer;
    padding: 12px 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    font-size: 0.88rem;
    color: var(--color-primary);
}
.calg-detail .shift-list { padding-bottom: 14px; }

/* ── 页脚（备案号） ──────────────────────────────────── */
.site-footer {
    max-width: var(--max-width);
    margin: 24px auto 0;
    padding: 14px 18px 24px;
    text-align: center;
    font-size: 0.78rem;
    color: var(--color-text-muted);
}
.site-footer a {
    color: var(--color-text-muted);
    text-decoration: none;
    display: inline-block;
    padding: 6px 10px;          /* 触摸目标别太小 */
}
.site-footer a:hover { text-decoration: underline; }
@media (max-width: 768px) {
    /* 手机上底部还有固定 Tab 栏，页脚要给它留位置 */
    .site-footer { padding-bottom: 84px; }
}

@media (max-width: 768px) {
    /* 31 列宽矩阵在手机上要横滑 6~7 屏：默认换成月历网格；
       但保留一个开关，真想看原宽表时能切出来。 */
    .cal-desktop { display: none; }
    .cal-mobile { display: block; }
    body.show-wide-calendar .cal-desktop { display: block; }
}

/* ── 换班状态徽章补充 ── */
.badge-info  { background: #dbeafe; color: #1e40af; }.badge-muted { background: #e5e7eb; color: #4b5563; }

/* ── 刷题：题目/选项/结果（Phase 2c 补齐缺失样式） ── */
.quiz-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.question-text { font-size: 1.05rem; line-height: 1.6; margin-bottom: 20px; white-space: pre-wrap; }
.options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.option-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 14px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    font-size: 0.95rem;
    line-height: 1.5;
}
.option-item:hover { border-color: var(--color-primary); }
.option-item input { margin-top: 3px; flex-shrink: 0; }
.option-letter { font-weight: 700; color: var(--color-primary); flex-shrink: 0; }
.result-banner {
    padding: 14px 18px; border-radius: var(--radius-sm);
    font-weight: 700; font-size: 1.05rem; margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
}
.result-banner.correct { background: #d1fae5; color: #065f46; }
.result-banner.wrong { background: #fee2e2; color: #991b1b; }
.result-detail {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-lg); padding: 16px 18px; margin-bottom: 16px;
}
.result-detail p { margin: 0 0 8px; }
.explanation {
    margin-top: 10px; padding: 12px 14px; background: #f8fafc;
    border-radius: var(--radius-sm); font-size: 0.9rem; line-height: 1.6;
}
.result-actions { display: flex; flex-direction: column; gap: 10px; }

/* ── 批量刷题 ── */
.batch-topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.batch-progress { flex: 1; height: 8px; background: var(--color-bg); border-radius: var(--radius-full); overflow: hidden; }
.batch-progress-fill { height: 100%; background: var(--color-primary); transition: width .2s; }
.batch-question { display: none; }
.batch-question.active { display: block; }
.batch-nav { display: flex; gap: 8px; margin-top: 16px; }
.batch-nav .btn { flex: 1; }
.batch-result-item {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 12px;
}
.batch-result-item.correct { border-left: 4px solid #10b981; }
.batch-result-item.wrong { border-left: 4px solid #ef4444; }

/* ── 报餐截止提示（Phase 2d） ── */
.deadline-note { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.88rem; margin-bottom: 16px; line-height: 1.5; }
.deadline-open { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.deadline-closed { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ── 报修状态时间线（Phase 2d） ── */
.repair-steps { display: flex; align-items: center; gap: 6px; margin: 10px 0; font-size: 0.8rem; flex-wrap: wrap; }
.repair-steps .step { padding: 4px 12px; border-radius: var(--radius-full); background: #f1f5f9; color: var(--color-text-muted); }
.repair-steps .step.current { background: #dbeafe; color: #1e40af; font-weight: 600; }
.repair-steps .step.done { background: #d1fae5; color: #065f46; }
.repair-steps .step-arrow { color: var(--color-text-light); }
