/* ============================================================
   研发工时统计 · 设计系统
   视觉方向：macOS / iOS 系统级质感（Apple）
   —— 结构化信息 + 克制的材质：分级灰、发丝分隔线、半透明侧栏
   —— 单一强调色（品牌蓝 #0071e3），只用于关键动作与选中态
   —— 左右结构：左侧固定导航栏 + 右侧内容区（含毛玻璃顶栏）
   —— 浅色为默认，[data-theme="dark"] 切换深色，图表由 app.js 跟随重绘
   ============================================================ */

/* ---------- 1. 设计令牌 ---------- */
:root {
    color-scheme: light;

    /* 字体：Apple 平台字体栈（SF Pro / 苹方）。
       这是对「苹果风格」的刻意选择 —— 系统字体正是该视觉语言的一部分，
       换用展示字体会立刻失去 macOS 的系统感。 */
    --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
               "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    --font-num: "SF Mono", ui-monospace, "SF Mono Regular", Menlo, Consolas, monospace;

    /* 表面与文字 */
    --bg:              #f5f5f7;
    --bg-grad:
        radial-gradient(1100px 560px at 88% -12%, rgba(0, 113, 227, .09), transparent 62%),
        radial-gradient(760px 480px at -8% 104%, rgba(0, 113, 227, .05), transparent 60%);
    --surface:         #ffffff;
    --surface-2:       #fbfbfd;
    --surface-sunken:  #f2f2f5;
    --sidebar-bg:      rgba(255, 255, 255, .74);
    --topbar-bg:       rgba(250, 250, 252, .72);

    --text:            #1d1d1f;
    --text-2:          #6e6e73;
    --text-3:          #75757c;

    --separator:       rgba(0, 0, 0, .082);
    --separator-2:     rgba(0, 0, 0, .13);
    --fill:            rgba(120, 120, 128, .14);
    --fill-2:          rgba(120, 120, 128, .072);

    /* 强调色：Apple 系统蓝，与 Omat 品牌蓝同族 */
    --accent:          #0071e3;
    --accent-hover:    #0077ed;
    --accent-soft:     rgba(0, 113, 227, .10);
    --accent-ring:     rgba(0, 113, 227, .26);

    --danger:          #d70015;
    --danger-soft:     rgba(215, 0, 21, .085);
    --success:         #248a3d;
    --success-soft:    rgba(36, 138, 61, .10);
    --warn:            #b25000;
    --warn-soft:       rgba(255, 149, 0, .13);

    /* 圆角 / 阴影 / 动效 */
    --radius-xs: 6px;
    --radius-sm: 9px;
    --radius:    12px;
    --radius-lg: 16px;
    --radius-xl: 22px;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, .045), 0 1px 1px rgba(0, 0, 0, .022);
    --shadow-2: 0 6px 22px rgba(0, 0, 0, .062), 0 1px 3px rgba(0, 0, 0, .04);
    --shadow-3: 0 22px 60px rgba(0, 0, 0, .14), 0 4px 12px rgba(0, 0, 0, .05);

    --ease: cubic-bezier(.16, 1, .3, 1);
    --dur: .34s;

    --sidebar-w: 264px;
    --rail-w: 78px;
    --content-max: 1640px;
}

