/* ============================================================
   change_log_monitor — 移动端浅色主题 (Light)
   ============================================================ */

:root {
    --bg-primary: #f4f6f9;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #eef2f7;
    --border: #dfe4ec;
    --text-primary: #1f2d3d;
    --text-secondary: #5a6b7d;
    --text-dim: #7c8a99;
    --text-muted: #a6b1bf;
    --green: #2fa55f;
    --orange: #e08a2e;
    --red: #d94a5e;
    --blue: #2f7fd1;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(31,45,61,0.08);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Microsoft YaHei", "HarmonyOS Sans", sans-serif;
    font-size: 15px;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* ====== 顶部状态栏 ====== */
#top-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    height: 48px;
    flex-shrink: 0;
    z-index: 100;
}

#menu-toggle {
    display: none;  /* 桌面端隐藏，移动端显示 */
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    min-width: 44px;
    min-height: 44px;
    border-radius: var(--radius);
    align-items: center;
    justify-content: center;
}
#menu-toggle:active { background: var(--bg-input); }

.dot {
    display: inline-block;
    width: 12px; height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot.green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.orange { background: var(--orange); box-shadow: 0 0 6px var(--orange); }

#status-label { font-weight: 600; font-size: 14px; white-space: nowrap; }

#last-update {
    font-size: 12px;
    color: var(--text-dim);
    white-space: nowrap;
    margin-left: auto;
}

#record-count {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.btn {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    padding: 6px 12px;
    white-space: nowrap;
    min-height: 34px;
    transition: background 0.15s;
}
.btn:active { background: var(--border); }
.btn.small { padding: 4px 10px; font-size: 12px; min-height: 30px; }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn.danger:active { background: rgba(217,74,106,0.15); }
.btn.pending-badge {
    background: var(--orange);
    color: #fff;
    border: none;
    position: relative;
    margin-left: auto;
}
.btn.pending-badge #pending-count-badge {
    background: var(--red);
    color: #fff;
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 10px;
    margin-left: 4px;
    min-width: 16px;
    display: inline-block;
    text-align: center;
}

/* ====== 主布局 ====== */
#main-layout {
    display: flex;
    height: calc(100% - 48px);
    overflow: hidden;
}

/* ====== 遮罩层 ====== */
#overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
}
#overlay.show { display: block; }

/* ====== 左侧面板 ====== */
#sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 210;
    display: flex;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.panel-section {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.panel-section h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

/* 归类方式 */
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 0;
    min-height: 36px;
}
.radio-label input[type="radio"] {
    accent-color: var(--blue);
    width: 16px; height: 16px;
    margin: 0;
    cursor: pointer;
}

/* 筛选器 */
.filter-label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    margin-top: 8px;
}
.filter-label:first-of-type { margin-top: 0; }
.filter-select {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    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='M6 8L1 3h10z' fill='%238899aa'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

/* 统计 */
.stats-section { flex: 1; overflow-y: auto; }
.stats-section::-webkit-scrollbar { width: 4px; }
.stats-section::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.stat-group { margin-bottom: 14px; }
.stat-group-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 13px;
}
.stat-row .stat-name { color: var(--text-secondary); }
.stat-row .stat-value { color: var(--text-primary); font-weight: 600; }
.stat-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 10px 0;
}

/* ====== 卡片区 ====== */
#cards-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}
#cards-area::-webkit-scrollbar { width: 6px; }
#cards-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

#cards-container {
    max-width: 900px;
    margin: 0 auto;
}

.empty-hint {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-size: 15px;
}

/* ====== 下拉刷新指示器 ====== */
#pull-indicator {
    text-align: center;
    padding: 0;
    height: 0;
    overflow: hidden;
    transition: height 0.2s ease, padding 0.2s ease;
    color: var(--text-dim);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
#pull-indicator.pulling { height: 44px; padding: 8px 0; }
#pull-indicator.refreshing { height: 44px; padding: 8px 0; color: var(--blue); }

