:root {
    --primary: #5B6CFF;
    --primary-light: #EEF0FF;
    --accent: #5B6CFF;
    --accent-light: #EEF0FF;
    --text: #1E1E2D;
    --text-secondary: #6E6E82;
    --text-hint: #A8A8BE;
    --bg: #F4F5F7;
    --card: #FFFFFF;
    --border: #E8E9ED;
    --danger: #E54D4D;
    --success: #34C759;
    --tag-blue: #4A90D9;
    --tag-green: #34C759;
    --tag-orange: #FF9500;
    --radius: 12px;
    --nav-height: 60px;
    --fab-bottom: 80px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.4;
    overflow: hidden;
}

.app {
    max-width: 480px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--card);
}

/* PC 端整体布局：侧边导航 + 内容区 */
@media (min-width: 768px) {
    body {
        overflow: auto;
    }

    .app {
        max-width: 100%;
        flex-direction: row;
        background: var(--bg);
    }
}

/* ===== Main Content Wrapper (PC) ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    position: relative;
    background: var(--card);
}

@media (max-width: 767px) {
    .main-content {
        display: contents;
    }
}

/* ===== Top Bar ===== */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--card);
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .top-bar {
        padding: 16px 32px;
    }

    .month-title {
        font-size: 22px;
    }
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.icon-btn:hover {
    background: var(--border);
}

.month-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.month-title {
    font-size: 20px;
    font-weight: 700;
    min-width: 60px;
    text-align: center;
}

.nav-arrow {
    border: none;
    background: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.nav-arrow:hover {
    color: var(--text);
}

/* ===== Views ===== */
.view {
    display: none;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    flex-direction: column;
}

.view.active {
    display: flex;
}

/* 日历视图：block 布局 + 滚动，保证 sticky 生效 */
#calendarView.active {
    display: block;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
    .view {
        overflow-y: auto;
    }
}

/* ===== Calendar: Weekday Row ===== */
.weekday-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    padding: 4px 8px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--card);
}

.weekday-row span {
    text-align: center;
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 8px 0;
}

@media (min-width: 768px) {
    .weekday-row {
        padding: 8px 16px;
    }

    .weekday-row span {
        font-size: 14px;
        padding: 8px 0;
    }
}

/* ===== Calendar: Grid ===== */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    padding: 0 4px;
    min-height: 320px;
}

@media (min-width: 768px) {
    .weekday-row {
        padding: 4px 16px;
    }

    .weekday-row span {
        font-size: 14px;
        padding: 8px 0;
    }

    .calendar-grid {
        padding: 0 12px;
        gap: 2px;
    }
}

@media (min-width: 768px) {
    .calendar-grid {
        padding: 0 12px;
        gap: 2px;
    }
}

.cal-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 2px 5px;
    min-height: 100px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.12s;
    overflow: hidden;
    min-height: 0;
}

@media (min-width: 768px) {
    .cal-cell {
        padding: 8px 4px 6px;
        border-radius: 10px;
        align-items: stretch;
    }

    .cal-cell .cal-num-wrap {
        align-self: center;
    }
}

.cal-cell:hover {
    background: var(--bg);
}

.cal-cell.selected {
    background: var(--primary-light);
}

.cal-num-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
}