[data-theme="dark"] {
    color-scheme: dark;

    --bg:              #0a0a0b;
    --bg-grad:
        radial-gradient(1100px 560px at 88% -12%, rgba(10, 132, 255, .13), transparent 62%),
        radial-gradient(760px 480px at -8% 104%, rgba(10, 132, 255, .07), transparent 60%);
    --surface:         #17171a;
    --surface-2:       #1c1c1f;
    --surface-sunken:  #121214;
    --sidebar-bg:      rgba(24, 24, 27, .72);
    --topbar-bg:       rgba(16, 16, 18, .70);

    --text:            #f5f5f7;
    --text-2:          #a1a1a6;
    --text-3:          #9a9aa0;

    --separator:       rgba(255, 255, 255, .10);
    --separator-2:     rgba(255, 255, 255, .16);
    --fill:            rgba(120, 120, 128, .26);
    --fill-2:          rgba(120, 120, 128, .13);

    --accent:          #0a84ff;
    --accent-hover:    #369eff;
    --accent-soft:     rgba(10, 132, 255, .16);
    --accent-ring:     rgba(10, 132, 255, .34);

    --danger:          #ff6961;
    --danger-soft:     rgba(255, 105, 97, .13);
    --success:         #32d74b;
    --success-soft:    rgba(50, 215, 75, .13);
    --warn:            #ffb340;
    --warn-soft:       rgba(255, 179, 64, .13);

    --shadow-1: 0 1px 2px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 255, 255, .035) inset;
    --shadow-2: 0 8px 26px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 255, 255, .04) inset;
    --shadow-3: 0 24px 64px rgba(0, 0, 0, .66);
}

/* ---------- 2. 基础 ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--text);
    background-color: var(--bg);
    background-image: var(--bg-grad);
    background-attachment: fixed;
    background-repeat: no-repeat;
    min-height: 100vh;
    letter-spacing: 0;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3 { letter-spacing: -.012em; font-weight: 600; }

/* 数字统一等宽对齐 */
.num, .mono, .stat-value, .tbl-month td, .bar-cell em { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-num); font-size: 12.5px; }
.muted { color: var(--text-2); }
.gold { color: var(--text); font-weight: 600; }
.num  { text-align: right; }

/* 焦点：键盘可见，鼠标不打扰 */
:focus { outline: none; }
:focus-visible {
    outline: 2.5px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

::selection { background: var(--accent-soft); color: var(--text); }

/* 细腻滚动条，贴近 macOS overlay scrollbar */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--fill);
    border: 3.5px solid transparent;
    background-clip: content-box;
    border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* 主题相关的图片可见性 */
[data-theme="light"] .only-dark { display: none !important; }
[data-theme="dark"]  .only-light { display: none !important; }

/* ---------- 3. 应用骨架（左右结构） ---------- */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
}

.main { display: flex; flex-direction: column; min-width: 0; }

/* 左侧导航栏：固定在视口，材质为半透明磨砂 */
.sidebar {
    position: sticky;
    top: 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 16px 12px 12px;
    background: var(--sidebar-bg);
    -webkit-backdrop-filter: blur(26px) saturate(180%);
    backdrop-filter: blur(26px) saturate(180%);
    border-right: 1px solid var(--separator);
}

/* 右侧顶栏：与侧栏同材质的毛玻璃，滚动时常驻 */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 66px;
    padding: 11px 30px;
    background: var(--topbar-bg);
    -webkit-backdrop-filter: blur(26px) saturate(180%);
    backdrop-filter: blur(26px) saturate(180%);
    border-bottom: 1px solid var(--separator);
}

.topbar-title { min-width: 0; flex: 1; }
.topbar-title h1 { font-size: 19px; line-height: 1.3; letter-spacing: -.02em; }
.topbar-title p {
    margin-top: 2px;
    font-size: 12.5px;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.content {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 24px 30px 64px;
}

/* ---------- 4. 侧栏内容 ---------- */
.brand {
    display: flex;
    align-items: center;
    padding: 0 8px;
    height: 34px;
}
.brand-logo { display: block; height: 21px; width: auto; }
.brand-mark { display: none; height: 26px; width: auto; }
.brand-sub {
    padding: 7px 10px 0;
    font-size: 11.5px;
    color: var(--text-2);
    letter-spacing: .02em;
}

.side-nav { margin-top: 10px; flex: 1; overflow-y: auto; overflow-x: hidden; }
.side-nav::-webkit-scrollbar { width: 0; }

.side-label {
    padding: 16px 10px 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .045em;
    text-transform: uppercase;
    color: var(--text-2);
}

.side-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 36px;
    margin-bottom: 2px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text);
    transition: background .16s ease, color .16s ease;
}
.side-link svg { flex-shrink: 0; width: 17px; height: 17px; opacity: .82; }
.side-link:hover { background: var(--fill-2); }
.side-link:hover svg { opacity: 1; }
.side-link.on {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}
.side-link.on svg { opacity: 1; }
.side-link .side-badge {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}