#pull-icon {
    display: inline-block;
    transition: transform 0.2s ease;
    font-size: 18px;
}
#pull-indicator.pulling #pull-icon { transform: rotate(180deg); }
#pull-indicator.refreshing #pull-icon {
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 刷新按钮动画 */
.btn.spinning {
    pointer-events: none;
    opacity: 0.7;
}

/* ====== 分组标题 ====== */
.group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 20px 6px 10px 6px;
    margin-top: 4px;
}
.group-header:first-child { margin-top: 0; padding-top: 4px; }
.group-header .group-icon {
    color: var(--blue);
    font-size: 18px;
    line-height: 1;
}
.group-header .group-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}
.group-header .group-count {
    font-size: 12px;
    color: var(--text-dim);
}
.group-header .group-line {
    flex: 1;
    height: 1px;
    background: var(--border);
    margin-left: 4px;
}

/* ====== 卡片 ====== */
.card {
    display: flex;
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease;
}
.card.new-card {
    animation: slideInNew 0.5s ease;
}
@keyframes slideIn { from { opacity: 0.8; } to { opacity: 1; } }
@keyframes slideInNew {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.card-bar {
    width: 5px;
    flex-shrink: 0;
}

.card-body {
    flex: 1;
    padding: 12px 14px;
    min-width: 0;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 4px;
}

.card-sheet {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    word-break: break-all;
}

.card-time {
    font-size: 12px;
    color: var(--text-dim);
    white-space: nowrap;
    flex-shrink: 0;
}

.card-fields {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
}

.field-row {
    display: flex;
    gap: 8px;
    font-size: 13px;
    line-height: 1.5;
    align-items: flex-start;
}

.field-key {
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
    min-width: 80px;
    flex-shrink: 0;
}
.field-val {
    color: var(--text-primary);
    word-break: break-all;
    min-width: 0;
}

.card-debug {
    margin-top: 6px;
    font-size: 10px;
    color: var(--text-muted);
}

/* 变化类型徽章 */
.change-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.change-badge-new { background: #dae8fc; color: #1c5cab; }
.change-badge-modified { background: #fff2cc; color: #916e00; }
.change-badge-deleted { background: #f8cecc; color: #b85450; }

.card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 10px;
    margin-top: 10px;
    border-top: 1px solid var(--border);
}
.card-approve-btn {
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 5px 14px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.15s;
}
.card-approve-btn:active { opacity: 0.7; }
.card-reject-btn {
    background: var(--red);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 5px 14px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.15s;
}
.card-reject-btn:active { opacity: 0.7; }

/* 已修改标记按钮 */
.confirm-actions {
    justify-content: flex-end;
}
.modified-btn {
    border: 1px solid;
    border-radius: 18px;
    padding: 5px 16px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-unmodified {
    background: var(--surface, #fcfcfb);
    color: var(--text-secondary, #898781);
    border-color: var(--border, #c3c2b7);
}
.btn-unmodified:hover {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
}
.btn-modified {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
}
.btn-modified:hover {
    background: #e34948;
    border-color: #e34948;
}
.unconfirm-btn {
    background: none;
    color: var(--orange, #eb6834);
    border: 1px solid var(--orange, #eb6834);
    border-radius: 18px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}
.unconfirm-btn:hover {
    background: var(--orange, #eb6834);
    color: #fff;
}

/* 字段变更对比 */
.field-row.field-changed {
    background: rgba(230, 150, 50, 0.1);
    border-radius: 3px;
    padding: 2px 4px;
    margin: 1px -4px;
}
.field-old {
    color: var(--red);
    text-decoration: line-through;
    font-size: 12px;
}
.field-arrow {
    color: var(--orange);
    margin: 0 4px;
    font-weight: bold;
}
.field-new {
    color: var(--green);
    font-weight: bold;
}

/* ====== 响应式 — 移动端 ====== */
@media (max-width: 768px) {
    #menu-toggle { display: flex; }

    #last-update { display: none; }
    #record-count { font-size: 11px; }

    #sidebar {
        position: fixed;
        top: 48px;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        width: 280px;
        min-width: 280px;
        box-shadow: 4px 0 20px rgba(0,0,0,0.5);
    }
    #sidebar.open { transform: translateX(0); }

    #cards-area { padding: 8px; }

    .card-body { padding: 10px 12px; }
    .field-key { min-width: 64px; font-size: 12px; }
    .field-val { font-size: 12px; }
    .card-sheet { font-size: 13px; }
}

/* ====== 响应式 — 宽屏 ====== */
@media (min-width: 1200px) {
    .card-fields {
        grid-template-columns: 1fr 1fr;
        gap: 2px 16px;
    }
    .field-key { min-width: 90px; }
}

/* ====== Toast 提示 ====== */
.toast {
    position: fixed;
    bottom: calc(20px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%);
    background: var(--green);
    color: #fff;
    padding: 10px 24px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}
.toast.show { opacity: 1; }

/* ====== Tab 内容面板 ====== */
.tab-content {
    display: none;
    height: calc(100% - 60px);  /* 减去底部导航高度 */
    overflow: hidden;
}
.tab-content.active {
    display: flex;
    flex-direction: column;
}

/* ====== 占位页面 ====== */
.placeholder-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 20px;
}
.placeholder-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.6;
}
.placeholder-page h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.placeholder-desc {
    font-size: 15px;
    color: var(--text-dim);
}

/* ====== 底部导航栏 ====== */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 300;
    padding-bottom: var(--safe-bottom);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    flex: 1;
    height: 100%;
    padding: 6px 4px;
    font-family: inherit;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
    min-width: 0;
}

.nav-item .nav-icon {
    font-size: 22px;
    line-height: 1;
}

.nav-icon-svg {
    width: 24px;
    height: 24px;
    opacity: 0.55;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.nav-item.active .nav-icon-svg {
    opacity: 1;
}

.nav-item .nav-label {
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.nav-item.active {
    color: var(--blue);
}

.nav-item.active .nav-label {
    font-weight: 700;
}

.nav-item:active {
    opacity: 0.7;
}

/* ====== 主布局高度适配 ====== */
#tab-dynamic {
    height: calc(100% - 60px);
}

#tab-design {
    overflow-y: auto;
}
#tab-design.active {
    display: flex;
    flex-direction: column;
}

/* ====== 主页 & 台账 ====== */
#tab-home {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
#tab-home.active {
    display: flex;
    flex-direction: column;
}

#home-view {
    flex: 1;
    overflow-y: auto;
}

/* 台账按钮网格 */
#ledger-buttons, .btn-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    padding: 10px 16px 20px;
    max-width: 500px;
    margin: 0 auto;
}
.ledger-btn, .tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    aspect-ratio: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    transition: background 0.2s, transform 0.15s, border-color 0.2s;
    padding: 8px;
}
.ledger-btn svg, .tool-btn svg {
    width: 28px;
    height: 28px;
}
.ledger-btn:active, .tool-btn:active {
    background: var(--bg-input);
    transform: scale(0.95);
    border-color: var(--blue);
    color: var(--blue);
}

/* 台账子页面 */
#ledger-subpage {
    flex: 1;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}
