/* 每日事务规划 · Web 端 */
:root {
    --bg: #F5F7FA;
    --surface: #FFFFFF;
    --line: #E5E7EB;
    --line-2: #EEF0F3;
    --text: #1F2328;
    --muted: #6B7280;
    --faint: #9CA3AF;
    --accent: #2F6FEB;
    --accent-weak: #EAF1FF;
    --accent-ink: #1E4FB8;
    --ok: #1B7F52;
    --ok-weak: #EFF8F3;
    --danger: #E5484D;
    --danger-weak: #FDECEC;
    --warn: #D97706;
    --note: #FFF8E1;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
    color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }

.boot { padding: 80px 16px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.ok { color: var(--ok); }
.danger { color: var(--danger); }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
.spacer { flex: 1; }
.show-sm { display: none; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------------- 按钮 / 表单 ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    height: 32px; padding: 0 12px; border-radius: 8px;
    border: 1px solid var(--line); background: var(--surface); cursor: pointer;
    white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: #F3F4F6; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #EEF0F3; }
.btn.sm { height: 28px; padding: 0 9px; font-size: 13px; }
.btn.icon { width: 32px; padding: 0; }
.btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.input, select.input, textarea.input {
    height: 34px; padding: 0 10px; border: 1px solid #D0D7DE; border-radius: 8px; background: #fff;
    outline: none; min-width: 0;
}
textarea.input { height: auto; padding: 8px 10px; resize: vertical; min-height: 72px; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.input.sm { height: 30px; }
label.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }

.field { display: grid; grid-template-columns: 76px 1fr; gap: 6px 10px; align-items: center; margin-bottom: 12px; }
.field > .lbl { color: #4B5563; }
.field > .lbl.top { align-self: start; padding-top: 7px; }
.hint { font-size: 12px; color: var(--faint); margin-top: 3px; }

.chip {
    display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border-radius: 999px;
    border: 1px solid #D0D7DE; background: #fff; cursor: pointer; user-select: none; font-size: 13px;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.tag {
    display: inline-block; padding: 0 7px; border-radius: 6px; font-size: 12px; line-height: 20px;
    background: #F3F4F6; color: #4B5563;
}
.tag.important { background: var(--danger-weak); color: #B42318; font-weight: 600; }
.tag.done { background: var(--ok-weak); color: var(--ok); }
.tag.doing { background: var(--accent-weak); color: var(--accent-ink); }
.tag.cancel { background: #F3F4F6; color: var(--faint); }

/* ---------------- 顶栏 ---------------- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 16px; padding: 0 20px; height: 56px;
    background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; white-space: nowrap; }
.brand .logo { width: 26px; height: 26px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
    padding: 7px 13px; border-radius: 8px; color: #4B5563; white-space: nowrap; text-decoration: none;
}
.tabs a:hover { background: #F3F4F6; }
.tabs a.active { background: var(--accent-weak); color: var(--accent-ink); font-weight: 600; }
.user { display: flex; align-items: center; gap: 10px; white-space: nowrap; }

/* 邮箱未验证：一直显示的红色提醒 */
.email-banner {
    display: flex; align-items: center; gap: 10px; padding: 9px 20px;
    background: #FDECEC; color: #B42318; border-bottom: 1px solid #F5C2C0; font-size: 13.5px;
}
.email-banner .btn { border-color: #E5484D; color: #B42318; background: #fff; }
.email-banner .btn:hover { background: #FFF5F5; }

.page { max-width: 1240px; margin: 0 auto; padding: 18px 20px 60px; }

/* 周期导航 */
.period {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px;
}
.period h2 { font-size: 20px; margin: 0 6px; }

/* ---------------- 卡片 ---------------- */
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 14px;
}
.card-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px 0; flex-wrap: wrap; }
.card-h h3 { font-size: 15px; }
.card-b { padding: 10px 14px 14px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.grid2 > * { min-width: 0; }

/* ---------------- 条目表格 ---------------- */
.table-wrap { overflow-x: auto; }
table.items { width: 100%; border-collapse: collapse; }
table.items th, table.items td { padding: 8px 8px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: middle; }
table.items th {
    font-weight: 500; color: var(--muted); font-size: 12.5px; white-space: nowrap; background: #FAFBFC;
    user-select: none; position: sticky; top: 0;
}
table.items th.sortable { cursor: pointer; }
table.items th.sortable:hover { color: var(--text); }
table.items th .arrow { color: var(--accent); margin-left: 2px; }
table.items tbody tr { cursor: pointer; }
table.items tbody tr:hover { background: #F7F9FC; }
table.items tbody tr.sel { background: var(--accent-weak); }
table.items tbody tr.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
table.items tr.group td { background: #FAFBFC; color: #374151; font-weight: 600; cursor: default; padding-top: 12px; }
table.items .seq { color: var(--muted); text-align: right; width: 34px; }
table.items .title { font-weight: 500; }
table.items tr.closed .title { color: var(--faint); text-decoration: line-through; }
table.items .sub { font-size: 12px; color: var(--faint); margin-top: 1px; }
table.items td.cb { width: 30px; }
table.items th.col-title { width: 40%; }
.bar { position: relative; height: 6px; border-radius: 3px; background: #EEF0F3; overflow: hidden; min-width: 70px; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--accent); }
.bar.ok > i { background: var(--ok); }
.empty { padding: 28px 10px; text-align: center; color: var(--faint); }

/* 目标小卡片 */
.goal-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.goal-chip {
    display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; min-width: 180px; max-width: 280px;
    border: 1px solid var(--line); border-radius: 8px; background: #FCFDFE; cursor: pointer;
}
.goal-chip:hover { border-color: var(--accent); }

/* ---------------- 日历 ---------------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .wh { text-align: center; color: var(--muted); font-size: 12px; padding: 2px 0; }
.cal .d {
    min-height: 66px; border: 1px solid var(--line-2); border-radius: 8px; padding: 5px 7px; cursor: pointer; background: #fff;
    display: flex; flex-direction: column; gap: 3px;
}
.cal .d:hover { border-color: var(--accent); }
.cal .d.other { background: #FAFBFC; color: var(--faint); }
.cal .d.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal .d .n { font-weight: 600; font-size: 13px; }
.cal .d .s { font-size: 11.5px; color: var(--muted); }

/* 一周七天 */
.week-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week-day { border: 1px solid var(--line-2); border-radius: 8px; padding: 8px; background: #fff; min-height: 120px; cursor: pointer; }
.week-day:hover { border-color: var(--accent); }
.week-day.today { border-color: var(--accent); }
.week-day ol { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; }
.week-day li.closed { color: var(--faint); text-decoration: line-through; }

/* ---------------- 拆解树 ---------------- */
.tree ul { list-style: none; margin: 0; padding-left: 22px; border-left: 1px dashed #D7DCE3; }
.tree > ul { padding-left: 0; border-left: none; }
.tree li { margin: 2px 0; }
.tree .node { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.tree .node:hover { background: #F5F8FF; }
.tree .node .tw { width: 18px; text-align: center; color: var(--muted); flex: none; }
.stat-list { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; font-size: 12.5px; }

/* ---------------- 附件 ---------------- */
.tiles { display: flex; flex-wrap: wrap; gap: 8px; }
.tile {
    position: relative; width: 92px; height: 92px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line);
    background: #F3F4F6; display: flex; align-items: center; justify-content: center; flex-direction: column;
    text-align: center; font-size: 11px; color: var(--muted);
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .ext { font-weight: 700; font-size: 15px; color: var(--accent-ink); }
.tile .nm { padding: 0 4px; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .x {
    position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: none;
    background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; display: none; line-height: 20px; padding: 0; font-size: 13px;
}
.tile:hover .x { display: block; }
.dropzone { border: 1.5px dashed #CBD5E1; border-radius: 10px; padding: 10px; background: #FAFBFC; }
.dropzone.over { border-color: var(--accent); background: var(--accent-weak); }
.progress { height: 4px; background: #E5E7EB; border-radius: 2px; overflow: hidden; margin-top: 6px; }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .15s; }

/* ---------------- 评论 ---------------- */
.comment {
    border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; background: #fff; cursor: pointer; margin-bottom: 6px;
}
.comment:hover { background: #F5F8FF; }
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; align-items: center; }
.rte-toolbar .btn { height: 28px; min-width: 30px; padding: 0 8px; }
.swatch { width: 20px; height: 20px; border-radius: 5px; border: 1px solid rgba(0, 0, 0, .2); cursor: pointer; padding: 0; }
.rte {
    min-height: 260px; max-height: 52vh; overflow: auto; border: 1px solid #D0D7DE; border-radius: 8px; padding: 10px 12px;
    outline: none; background: #fff; line-height: 1.7;
}
.rte:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.rte:empty::before { content: attr(data-placeholder); color: var(--faint); }
.rich { line-height: 1.75; word-break: break-word; }
.rich h1, .rich h2, .rich h3, .rich h4 { font-size: 17px; margin: 8px 0 4px; }
.rich p { margin: 0 0 6px; }
.rich blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid #D0D7DE; color: #4B5563; }

/* ---------------- 弹窗 ---------------- */
.mask {
    position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, .38);
    display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
}
.modal {
    width: 100%; max-width: 620px; background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
    display: flex; flex-direction: column;
}
.modal.wide { max-width: 860px; }
.modal-h { display: flex; align-items: center; gap: 8px; padding: 16px 20px 6px; }
.modal-h h3 { font-size: 17px; }
.modal-b { padding: 10px 20px 4px; }
.modal-f { display: flex; align-items: center; gap: 8px; padding: 12px 20px 18px; }
.section { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.section > .sh { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 600; }
.timeline { background: var(--ok-weak); color: var(--ok); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; margin-bottom: 12px; }
.preview { background: #F0F5FF; border-radius: 8px; padding: 8px 12px; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); padding: 30px 28px; }
.login h1 { font-size: 24px; }
.login .input { width: 100%; height: 40px; }

/* 提示 */
.toasts { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #1F2937; color: #fff; padding: 9px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); max-width: 90vw; white-space: pre-line; }
.toast.err { background: #B42318; }

/* ---------------- 打印（导出 PDF） ---------------- */
.print-only { display: none; }
.report h1 { font-size: 22px; margin-bottom: 4px; }
.report h2 { font-size: 16px; margin: 18px 0 6px; }
.report table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.report th, .report td { border: 1px solid #D0D7DE; padding: 5px 7px; text-align: left; }
.report th { background: #F3F4F6; }
.report .done { color: var(--ok); }
.report .lvl1 td:first-child { padding-left: 7px; }

@media print {
    html, body { background: #fff; }
    .modal, .modal.wide { max-width: none; width: 100%; }
    .no-print, .topbar, .toasts { display: none !important; }
    .print-only { display: block !important; }
    .mask { position: static; background: none; padding: 0; display: block; }
    .modal { box-shadow: none; max-width: none; }
    .report tr { break-inside: avoid; }
    /* 打印报告时只打报告本身 */
    body.printing .page, body.printing .topbar, body.printing .mask:not(.report-mask) { display: none !important; }
    body.printing .modal-b { padding: 0; }
}

/* ---------------- 手机 ---------------- */
@media (max-width: 900px) {
    .grid2 { grid-template-columns: minmax(0, 1fr); }
    .week-days { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .topbar { padding: 0 12px; gap: 8px; height: auto; flex-wrap: wrap; padding-top: 8px; padding-bottom: 6px; }
    .topbar .tabs { order: 3; width: 100%; }
    .brand span { display: none; }
    .page { padding: 12px 16px 60px; }
    .field { grid-template-columns: 1fr; }
    .field > .lbl.top { padding-top: 0; }
    .mask { padding: 0; }
    .modal { border-radius: 0; min-height: 100vh; }
    .cal .d { min-height: 52px; padding: 4px; }
    .cal .d .s { font-size: 10.5px; }
    .hide-sm { display: none; }
    .show-sm { display: block; margin-bottom: 2px; }
    table.items th.col-title { width: 100%; }
    table.items th, table.items td { padding: 8px 5px; }
}