/* 侧栏底部：账户与外观控制 */
.side-foot {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--separator);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 8px;
    border-radius: var(--radius-sm);
}
.avatar {
    flex-shrink: 0;
    width: 28px; height: 28px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 12.5px; font-weight: 600;
    color: #fff;
    background: linear-gradient(150deg, #4ba3ff, var(--accent));
    box-shadow: 0 1px 3px rgba(0, 0, 0, .16);
}
.user-meta { min-width: 0; line-height: 1.35; }
.user-meta b { display: block; font-size: 13px; font-weight: 600; }
.user-meta span {
    display: block;
    font-size: 11.5px;
    color: var(--text-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-meta .bound { color: var(--success); }

.side-tools { display: flex; gap: 4px; padding: 0 4px; }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 34px; height: 34px;
    flex-shrink: 0;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    transition: background .16s ease, color .16s ease;
}
.icon-btn:hover { background: var(--fill-2); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }
.side-tools .icon-btn { flex: 1; width: auto; }
.side-tools .icon-btn:hover { background: var(--fill); }

/* 移动端汉堡按钮与遮罩（桌面不出现） */
.nav-toggle { display: none; }
.scrim {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 0, 0, .34);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

/* ---------- 5. 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 15px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: background .16s ease, border-color .16s ease, color .16s ease,
                transform .16s var(--ease), box-shadow .16s ease, opacity .16s;
}
.btn:active { transform: scale(.975); }
.btn svg { width: 15px; height: 15px; }

/* 主按钮：唯一实心强调色，只给页面最关键动作 */
.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .5; cursor: default; transform: none; }

/* 次按钮：发丝描边 + 白底，工具栏默认形态 */
.btn-ghost {
    background: var(--surface);
    border-color: var(--separator-2);
    color: var(--text);
    box-shadow: var(--shadow-1);
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn-ghost.disabled, .btn.disabled {
    opacity: .38;
    pointer-events: none;
    box-shadow: none;
}

/* 纯文字按钮 */
.btn-plain { background: transparent; color: var(--text-2); }
.btn-plain:hover { background: var(--fill-2); color: var(--text); }

.btn-block { width: 100%; height: 44px; border-radius: var(--radius); font-size: 15px; }

/* ---------- 6. 表单控件 ---------- */
input[type="text"], input[type="password"], input[type="date"], input[type="search"], select {
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--separator-2);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 13.5px;
    font-family: inherit;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
input::placeholder { color: var(--text-3); }
input:hover, select:hover { border-color: var(--text-3); }
input:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3.5px var(--accent-ring);
}
input[type="date"] { font-variant-numeric: tabular-nums; }

/* 下拉箭头：原生外观换成分级灰 chevron */
select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' fill='none' stroke='%238e8e93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    cursor: pointer;
}

/* 选项卡（分段控件）：macOS segmented control */
.seg {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border-radius: 10px;
    background: var(--fill-2);
    border: 1px solid var(--separator);
}
.seg a {
    display: inline-flex;
    align-items: center;
    height: 29px;
    padding: 0 13px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}
.seg a:hover { color: var(--text); }
.seg a.on {
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .10), 0 0 0 .5px rgba(0, 0, 0, .05);
}
[data-theme="dark"] .seg a.on { box-shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 0 0 .5px rgba(255, 255, 255, .08); }

.chk {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--text-2);
    cursor: pointer;
    user-select: none;
}
.chk input {
    width: 15px; height: 15px;
    accent-color: var(--accent);
    cursor: pointer;
}

