/* ========================================
   研发部共享可视化工作台 - 样式层
   企业级仪表盘设计系统
   ======================================== */

/* ========== 全局重置 ========== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 主色调 */
    --primary: #2563eb;
    --primary-light: #dbeafe;
    --primary-dark: #1d4ed8;

    /* 功能色 */
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --danger-bg: #fef2f2;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #6366f1;
    --info-light: #e0e7ff;

    /* 中性色 */
    --bg-page: #f0f2f5;
    --bg-card: #ffffff;
    --bg-hover: #f8fafc;
    --bg-sidebar: #1e293b;
    --bg-sidebar-active: #2563eb;

    /* 文字色 */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --text-inverse: #f8fafc;

    /* 边框 */
    --border: #e2e8f0;
    --border-dark: #cbd5e1;

    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);

    /* 圆角 */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    /* 间距 */
    --sidebar-w: 240px;
    --topbar-h: 60px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-page);
    overflow-x: hidden;
}

/* ========== 顶部导航栏 ========== */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--info));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    font-weight: 700;
}

.topbar-title {
    font-size: 13px;
    color: var(--text-secondary);
    border-left: 1px solid var(--border);
    padding-left: 16px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* 角色切换器 */
.role-switcher {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-page);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.role-switcher label {
    font-size: 12px;
    color: var(--text-secondary);
    padding-left: 8px;
}

.role-switcher select {
    border: none;
    background: var(--bg-card);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    font-weight: 600;
}

.btn-reset {
    padding: 6px 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}
.btn-reset:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: #fef5f5;
}

.btn-auth {
    padding: 6px 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}
.btn-auth:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* ========== 身份验证弹窗 ========== */
.auth-modal { max-width: 420px !important; }
.auth-hint {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--primary-light);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 14px;
    line-height: 1.6;
}
.auth-field { margin-bottom: 12px; }
.auth-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.auth-field select,
.auth-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-primary);
    background: #fff;
    outline: none;
    box-sizing: border-box;
}
.auth-field input:focus,
.auth-field select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.auth-error {
    font-size: 12px;
    color: var(--danger);
    min-height: 16px;
    margin: 4px 0 8px;
}
.auth-actions { margin-bottom: 14px; }
.auth-admin {
    border-top: 1px dashed var(--border);
    padding-top: 12px;
    margin-top: 6px;
}
.auth-admin summary {
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}
.auth-admin summary:hover { color: var(--primary); }
.auth-admin .auth-field { margin-top: 10px; }

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--primary-light);
    border-radius: 20px;
    font-size: 13px;
    color: var(--primary-dark);
    font-weight: 600;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

/* ========== 侧边栏 ========== */
.sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    color: var(--text-tertiary);
    overflow-y: auto;
    z-index: 90;
    transition: transform 0.3s ease;
}

.sidebar-section {
    padding: 16px 0;
}

.sidebar-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
    padding: 0 24px 8px;
    opacity: 0.6;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    font-size: 14px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-inverse);
}

.nav-item.active {
    background: rgba(37, 99, 235, 0.2);
    border-left-color: var(--primary);
    color: white;
    font-weight: 600;
}

.nav-item .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

.nav-item .nav-badge {
    margin-left: auto;
    font-size: 11px;
    background: var(--danger);
    color: white;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
}

.nav-item.readonly::after {
    content: "只读";
    margin-left: auto;
    font-size: 10px;
    color: var(--text-tertiary);
    background: rgba(255, 255, 255, 0.1);
    padding: 1px 6px;
    border-radius: 4px;
}

/* ========== 主内容区 ========== */
.main-content {
    margin-left: var(--sidebar-w);
    margin-top: var(--topbar-h);
    padding: 24px;
    min-height: calc(100vh - var(--topbar-h));
}

