/* ==========================================================================
   合拍科技内容排期系统 · 界面样式（2026 重构版）
   --------------------------------------------------------------------------
   兼容目标：
     · 服务器 PHP 5.6（本文件为纯 CSS，不涉及任何 PHP 语法）
     · 现代浏览器（系统内 JS 已使用 let/const/箭头函数/模板字符串，等同
       现代浏览器基线；Chrome 88+ / Safari 14+ / 微信 X5 新版）即可使用
       CSS 变量、env() 安全区、grid、sticky 等特性
   结构说明：
     · 桌面端：紫色系品牌头部 + 白色卡片工作台 + 固定表头/首列排期表
     · 移动端（≤768px）：紧凑头部、可横滑筛选、日期 Tab 单日视图、
       底部抽屉式弹窗、悬浮「+」按钮
   注意：本文件会整体替换原 paiqi.css，原文件里被 JS / 内联样式依赖的
         类名、id、定位关系全部保留，只重写了视觉与布局。
   ========================================================================== */

/* ==========================================================================
   1. 设计变量
   ========================================================================== */
:root {
    /* 品牌色 */
    --brand: #4338ca;
    --brand-600: #4f46e5;
    --brand-500: #6366f1;
    --brand-soft: #eef2ff;
    --brand-ink: #312e81;

    /* 语义色 */
    --success: #16a34a;
    --success-soft: #ecfdf5;
    --success-line: #bbf7d0;
    --warning: #d97706;
    --warning-soft: #fffbeb;
    --warning-line: #fde68a;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --danger-line: #fecaca;

    /* 中性色 */
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #f1f5f9;
    --line: #e8ecf4;
    --line-strong: #d8dfeb;
    --text: #1b2434;
    --text-2: #475467;
    --muted: #8792a6;

    /* 圆角 / 阴影 */
    --radius-lg: 18px;
    --radius: 12px;
    --radius-sm: 9px;
    --shadow-sm: 0 1px 2px rgba(23, 31, 54, .05), 0 1px 3px rgba(23, 31, 54, .06);
    --shadow-md: 0 8px 24px rgba(23, 31, 54, .08);
    --shadow-lg: 0 20px 50px rgba(23, 31, 54, .18);

    /* 骨架尺寸 */
    --header-row-1: 42px;
    --header-row-2: 32px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ==========================================================================
   2. 基础重置与排版
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    background-color: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, p, figure {
    margin: 0;
}

h1 { font-size: 23px; font-weight: 700; letter-spacing: .2px; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
h4 { font-size: 14px; font-weight: 700; color: var(--text); }
h5 { font-size: 12.5px; font-weight: 400; }

a {
    color: var(--brand-600);
    text-decoration: none;
}

a:hover { text-decoration: underline; }

img { max-width: 100%; }

::selection {
    background: var(--brand-soft);
    color: var(--brand-ink);
}

/* 统一细滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: #cfd7e5;
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #aeb9cc; background-clip: content-box; }

/* ==========================================================================
   3. 按钮
   ========================================================================== */
button {
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    color: #fff;
    background: linear-gradient(135deg, var(--brand-600), var(--brand));
    border: 0;
    border-radius: 10px;
    padding: 9px 16px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(67, 56, 202, .22);
    transition: background .18s ease, box-shadow .18s ease, transform .12s ease;
}

button:hover {
    background: linear-gradient(135deg, var(--brand), var(--brand-ink));
    box-shadow: 0 6px 16px rgba(67, 56, 202, .28);
    text-decoration: none;
}

button:active { transform: translateY(1px); }

button:focus-visible {
    outline: 2px solid var(--brand-500);
    outline-offset: 2px;
}

/* a 元素伪装成按钮时保持一致 */
a.btn-small,
a.btn-med {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

/* ==========================================================================
   4. 表单控件
   ========================================================================== */
input[type="text"],
input[type="search"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="password"],
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background-color: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
    -webkit-appearance: none;
    appearance: none;
}

select {
    padding-right: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2364748b' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}

textarea {
    min-height: 92px;
    resize: vertical;
    padding: 10px 12px;
    line-height: 1.6;
}

input::placeholder,
textarea::placeholder { color: #a7b0c0; }

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .16);
    background-color: #fff;
}

input[type="date"],
input[type="time"] { min-height: 42px; }

input[type="color"] {
    width: 64px;
    min-width: 56px;
    height: 42px;
    padding: 4px;
    cursor: pointer;
}

input[type="file"] {
    width: 100%;
    padding: 9px 12px;
    font-size: 13px;
    color: var(--text-2);
    background: var(--surface-2);
    border: 1px dashed var(--line-strong);
    border-radius: 10px;
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 6px 12px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--brand);
    background: var(--brand-soft);
    border: 0;
    border-radius: 8px;
    cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] { accent-color: var(--brand-600); }

.form-group { margin-bottom: 14px; }

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--muted);
}

.form-group input,
.form-group select,
.form-group textarea { margin: 0; }

/* ==========================================================================
   5. 页面骨架
   ========================================================================== */
.container {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 18px 24px 56px;
}

/* 管理后台是独立视图：排期相关内容隐藏，只保留管理面板（DOM 不销毁，JS 不受影响） */
body.view-admin .top-controls,
body.view-admin .stats-section,
body.view-admin .schedule-wrap,
body.view-admin .fab {
    display: none !important;
}

/* 排期视图下不渲染管理面板，避免页面过长 */
body.page-app:not(.view-admin) .admin-section {
    display: none !important;
}

body.view-admin .admin-section { margin-top: 16px; }

/* ==========================================================================
   6. 登录页（body.page-login）
   ========================================================================== */
.page-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 46%, #1e3a8a 100%);
    overflow-x: hidden;
    overflow-y: auto;
}

.page-login::before,
.page-login::after {
    content: "";
    position: fixed;
    border-radius: 50%;
    filter: blur(70px);
    opacity: .5;
    pointer-events: none;
}

.page-login::before {
    width: 420px;
    height: 420px;
    top: -140px;
    left: -120px;
    background: #6366f1;
}

.page-login::after {
    width: 400px;
    height: 400px;
    right: -120px;
    bottom: -140px;
    background: #0ea5e9;
}

.login-form {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 38px 32px 30px;
    text-align: center;
    background: rgba(255, 255, 255, .97);
    border-radius: 24px;
    box-shadow: 0 30px 70px rgba(15, 23, 42, .45), inset 0 1px 0 rgba(255, 255, 255, .8);
    animation: login-rise .5s cubic-bezier(.22, 1, .36, 1) both;
}

.login-form::before {
    content: "合";
    display: flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    margin: 0 auto 18px;
    font-size: 27px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border-radius: 17px;
    box-shadow: 0 12px 26px rgba(79, 70, 229, .38);
}

.login-form h2 {
    margin-bottom: 6px;
    font-size: 21px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: .2px;
}