.cal-num {
    font-size: 18px;
    font-weight: 500;
    line-height: 1;
    width: 34px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.cal-lunar {
    font-size: 12px;
    color: var(--text-hint);
    line-height: 1.2;
    margin-top: 2px;
}

.cal-cell.other .cal-num {
    color: var(--text-hint);
}

.cal-cell.other .cal-lunar {
    color: var(--text-hint);
    opacity: 0.8;
}

.cal-cell.today .cal-num {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.cal-cell.selected:not(.today) .cal-num {
    color: var(--primary);
    font-weight: 600;
}

.cal-tags {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    margin-top: 3px;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

.cal-tag {
    font-size: 12px;
    line-height: 1.3;
    padding: 2px 5px;
    border-radius: 4px;
    background: #F2F1FA;
    color: #5A5672;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.cal-tag:active {
    opacity: 0.6;
}

.cal-tag.done {
    background: var(--bg);
    color: var(--text-hint);
    text-decoration: line-through;
    opacity: 0.5;
}

.cal-dot-row {
    display: flex;
    gap: 3px;
    margin-top: 2px;
}

.cal-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .cal-cell {
        padding: 8px 4px 6px;
        border-radius: 10px;
        min-height: 80px;
    }

    .cal-num {
        font-size: 15px;
        width: 34px;
        height: 34px;
    }

    .cal-lunar {
        font-size: 11px;
    }

    .cal-tags {
        gap: 3px;
        margin-top: 4px;
    }

    .cal-tag {
        font-size: 11px;
        padding: 2px 5px;
        border-radius: 4px;
    }
}

@media (min-width: 1024px) {
    .cal-cell {
        min-height: 90px;
        padding: 8px 6px 6px;
    }

    .cal-tag {
        font-size: 12px;
        padding: 2px 6px;
    }
}

/* ===== Floating Action Button ===== */
.fab {
    position: absolute;
    bottom: var(--fab-bottom);
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(91, 108, 255, 0.4);
    z-index: 50;
    transition: transform 0.2s, box-shadow 0.2s;
}

.fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(91, 108, 255, 0.5);
}

.fab:active {
    transform: scale(0.95);
}

@media (min-width: 768px) {
    .fab {
        bottom: 32px;
        right: 32px;
        width: 60px;
        height: 60px;
    }
}

/* ===== Day Task List Modal ===== */
.day-modal {
    max-height: 75vh;
    display: flex;
    flex-direction: column;
}
.day-modal-list {
    flex: 1; overflow-y: auto;
    padding: 8px 16px;
}
.day-modal-list:empty::after {
    content: '暂无任务';
    display: block; text-align: center;
    color: var(--text-hint); padding: 28px 0;
    font-size: 14px;
}
.day-task-item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px;
    border-radius: 12px;
    background: var(--bg);
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.day-task-item:active { background: var(--border); }
.day-task-check {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border);
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.15s;
}
.day-task-check.checked {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.day-task-content { flex: 1; min-width: 0; }
.day-task-title {
    font-size: 15px; font-weight: 500;
    color: var(--text);
}
.day-task-title.done {
    text-decoration: line-through;
    color: var(--text-hint);
}
.day-task-tag {
    display: inline-block;
    font-size: 11px; font-weight: 600;
    padding: 1px 8px; border-radius: 6px;
    margin-top: 3px;
}
.day-task-edit {
    width: 32px; height: 32px;
    border: none; background: none;
    color: var(--text-hint);
    cursor: pointer; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
}
.day-task-edit:active { background: var(--border); }
.day-modal-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex; gap: 10px;
}
.day-modal-add-btn { flex: 1; }
.day-modal-voice-btn {
    width: 48px; height: 48px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff; border: none; border-radius: 50%;
    cursor: pointer; padding: 0;
}
.day-modal-voice-btn svg {
    width: 24px; height: 24px;
}
.day-modal-voice-btn:active { opacity: 0.7; }
.btn-block { width: 100%; }

/* ===== Voice FAB ===== */
.fab.fab-voice {
    right: 86px;
    width: 46px; height: 46px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4);
    bottom: calc(var(--fab-bottom) + 5px);
}
@media (min-width: 768px) {
    .fab.fab-voice {
        right: 102px; bottom: 37px;
        width: 50px; height: 50px;
    }
}

/* ===== Voice Modal ===== */
.voice-modal {
    text-align: center;
    padding: 28px 20px 20px;
    max-width: 360px;
    position: relative;
}
.voice-modal-header {
    font-size: 18px; font-weight: 700;
    margin-bottom: 10px;
}
.voice-status {
    font-size: 14px; color: var(--text-secondary);
    margin-bottom: 16px;
    min-height: 20px;
}
.voice-text {
    font-size: 16px; font-weight: 500;
    color: var(--text);
    min-height: 24px;
    margin-bottom: 16px;
    padding: 0 10px;
    word-break: break-word;
}
.voice-input-row {
    display: flex; gap: 8px;
    margin-bottom: 16px; padding: 0 4px;
}
.voice-text-input {
    flex: 1; padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 12px; font-size: 15px;
    background: var(--bg); color: var(--text);
    outline: none; transition: border-color 0.15s;
}
.voice-text-input:focus { border-color: var(--primary); }
.voice-text-send {
    width: 42px; height: 42px;
    border-radius: 12px; border: none;
    background: var(--primary); color: #fff;
    cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    flex-shrink: 0; transition: opacity 0.15s;
}
.voice-text-send:active { opacity: 0.7; }

