/* addon.css —— 前后端分离版新增组件 */

/* ---------------- 首屏加载遮罩 ---------------- */
.app-loading {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-warm);
}
.app-loading .loading-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: var(--text-secondary);
}
.app-loading .loading-box p { font-size: 14px; }
.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: wb-spin .8s linear infinite;
}
@keyframes wb-spin { to { transform: rotate(360deg); } }

/* ---------------- 同步状态指示器 ---------------- */
.sync-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    white-space: nowrap;
    background: var(--border-light);
    color: var(--text-secondary);
    transition: background .2s, color .2s;
}
.sync-indicator i { font-size: 7px; }
.sync-indicator.sync-loaded,
.sync-indicator.sync-reloaded,
.sync-indicator.sync-synced { background: var(--primary-lighter); color: var(--primary); }
.sync-indicator.sync-syncing { background: var(--accent-blue-light); color: var(--accent-blue); }
.sync-indicator.sync-syncing i { animation: wb-pulse 1s ease-in-out infinite; }
.sync-indicator.sync-error { background: rgba(220, 38, 38, .14); color: #DC2626; }
@keyframes wb-pulse { 50% { opacity: .25; } }

@media (max-width: 900px) {
    .sync-indicator span { display: none; }
    .sync-indicator { padding: 0 9px; }
}

/* ---------------- 顶栏按钮 / 用户菜单 ---------------- */
button.topbar-icon {
    border: none;
    cursor: pointer;
    font: inherit;
    background: transparent;
    padding: 0;
}
.user-menu { position: relative; }
button.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    cursor: pointer;
    font: inherit;
    color: var(--text-primary);
    transition: background .15s, border-color .15s;
}
button.user-info:hover { background: var(--border-light); border-color: var(--border); }
.user-caret { font-size: 10px; color: var(--text-muted); transition: transform .18s; }
.user-menu.open .user-caret { transform: rotate(180deg); }

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 176px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 6px;
    z-index: 500;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .16s, transform .16s, visibility .16s;
}
.user-menu.open .user-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 13px;
}
.user-dropdown a:hover { background: var(--border-light); }
.user-dropdown a i { width: 14px; text-align: center; color: var(--text-secondary); }
.user-dropdown a.danger { color: #DC2626; }
.user-dropdown a.danger i { color: #DC2626; }
.user-dropdown-sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* ---------------- 登录页 ---------------- */
.login-body {
    overflow: auto;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(1000px 520px at 12% -10%, var(--primary-lighter), transparent 60%),
        radial-gradient(900px 480px at 108% 110%, var(--accent-blue-light), transparent 60%),
        var(--bg-warm);
}
.login-wrap { width: 100%; max-width: 400px; }
.login-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 30px;
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand h1 { font-size: 19px; font-weight: 600; color: var(--text-primary); }
.login-brand p { margin-top: 6px; font-size: 12px; color: var(--text-secondary); }

.login-field { position: relative; }
.login-field > i:first-child {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--text-muted);
    pointer-events: none;
}
.login-field .form-control { padding-left: 34px; height: 42px; }
.login-eye {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
}
.login-eye:hover { color: var(--text-secondary); background: var(--border-light); }

.login-error {
    display: none;
    margin-bottom: 14px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    background: rgba(220, 38, 38, .10);
    border: 1px solid rgba(220, 38, 38, .28);
    color: #DC2626;
    font-size: 12.5px;
}
.login-error.show { display: block; }

.login-submit {
    width: 100%;
    height: 42px;
    justify-content: center;
    font-size: 15px;
    gap: 8px;
}
.login-submit:disabled { opacity: .7; cursor: not-allowed; }

.login-foot {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}
.login-copyright { margin-top: 18px; text-align: center; font-size: 12px; color: var(--text-muted); }
.login-icp { width: 100%; margin-top: 4px; text-align: center; font-size: 12px; color: var(--text-muted); }
.login-icp a { display: inline-block; color: var(--text-muted); text-decoration: none; text-align: center; }
.login-icp a:hover { color: var(--text-secondary); }

.hamburger { display: none; }

/* 进度条 */
.quick-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-warm);
    border-radius: 4px;
    overflow: hidden;
    margin: 12px 0 6px;
}
.quick-progress-bar > div {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #60a5fa);
    border-radius: 4px;
    transition: width 0.4s ease;
}
.quick-progress-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}
.quick-item .quick-sub {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 日历样式进度卡片 */
.quick-calendar {
    text-align: left;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
}
.quick-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.quick-cal-header .quick-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.quick-cal-header .quick-title i { color: var(--primary); }
.week-nav {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
}
.week-nav > i {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-muted);
    cursor: pointer;
    transition: background .15s, color .15s;
}
.week-nav > i:hover {
    background: var(--primary);
    color: #fff;
}
.week-reset {
    font-size: 11px;
    font-weight: 500;
    color: var(--primary);
    background: rgba(59, 130, 246, 0.12);
    padding: 2px 8px;
    border-radius: 999px;
    cursor: pointer;
    margin-left: 2px;
}
.week-reset:hover { background: rgba(59, 130, 246, 0.22); }
.quick-cal-rate {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}
.quick-cal-rate span {
    font-size: 13px;
    font-weight: 500;
    margin-left: 1px;
}