.login-form h2::after {
    content: "内容 · 排期 · 交付，一处管理";
    display: block;
    margin-top: 8px;
    font-size: 12.5px;
    font-weight: 400;
    color: var(--muted);
    letter-spacing: .5px;
}

.login-form .alert { text-align: left; }

.login-note {
    margin-top: 18px;
    font-size: 12px;
    line-height: 1.7;
    color: var(--muted);
}

/* 飞书登录按钮 */
.feishu-login-link {
    display: block;
    width: 100%;
    margin: 22px 0 4px;
    text-decoration: none;
}

.feishu-login-link:hover { text-decoration: none; }

.feishu-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 50px;
    padding: 0 16px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: #3370ff;
    border: 0;
    border-radius: 12px;
    box-shadow: 0 10px 22px rgba(51, 112, 255, .32);
    transition: background .18s ease, box-shadow .18s ease, transform .12s ease;
}

.feishu-login-link:hover .feishu-login-btn {
    background: #2b62e6;
    box-shadow: 0 14px 28px rgba(51, 112, 255, .38);
}

.feishu-login-link:active .feishu-login-btn { transform: translateY(1px); }

.feishu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    font-size: 13px;
    font-weight: 700;
    color: #3370ff;
    background: #fff;
    border-radius: 8px;
}

@keyframes login-rise {
    from { opacity: 0; transform: translateY(18px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   7. 顶部品牌区
   ========================================================================== */
header {
    position: relative;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(120deg, #312e81 0%, #4338ca 52%, #2563eb 100%);
    border-radius: var(--radius-lg);
    box-shadow: 0 14px 34px rgba(49, 46, 129, .28);
}

header::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background:
        radial-gradient(720px 260px at 88% -40%, rgba(125, 211, 252, .32), transparent 62%),
        radial-gradient(520px 240px at 6% 130%, rgba(192, 132, 252, .30), transparent 65%);
    pointer-events: none;
}

header::after {
    content: "";
    position: absolute;
    right: -60px;
    bottom: -110px;
    width: 300px;
    height: 300px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 50%;
    box-shadow: 0 0 0 34px rgba(255, 255, 255, .05), 0 0 0 74px rgba(255, 255, 255, .035);
    pointer-events: none;
}

.header-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    padding: 22px 26px;
}

.brand {
    flex: 1 1 auto;
    min-width: 0;
}

.brand h1 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 23px;
    line-height: 1.25;
    text-shadow: 0 1px 2px rgba(15, 23, 42, .18);
}

.brand h1::before {
    content: "合";
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(255, 255, 255, .32);
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
    text-shadow: none;
}

.header-subtitle {
    margin-top: 8px;
    padding-left: 52px;
    font-size: 12.5px;
    font-weight: 400;
    line-height: 1.6;
    color: rgba(255, 255, 255, .82);
}

.user-area {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.user-welcome {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 360px;
    color: rgba(255, 255, 255, .92);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-badge {
    padding: 2px 9px;
    font-size: 11px;
    font-weight: 700;
    color: #fef3c7;
    background: rgba(250, 204, 21, .18);
    border: 1px solid rgba(250, 204, 21, .38);
    border-radius: 999px;
}

/* 管理后台入口 / 返回排期 */
.admin-nav-btn {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    font-size: 12.5px;
    font-weight: 600;
    color: #fef3c7;
    white-space: nowrap;
    text-decoration: none;
    background: rgba(250, 204, 21, .16);
    border: 1px solid rgba(250, 204, 21, .42);
    border-radius: 999px;
    transition: background .18s ease, color .18s ease;
}

.admin-nav-btn:hover {
    color: #fff;
    background: rgba(250, 204, 21, .30);
    text-decoration: none;
}

body.view-admin .admin-nav-btn {
    color: #fff;
    background: rgba(255, 255, 255, .14);
    border-color: rgba(255, 255, 255, .30);
}

body.view-admin .admin-nav-btn:hover { background: rgba(255, 255, 255, .26); }

.user-avatar {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, .7);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .25);
}

/* 顶部退出按钮（header 内透明玻璃风） */
header .logout-btn {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    height: 34px;
    white-space: nowrap;
    padding: 0 15px;
    font-size: 12.5px;
    font-weight: 600;
    color: #fff;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .30);
    border-radius: 999px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: background .18s ease;
}

header .logout-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, .26);
    text-decoration: none;
}

/* 通用退出/链接按钮（管理面板里也有 .logout-btn） */
.logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding: 0 16px;
    font-size: 12.5px;
    font-weight: 600;
    color: #fff;
    background: var(--brand);
    border-radius: 10px;
    text-decoration: none;
    transition: background .18s ease;
}

.logout-btn:hover {
    color: #fff;
    background: var(--brand-ink);
    text-decoration: none;
}

/* ==========================================================================
   8. 顶部控制栏
   ========================================================================== */
.top-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px 18px;
    align-items: center;
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.week-navigation {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.week-navigation a { display: inline-flex; }

.week-navigation button {
    height: 36px;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    box-shadow: none;
}

.week-navigation button:hover {
    color: var(--brand);
    background: var(--brand-soft);
    border-color: #c7d2fe;
    box-shadow: none;
}

.week-display {
    margin-left: 4px;
    padding: 5px 12px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-2);
    background: var(--surface-2);
    border-radius: 999px;
    white-space: nowrap;
}

.action-buttons {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.action-buttons button,
.action-buttons .btn-med {
    height: 36px;
    padding: 0 14px;
    font-size: 13px;
    border-radius: 10px;
}

/* 外链类按钮（知识库 / 审片 / 小包团） */
.btn-external,
.action-buttons .btn-external {
    color: #fff;
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 1px 2px rgba(5, 150, 105, .25);
}

.btn-external:hover,
.action-buttons .btn-external:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 6px 16px rgba(5, 150, 105, .3);
}

/* ---- 筛选区 ---- */
.filter-section-compact {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: center;
    padding-top: 12px;
    border-top: 1px dashed var(--line);
}

.filter-group-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 6px 0 10px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.filter-group-compact label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}

.filter-group-compact select {
    width: auto;
    min-width: 66px;
    height: 32px;
    min-height: 32px;
    padding: 0 26px 0 2px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    background-color: transparent;
    background-position: right 4px center;
    border: 0;
    border-radius: 8px;
    box-shadow: none;
}

.filter-group-compact select:focus {
    box-shadow: none;
    color: var(--brand);
}

/* ==========================================================================
   9. 人员任务统计
   ========================================================================== */
.stats-section {
    margin-top: 16px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.stats-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: start;
}

.stats-title-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.stats-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}

.stats-title::before {
    content: "📊";
    font-size: 15px;
}

.stats-title::after {
    content: "▾";
    display: inline-block;
    margin-left: 2px;
    font-size: 12px;
    color: var(--muted);
    transition: transform .25s ease;
}

.stats-title.collapsed::after { transform: rotate(-90deg); }

.role-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
}

.role-color-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px 3px 7px;
    font-size: 11.5px;
    color: var(--text-2);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 999px;
}