.voice-mic-btn {
    width: 64px; height: 64px;
    border-radius: 50%; border: none;
    background: var(--bg);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center; justify-content: center;
    transition: all 0.2s;
    margin-bottom: 4px;
}
.voice-mic-btn.no-speech-api {
    opacity: 0.3; pointer-events: none;
}
.voice-mic-hint {
    font-size: 12px; color: var(--text-hint);
    margin-bottom: 14px;
}
.voice-mic-btn.listening {
    background: #e74c3c;
    color: #fff;
    box-shadow: 0 0 0 8px rgba(231, 76, 60, 0.2);
    animation: pulse-ring 1.5s ease-in-out infinite;
}
@keyframes pulse-ring {
    0% { box-shadow: 0 0 0 4px rgba(231,76,60,0.3); }
    50% { box-shadow: 0 0 0 12px rgba(231,76,60,0.1); }
    100% { box-shadow: 0 0 0 4px rgba(231,76,60,0.3); }
}
.voice-mic-btn.parsing {
    background: var(--border);
    color: var(--text-hint);
    pointer-events: none;
}

.voice-parse-result {
    text-align: left;
    background: var(--bg);
    border-radius: 14px;
    padding: 14px;
    margin-top: 4px;
}
.voice-parse-item {
    display: flex; align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}
.voice-parse-item:last-of-type { border-bottom: none; }
.voice-parse-label {
    font-size: 13px; font-weight: 600;
    color: var(--text-secondary);
    width: 42px; flex-shrink: 0;
}
.voice-parse-value {
    font-size: 14px; font-weight: 500;
    color: var(--text);
}
.voice-parse-actions {
    display: flex; gap: 10px;
    margin-top: 14px;
}
.voice-parse-actions .btn { flex: 1; }

.modal-close {
    position: absolute; top: 10px; right: 14px;
    background: none; border: none;
    font-size: 20px; color: var(--text-hint);
    cursor: pointer;
}

/* ===== Bottom Nav ===== */
.bottom-nav {
    display: flex;
    height: var(--nav-height);
    background: var(--card);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 40;
    order: 99;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.15s;
    padding: 0;
}

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

.nav-item.active svg {
    stroke: var(--primary);
}

/* PC: 侧边栏导航 */
@media (min-width: 768px) {
    .bottom-nav {
        flex-direction: column;
        width: 72px;
        height: 100vh;
        border-top: none;
        border-right: 1px solid var(--border);
        padding: 16px 0;
        gap: 8px;
        flex-shrink: 0;
        order: -1;
    }

    .nav-item {
        flex: none;
        padding: 12px 0;
        border-radius: 12px;
        margin: 0 8px;
        font-size: 11px;
        gap: 4px;
        transition: color 0.15s, background 0.15s;
    }

    .nav-item:hover {
        background: var(--bg);
    }

    .nav-item.active {
        background: var(--primary-light);
    }
}

/* ===== List View ===== */
.all-tasks-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    padding-bottom: 80px;
}

@media (min-width: 768px) {
    .all-tasks-list {
        padding: 16px 32px 80px;
        max-width: 720px;
    }

    .task-item {
        padding: 16px 16px;
    }

    .task-title {
        font-size: 16px;
    }

    .task-desc {
        font-size: 14px;
    }
}

.date-group-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 14px 0 6px;
}

.date-group-title:first-child {
    padding-top: 4px;
}

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 12px;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: transform 0.12s;
}

.task-item:active {
    transform: scale(0.98);
}

.task-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    background: none;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.task-check:hover {
    background: var(--primary-light);
}

.task-check.done {
    background: var(--success);
    border-color: var(--success);
}