/* ========== 页面头部 ========== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-title-group h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.page-title-group .subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.page-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn {
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-dark);
}

.btn-outline:hover {
    background: var(--bg-hover);
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

/* ========== KPI 卡片 ========== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.kpi-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.kpi-card.danger::before { background: var(--danger); }
.kpi-card.success::before { background: var(--success); }
.kpi-card.warning::before { background: var(--warning); }
.kpi-card.info::before { background: var(--info); }

.kpi-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.kpi-value .unit {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-tertiary);
    margin-left: 4px;
}

.kpi-meta {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.kpi-meta .trend-up { color: var(--success); }
.kpi-meta .trend-down { color: var(--danger); }

/* ========== 板块进度卡片 ========== */
.board-progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.board-progress-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.board-progress-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.board-progress-card .bp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.board-progress-card .bp-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.board-progress-card .bp-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 14px;
    font-size: 13px;
}

.board-progress-card .bp-stat {
    display: flex;
    flex-direction: column;
}

.board-progress-card .bp-stat-val {
    font-size: 20px;
    font-weight: 700;
}

.board-progress-card .bp-stat-label {
    font-size: 11px;
    color: var(--text-tertiary);
}

/* 进度条 */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-page);
    border-radius: 4px;
    overflow: hidden;
    margin: 6px 0;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
    background: var(--primary);
}

.progress-bar-fill.success { background: var(--success); }
.progress-bar-fill.warning { background: var(--warning); }
.progress-bar-fill.danger { background: var(--danger); }

/* ========== 通用卡片 ========== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-hover);
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title .card-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background: var(--primary-light);
    color: var(--primary-dark);
}

.card-body {
    padding: 20px;
}

.card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ========== 督办待办分栏（日常工作 / 年度目标） ========== */
.todo-subsection {
    background: var(--bg-card);
}
.todo-subsection + .todo-subsection {
    border-top: 1px solid var(--border);
}
.subsection-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-hover);
    border-bottom: 1px solid var(--border);
    gap: 10px;
    flex-wrap: wrap;
}
.subsection-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.subsection-title .card-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    background: var(--primary-light);
    color: var(--primary-dark);
}
.subsection-meta {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ========== 数据表格 ========== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead th {
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background 0.15s ease;
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table tbody tr.row-danger {
    background: var(--danger-bg);
}

.data-table tbody tr.row-danger:hover {
    background: var(--danger-light);
}

.data-table tbody tr.row-danger td:first-child {
    border-left: 3px solid var(--danger);
}

/* ========== 状态徽章 ========== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-success { background: var(--success-light); color: #065f46; }
.badge-danger  { background: var(--danger-light);  color: #991b1b; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-info    { background: var(--info-light);    color: #3730a3; }
.badge-default { background: #f1f5f9;              color: var(--text-secondary); }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }

/* ========== 岗位信息块 ========== */
.position-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.position-card {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.position-card.vacant {
    background: var(--danger-bg);
    border-color: var(--danger);
    border-left: 4px solid var(--danger);
    animation: pulse-danger 2s infinite;
}

.position-card.active {
    border-left: 4px solid var(--success);
}

.position-card.reserve {
    border-left: 4px solid var(--warning);
    background: #fffbeb;
}

@keyframes pulse-danger {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.15); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.position-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.position-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.position-assignee {
    font-size: 12px;
    color: var(--text-secondary);
}

.position-note {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* ========== 模块导航标签 ========== */
.module-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    overflow-x: auto;
    flex-wrap: wrap;
}

.module-tab {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
    white-space: nowrap;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.module-tab:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.module-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 700;
}

.module-tab .tab-count {
    font-size: 11px;
    background: var(--text-tertiary);
    color: white;
    padding: 0 6px;
    border-radius: 10px;
    margin-left: 4px;
}

.module-tab.active .tab-count {
    background: var(--primary);
}

/* ========== 模块内容 ========== */
.module-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.module-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== 只读提示条 ========== */
.readonly-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--warning-light);
    border: 1px solid var(--warning);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: #92400e;
    margin-bottom: 16px;
    font-weight: 600;
}

.readonly-banner .banner-icon {
    font-size: 16px;
}

/* ========== 岗位工作台账：双向同步提示条 ========== */
.sync-banner {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 16px;
    background: var(--info-light);
    border: 1px solid #c7d2fe;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: #3730a3;
    line-height: 1.7;
    font-weight: 500;
}

.sync-banner .banner-icon {
    font-size: 16px;
    flex-shrink: 0;
}

/* 岗位在办任务统计行 */
.ledger-pos-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 0 4px;
}