.role-color-box {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .08);
}

.role-color-text { font-size: 11.5px; }

/* 五个总览数字 */
.top-stats-bar-compact {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 4px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 14px;
}

.stat-item-compact {
    min-width: 78px;
    padding: 6px 14px;
    text-align: center;
    border-right: 1px solid var(--line);
    border-radius: 10px;
}

.stat-item-compact:last-child { border-right: 0; }

.stat-value-compact {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.15;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
}

.stat-label-compact {
    margin-top: 2px;
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
}

/* 人员统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
    gap: 10px;
    margin-top: 14px;
    overflow: hidden;
    transition: max-height .3s ease;
}

.stats-grid.collapsed { max-height: 0; }

.stat-card {
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 3px solid var(--brand-500);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(23, 31, 54, .04);
}

.stat-card h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.stat-card .value {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-2);
}

.role-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 9px;
}

/* 卡片内的角色小标签（.task 在统计区中的形态） */
.stat-card .task {
    display: inline-block;
    min-height: 0;
    cursor: default;
    padding: 2px 7px;
    margin: 0;
    font-size: 10.5px;
    line-height: 1.5;
    border-radius: 6px;
    box-shadow: none;
}

/* ==========================================================================
   10. 日期 Tab（移动端单日视图切换）
   ========================================================================== */
/* 仅作为吸顶范围的容器（移动端日期 Tab 的 sticky 不会越界到管理面板） */
.schedule-wrap { position: relative; }

.day-tabs { display: none; }

/* ==========================================================================
   11. 排期表格
   ========================================================================== */
.schedule-table-container {
    position: relative;
    margin-top: 16px;
    max-height: min(76vh, 860px);
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    -webkit-overflow-scrolling: touch;
}

.schedule-table {
    width: 100%;
    min-width: 1140px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.schedule-table th,
.schedule-table td {
    padding: 6px 4px;
    text-align: center;
    vertical-align: middle;
    border-right: 1px solid #e7edf6;
    border-bottom: 1px solid #dfe6f0;
}

.schedule-table th:last-child,
.schedule-table td:last-child { border-right: 0; }

.schedule-table tbody tr:last-child th,
.schedule-table tbody tr:last-child td { border-bottom: 0; }

/* 表头（两行都是粘性） */
.schedule-table thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    height: var(--header-row-1);
    font-size: 12.5px;
    font-weight: 700;
    color: #334155;
    background: #f8fafc;
    border-bottom: 1px solid var(--line-strong);
    white-space: nowrap;
}

.schedule-table thead tr:first-child th { z-index: 6; }

/* 首列宽度固定：table-layout:fixed 下防止被 colspan 抢走宽度 */
.schedule-table thead th:first-child {
    width: 88px;
    min-width: 88px;
    max-width: 88px;
}

.schedule-table thead tr:nth-child(2) th {
    top: var(--header-row-1);
    z-index: 5;
    height: var(--header-row-2);
    font-size: 11.5px;
    font-weight: 600;
    /* 与第一行表头（日期/星期）保持同样的文字颜色和背景 */
    color: #334155;
    background: #f8fafc;
}

/* 表头首格（人员）+ 首列粘性 */
.schedule-table thead tr:first-child th:first-child {
    left: 0;
    z-index: 8;
    text-align: left;
    padding-left: 14px;
    background: #f8fafc;
    box-shadow: 1px 0 0 var(--line);
}

.schedule-table thead tr:nth-child(2) th:first-child {
    left: 0;
    z-index: 7;
    background: #f8fafc;
    box-shadow: 1px 0 0 var(--line);
}

.schedule-table tbody th {
    position: sticky;
    left: 0;
    z-index: 2;
    width: 88px;
    min-width: 88px;
    max-width: 88px;
    padding: 10px 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    text-align: left;
    background: var(--surface);
    border-right: 1px solid var(--line);
    box-shadow: 1px 0 0 var(--line);
}

.schedule-table tbody tr:nth-child(even) td { background: #f8fafd; }

.schedule-table tbody tr:nth-child(even) th { background: #fafbfe; }
.schedule-table tbody tr:hover th { background: #fafbff; }
.schedule-table tbody tr:hover td { background: #f1f5ff; }

.schedule-table tbody tr:hover th { background: #f6f9ff; }

.personnel-department {
    margin-top: 2px;
    font-size: 10.5px;
    font-weight: 400;
    color: var(--muted);
}

/* 今天所在列 */
.today-column {
    background: #eef2ff !important;
    font-weight: 700;
}

.schedule-table thead th.today-column {
    color: var(--brand);
    background: #e8edff !important;
}

.schedule-table tbody tr:hover td.today-column { background: #e6ebff !important; }

/* 时段单元格 */
.schedule-table td.task-cell {
    min-width: 60px;
    padding: 5px 4px;
    vertical-align: top;
}

.task {
    position: relative;
    isolation: isolate; /* 让角标的 z-index 只作用于任务块内部，不盖住吸顶表头 */
    display: inline-block;
    max-width: 100%;
    min-height: 34px;
    padding: 4px 6px;
    margin: 2px;
    font-size: 11px;
    line-height: 1.25;
    color: #fff;
    text-align: center;
    white-space: normal;
    word-break: break-word;
    border-radius: 7px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .18);
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}

.task:hover {
    filter: brightness(1.04);
    transform: translateY(-1px);
    box-shadow: 0 5px 12px rgba(15, 23, 42, .22);
}

.task small {
    font-size: 10px;
    font-weight: 500;
    opacity: .92;
    white-space: nowrap;
}

/* 同一格内多个任务：整行铺满，便于点击 */
.task-cell .task {
    display: block;
    width: 100%;
    margin: 0 0 3px;
}

.task-completed {
    color: #64748b !important;
    background-color: #eef1f6 !important;
    text-decoration: line-through;
}

.task-paused,
.task-pending {
    color: #64748b !important;
    background-color: #e9edf4 !important;
}

/* 文档图标 */
.task .document-icon {
    position: absolute;
    right: -3px;
    bottom: -3px;
    font-size: 12px;
    line-height: 1;
    filter: drop-shadow(0 1px 1px rgba(15, 23, 42, .3));
}

/* 单元格内「+」新增按钮 */
.add-task-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 30px;
    padding: 4px 6px;
    font-size: 16px;
    font-weight: 500;
    line-height: 1;
    color: #9aa4b2;
    background: #f8fafc;
    border: 1px dashed #d9e0ea;
    border-radius: 7px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.add-task-btn:hover {
    color: #64748b;
    background: #f1f5f9;
    border-color: #bcc7d6;
}

/* 修改角标 / 项目等级角标 */
.modified-badge,
.project-level-badge {
    position: absolute !important;
    top: -5px !important;
    width: 16px !important;
    height: 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    color: #fff !important;
    border: 2px solid #fff !important;
    border-radius: 50% !important;
    z-index: 10 !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .28);
}

.modified-badge {
    left: -5px !important;
    background-color: #ef4444 !important;
}

.project-level-badge {
    right: -5px !important;
    z-index: 5 !important;
}

.project-leader {
    margin-top: 2px;
    font-size: 9px;
    font-style: normal;
    line-height: 1.3;
    opacity: .88;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* ==========================================================================
   12. 悬浮提示（桌面 hover）
   ========================================================================== */
.tooltip {
    position: relative;
    display: inline-block;
}

/* 提示改为 JS 渲染的 fixed 浮层（.task-tooltip），
   不再使用 ::before 伪元素，避免被表格滚动容器或吸顶表头裁剪。 */
.task-tooltip {
    position: fixed;
    z-index: 950;
    max-width: min(340px, calc(100vw - 24px));
    padding: 10px 13px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.55;
    color: #fff;
    text-align: left;
    white-space: pre-wrap;
    word-break: break-word;
    pointer-events: none;
    background: rgba(17, 24, 39, .96);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 10px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .38);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .12s ease, transform .12s ease;
}

.task-tooltip.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   13. 弹窗 / 移动端底部抽屉
   ========================================================================== */
.modal {
    display: none; /* JS 用 display:flex 打开 */
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 26px;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.modal-content {
    position: relative;
    width: 560px;
    max-width: 94vw;
    max-height: 88vh;
    max-height: 88dvh;
    padding: 0;
    overflow-y: auto;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: modal-pop .22s cubic-bezier(.22, 1, .36, 1) both;
    -webkit-overflow-scrolling: touch;
}

@keyframes modal-pop {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--line);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.close-modal {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 20px;
    line-height: 1;
    color: var(--muted);
    background: var(--surface-2);
    border: 0;
    border-radius: 999px;
    box-shadow: none;
    cursor: pointer;
}

.close-modal:hover {
    color: var(--text);
    background: var(--surface-3);
    box-shadow: none;
}

.modal form {
    display: flex;
    flex-direction: column;
    padding: 16px 20px 20px;
}

.modal form .form-group:last-of-type { margin-bottom: 18px; }

.modal button[type="submit"] {
    position: sticky;
    bottom: 0;
    width: 100%;
    height: 46px;
    margin-top: 6px;
    font-size: 15px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--brand-600), var(--brand));
    box-shadow: 0 -10px 18px rgba(255, 255, 255, .95), 0 6px 16px rgba(67, 56, 202, .26);
}

.modal button[type="submit"]:hover {
    background: linear-gradient(135deg, var(--brand), var(--brand-ink));
}

/* ==========================================================================
   14. 任务详情 / 请假详情
   ========================================================================== */
.task-detail-modal .modal-content { width: 780px; }

#taskDetailContent,
#dayOffDetailContent { padding: 8px 20px 0; }

.task-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 10px;
    padding: 9px 0;
    margin: 0;
    border-bottom: 1px dashed var(--line);
}

.task-detail:last-child { border-bottom: 0; }

.task-detail label {
    flex: 0 0 96px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--muted);
}

.task-detail span {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text);
    word-break: break-word;
}