.task-check.done::after {
    content: "✓";
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.task-body {
    flex: 1;
    min-width: 0;
}

.task-title {
    font-size: 15px;
    word-break: break-word;
}

.task-item.completed .task-title {
    text-decoration: line-through;
    color: var(--text-hint);
}

.task-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 3px;
    word-break: break-word;
}

.task-date-tag {
    font-size: 12px;
    color: var(--primary);
    margin-top: 3px;
}

.completed-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 0 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-hint);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.completed-toggle .arrow {
    display: inline-block;
    font-size: 12px;
    transition: transform 0.2s;
}

.completed-toggle.open .arrow {
    transform: rotate(90deg);
}

.completed-section {
    display: none;
}

.completed-section.open {
    display: block;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-hint);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-text {
    font-size: 15px;
}

/* ===== Modal ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 200;
    align-items: flex-end;
    justify-content: center;
}

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

.modal {
    background: var(--card);
    width: 100%;
    max-width: 480px;
    border-radius: 16px 16px 0 0;
    animation: slideUp 0.25s ease-out;
    max-height: 85vh;
    overflow-y: auto;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

@media (min-width: 768px) {
    .modal-overlay {
        align-items: center;
    }

    .modal {
        max-width: 520px;
        border-radius: 16px;
        animation: fadeIn 0.2s ease-out;
        box-shadow: 0 16px 48px rgba(0,0,0,0.15);
    }

    .modal-footer {
        padding-bottom: 20px;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 10px;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 600;
}

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

.modal-body {
    padding: 0 20px;
}

.input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    margin-bottom: 12px;
    outline: none;
    transition: border-color 0.2s;
}

.input:focus {
    border-color: var(--primary);
}

.textarea {
    resize: vertical;
    min-height: 80px;
}

.modal-footer {
    display: flex;
    align-items: center;
    padding: 12px 20px 24px;
    gap: 10px;
}

.modal-spacer {
    flex: 1;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn:active {
    opacity: 0.7;
}

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

.btn-secondary {
    background: var(--border);
    color: var(--text-secondary);
}

.btn-danger {
    background: none;
    color: var(--danger);
    padding: 10px 12px;
}

/* ===== Tag Picker (Modal) ===== */
.tag-picker {
    margin-bottom: 12px;
}

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

.tag-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 20px;
    border: 2px solid transparent;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    background: none;
    line-height: 1.4;
}

.tag-chip .tag-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tag-chip:active {
    transform: scale(0.95);
}

.tag-chip.selected {
    border-color: currentColor;
    font-weight: 600;
}

/* ===== Tag Badge (List & Calendar) ===== */
.task-tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 500;
    margin-top: 3px;
    padding: 1px 6px;
    border-radius: 8px;
    line-height: 1.5;
}

.task-tag-badge .tag-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ===== Quick Stats (日历页内嵌统计) ===== */
.quick-stats {
    padding: 10px 12px 16px;
    flex-shrink: 0;
}

.quick-stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.quick-stats-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.quick-stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-stats-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    background: var(--card);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    overflow: hidden;
    font-family: inherit;
    color: var(--text);
}

.quick-stats-chip:active {
    transform: scale(0.93);
}

.quick-stats-emoji {
    font-size: 14px;
    line-height: 1;
}

.quick-stats-name {
    line-height: 1.3;
}

.quick-stats-count {
    font-size: 11px;
    font-weight: 700;
    background: rgba(0,0,0,0.08);
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    line-height: 1.4;
}

.quick-stats-check {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--success);
    color: white;
    font-size: 16px;
    font-weight: bold;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.15s, transform 0.15s;
    border-radius: 20px;
    pointer-events: none;
}

.quick-stats-chip.recorded .quick-stats-check {
    opacity: 1;
    transform: scale(1);
}

@media (min-width: 768px) {
    .quick-stats {
        padding: 12px 20px 20px;
        border-top: 1px solid var(--border);
    }

    .quick-stats-grid {
        gap: 10px;
    }

    .quick-stats-chip {
        padding: 8px 16px;
        font-size: 14px;
        gap: 6px;
    }

    .quick-stats-emoji {
        font-size: 16px;
    }

    .quick-stats-count {
        font-size: 12px;
        padding: 2px 8px;
    }
}