.ledger-pos-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: #f8fafc;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 999px;
    font-size: 12px;
    color: var(--text-secondary);
}

.ledger-pos-chip em {
    font-style: normal;
    font-weight: 600;
}

.ledger-pos-chip em.text-danger {
    color: var(--danger, #dc2626);
}

/* ========== 权限标记 ========== */
.perm-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.perm-tag.edit {
    background: var(--success-light);
    color: #065f46;
}

.perm-tag.read {
    background: #f1f5f9;
    color: var(--text-secondary);
}

/* ========== 报表区域 ========== */
.report-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .report-section { grid-template-columns: 1fr; }
}

.report-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

.report-card h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.report-meta {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

.report-list {
    list-style: none;
}

.report-list li {
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px dashed var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.report-list li:last-child {
    border-bottom: none;
}

.report-list .report-val {
    font-weight: 700;
    color: var(--primary);
}

/* ========== 工具栏 ========== */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    min-width: 220px;
}

.search-box input {
    border: none;
    outline: none;
    font-size: 13px;
    background: transparent;
    width: 100%;
    color: var(--text-primary);
}

.filter-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.filter-group select {
    padding: 6px 12px;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
}

/* ========== 表格容器 ========== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-sm);
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
    font-size: 14px;
}

/* ========== 模态框 ========== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

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

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-hover);
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.modal-close:hover {
    background: var(--danger-light);
    color: var(--danger);
}

.modal-body {
    padding: 24px;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    :root {
        --sidebar-w: 0px;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 240px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .board-progress-grid {
        grid-template-columns: 1fr;
    }

    .topbar-right {
        gap: 8px;
    }

    .role-switcher label {
        display: none;
    }

    /* 移动端底部导航 */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-card);
        border-top: 1px solid var(--border);
        z-index: 50;
        padding: 6px 0;
        padding-bottom: env(safe-area-inset-bottom, 6px);
        justify-content: space-around;
    }
    .mobile-bottom-nav .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 4px 8px;
        font-size: 10px;
        color: var(--text-tertiary);
        cursor: pointer;
        border: none;
        background: transparent;
    }
    .mobile-bottom-nav .nav-item.active {
        color: var(--primary);
    }
    .mobile-bottom-nav .nav-icon {
        font-size: 18px;
    }

    /* 主内容区底部留空给导航栏 */
    .main-content {
        padding-bottom: 70px;
    }

    /* 表格横向滚动 */
    .data-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 弹窗全屏化 */
    .modal {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }
    .modal-overlay {
        align-items: flex-end;
    }
    .form-group input, .form-group select, .form-group textarea {
        font-size: 16px !important; /* 防止iOS自动缩放 */
    }
}

/* 桌面端隐藏底部导航 */
.mobile-bottom-nav {
    display: none;
}