/* 周历 */
.quick-week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}
.quick-week-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 2px 6px;
    border-radius: var(--radius-sm);
    background: var(--bg-warm);
    border: 1px solid transparent;
    min-height: 64px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.quick-week-day:hover { background: var(--border-light); }
.quick-week-day.today {
    background: var(--primary-lighter);
    border-color: var(--primary-light);
}
.quick-week-day.selected {
    background: var(--primary);
    border-color: var(--primary);
}
.quick-week-day.selected .qwd-weekday,
.quick-week-day.selected .qwd-date { color: #fff; }
.quick-week-day.selected.today .qwd-date { background: rgba(255,255,255,.25); }
.qwd-weekday {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 2px;
}
.qwd-date {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.quick-week-day.today .qwd-date {
    background: var(--primary);
    color: #fff;
}
.qwd-dots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px;
    min-height: 6px;
}

/* 月历 */
.quick-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 12px;
}
.quick-month-header {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    padding: 2px 0;
}
.quick-month-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 0 2px;
    border-radius: var(--radius-sm);
    background: var(--bg-warm);
    min-height: 34px;
    border: 1px solid transparent;
}
.quick-month-day.other {
    opacity: 0.4;
    background: transparent;
}
.quick-month-day.today {
    background: var(--primary-lighter);
    border-color: var(--primary-light);
}
.qmd-date {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
    color: var(--text-primary);
}
.quick-month-day.today .qmd-date {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}
.qmd-dots {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin-top: 1px;
    min-height: 5px;
}

/* 本月工作日 / 休息日统计与节假日提醒（横向紧凑） */
.month-summary {
    margin-top: auto;
    padding: 10px 12px;
    background: var(--bg-warm);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.week-summary {
    margin-top: auto;
    font-size: 12px;
}
.ms-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-size: 12px;
    line-height: 1.5;
}
.ms-block {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.ms-label {
    color: var(--text-muted);
    white-space: nowrap;
}
.ms-value {
    color: var(--text-secondary);
}
.ms-value b {
    color: var(--text-primary);
    font-weight: 600;
    margin: 0 2px;
}
.ms-divider {
    width: 1px;
    height: 14px;
    background: var(--border);
    flex-shrink: 0;
}
.ms-reminder-row {
    border-top: 1px solid var(--border-light);
    padding-top: 8px;
    align-items: center;
}
.ms-reminders {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.ms-reminder {
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    cursor: default;
}
.ms-reminder.holiday {
    background: rgba(147, 197, 253, 0.12);
    color: #93c5fd;
}
.ms-reminder.workday {
    background: rgba(253, 186, 116, 0.12);
    color: #fdba74;
}
.ms-reminder-empty {
    font-size: 11px;
    color: var(--text-muted);
}

/* 任务状态小点 */
.quick-cal-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    display: inline-block;
}
.quick-cal-dot.done { background: var(--primary); }
.quick-cal-dot.todo { background: var(--border); }
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 99;
}

/* ---------------- 时间轴 ---------------- */
.quick-timeline-header {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin: 4px 0 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-light);
}
.quick-timeline {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    max-height: 220px;
    overflow-y: auto;
}
.timeline-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
}
.timeline-label {
    width: 42px;
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
    flex-shrink: 0;
}
.timeline-slot {
    flex: 1;
    min-height: 22px;
    background: var(--bg-warm);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 6px;
}
.timeline-task {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-orange);
    cursor: pointer;
}
.timeline-task.done { background: var(--primary); }
.timeline-task.pinned {
    box-shadow: 0 0 0 2px var(--primary-light);
}
.timeline-empty {
    display: block;
    width: 100%;
    height: 1px;
    background: var(--border-light);
}

/* ---------------- 待办表单 / 列表 ---------------- */
.form-datetime {
    display: flex;
    gap: 10px;
}
.form-datetime input[type="date"],
.form-datetime input[type="time"] { flex: 1; }

.task-item.pinned,
tr.pinned {
    background: var(--primary-lighter);
    border-left: 3px solid var(--primary);
}
.task-item.pinned .task-name { font-weight: 600; }
.icon-btn.active { color: var(--primary); }
.icon-btn.active:hover { color: var(--primary); }

/* ---------------- 历史工作成果（按年度存档） ---------------- */
.history-year-group {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    overflow: hidden;
    background: var(--bg-white);
}
.history-year-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-warm);
    cursor: pointer;
    user-select: none;
    transition: background .15s;
}
.history-year-header:hover { background: var(--border-light); }
.history-year-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.history-year-title i { color: var(--primary); font-size: 13px; }
.history-year-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
}
.history-year-arrow {
    font-size: 11px;
    color: var(--text-muted);
    transition: transform .2s;
    margin-left: 8px;
}
.history-year-arrow.expanded { transform: rotate(180deg); }
.history-year-body {
    padding: 8px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.history-achievement-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.history-achievement-item:hover {
    background: var(--bg-warm);
    border-color: var(--border);
}
.history-achievement-main {
    min-width: 0;
    flex: 1;
}
.history-achievement-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-achievement-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ---------------- 小屏适配 ---------------- */
@media (max-width: 768px) {
    .hamburger { display: flex; }
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s; z-index: 100; }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-md); }
    .sidebar.open + .sidebar-backdrop { display: block; }
    .main { width: 100%; }
    .search-box { display: none; }
    .topbar-left { gap: 12px; }
}