/* ===== Quick Items (常驻事项) ===== */
.quick-items-section {
    margin-bottom: 14px;
}

.quick-items-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.quick-items-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.quick-items-manage {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    color: var(--text-hint);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.quick-items-manage:hover {
    background: var(--bg);
    color: var(--text-secondary);
}

.quick-items-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-item-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--card);
    color: var(--text);
    position: relative;
    overflow: hidden;
    line-height: 1.4;
    font-family: inherit;
}

.quick-item-btn .quick-emoji {
    font-size: 15px;
    line-height: 1;
}

.quick-item-btn:active {
    transform: scale(0.93);
}

.quick-item-btn.tagged {
    border-color: transparent;
}

/* Ripple / check animation on tap */
.quick-item-btn .quick-check {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--success);
    color: white;
    font-size: 16px;
    font-weight: bold;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.15s, transform 0.15s;
    border-radius: 20px;
    pointer-events: none;
}

.quick-item-btn.recorded .quick-check {
    opacity: 1;
    transform: scale(1);
}

/* ===== Quick Items Manage Modal ===== */
.quick-manage-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    max-height: 280px;
    overflow-y: auto;
}

.quick-manage-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: 10px;
}

.quick-manage-item .qm-emoji {
    font-size: 18px;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.quick-manage-item .qm-title {
    flex: 1;
    font-size: 14px;
    min-width: 0;
}

.quick-manage-item .qm-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    flex-shrink: 0;
}

.quick-manage-item .qm-delete {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    color: var(--text-hint);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}

.quick-manage-item .qm-delete:hover {
    color: var(--danger);
    background: #FFE5E2;
}