.inline-form { display: inline-flex; align-items: center; gap: 8px; }

/* 筛选条：一整行控件收进一张浅卡 */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    padding: 12px 14px;
    margin-bottom: 16px;
    background: var(--surface);
    border: 1px solid var(--separator);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
}
.filter-bar input[type="text"] { min-width: 200px; }
.filter-bar .tilde { color: var(--text-3); font-size: 13px; }
.filter-bar .spacer { flex: 1; }

/* ---------- 7. 卡片 / 统计 ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--separator);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
    padding: 17px 19px 15px;
    transition: box-shadow .24s var(--ease), transform .24s var(--ease);
}
.stat-card:hover { box-shadow: var(--shadow-2); }
.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-2);
    letter-spacing: .01em;
}
.stat-value {
    margin-top: 7px;
    font-size: 29px;
    font-weight: 600;
    line-height: 1.14;
    letter-spacing: -.028em;
}
.stat-value.up   { color: var(--accent); }
.stat-value.down { color: var(--text-2); }
.stat-unit {
    margin-top: 3px;
    font-size: 11.5px;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.unit-inline { font-size: 14px; color: var(--text-3); margin-left: 1px; font-weight: 500; }

/* 面板 */
.panel {
    background: var(--surface);
    border: 1px solid var(--separator);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
    padding: 18px 20px 16px;
    margin-bottom: 16px;
    min-width: 0;
}
.panel-title {
    display: flex;
    align-items: baseline;
    gap: 9px;
    margin-bottom: 12px;
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: -.012em;
}
.panel-title .muted { font-size: 12px; font-weight: 400; }

/* 图表栅格 */
.chart-grid { display: grid; gap: 14px; margin-bottom: 16px; }
.chart-grid-2 { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.chart { width: 100%; height: 292px; }
.chart-tall { height: 348px; }
.chart-empty {
    display: grid;
    place-items: center;
    height: 100%;
    color: var(--text-2);
    font-size: 13px;
}

/* ---------- 8. 表格 ---------- */
.table-panel {
    padding: 0;
    overflow: hidden;
}
.table-panel .panel-title { padding: 15px 18px 0; margin-bottom: 12px; }
.table-scroll { overflow-x: auto; }

.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 9px 14px;
    text-align: left;
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: .02em;
    color: var(--text-2);
    white-space: nowrap;
    background: var(--surface-2);
    border-bottom: 1px solid var(--separator);
}
.tbl td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--separator);
    white-space: nowrap;
    color: var(--text);
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .14s ease; }
.tbl tbody tr:hover td { background: var(--fill-2); }
.tbl .empty {
    padding: 46px 0;
    text-align: center;
    color: var(--text-3);
    font-size: 13px;
}

/* ---------- 9. 状态标签 ---------- */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 22px;
    padding: 0 9px;
    border: 0;
    border-radius: var(--radius-xs);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.tag::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.tag-pass   { color: var(--success); background: var(--success-soft); }
.tag-doing  { color: var(--accent);  background: var(--accent-soft); }
.tag-reject { color: var(--danger);  background: var(--danger-soft); }
.tag-cancel { color: var(--text-2);  background: var(--fill-2); }
.tag-none   { color: var(--text-3);  background: var(--fill-2); }

/* ---------- 10. 分页 / 提示 ---------- */
.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
}
.pager-info { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }

.alert {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 14px;
    margin-bottom: 14px;
    border-radius: var(--radius);
    font-size: 13px;
    border: 1px solid transparent;
}
.alert-error { color: var(--danger);  background: var(--danger-soft);  border-color: rgba(215, 0, 21, .22); }
.alert-ok    { color: var(--success); background: var(--success-soft); border-color: rgba(36, 138, 61, .22); }