/* ========== 触摸优化 ========== */
/* 防止iOS双击缩放 */
* {
    -webkit-tap-highlight-color: transparent;
}
/* 禁止手势缩放 */
@media (max-width: 768px) {
    body {
        touch-action: pan-y;
    }
}
.text-danger { color: var(--danger) !important; font-weight: 700; }
.text-success { color: var(--success) !important; font-weight: 700; }
.text-warning { color: var(--warning) !important; font-weight: 700; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.w-full { width: 100%; }

/* ========== 滚动条美化 ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-page);
}

::-webkit-scrollbar-thumb {
    background: var(--border-dark);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ========== 记录编辑表单 ========== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-input {
    padding: 8px 12px;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-card);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.form-readonly {
    background: var(--bg-hover);
    color: var(--text-tertiary);
    cursor: not-allowed;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.form-actions .btn {
    min-width: 80px;
    justify-content: center;
}

.btn-danger-outline {
    background: var(--bg-card);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-danger-outline:hover {
    background: var(--danger-light);
}

@media (max-width: 600px) {
    .form-grid { grid-template-columns: 1fr; }
}

/* ========== 表格操作按钮 ========== */
.table-action-btn {
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid var(--border-dark);
    border-radius: 4px;
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.table-action-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.table-action-btn.danger {
    color: var(--danger);
}

.table-action-btn.danger:hover {
    background: var(--danger-light);
    border-color: var(--danger);
}

/* ========== 移动端菜单按钮 ========== */
.menu-toggle {
    display: none;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .menu-toggle { display: flex; align-items: center; justify-content: center; }
}

/* ========== 多人同步状态徽章 ========== */
.sync-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    transition: all .2s ease;
}
.sync-badge.online {
    background: rgba(34, 197, 94, .12);
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, .35);
}
.sync-badge.local {
    background: rgba(234, 179, 8, .12);
    color: #a16207;
    border: 1px solid rgba(234, 179, 8, .35);
}
.sync-badge.saving {
    background: rgba(59, 130, 246, .12);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, .35);
    animation: syncPulse 1s ease-in-out infinite;
}
.sync-badge.error {
    background: rgba(239, 68, 68, .12);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, .4);
}
@keyframes syncPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .55; }
}
@media (max-width: 768px) {
    .sync-badge { font-size: 11px; padding: 4px 8px; }
    .topbar-title { display: none; }
}

/* ========== 手机/电脑访问连接面板（桌面+手机通用） ========== */
.conn-loading { color: var(--text-tertiary); font-size: 13px; padding: 6px 0; }
.conn-panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.conn-row { padding: 12px 16px; border-radius: var(--radius-md); background: var(--bg-page); border: 1px solid var(--border); }
.conn-row.pc { background: rgba(34, 197, 94, .06); border-color: rgba(34, 197, 94, .3); }
.conn-row.phone { background: rgba(59, 130, 246, .06); border-color: rgba(59, 130, 246, .3); }
.conn-row.muted { opacity: .65; }
.conn-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.conn-url { font-size: 15px; font-weight: 700; color: var(--primary-dark); word-break: break-all; letter-spacing: .3px; }
.conn-tip { margin-top: 10px; font-size: 12px; color: var(--text-secondary); line-height: 1.7; background: var(--bg-page); border-radius: 8px; padding: 10px 14px; }