.task-detail .document-actions { flex: 1 1 100%; }

.task-detail span.project-level-chip {
    flex: 0 0 auto;
    align-self: center;
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
}

.status-change-section {
    margin: 16px 20px;
    padding: 14px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-left: 4px solid var(--success);
    border-radius: 12px;
}

.status-change-section h4 {
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.status-change-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.status-change-controls select { flex: 1; }

.btn-update-status {
    flex: 0 0 auto;
    height: 42px;
    padding: 0 18px;
    font-size: 13px;
    background: linear-gradient(135deg, #22c55e, var(--success));
    box-shadow: 0 1px 2px rgba(22, 163, 74, .25);
}

.btn-update-status:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
    box-shadow: 0 6px 16px rgba(22, 163, 74, .3);
}

.task-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
    padding: 14px 20px calc(16px + var(--safe-bottom));
    background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 34%);
}

.task-actions button {
    height: 40px;
    padding: 0 22px;
    font-size: 13.5px;
    border-radius: 10px;
}

.btn-edit,
.btn-delete {
    color: #fff;
}

.btn-edit {
    background: linear-gradient(135deg, #fbbf24, #d97706);
    box-shadow: 0 1px 2px rgba(217, 119, 6, .25);
}

.btn-edit:hover {
    background: linear-gradient(135deg, #f59e0b, #b45309);
    box-shadow: 0 6px 16px rgba(217, 119, 6, .3);
}

.btn-delete {
    background: linear-gradient(135deg, #f87171, var(--danger));
    box-shadow: 0 1px 2px rgba(220, 38, 38, .25);
}

.btn-delete:hover {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    box-shadow: 0 6px 16px rgba(220, 38, 38, .3);
}

/* ==========================================================================
   15. 文档预览
   ========================================================================== */
.document-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.document-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 15px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s ease, box-shadow .15s ease;
}

.document-action-btn.view {
    color: #fff;
    background: linear-gradient(135deg, var(--brand-500), var(--brand));
    box-shadow: 0 1px 2px rgba(67, 56, 202, .22);
}

.document-action-btn.view:hover {
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-ink));
    text-decoration: none;
}