.sync-note {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.85;
    color: var(--text-2);
}
.sync-note .tag { margin: 0 3px; vertical-align: 1px; }
.err-line { color: var(--danger); margin-top: 4px; }
.scroll-hint { display: none; }

/* ---------- 11. 月度透视表 ---------- */
.month-panel { padding: 0; }
.month-panel .table-scroll { border-radius: var(--radius-lg); }

.tbl-month { font-size: 12.5px; }
.tbl-month th, .tbl-month td {
    padding: 8px 5px;
    border-bottom: 1px solid var(--separator);
}
.tbl-month th { font-size: 11px; letter-spacing: 0; }

.tbl-month .day-col {
    width: 31px;
    min-width: 31px;
    padding: 8px 3px;
    text-align: right;
    font-size: 12px;
}
/* 合计列吸右：31 个日期列再宽，合计也永远可见 */
.tbl-month .col-sum {
    position: sticky;
    right: 0;
    z-index: 2;
    width: 70px;
    min-width: 70px;
    padding-right: 12px;
    font-weight: 600;
    background: var(--surface);
    border-left: 1px solid var(--separator);
}
.tbl-month thead th.col-sum { z-index: 3; background: var(--surface-2); }
.tbl-month .row-total td.col-sum { z-index: 3; }
/* 左右固定列的投影：提示「这一侧还有内容可以滚」 */
.tbl-month .col-sum { box-shadow: -9px 0 12px -9px rgba(0, 0, 0, .22); }
.tbl-month .col-name { box-shadow: 7px 0 10px -9px rgba(0, 0, 0, .18); }
[data-theme="dark"] .tbl-month .col-sum { box-shadow: -9px 0 12px -9px rgba(0, 0, 0, .8); }
[data-theme="dark"] .tbl-month .col-name { box-shadow: 7px 0 10px -9px rgba(0, 0, 0, .7); }
.tbl-month .col-code {
    position: sticky;
    left: 0;
    z-index: 2;
    width: 76px; min-width: 76px;
    text-align: left;
    padding-left: 16px;
    font-family: var(--font-num);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-2);
    background: var(--surface);
    border-right: 1px solid var(--separator);
}
.tbl-month .col-name {
    position: sticky;
    left: 76px;
    z-index: 2;
    width: 84px; min-width: 84px;
    padding-left: 12px;
    font-weight: 500;
    background: var(--surface);
    border-right: 1px solid var(--separator);
}
/* 无项目编号列时（按人员汇总），申请人列贴左 */
.tbl-month.no-code .col-name { left: 0; }
.tbl-month .col-dept {
    min-width: 92px; max-width: 124px;
    overflow: hidden; text-overflow: ellipsis;
    color: var(--text-2);
}
.tbl-month .col-proj { min-width: 240px; padding-left: 18px; }

.tbl-month thead th { background: var(--surface-2); }
.tbl-month thead th.col-code,
.tbl-month thead th.col-name {
    z-index: 3;
    background: var(--surface-2);
    color: var(--text-2);
}
.tbl-month tbody tr:hover td { background: var(--accent-soft); }
.tbl-month tbody tr:hover td.col-code,
.tbl-month tbody tr:hover td.col-name { background: color-mix(in srgb, var(--surface) 82%, var(--accent)); }
.tbl-month .row-share td { color: var(--text-2); }
.tbl-month .row-share td.col-code { color: var(--text-3); }

.tbl-month .row-total td {
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: var(--surface-2);
    font-weight: 600;
    color: var(--text);
    border-top: 1.5px solid var(--separator-2);
    border-bottom: 0;
}
.tbl-month .row-total td.col-code,
.tbl-month .row-total td.col-name { z-index: 3; background: var(--surface-2); }

/* ---------- 12. 项目台账 ---------- */
.tbl-projects td { vertical-align: middle; }
.tbl-projects .up   { color: var(--accent); }
.tbl-projects .down { color: var(--text-2); }