#ledger-sub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    height: 44px;
}
#ledger-back-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--blue);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
    min-width: 72px;
}
#ledger-back-btn:active { background: var(--bg-input); }
#ledger-back-btn svg { width: 18px; height: 18px; }
#ledger-sub-title {
    flex: 1;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}
/* 子页头部通用：标题居中，右侧放操作按钮 */
.hdr-right {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
    min-width: 72px;
}
.sub-hdr {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}
.sub-hdr-title {
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

/* 台账表格 */
#ledger-table-wrapper {
    flex: 1;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}
#ledger-table {
    border-collapse: collapse;
    font-size: 12px;
    white-space: nowrap;
    min-width: 100%;
}
#ledger-table th, #ledger-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}
#ledger-table th {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}
#ledger-table td {
    color: var(--text-secondary);
}
.ledger-row-click {
    cursor: pointer;
}

/* 详情视图 */
.detail-row {
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.detail-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 3px;
}
.detail-value {
    font-size: 15px;
    color: var(--text-primary);
    word-break: break-all;
}
#ledger-table td a {
    color: var(--blue);
    text-decoration: none;
}
.ledger-warn-row td {
    color: var(--red) !important;
}
.ledger-done-row td {
    color: var(--text-muted) !important;
}
/* 设计变更：闭合行字体绿色 */
.ledger-dc-closed-row td {
    color: var(--green) !important;
    font-weight: 600;
}
/* 风险跟踪：已完成→绿色字体，正在进行→黄色字体 */
.ledger-risk-done-row td {
    color: var(--green) !important;
}
.ledger-risk-ongoing-row td {
    color: var(--orange) !important;
}
/* 风险跟踪：暂停→灰色字体 */
.ledger-risk-paused-row td {
    color: var(--text-dim) !important;
}
.ledger-todo-row td {
    color: #ffffff !important;
    font-weight: 700;
}
.celu-landed-row td {
    color: var(--green) !important;
    font-weight: 600;
}
.celu-fail-row td {
    color: #8b0000 !important;
    font-weight: 600;
}