.quick-manage-add {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.quick-emoji-input {
    width: 52px;
    text-align: center;
    font-size: 18px;
    flex-shrink: 0;
    padding: 10px 6px;
}

.quick-title-input {
    flex: 1;
    min-width: 80px;
}

.quick-tag-select {
    width: 80px;
    flex-shrink: 0;
    padding: 10px 8px;
    appearance: auto;
}

.quick-add-btn {
    flex-shrink: 0;
    padding: 10px 16px;
}

.quick-manage-empty {
    text-align: center;
    color: var(--text-hint);
    font-size: 13px;
    padding: 20px 0;
}

/* ========== Smart Assistant Card ========== */

.assistant-card {
    margin: 10px 16px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 18px;
    padding: 16px;
    color: #fff;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
.assistant-card::before {
    content: '';
    position: absolute; top: -30px; right: -30px;
    width: 100px; height: 100px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
}
.assistant-header {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 12px;
}
.assistant-icon {
    width: 36px; height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.assistant-header-text { flex: 1; }
.assistant-label {
    font-size: 13px; font-weight: 700; opacity: 0.85;
    letter-spacing: 1px; text-transform: uppercase;
}
.assistant-greeting {
    font-size: 15px; font-weight: 500;
    margin-top: 2px;
}
.assistant-refresh {
    background: rgba(255,255,255,0.2);
    border: none; border-radius: 10px;
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #fff;
    transition: background 0.15s;
}
.assistant-refresh:active { background: rgba(255,255,255,0.35); }
.assistant-refresh.spinning svg {
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.assistant-body {
    font-size: 14px; line-height: 1.7;
    word-break: break-word;
}
.assistant-loading {
    text-align: center; padding: 12px 0;
    opacity: 0.8; font-size: 13px;
}

.assistant-section {
    margin-bottom: 10px;
}
.assistant-section-title {
    font-size: 12px; font-weight: 700;
    opacity: 0.7; margin-bottom: 6px;
    text-transform: uppercase; letter-spacing: 0.5px;
}

.assistant-month-block {
    background: rgba(255,255,255,0.12);
    border-radius: 12px; padding: 12px;
    margin-bottom: 10px;
}
.assistant-month-summary {
    font-size: 14px; font-weight: 500;
    margin-bottom: 10px;
}
.assistant-keywords {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-bottom: 10px;
}
.assistant-keyword {
    background: rgba(255,255,255,0.22);
    padding: 3px 10px; border-radius: 20px;
    font-weight: 600; white-space: nowrap;
}
.assistant-month-insight {
    font-size: 13px; line-height: 1.7;
    opacity: 0.9;
    border-top: 1px solid rgba(255,255,255,0.15);
    padding-top: 8px; margin-top: 2px;
}

.assistant-overdue {
    background: rgba(231,76,60,0.2);
    border-left: 3px solid rgba(231,76,60,0.7);
    border-radius: 10px; padding: 10px 12px;
    font-size: 14px; font-weight: 600;
    margin-bottom: 10px;
}

.assistant-streak {
    background: rgba(255,193,7,0.2);
    border-radius: 10px; padding: 10px 12px;
    font-size: 14px; font-weight: 600;
    margin-bottom: 10px;
}

.assistant-today-summary {
    background: rgba(255,255,255,0.12);
    border-radius: 12px; padding: 10px 12px;
    font-size: 14px; margin-bottom: 10px;
}

.assistant-plan-item {
    background: rgba(255,255,255,0.12);
    border-radius: 12px; padding: 10px 12px;
    margin-bottom: 6px;
    display: flex; align-items: flex-start; gap: 10px;
}
.assistant-plan-tag {
    font-size: 11px; font-weight: 700;
    padding: 2px 8px; border-radius: 6px;
    background: rgba(255,255,255,0.25);
    white-space: nowrap; flex-shrink: 0;
    margin-top: 2px;
}
.assistant-plan-content { flex: 1; }
.assistant-plan-title {
    font-size: 14px; font-weight: 600;
}
.assistant-plan-reason {
    font-size: 12px; opacity: 0.75;
    margin-top: 2px;
}
.assistant-plan-date {
    display: inline-block;
    font-size: 11px;
    color: var(--primary);
    background: rgba(99,102,241,0.1);
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 4px;
    font-weight: 500;
}
.assistant-plan-add {
    background: rgba(255,255,255,0.25);
    border: none; border-radius: 8px;
    color: #fff; font-size: 12px;
    padding: 4px 10px; cursor: pointer;
    white-space: nowrap; flex-shrink: 0;
    margin-top: 2px;
    transition: background 0.15s;
}
.assistant-plan-add:active { background: rgba(255,255,255,0.4); }
.assistant-plan-add.added {
    background: rgba(255,255,255,0.1);
    pointer-events: none; opacity: 0.6;
}

.assistant-week-advice {
    background: rgba(255,255,255,0.12);
    border-radius: 12px; padding: 10px 12px;
    font-size: 13px; line-height: 1.6;
}

.assistant-warnings {
    display: flex; flex-direction: column; gap: 4px;
}
.assistant-warning-item {
    font-size: 13px; padding: 6px 10px;
    background: rgba(255,193,7,0.2);
    border-radius: 8px;
    border-left: 3px solid rgba(255,193,7,0.6);
}

.assistant-tips {
    font-size: 13px; opacity: 0.8;
    font-style: italic;
    padding: 6px 0;
}

.assistant-actions {
    margin-top: 10px;
    display: flex; justify-content: center;
}
.assistant-actions .btn {
    background: rgba(255,255,255,0.25);
    color: #fff; border: none;
    font-weight: 600;
}
.assistant-actions .btn:active { background: rgba(255,255,255,0.35); }

/* ========== Insights View ========== */

.insights-container {
    padding: 12px 16px;
}
.insights-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
}
.insights-title {
    font-size: 16px; font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.tag-chart {
    display: flex; flex-direction: column; gap: 10px;
}
.tag-bar-row {
    display: flex; align-items: center; gap: 10px;
}
.tag-bar-label {
    width: 50px; font-size: 13px; font-weight: 600;
    text-align: right; flex-shrink: 0;
}
.tag-bar-track {
    flex: 1; height: 24px; background: var(--bg);
    border-radius: 12px; overflow: hidden;
    position: relative;
}
.tag-bar-fill {
    height: 100%; border-radius: 12px;
    transition: width 0.4s ease;
    min-width: 2px;
}
.tag-bar-count {
    font-size: 12px; color: var(--text-hint);
    width: 36px; text-align: right; flex-shrink: 0;
}

.completion-rate {
    margin-top: 14px; padding: 14px;
    background: var(--bg); border-radius: 12px;
    display: flex; align-items: center; gap: 14px;
}
.completion-ring {
    width: 56px; height: 56px; flex-shrink: 0;
    position: relative;
}
.completion-ring svg { transform: rotate(-90deg); }
.completion-ring-text {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; color: var(--text-primary);
}
.completion-info { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

.team-overview {
    display: flex; flex-direction: column; gap: 10px;
}
.team-member-card {
    display: flex; align-items: center; gap: 12px;
    padding: 12px;
    background: var(--bg); border-radius: 12px;
}
.team-member-card .user-avatar,
.team-member-card .user-avatar-placeholder { width: 36px; height: 36px; font-size: 15px; }
.team-member-info { flex: 1; min-width: 0; }
.team-member-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.team-member-name .me-badge {
    font-size: 11px; color: var(--accent);
    background: var(--accent-light); padding: 1px 6px;
    border-radius: 6px; margin-left: 6px;
}
.team-member-tags {
    display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap;
}
.team-tag-pill {
    font-size: 11px; padding: 2px 8px;
    border-radius: 8px; font-weight: 600;
}
.team-member-stat {
    font-size: 13px; font-weight: 700;
    color: var(--text-primary); text-align: center;
    flex-shrink: 0;
}
.team-member-stat small {
    display: block; font-size: 11px;
    font-weight: 400; color: var(--text-hint);
}

.ai-user-select {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-bottom: 12px;
}
.ai-user-chip {
    padding: 6px 14px; border-radius: 10px;
    border: 2px solid var(--border);
    background: var(--bg); font-size: 13px;
    font-weight: 600; cursor: pointer;
    transition: all 0.15s;
}
.ai-user-chip.active {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
}
.ai-analyze-btn {
    width: 100%; margin-bottom: 14px;
}
.ai-analysis-result {
    font-size: 14px; line-height: 1.8;
    color: var(--text-secondary);
    white-space: pre-wrap;
}
.ai-analysis-result .ai-loading {
    text-align: center; color: var(--text-hint);
    padding: 20px 0;
}

/* ========== People View ========== */

.users-list {
    padding: 8px 16px;
}
.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--card-bg);
    border-radius: 14px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
}
.user-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--border);
    flex-shrink: 0;
}
.user-avatar-placeholder {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.user-perm-status {
    font-size: 12px; color: var(--text-hint); margin-top: 2px;
}
.user-action-btn {
    padding: 7px 16px; border-radius: 10px;
    font-size: 13px; font-weight: 600;
    border: none; cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}
.user-action-btn.request {
    background: var(--accent); color: #fff;
}
.user-action-btn.pending {
    background: var(--border); color: var(--text-secondary);
    cursor: default;
}
.user-action-btn.btn-view {
    background: #27AE60; color: #fff;
}

.pending-requests {
    padding: 8px 16px;
}
.pending-request-card {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    background: #FFF8E0;
    border-radius: 14px;
    margin-bottom: 10px;
    border: 1px solid #F0E0A0;
}
.pending-request-card .user-info { flex: 1; }
.pending-request-card .user-name { font-size: 14px; }
.pending-request-card .perm-hint { font-size: 12px; color: #B8860B; margin-top: 2px; }
.perm-actions { display: flex; gap: 8px; }
.perm-actions button {
    padding: 6px 14px; border-radius: 8px; border: none;
    font-size: 13px; font-weight: 600; cursor: pointer;
}
.perm-approve { background: #27AE60; color: #fff; }
.perm-reject { background: #E74C3C; color: #fff; }

.viewing-banner {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; margin: 8px 16px;
    background: linear-gradient(135deg, #E0EEFF, #F0E0FF);
    border-radius: 12px; font-size: 14px; font-weight: 600;
    color: var(--text-primary);
}
.viewing-banner .btn-sm {
    padding: 5px 12px; font-size: 12px;
}

.people-empty {
    text-align: center; color: var(--text-hint);
    font-size: 14px; padding: 40px 0;
}

.hidden {
    display: none !important;
}