.bar-cell {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    min-width: 128px;
}
.bar-cell span {
    display: block;
    height: 5px;
    max-width: 74px;
    border-radius: 3px;
    background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 55%, transparent), var(--accent));
}
.bar-cell em {
    font-style: normal;
    font-size: 11.5px;
    color: var(--text-3);
    min-width: 42px;
    text-align: right;
}

.link-mini {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--accent);
    transition: opacity .16s ease;
}
.link-mini:hover { opacity: .72; }

/* 人员浮层 */
.people-pop { position: relative; display: inline-block; margin-left: 7px; }
.people-pop summary {
    display: inline-block;
    padding: 1px 7px;
    border-radius: var(--radius-xs);
    font-size: 11px;
    color: var(--text-2);
    background: var(--fill-2);
    cursor: pointer;
    list-style: none;
    transition: background .16s ease, color .16s ease;
}
.people-pop summary::-webkit-details-marker { display: none; }
.people-pop summary:hover { background: var(--fill); color: var(--text); }
.people-list {
    position: absolute;
    top: 25px;
    left: 0;
    z-index: 20;
    min-width: 186px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--separator-2);
    border-radius: var(--radius);
    box-shadow: var(--shadow-3);
}
.people-list span {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 5px 8px;
    border-radius: var(--radius-xs);
    font-size: 12.5px;
    white-space: nowrap;
}
.people-list span:hover { background: var(--fill-2); }
.people-list b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- 13. 登录 / 授权页 ---------- */
.login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 28px 20px;
    background-color: var(--bg);
    background-image:
        radial-gradient(900px 520px at 50% -14%, rgba(0, 113, 227, .10), transparent 62%),
        radial-gradient(700px 460px at 106% 108%, rgba(0, 113, 227, .07), transparent 58%);
    background-attachment: fixed;
}

.login-card {
    position: relative;
    width: 402px;
    max-width: 100%;
    padding: 38px 34px 30px;
    background: var(--surface);
    border: 1px solid var(--separator);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-3);
}

.login-logo { display: flex; justify-content: center; margin-bottom: 24px; }
.login-logo img { display: block; height: 32px; width: auto; }

/* 登录页右上角的外观切换，不占卡片空间 */
.login-theme {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10;
    background: var(--surface);
    border-color: var(--separator);
    box-shadow: var(--shadow-1);
}

.brand-pill {
    display: block;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .1em;
    color: var(--text-3);
    text-align: center;
}
.login-card h1 {
    font-size: 25px;
    font-weight: 600;
    letter-spacing: -.024em;
    text-align: center;
}
.login-sub {
    margin: 6px 0 26px;
    font-size: 13px;
    color: var(--text-2);
    text-align: center;
}
.login-card label {
    display: block;
    margin: 14px 0 6px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-2);
}
.login-card input { width: 100%; height: 42px; border-radius: var(--radius-sm); font-size: 14.5px; }
.login-card form .btn { margin-top: 22px; }

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0 16px;
    font-size: 11.5px;
    color: var(--text-3);
}.login-divider::before, .login-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--separator);
}