/* ====== 设计策划卡片 ====== */
.celu-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
}
.celu-card h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.celu-card-nums {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.celu-card-nums b {
    color: var(--text-primary);
}
/* 风险跟踪卡片状态色（覆盖 h4/nums 默认色） */
.risk-card-done,
.risk-card-done h4,
.risk-card-done .celu-card-nums,
.risk-card-done .celu-card-nums b {
    color: var(--green) !important;
}
.risk-card-ongoing,
.risk-card-ongoing h4,
.risk-card-ongoing .celu-card-nums,
.risk-card-ongoing .celu-card-nums b {
    color: var(--orange) !important;
}
.celu-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.celu-bar-label {
    font-size: 11px;
    color: var(--text-dim);
    min-width: 62px;
    text-align: right;
}
.celu-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}
.celu-bar-fill {
    height: 100%;
    background: var(--blue);
    border-radius: 3px;
    transition: width 0.5s ease;
}
.celu-bar-green { background: var(--green); }
.celu-bar-orange { background: var(--orange); }
.celu-bar-val {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 38px;
}

/* ====== 工作日历 ====== */
#tab-calendar {
    height: calc(100% - 60px);
    display: none;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 12px 12px;
    background: var(--bg-primary);
    position: relative;
}
#tab-calendar.active {
    display: flex;
}

/* 月份导航 */
#cal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 4px 0 6px;
    flex-shrink: 0;
}
#cal-month-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 100px;
    text-align: center;
}
.cal-nav-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cal-nav-btn svg { width: 16px; height: 16px; }

/* 星期头 */
#cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    padding-bottom: 2px;
    flex-shrink: 0;
}

/* 日历颜色说明 */
#cal-legend {
    font-size: 12px;
    color: var(--text-dim);
    padding: 6px 2px 10px;
    text-align: center;
    flex-shrink: 0;
}