/* ========== 手机端深度适配 ========== */
@media (max-width: 768px) {
    /* --- 顶栏精简 --- */
    .topbar { padding: 0 12px; }
    .topbar-left { gap: 8px; }
    .logo span { display: none; }
    .user-badge { padding: 4px 8px; }
    .user-badge span { display: none; }
    .role-switcher select { max-width: 130px; font-size: 12px; padding: 5px 6px; }

    /* --- 侧边栏抽屉 --- */
    .sidebar {
        width: 250px;
        box-shadow: 8px 0 30px rgba(0, 0, 0, .2);
        z-index: 150;
    }

    /* --- 页头堆叠 --- */
    .page-header { flex-direction: column; align-items: stretch; gap: 10px; }
    .page-title-group h1 { font-size: 19px; }
    .page-actions { width: 100%; display: flex; }
    .page-actions .btn { flex: 1; justify-content: center; }

    /* --- KPI 两列布局 --- */
    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .kpi-card { padding: 14px; min-height: auto; }
    .kpi-value { font-size: 24px; }
    .kpi-meta { font-size: 11px; -webkit-line-clamp: 2; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }

    /* --- 板块进度卡单列 --- */
    .board-progress-grid { grid-template-columns: 1fr; }

    /* --- 卡片头部允许换行 --- */
    .card-header { flex-wrap: wrap; gap: 8px; }
    .card-actions { flex-wrap: wrap; }

    /* --- 表格 → 卡片视图（核心） --- */
    .table-container { overflow-x: visible; }
    .data-table thead { display: none; }
    .data-table, .data-table tbody { display: block; width: 100%; }
    .data-table tbody tr {
        display: block;
        margin: 0 10px 12px;
        padding: 6px 0 2px;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: 12px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
    }
    .data-table tbody tr.row-danger { border-color: rgba(239, 68, 68, .5); background: rgba(239, 68, 68, .04); }
    .data-table tbody td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        border: none;
        border-bottom: 1px dashed var(--border);
        padding: 9px 14px;
        text-align: right;
        min-height: 42px;
        word-break: break-word;
    }
    .data-table tbody td::before {
        content: attr(data-label);
        font-size: 12px;
        font-weight: 600;
        color: var(--text-tertiary);
        text-align: left;
        flex-shrink: 0;
    }
    .data-table tbody td:last-child { border-bottom: none; }
    .data-table tbody td[colspan] {
        display: block;
        text-align: center;
        border-bottom: none;
        min-height: 0;
        padding: 28px 14px;
    }
    .data-table tbody td[colspan]::before { content: none; }
    .data-table tbody td.td-actions { justify-content: flex-end; }

    /* --- 触屏操作按钮加大 --- */
    .table-action-btn { padding: 8px 18px; font-size: 13px; border-radius: 6px; }
    .btn { min-height: 40px; }
    .btn-sm { min-height: 36px; }

    /* --- 模态框全屏 --- */
    .modal-overlay { align-items: stretch; }
    .modal { width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
    .modal-header { padding: 14px 16px; position: sticky; top: 0; background: var(--bg-card); z-index: 5; }
    .modal-header h2 { font-size: 16px; }
    .modal-close { width: 40px; height: 40px; }
    .modal-body { padding: 16px; }

    /* --- 弹窗内工具栏堆叠 --- */
    .toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
    .search-box input { width: 100%; }
    .filter-group { width: 100%; }
    .filter-group select { flex: 1; }

    /* --- 表单按钮铺满 --- */
    .form-actions { flex-direction: column-reverse; gap: 8px; }
    .form-actions .btn { width: 100%; }

    /* --- 岗位卡片 --- */
    .position-grid { grid-template-columns: 1fr; }
    .position-card { flex-direction: row; align-items: center; }

    /* --- 连接面板单列 --- */
    .conn-panel-grid { grid-template-columns: 1fr; }
}

/* --- 超小屏（手机竖屏）进一步优化 --- */
@media (max-width: 420px) {
    .main-content { padding: 12px 10px; }
    .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .kpi-card { padding: 12px; }
    .kpi-value { font-size: 22px; }
    .data-table tbody tr { margin: 0 2px 10px; }
    .data-table tbody td { padding: 8px 10px; }
}

/* --- 横屏平板 --- */
@media (min-width: 769px) and (max-width: 1024px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .board-progress-grid { grid-template-columns: repeat(2, 1fr); }
    .conn-panel-grid { grid-template-columns: 1fr; }
}

/* ========================================
   发布提醒（通知中心）
   ======================================== */
.notif-btn {
    position: relative;
    height: 34px;
    min-width: 38px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: all .15s;
}
.notif-btn:hover { background: var(--primary-light); border-color: var(--primary); }

.notif-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--bg-card);
}

.notif-panel {
    position: fixed;
    top: calc(var(--topbar-h) + 6px);
    right: 16px;
    width: 380px;
    max-width: calc(100vw - 24px);
    max-height: 70vh;
    display: none;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1200;
    overflow: hidden;
}
.notif-panel.show { display: flex; }

.notif-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-hover);
}
.notif-panel-header h3 { font-size: 15px; }
.notif-panel-header > div { display: flex; align-items: center; gap: 8px; }
.notif-close {
    border: none;
    background: transparent;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
}
.notif-close:hover { color: var(--danger); }

.notif-panel-body { overflow-y: auto; padding: 6px 0; }

.notif-item {
    display: flex;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    transition: background .12s;
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item:last-child { border-bottom: none; }
.notif-item-icon { font-size: 16px; line-height: 1.4; }
.notif-item-text { font-size: 13px; color: var(--text-primary); word-break: break-all; }
.notif-item-meta { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

.notif-empty { padding: 32px 16px; text-align: center; color: var(--text-tertiary); font-size: 13px; }

.notif-panel-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-tertiary);
    background: var(--bg-hover);
}