.btn-wecom {
    background: var(--surface);
    border-color: var(--separator-2);
    color: #07c160;
    font-weight: 600;
    box-shadow: var(--shadow-1);
}
.btn-wecom:hover { background: var(--surface-2); border-color: #07c160; }

.oauth-card { width: 430px; text-align: center; }
.oauth-card h1 { font-size: 20px; }
.oauth-card .login-sub { margin-bottom: 18px; line-height: 1.7; }

.qr-card {
    display: inline-block;
    margin: 6px 0 4px;
    padding: 9px;
    background: #fff;
    border-radius: var(--radius-lg);
    line-height: 0;
    box-shadow: var(--shadow-2);
}
.qr-card iframe { display: block; border: 0; border-radius: 10px; }
.qr-tip { margin-top: 14px; font-size: 12.5px; line-height: 1.8; color: var(--text-2); }
.qr-tip b { color: var(--text); font-weight: 600; }
.qr-mobile-tip { display: none; margin: 18px 0 4px; font-size: 13px; line-height: 1.9; color: var(--text-2); }
.oauth-back { margin-top: 22px; font-size: 12.5px; }
.oauth-back a { color: var(--text-2); transition: color .16s ease; }
.oauth-back a:hover { color: var(--accent); }

@media (max-width: 430px) {
    .qr-card { display: none; }
    .qr-mobile-tip { display: block; }
}

/* ---------- 14. 入场编排（一次，克制） ---------- */
@media (prefers-reduced-motion: no-preference) {
    .content > * {
        animation: ya-rise .52s var(--ease) both;
    }
    .content > *:nth-child(1) { animation-delay: .02s; }
    .content > *:nth-child(2) { animation-delay: .07s; }
    .content > *:nth-child(3) { animation-delay: .12s; }
    .content > *:nth-child(4) { animation-delay: .17s; }
    .content > *:nth-child(5) { animation-delay: .22s; }

    @keyframes ya-rise {
        from { opacity: 0; transform: translateY(9px); }
        to   { opacity: 1; transform: none; }
    }
}
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- 15. 响应式 ---------- */

/* 31 个日期列本身吃宽，屏幕不够时先收起部门列（姓名仍在，title 里有完整路径） */
@media (max-width: 1560px) {
    .tbl-month .col-dept { display: none; }
}

/* 中屏：侧栏收成图标轨道，把宽度让给 31 天的月度表 */
@media (max-width: 1240px) and (min-width: 901px) {
    .app { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
    .sidebar { padding: 16px 10px 12px; }
    .brand { justify-content: center; padding: 0; }
    .brand-logo, .brand-sub, .side-label { display: none; }
    .brand-mark { display: block; }
    .side-link {
        justify-content: center;
        padding: 0;
        height: 40px;
    }
    .side-link span, .side-link .side-badge { display: none; }
    .side-link svg { width: 19px; height: 19px; }
    .user-card { justify-content: center; padding: 7px 0; }
    .user-meta { display: none; }
    .side-tools { flex-direction: column; }
    .side-tools .icon-btn { width: 100%; height: 34px; }
}

/* 窄屏：侧栏改为抽屉，顶栏出现汉堡按钮 */
@media (max-width: 900px) {
    .app { grid-template-columns: minmax(0, 1fr); }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 282px;
        transform: translateX(-102%);
        transition: transform .42s var(--ease);
        box-shadow: none;
    }
    /* 抽屉展开时用实底：半透明会让下层文字透出来，影响可读性 */
    .sidebar { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
    .nav-open .sidebar { transform: none; box-shadow: var(--shadow-3); }
    .nav-open .scrim { display: block; }
    .nav-toggle { display: inline-grid; }
    .topbar { padding: 10px 16px; gap: 10px; min-height: 62px; }
    .topbar-title h1 { font-size: 17px; }
    .topbar-title p { display: none; }
    .content { padding: 16px 16px 48px; }
    .chart-grid-2 { grid-template-columns: minmax(0, 1fr); }
    .tbl-month .col-dept { display: none; }
    .scroll-hint { display: block; margin-top: 8px; }
    .head-hide-sm { display: none; }
}

@media (max-width: 620px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat-card { padding: 14px 15px 12px; }
    .stat-value { font-size: 24px; }
    .filter-bar { padding: 10px; gap: 8px; }
    .filter-bar input[type="text"] { min-width: 0; flex: 1 1 140px; }
    .topbar-actions .btn span { display: none; }
}

/* 打印：去掉外壳，只留表格 */
@media print {
    .sidebar, .topbar, .scrim, .filter-bar, .pager, .head-actions { display: none !important; }
    .app { display: block; }
    body { background: #fff; }
    .panel, .stat-card { box-shadow: none; border-color: #ddd; }
}