.document-action-btn.download {
    color: #fff;
    background: linear-gradient(135deg, #34d399, var(--success));
    box-shadow: 0 1px 2px rgba(22, 163, 74, .22);
}

.document-action-btn.download:hover {
    color: #fff;
    background: linear-gradient(135deg, #10b981, #15803d);
    text-decoration: none;
}

.document-viewer {
    margin-top: 12px;
    padding: 8px;
    overflow: auto;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.document-iframe {
    width: 100%;
    min-height: 560px;
    height: 62vh;
    background: #fff;
    border: 0;
    border-radius: 8px;
}

.image-preview {
    display: block;
    max-width: 100%;
    max-height: 62vh;
    margin: 0 auto;
    padding: 5px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.unsupported-document {
    padding: 22px;
    font-size: 13.5px;
    color: var(--text-2);
    text-align: center;
}

.unsupported-document p { margin-bottom: 6px; }

.unsupported-document .btn-edit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 18px;
    margin-top: 10px;
    color: #fff;
    text-decoration: none;
    border-radius: 10px;
}

.document-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-size: 12.5px;
    color: var(--brand);
    background: var(--brand-soft);
    border: 1px solid #c7d2fe;
    border-radius: 8px;
}

.document-link:hover {
    color: var(--brand-ink);
    background: #e0e7ff;
    text-decoration: none;
}

/* ==========================================================================
   16. 管理员面板
   ========================================================================== */
.admin-section {
    margin-top: 18px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.admin-section > h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 14px;
    margin-bottom: 16px;
    font-size: 16px;
    border-bottom: 1px solid var(--line);
}

.admin-section > h3::before {
    content: "⚙️";
    font-size: 16px;
}

/* 管理后台页头：标题 + 返回排期 */
.admin-panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.admin-panel-head h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.admin-panel-head h3::before {
    content: "⚙️";
    font-size: 16px;
}

.admin-panel-desc {
    margin: 0 0 16px;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--muted);
}

.admin-back-link {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 12px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-2);
    text-decoration: none;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 9px;
    transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.admin-back-link:hover {
    color: var(--brand);
    background: var(--brand-soft);
    border-color: #c7d2fe;
    text-decoration: none;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.admin-grid > div {
    padding: 14px;
    background: #fbfcfe;
    border: 1px solid var(--line);
    border-radius: 14px;
}

.admin-section h4 {
    margin-bottom: 10px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text);
}

.admin-subcard {
    padding: 14px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.admin-subhead {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.admin-hint {
    font-size: 12.5px;
    color: var(--muted);
}

/* 管理面板内的辅助布局 */
.admin-subfoot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.sync-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.sync-form .btn-small { height: 34px; }

.admin-grid .logout-btn {
    height: 34px;
    margin-bottom: 10px;
    font-size: 12.5px;
}

.admin-full { grid-column: 1 / -1; }

.admin-grid .form-group form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.admin-grid .form-group form input {
    flex: 1 1 140px;
    min-width: 0;
    margin: 0;
}

.admin-grid .form-group form input[type="color"] { flex: 0 0 64px; }

.admin-grid .form-group form button {
    flex: 0 0 auto;
    height: 42px;
}

.admin-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    margin-bottom: 8px;
    font-size: 13px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.admin-item:last-child { margin-bottom: 0; }

.admin-item > span { min-width: 0; line-height: 1.7; }

.admin-item small {
    display: inline-block;
    padding: 1px 7px;
    margin-left: 4px;
    font-size: 11px;
    font-weight: 500;
    background: var(--surface-3);
    border-radius: 999px;
}

.admin-item span small[style*="color: #40c057"] {
    background-color: var(--success-soft);
    color: var(--success) !important;
}

.admin-item span small[style*="color: #ff6b6b"] {
    background-color: var(--danger-soft);
    color: var(--danger) !important;
}

.admin-actions-small {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.btn-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    padding: 0 11px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    background: var(--surface-3);
    border-radius: 8px;
    box-shadow: none;
    cursor: pointer;
    text-decoration: none;
}

.btn-small:hover {
    color: var(--text);
    background: #e6ebf3;
    box-shadow: none;
    text-decoration: none;
}

.btn-edit.btn-small {
    color: #92400e;
    background: var(--warning-soft);
}

.btn-edit.btn-small:hover { background: #fef3c7; }

.btn-delete.btn-small {
    color: #b91c1c;
    background: var(--danger-soft);
}

.btn-delete.btn-small:hover { background: #fee2e2; }

.btn-hide {
    color: #b91c1c;
    background: var(--danger-soft);
}

.btn-hide:hover { background: #fee2e2; }

.btn-show {
    color: #15803d;
    background: var(--success-soft);
}

.btn-show:hover { background: #dcfce7; }

.sort-btn {
    color: var(--brand);
    background: var(--brand-soft);
}

.sort-btn:hover { background: #e0e7ff; }

.sort-controls {
    display: flex;
    gap: 5px;
    margin-left: 0;
}

.sortable-item {
    cursor: move;
    transition: background-color .15s ease, box-shadow .15s ease;
}

.sortable-item:hover { background: #fafbff; }

.sortable-item.dragging {
    opacity: .55;
    background: var(--brand-soft);
    box-shadow: var(--shadow-md);
}

/* 项目等级小徽章（内联背景色由 PHP 输出） */
.project-level-chip {
    display: inline-block;
    margin-left: 4px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.5;
    color: #fff;
    border-radius: 999px;
}

/* 项目列表滚动容器 */
.scrollable-projects {
    max-height: 320px;
    padding: 10px;
    margin-top: 10px;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
}

.project-item {
    padding: 9px 12px;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    transition: background .15s ease, border-color .15s ease;
}

.project-item:hover {
    background: #fafbff;
    border-color: var(--line-strong);
}

.project-item:last-child { margin-bottom: 0; }

.scrollable-projects::-webkit-scrollbar { width: 6px; }

.scrollable-projects::-webkit-scrollbar-thumb {
    background: #cfd7e5;
    border: 0;
    border-radius: 999px;
}

/* 管理面板里的颜色预览 */
.color-preview {
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-right: 6px;
    vertical-align: -3px;
    border-radius: 5px;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .12);
}

.config-info {
    padding: 15px;
    margin-top: 20px;
    font-size: 13.5px;
    text-align: left;
    background: var(--surface-2);
    border-radius: 12px;
}

.config-info h4 { margin-bottom: 10px; }

/* ==========================================================================
   17. 项目搜索下拉
   ========================================================================== */
.search-select-container {
    position: relative;
    width: 100%;
}

.search-input { width: 100%; }

.search-results {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    left: 0;
    z-index: 130;
    display: none;
    max-height: 232px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    box-shadow: 0 16px 36px rgba(15, 23, 42, .16);
}

.search-result-item {
    padding: 10px 13px;
    font-size: 13px;
    color: var(--text-2);
    cursor: pointer;
    border-bottom: 1px solid var(--surface-3);
}

.search-result-item:last-child { border-bottom: 0; }

.search-result-item:hover {
    color: var(--brand-ink);
    background: var(--brand-soft);
}

.selected-project {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--brand-ink) !important;
    background: var(--brand-soft);
    border: 1px solid #dbe3ff;
    border-radius: 10px;
}

.remove-project {
    margin-left: auto;
    padding: 0 6px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    color: #ef4444;
    cursor: pointer;
}

.remove-project:hover { color: #b91c1c; }

/* ==========================================================================
   18. 提示条
   ========================================================================== */
.alert {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px;
    align-items: baseline;
    padding: 11px 14px;
    margin-bottom: 14px;
    font-size: 13px;
    line-height: 1.6;
    border: 1px solid transparent;
    border-radius: 10px;
}

.alert-success {
    color: #166534;
    background: var(--success-soft);
    border-color: var(--success-line);
}

.alert-error {
    color: #991b1b;
    background: var(--danger-soft);
    border-color: var(--danger-line);
}

.alert strong { font-weight: 700; }

/* ==========================================================================
   19. 浮动新增按钮（仅移动端）
   ========================================================================== */
.fab { display: none; }

/* ==========================================================================
   20. 响应式：≤1200px（小笔记本 / 横屏平板）
   ========================================================================== */
@media (max-width: 1200px) {
    .top-controls { grid-template-columns: minmax(0, 1fr); }
    .week-navigation { grid-column: 1; grid-row: 1; }
    .filter-section-compact { grid-column: 1; grid-row: 2; }
    .action-buttons {
        grid-column: 1;
        grid-row: 3;
        justify-content: flex-start;
    }

    .stats-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .admin-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   21. 响应式：≤992px（平板竖屏）
   ========================================================================== */
@media (max-width: 992px) {
    .container { padding: 16px 16px 48px; }

    .header-content { gap: 16px; padding: 20px; }
    .brand h1 { font-size: 21px; }

    .stats-header { grid-template-columns: 1fr; gap: 14px; }
    .top-stats-bar-compact { align-self: stretch; }

    .action-buttons button,
    .action-buttons .btn-med { height: 34px; }

    .schedule-table-container { max-height: min(70vh, 720px); }
}

/* ==========================================================================
   22. 响应式：≤768px（手机 — 核心适配层）
   ========================================================================== */
@media (max-width: 768px) {
    /* ---- 页面骨架 ---- */
    .container { padding: 12px 12px calc(96px + var(--safe-bottom)); }

    /* ---- 顶部品牌区 ---- */
    header { border-radius: 16px; }

    .header-content {
        flex-wrap: wrap;
        gap: 12px;
        padding: 16px;
    }

    .brand { flex: 1 1 100%; }

    .brand h1 {
        gap: 10px;
        font-size: 18px;
        line-height: 1.3;
    }

    .brand h1::before {
        width: 34px;
        height: 34px;
        font-size: 17px;
        border-radius: 10px;
    }

    .header-subtitle {
        margin-top: 6px;
        padding-left: 0;
        font-size: 11.5px;
        line-height: 1.55;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .user-area {
        width: 100%;
        justify-content: flex-end;
        gap: 9px;
        padding-top: 11px;
        border-top: 1px solid rgba(255, 255, 255, .16);
    }

    .user-welcome {
        flex: 1 1 auto;
        font-size: 12px;
        gap: 6px;
    }

    .admin-badge { padding: 1px 7px; font-size: 10px; }

    .user-avatar { width: 30px; height: 30px; }

    header .logout-btn { height: 32px; padding: 0 13px; }

    /* ---- 顶部控制栏 ---- */
    .top-controls {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-top: 12px;
        padding: 12px;
        border-radius: 16px;
    }

    .week-navigation {
        grid-column: 1;
        grid-row: 1;
        width: 100%;
        gap: 6px;
    }

    .week-navigation a {
        flex: 1 1 0;
        min-width: 0;
    }

    .week-navigation button {
        width: 100%;
        height: 36px;
        padding: 0 8px;
        font-size: 13px;
    }

    .week-display {
        flex: 1 1 100%;
        margin: 2px 0 0;
        padding: 4px 0 0;
        font-size: 12px;
        text-align: center;
        background: transparent;
    }

    /* 手机上 4 个筛选项 2×2 排布，全部可见、无需横向滑动 */
    .filter-section-compact {
        grid-column: 1;
        grid-row: 2;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        padding: 8px 0 0;
        overflow: visible;
    }

    .filter-group-compact {
        min-width: 0;
        height: 36px;
        padding: 0 5px 0 9px;
    }

    .filter-group-compact label {
        flex: 0 0 auto;
        font-size: 11.5px;
    }

    .filter-group-compact select {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        height: 34px;
        min-height: 34px;
        /* 16px 避免 iOS 聚焦时自动放大页面 */
        font-size: 16px;
    }

    .action-buttons {
        grid-column: 1;
        grid-row: 3;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 7px;
        width: 100%;
    }

    .action-buttons button,
    .action-buttons .btn-med {
        width: 100%;
        height: 36px;
        padding: 0 4px;
        font-size: 12.5px;
        border-radius: 9px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* ---- 统计区 ---- */
    .stats-section {
        margin-top: 12px;
        padding: 13px;
        border-radius: 16px;
    }

    .stats-header { grid-template-columns: 1fr; gap: 10px; }

    .stats-title { font-size: 13.5px; }

    .role-colors { gap: 6px; }

    .role-color-item { padding: 2px 8px 2px 6px; }
    .role-color-text { font-size: 11px; }

    .top-stats-bar-compact {
        display: flex;
        gap: 0;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .top-stats-bar-compact::-webkit-scrollbar { display: none; }

    .stat-item-compact {
        flex: 1 0 auto;
        min-width: 70px;
        padding: 5px 10px;
    }

    .stat-value-compact { font-size: 18px; }
    .stat-label-compact { font-size: 10.5px; }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-top: 12px;
    }

    .stat-card { padding: 10px 11px; }

    .stat-card h3 { font-size: 12.5px; }

    .stat-card .value {
        font-size: 11px;
        line-height: 1.6;
    }

    .role-breakdown { margin-top: 7px; }

    .stat-card .task {
        font-size: 10px;
        padding: 1px 6px;
    }

    /* ---- 日期 Tab ---- */
    .day-tabs {
        position: sticky;
        top: 0;
        z-index: 40;
        display: flex;
        gap: 8px;
        margin: 12px -12px 0;
        padding: 9px 12px;
        overflow-x: auto;
        scrollbar-width: none;
        background: linear-gradient(180deg, var(--bg) 72%, rgba(244, 246, 251, .86) 100%);
        -webkit-overflow-scrolling: touch;
    }

    .day-tabs::-webkit-scrollbar { display: none; }

    .day-tab {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        height: 36px;
        padding: 0 14px;
        font-size: 12.5px;
        font-weight: 600;
        color: var(--text-2);
        background: #fff;
        border: 1px solid var(--line-strong);
        border-radius: 999px;
        box-shadow: var(--shadow-sm);
    }

    .day-tab:hover {
        color: var(--brand);
        background: var(--brand-soft);
        border-color: #c7d2fe;
        box-shadow: none;
    }

    .day-tab.has-today::after {
        content: "";
        width: 6px;
        height: 6px;
        margin-left: 6px;
        background: #f59e0b;
        border-radius: 50%;
    }

    .day-tab.day-tab-all { color: var(--text-2); }

    .day-tab.is-active,
    .day-tab.is-active:hover {
        color: #fff;
        background: linear-gradient(135deg, var(--brand-600), var(--brand));
        border-color: transparent;
        box-shadow: 0 6px 16px rgba(67, 56, 202, .32);
    }

    .day-tab.is-active.has-today::after { background: #fde68a; }

    /* ---- 排期表：单日视图（页面滚动 + 表头吸顶；全周模式回到容器内横滑） ---- */
    .schedule-table-container {
        margin-top: 10px;
        max-height: none;
        overflow: visible;
        background: transparent;
        border: 0;
        border-radius: 16px;
        box-shadow: none;
    }

    /* 「全周」时恢复横向滚动容器 */
    .schedule-table-container.is-week-view {
        overflow-x: auto;
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: 16px;
        box-shadow: var(--shadow-sm);
    }

    .schedule-table {
        width: 100%;
        min-width: 0;
        table-layout: auto;
        background: var(--surface);
        border-radius: 16px;
        box-shadow: 0 0 0 1px var(--line), var(--shadow-sm);
    }

    .schedule-table-container.is-week-view .schedule-table {
        border-radius: 0;
        box-shadow: none;
    }

    /* 非「全周」模式：先全部隐藏，再按 data-day 显示当天 3 个时段列 */
    .schedule-table:not([data-day="all"]) th:nth-child(n + 2),
    .schedule-table:not([data-day="all"]) td:nth-child(n + 2) {
        display: none;
    }

    /* data-day="0" → 第 2~4 列 */
    .schedule-table[data-day="0"] thead tr:first-child th:nth-child(2),
    .schedule-table[data-day="0"] thead tr:nth-child(2) th:nth-child(2),
    .schedule-table[data-day="0"] thead tr:nth-child(2) th:nth-child(3),
    .schedule-table[data-day="0"] thead tr:nth-child(2) th:nth-child(4),
    .schedule-table[data-day="0"] tbody tr td:nth-child(2),
    .schedule-table[data-day="0"] tbody tr td:nth-child(3),
    .schedule-table[data-day="0"] tbody tr td:nth-child(4) {
        display: table-cell;
    }

    /* data-day="1" → 第 5~7 列 */
    .schedule-table[data-day="1"] thead tr:first-child th:nth-child(3),
    .schedule-table[data-day="1"] thead tr:nth-child(2) th:nth-child(5),
    .schedule-table[data-day="1"] thead tr:nth-child(2) th:nth-child(6),
    .schedule-table[data-day="1"] thead tr:nth-child(2) th:nth-child(7),
    .schedule-table[data-day="1"] tbody tr td:nth-child(5),
    .schedule-table[data-day="1"] tbody tr td:nth-child(6),
    .schedule-table[data-day="1"] tbody tr td:nth-child(7) {
        display: table-cell;
    }

    /* data-day="2" → 第 8~10 列 */
    .schedule-table[data-day="2"] thead tr:first-child th:nth-child(4),
    .schedule-table[data-day="2"] thead tr:nth-child(2) th:nth-child(8),
    .schedule-table[data-day="2"] thead tr:nth-child(2) th:nth-child(9),
    .schedule-table[data-day="2"] thead tr:nth-child(2) th:nth-child(10),
    .schedule-table[data-day="2"] tbody tr td:nth-child(8),
    .schedule-table[data-day="2"] tbody tr td:nth-child(9),
    .schedule-table[data-day="2"] tbody tr td:nth-child(10) {
        display: table-cell;
    }

    /* data-day="3" → 第 11~13 列 */
    .schedule-table[data-day="3"] thead tr:first-child th:nth-child(5),
    .schedule-table[data-day="3"] thead tr:nth-child(2) th:nth-child(11),
    .schedule-table[data-day="3"] thead tr:nth-child(2) th:nth-child(12),
    .schedule-table[data-day="3"] thead tr:nth-child(2) th:nth-child(13),
    .schedule-table[data-day="3"] tbody tr td:nth-child(11),
    .schedule-table[data-day="3"] tbody tr td:nth-child(12),
    .schedule-table[data-day="3"] tbody tr td:nth-child(13) {
        display: table-cell;
    }

    /* data-day="4" → 第 14~16 列 */
    .schedule-table[data-day="4"] thead tr:first-child th:nth-child(6),
    .schedule-table[data-day="4"] thead tr:nth-child(2) th:nth-child(14),
    .schedule-table[data-day="4"] thead tr:nth-child(2) th:nth-child(15),
    .schedule-table[data-day="4"] thead tr:nth-child(2) th:nth-child(16),
    .schedule-table[data-day="4"] tbody tr td:nth-child(14),
    .schedule-table[data-day="4"] tbody tr td:nth-child(15),
    .schedule-table[data-day="4"] tbody tr td:nth-child(16) {
        display: table-cell;
    }

    /* data-day="5" → 第 17~19 列 */
    .schedule-table[data-day="5"] thead tr:first-child th:nth-child(7),
    .schedule-table[data-day="5"] thead tr:nth-child(2) th:nth-child(17),
    .schedule-table[data-day="5"] thead tr:nth-child(2) th:nth-child(18),
    .schedule-table[data-day="5"] thead tr:nth-child(2) th:nth-child(19),
    .schedule-table[data-day="5"] tbody tr td:nth-child(17),
    .schedule-table[data-day="5"] tbody tr td:nth-child(18),
    .schedule-table[data-day="5"] tbody tr td:nth-child(19) {
        display: table-cell;
    }

    /* data-day="6" → 第 20~22 列 */
    .schedule-table[data-day="6"] thead tr:first-child th:nth-child(8),
    .schedule-table[data-day="6"] thead tr:nth-child(2) th:nth-child(20),
    .schedule-table[data-day="6"] thead tr:nth-child(2) th:nth-child(21),
    .schedule-table[data-day="6"] thead tr:nth-child(2) th:nth-child(22),
    .schedule-table[data-day="6"] tbody tr td:nth-child(20),
    .schedule-table[data-day="6"] tbody tr td:nth-child(21),
    .schedule-table[data-day="6"] tbody tr td:nth-child(22) {
        display: table-cell;
    }

    /* 「全周」模式：横向滚动整周；列宽保证「08-12」不折行 */
    .schedule-table[data-day="all"] { min-width: 1320px; }

    /* 表头吸顶：页面滚动时固定在日期 Tab 下方，看后面人员也知道上午/下午/晚上 */
    .schedule-table thead th {
        position: sticky;
        top: 54px;
        z-index: 6;
        height: 34px;
        font-size: 11.5px;
        white-space: nowrap;
        background: #f8fafc;
    }

    .schedule-table thead tr:nth-child(2) th {
        top: 88px;
        z-index: 5;
        background: #f8fafc;
    }

    .schedule-table thead tr:first-child th:first-child {
        left: 0;
        z-index: 8;
        padding-left: 10px;
        background: #f8fafc;
    }

    .schedule-table thead tr:nth-child(2) th:first-child {
        left: 0;
        z-index: 7;
        background: #f8fafc;
    }

    /* 「全周」模式：表格容器恢复横向滚动后，表头不能再做纵向吸顶，
       否则 sticky 的 top 偏移会把表头向下顶、遮住第一行数据；
       这里只保留首列的横向吸顶，纵向跟随页面滚动。 */
    .schedule-table-container.is-week-view .schedule-table thead th {
        position: static;
        top: auto;
    }

    .schedule-table-container.is-week-view .schedule-table thead tr:first-child th:first-child,
    .schedule-table-container.is-week-view .schedule-table thead tr:nth-child(2) th:first-child {
        position: sticky;
        left: 0;
        top: auto;
        z-index: 8;
    }

    .schedule-table thead th:first-child,
    .schedule-table tbody th {
        width: 76px;
        min-width: 76px;
        max-width: 76px;
    }

    .schedule-table tbody th {
        padding: 8px 9px;
        font-size: 12.5px;
        border-right: 1px solid var(--line);
    }

    .personnel-department { font-size: 10px; }

    .schedule-table th,
    .schedule-table td { padding: 5px 3px; }

    .schedule-table td.task-cell {
        min-width: 0;
        padding: 4px 3px;
    }

    .task-cell .task {
        min-height: 38px;
        max-width: 168px;
        padding: 5px 4px;
        margin: 0 auto 4px;
        font-size: 11px;
        line-height: 1.25;
        border-radius: 8px;
    }

    .add-task-btn {
        max-width: 168px;
        margin-left: auto;
        margin-right: auto;
    }

    .task small { font-size: 9.5px; }

    .add-task-btn {
        min-height: 34px;
        font-size: 17px;
    }

    .modified-badge,
    .project-level-badge {
        width: 15px !important;
        height: 15px !important;
        top: -4px !important;
        font-size: 9px !important;
    }

    .modified-badge { left: -4px !important; }
    .project-level-badge { right: -4px !important; }

    .project-leader { font-size: 8.5px; }

    /* 手机上不渲染 hover 提示（点击任务会打开详情弹窗） */

    /* ---- 弹窗 → 底部抽屉 ---- */
    .modal {
        align-items: flex-end;
        padding: 0;
    }

    .modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        max-height: 92dvh;
        border-radius: 20px 20px 0 0;
        animation: sheet-up .26s cubic-bezier(.22, 1, .36, 1) both;
    }

    .modal-content::before {
        content: "";
        display: block;
        width: 40px;
        height: 4px;
        margin: 8px auto 0;
        background: #dfe5ef;
        border-radius: 999px;
    }

    @keyframes sheet-up {
        from { opacity: .6; transform: translateY(100%); }
        to { opacity: 1; transform: translateY(0); }
    }

    .modal-header {
        padding: 12px 16px;
        background: #fff;
    }

    .modal-header h3 { font-size: 15.5px; }

    .close-modal {
        width: 34px;
        height: 34px;
        font-size: 22px;
    }

    .modal form { padding: 14px 16px calc(16px + var(--safe-bottom)); }

    /* 防止 iOS 聚焦时自动放大 */
    input[type="text"],
    input[type="search"],
    input[type="date"],
    input[type="time"],
    input[type="number"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    select,
    textarea {
        font-size: 16px;
        min-height: 46px;
    }

    .form-group { margin-bottom: 13px; }

    .form-group label { font-size: 12.5px; margin-bottom: 5px; }

    .modal button[type="submit"] {
        height: 48px;
        font-size: 15.5px;
    }

    /* 任务详情 */
    .task-detail-modal .modal-content { width: 100%; }

    #taskDetailContent,
    #dayOffDetailContent { padding: 4px 16px 0; }

    .task-detail { padding: 8px 0; gap: 2px 8px; }

    .task-detail label {
        flex: 0 0 82px;
        font-size: 12px;
    }

    .task-detail span { font-size: 13px; }

    .task-detail .document-actions {
        margin-top: 6px;
        gap: 6px;
    }

    .document-action-btn {
        flex: 1 1 auto;
        justify-content: center;
        padding: 10px 8px;
        font-size: 12.5px;
    }

    .status-change-section {
        margin: 12px 16px;
        padding: 12px;
    }

    .status-change-controls { gap: 8px; }

    .status-change-controls select { min-height: 44px; }

    .btn-update-status { height: 44px; padding: 0 14px; }

    .task-actions {
        margin-top: 6px;
        padding: 12px 16px calc(14px + var(--safe-bottom));
    }

    .task-actions button {
        flex: 1;
        height: 44px;
        padding: 0 12px;
    }

    .document-iframe { height: 58vh; min-height: 320px; }

    /* ---- 管理面板 ---- */
    .admin-section {
        margin-top: 12px;
        padding: 14px;
        border-radius: 16px;
    }

    .admin-section > h3 { font-size: 15px; padding-bottom: 12px; margin-bottom: 12px; }

    .admin-grid { grid-template-columns: 1fr; gap: 10px; }

    .admin-grid > div { padding: 12px; border-radius: 12px; }

    .admin-item {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 9px 11px;
    }

    .admin-item > span { line-height: 1.8; }

    .admin-actions-small { justify-content: flex-end; gap: 6px; }

    .btn-small {
        height: 34px;
        padding: 0 12px;
        font-size: 12.5px;
    }

    .admin-subcard { padding: 12px; }

    .admin-subhead { justify-content: flex-start; }

    .scrollable-projects { max-height: 260px; }

    .login-form { padding: 30px 22px 24px; border-radius: 20px; }

    .admin-nav-btn {
        height: 32px;
        padding: 0 12px;
        font-size: 12px;
        gap: 4px;
    }

    .admin-panel-head { padding-bottom: 10px; margin-bottom: 8px; }
    .admin-panel-head h3 { font-size: 15px; }
    .admin-panel-desc { font-size: 12px; margin-bottom: 12px; }
    .admin-back-link { height: 30px; font-size: 12px; }

    /* 弹窗内搜索下拉限制高度，避免被键盘遮挡 */
    .search-results { max-height: 180px; }

    /* ---- 悬浮新增按钮 ---- */
    .fab {
        position: fixed;
        right: 16px;
        bottom: calc(18px + var(--safe-bottom));
        z-index: 900;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 54px;
        height: 54px;
        padding: 0;
        font-size: 26px;
        font-weight: 400;
        line-height: 1;
        color: #fff;
        background: linear-gradient(135deg, var(--brand-600), #7c3aed);
        border: 0;
        border-radius: 50%;
        box-shadow: 0 12px 26px rgba(79, 70, 229, .46);
    }

    .fab:hover { box-shadow: 0 14px 30px rgba(79, 70, 229, .55); }
}

/* ==========================================================================
   23. 响应式：≤480px（小屏手机，进一步压缩）
   ========================================================================== */
@media (max-width: 480px) {
    .container { padding: 10px 10px calc(94px + var(--safe-bottom)); }

    /* 小屏 header 空间紧张：有「管理后台」按钮时不再重复展示管理员徽章 */
    .admin-badge { display: none; }

    .brand h1 { font-size: 17px; }

    .header-content { padding: 14px; }

    .top-controls { padding: 10px; }

    .stats-section { padding: 11px; }

    .stat-item-compact {
        min-width: 64px;
        padding: 5px 8px;
    }

    .stat-value-compact { font-size: 17px; }

    .day-tabs { margin: 10px -10px 0; padding: 8px 10px; }

    .schedule-table thead th { top: 52px; }
    .schedule-table thead tr:nth-child(2) th { top: 86px; }

    .schedule-table thead th:first-child,
    .schedule-table tbody th {
        width: 72px;
        min-width: 72px;
        max-width: 72px;
    }

    .schedule-table tbody th {
        padding: 7px 7px;
        font-size: 12px;
    }

    .task-cell .task { font-size: 10.5px; }

    .action-buttons { gap: 6px; }

    .action-buttons button,
    .action-buttons .btn-med { height: 34px; font-size: 12px; }

    .admin-section { padding: 12px; }

    .modal-content { max-height: 94vh; }
}

/* ==========================================================================
   24. 无障碍 / 动效偏好
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}