/* Toast 弹层 */
.toast-container {
    position: fixed;
    top: calc(var(--topbar-h) + 12px);
    right: 16px;
    z-index: 1300;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: min(360px, calc(100vw - 32px));
}
.toast-item {
    position: relative;
    padding: 12px 40px 12px 14px;
    background: #1e293b;
    color: #f8fafc;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    line-height: 1.5;
    cursor: pointer;
    animation: toastIn .25s ease;
    word-break: break-all;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(24px); }
    to { opacity: 1; transform: translateX(0); }
}
.toast-close {
    position: absolute;
    top: 6px;
    right: 8px;
    color: #94a3b8;
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
}
.toast-close:hover { color: #fff; }

/* ========================================
   上下班打卡（考勤）
   ======================================== */
.att-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 28px 32px;
}

.att-clock-wrap { text-align: left; }
.att-date { font-size: 14px; color: var(--text-secondary); }
.att-clock {
    font-size: 56px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 2px;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.att-my-status { font-size: 13px; color: var(--text-secondary); margin-top: 6px; display: flex; align-items: center; gap: 8px; }

.att-actions { display: flex; flex-direction: column; gap: 12px; align-items: stretch; min-width: 200px; }
.att-btn {
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all .15s;
    color: #fff;
}
.att-btn.in { background: var(--primary); }
.att-btn.in:hover:not(.disabled) { background: var(--primary-dark); }
.att-btn.out { background: var(--success); }
.att-btn.out:hover:not(.disabled) { background: #059669; }
.att-btn.disabled { opacity: .45; cursor: not-allowed; }
.att-hint { font-size: 12px; color: var(--text-tertiary); text-align: center; }

@media (max-width: 768px) {
    .att-hero { flex-direction: column; align-items: stretch; text-align: center; padding: 20px; }
    .att-clock { font-size: 44px; }
    .att-clock-wrap { text-align: center; }
    .att-my-status { justify-content: center; }
    .att-actions { min-width: 0; }
    .notif-panel { right: 8px; }
    .toast-container { right: 8px; }
}

/* 定位打卡（钉钉式地理围栏） */
.att-loc { padding: 16px 20px; margin-bottom: 16px; }
.att-loc-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.att-loc-name { font-size: 14px; }
.att-loc-dist { margin-top: 10px; font-size: 13px; color: var(--text-secondary); background: rgba(37,99,235,.06); border-radius: 8px; padding: 8px 12px; }
.att-ck-set { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border, #e5e7eb); }
.att-ck-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 10px; }
.att-ck-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.att-ck-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.att-ck-check input { width: auto; }

@media (max-width: 768px) {
    .att-loc-info { flex-direction: column; align-items: flex-start; gap: 6px; }
    .att-ck-row { flex-direction: column; align-items: stretch; }
    .att-ck-row .form-input { max-width: none !important; width: 100%; }
}

/* 文件上传输入框 */
.file-input { padding: 8px; cursor: pointer; }
.form-hint { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; line-height: 1.5; }

/* ===== 督办待办发布：板块/成员多选面板（总工作台多选下发） ===== */
.pick-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
    padding: 10px 12px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    width: 100%;
}
.pick-group { width: 100%; }
.pick-group-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 2px 0 2px;
    padding-left: 2px;
}
.pick-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
    transition: all .15s ease;
    margin: 2px 6px 2px 0;
}
.pick-chip:hover { border-color: var(--primary); }
.pick-chip input {
    accent-color: var(--primary);
    width: 15px;
    height: 15px;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}
.pick-chip:has(input:checked) {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark);
    font-weight: 600;
}
.pick-empty { font-size: 12px; color: var(--text-tertiary); padding: 4px 2px; }
.mode-panel .pick-chip { border-radius: var(--radius-md); padding: 8px 14px; }
.mode-panel .pick-chip span { font-size: 12px; color: var(--text-secondary); }
.mode-panel .pick-chip:has(input:checked) span { color: var(--primary-dark); }
.sync-hint {
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--info-light);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: #3730a3;
    line-height: 1.6;
}