/* 日历格子 */
#cal-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
    flex-shrink: 0;
    border-left: 1px solid var(--border);
    border-top: 1px solid var(--border);
}
.cal-cell {
    height: 184px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    padding: 4px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:active { background: var(--bg-input); }
.cal-cell-other { cursor: default; opacity: 0.35; pointer-events: none; }

.cal-day {
    font-size: 17px;
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1;
    align-self: flex-start;
    padding: 1px 4px;
    flex-shrink: 0;
}

/* 单天事项圆角矩形 */
.cal-event {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    border-radius: 6px;
    padding: 3px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}
.cal-event.span-offset { } /* 偏移量由 JS 按跨天条层数动态设置 margin-top */

/* 更多折叠 */
.cal-more {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 0 4px;
    cursor: pointer;
    flex-shrink: 0;
}

/* 已完成事项淡化 */
.cal-event-done,
.cal-span-done {
    opacity: 0.5;
    filter: saturate(0.7);
}

/* 跨天条（绝对定位，连贯横跨） */
.cal-span {
    position: absolute;
    height: 22px;
    border-radius: 11px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    padding: 3px 8px;
    white-space: nowrap;
    overflow: hidden;
    z-index: 5;
    box-shadow: 0 1px 2px rgba(0,0,0,.12);
    cursor: pointer;
}

/* 添加按钮 */
#cal-add-btn {
    position: absolute;
    top: 8px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    border: none;
    font-size: 18px;
    cursor: pointer;
    z-index: 280;
    box-shadow: 0 2px 8px rgba(74,144,217,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
#cal-add-btn:active {
    transform: scale(0.9);
}

/* 弹窗遮罩 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 500;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.modal-overlay.modal-hidden { display: none; }

/* 弹窗面板 */
.modal-panel {
    background: var(--bg-card);
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 20px 18px calc(20px + var(--safe-bottom));
    animation: slideUp 0.3s ease;
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
.modal-panel h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    text-align: center;
}
.modal-field {
    margin-bottom: 14px;
}
.modal-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.modal-field input,
.modal-field textarea,
.modal-field select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}
.modal-field input:focus,
.modal-field textarea:focus,
.modal-field select:focus {
    border-color: var(--blue);
}
.modal-field textarea {
    min-height: 80px;
}
.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}
.modal-actions .btn {
    flex: 1;
    text-align: center;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
}
.modal-actions .btn-primary {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}
.modal-actions .btn-cancel {
    background: var(--bg-input);
    color: var(--text-secondary);
}

/* 今天标记 */
.cal-cell-today .cal-day {
    color: var(--blue);
    font-weight: 700;
}
.cal-dot {
    width: 4px;
    height: 4px;
    background: var(--blue);
    border-radius: 50%;
    flex-shrink: 0;
}

/* 有数据标记 - 未完成（暖色） */
.cal-cell-has-todo {
    background: rgba(232, 150, 58, 0.25);
    font-weight: 600;
}

/* 有数据标记 - 全部完成（绿色） */
.cal-cell-all-done {
    background: rgba(80, 184, 108, 0.25);
    font-weight: 600;
}

/* 选中标记 */
.cal-cell-selected {
    box-shadow: inset 0 0 0 2px var(--blue);
}

/* 选中日期标签 */
#cal-selected-date {
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--blue);
    padding: 12px 0 8px;
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

/* 工作卡片区域 */
#work-cards {
    padding-bottom: 70px;
}

/* 工作卡片 */
.work-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border-left: 4px solid var(--border);
    padding: 11px;
    margin-bottom: 8px;
    box-shadow: var(--shadow);
    transition: opacity 0.2s;
}
.work-card-done {
    opacity: 0.45;
}
.work-card-focus {
    border: 2px solid var(--blue);
    box-shadow: 0 0 0 3px rgba(74,144,217,0.2);
}
.work-card-done .work-card-title {
    text-decoration: line-through;
    color: var(--text-dim);
}
.work-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}
.work-card-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    flex: 1;
}
.work-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}
.work-card-field {
    display: flex;
    gap: 6px;
    font-size: 14px;
    line-height: 1.5;
}
.work-card-field .wf-label {
    color: var(--text-dim);
    flex-shrink: 0;
    min-width: 60px;
}
.work-card-field .wf-value {
    color: var(--text-primary);
    word-break: break-all;
}

/* 工作卡片图片 */
.work-card-images {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.work-card-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: transform 0.15s;
}
.work-card-img:active {
    transform: scale(0.95);
}
.work-card-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.card-edit-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}
.card-edit-btn svg { width: 16px; height: 16px; }
.card-edit-btn:active {
    color: var(--blue);
    background: rgba(74,144,217,0.15);
}
.card-del-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}
.card-del-btn svg { width: 16px; height: 16px; }
.card-del-btn:active {
    color: var(--red);
    background: rgba(217,74,106,0.15);
}

.work-card-project-badge {
    display: inline-block;
    font-size: 15px;
    color: #1baf7a;
    background: rgba(27,175,122,0.12);
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 700;
    margin-bottom: 2px;
}

/* 开关控件 */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 26px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 26px;
    cursor: pointer;
    transition: background 0.25s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--green);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

