/* ===== 待办事项工具 样式 ===== */
:root {
    --bg: #f2f4f8;
    --card: #ffffff;
    --line: #e5e9f0;
    --text: #1f2733;
    --muted: #8a94a6;
    --accent: #4f6ef7;
    --accent-dark: #3b5bdb;
    --danger: #e5484d;
    --danger-bg: #fdecec;
    --ok: #22a06b;
    --warn: #d9822b;
    --today: #e67e22;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
}

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

html, body { height: 100%; }

body {
    font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

/* ===== 顶栏 ===== */
.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--line);
    padding: 14px 24px 10px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar-inner {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
    width: 14px; height: 14px; border-radius: 4px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
}
.brand h1 { font-size: 18px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.today { color: var(--muted); font-size: 13px; }
.hint {
    max-width: 1440px; margin: 8px auto 0;
    color: var(--muted); font-size: 12px;
}
.hint kbd {
    background: #eef1f6; border: 1px solid #d6dbe6; border-bottom-width: 2px;
    border-radius: 4px; padding: 0 5px; font-size: 11px; font-family: inherit;
}

/* ===== 按钮 ===== */
.btn {
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
    background: #fff;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: #c9d1e0; background: #f8f9fc; }
.btn-sm { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
.btn-danger { color: var(--danger); border-color: #f3c6c8; background: #fff; }
.btn-danger:hover { background: var(--danger-bg); }
.icon-btn {
    border: none; background: none; font-size: 22px; line-height: 1;
    color: var(--muted); cursor: pointer; padding: 2px 6px;
}
.icon-btn:hover { color: var(--text); }

/* ===== 看板 ===== */
.board {
    max-width: 1440px;
    margin: 20px auto 120px;
    padding: 0 24px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}
@media (max-width: 1100px) { .board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .board { grid-template-columns: 1fr; padding: 0 12px; } }

.section {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.section-head {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    background: #fafbfd;
}
.section-head .dot { width: 10px; height: 10px; border-radius: 50%; }
.section-head h2 { font-size: 14px; font-weight: 600; }
.section-head .count {
    margin-left: auto;
    background: #eef1f6; color: var(--muted);
    font-size: 12px; border-radius: 999px; padding: 1px 9px;
}
.sec-sub {
    font-size: 11px; color: var(--muted);
    background: #f0f2f6; border-radius: 999px; padding: 1px 8px;
}
.section-body { padding: 10px; min-height: 120px; }
.section-empty {
    color: var(--muted); text-align: center; font-size: 12px;
    padding: 28px 10px;
    border: 1px dashed var(--line); border-radius: 8px;
}

/* ===== 任务卡片 ===== */
.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
    transition: box-shadow .15s, border-color .15s;
    position: relative;
}
.card:hover { box-shadow: 0 4px 14px rgba(16,24,40,.1); }
.card.flash {
    animation: flash 1.6s ease;
    border-color: var(--accent);
}
@keyframes flash {
    0%, 100% { box-shadow: var(--shadow); }
    20% { box-shadow: 0 0 0 3px rgba(79,110,247,.35); }
}
.card.done { opacity: .78; }
.card.done .card-title { text-decoration: line-through; color: var(--muted); }

.card-head { display: flex; align-items: flex-start; gap: 8px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; }
.card-title { font-weight: 600; font-size: 14px; word-break: break-all; flex: 1; }
.card-status {
    flex: none; font-size: 11px; border-radius: 5px; padding: 1px 7px;
    background: #eef1f6; color: var(--muted);
}
.card-status.s-in_progress { background: #e8ecfe; color: var(--accent); }
.card-status.s-done { background: #e2f5ec; color: var(--ok); }

.card-content { margin-top: 6px; color: #3d4757; font-size: 13px; white-space: pre-wrap; word-break: break-all; }
.card-meta { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.badge {
    font-size: 12px; border-radius: 6px; padding: 2px 8px;
    background: #f0f2f6; color: #55617a;
}
.badge.due-today { background: #fdf0e3; color: var(--today); }
.badge.overdue { background: var(--danger-bg); color: var(--danger); }
.badge.done-at { background: #e2f5ec; color: var(--ok); }
.card-note {
    margin-top: 8px; font-size: 12px; color: var(--muted);
    background: #f8f9fc; border-radius: 6px; padding: 6px 9px;
    border-left: 3px solid #d9dff0;
    white-space: pre-wrap; word-break: break-all;
}
.card-note b { color: #6b7688; font-weight: 600; }

.card-shot { margin-top: 8px; }
.card-shot img {
    max-width: 130px; max-height: 90px; border-radius: 6px;
    border: 1px solid var(--line); cursor: zoom-in; display: block;
}
.card-shot img:hover { opacity: .9; }

.card-actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.card-actions .btn { padding: 3px 10px; font-size: 12px; border-radius: 6px; }

/* ===== 浮球 ===== */
#fb { position: fixed; right: 24px; bottom: 24px; z-index: 50; }
.fb-ball {
    width: 58px; height: 58px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    box-shadow: 0 6px 20px rgba(79, 110, 247, .45);
    cursor: pointer;
    position: relative;
    transition: transform .15s;
}
.fb-ball:hover { transform: scale(1.06); }
.fb-ball::after {
    content: "";
    position: absolute; left: 50%; top: 50%;
    width: 16px; height: 16px;
    border: 2.5px solid #fff; border-top-color: transparent;
    border-radius: 50%;
    transform: translate(-50%, -60%);
}
.fb-count {
    position: absolute; top: -4px; right: -4px;
    min-width: 20px; height: 20px; line-height: 20px;
    text-align: center;
    background: var(--danger); color: #fff;
    border-radius: 999px; font-size: 12px; font-weight: 600;
    padding: 0 5px; border: 2px solid #fff;
}
.fb-panel {
    position: absolute; right: 0; bottom: 70px;
    width: 290px;
    background: #fff; border: 1px solid var(--line);
    border-radius: 12px; box-shadow: var(--shadow-lg);
    display: none;
    overflow: hidden;
}
.fb-panel.open { display: block; }
.fb-panel-head { font-weight: 600; padding: 12px 14px 2px; font-size: 14px; }
.fb-panel-sub { color: var(--muted); font-size: 12px; padding: 0 14px 8px; border-bottom: 1px solid var(--line); }
.fb-list { max-height: 300px; overflow-y: auto; padding: 6px; }
.fb-item {
    display: flex; flex-direction: column; gap: 2px;
    padding: 9px 10px; border-radius: 8px; cursor: pointer;
}
.fb-item:hover { background: #f4f6fb; }
.fb-item-title { font-size: 13px; font-weight: 500; word-break: break-all; }
.fb-item-due { font-size: 12px; color: var(--muted); }
.fb-item-due.overdue { color: var(--danger); }
.fb-empty { padding: 18px; text-align: center; color: var(--muted); font-size: 13px; display: none; }

/* ===== 弹窗 ===== */
.modal-mask {
    position: fixed; inset: 0; z-index: 60;
    background: rgba(16, 24, 40, .45);
    display: none;
    align-items: flex-start; justify-content: center;
    padding: 60px 16px;
    overflow-y: auto;
}
.modal-mask.open { display: flex; }
.modal {
    background: #fff; border-radius: 14px; width: 480px; max-width: 100%;
    box-shadow: var(--shadow-lg);
}
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px 0;
}
.modal-head h2 { font-size: 16px; }
.modal-body { padding: 14px 20px; }
.modal-foot {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 14px 20px 18px;
}

.shot-area {
    display: flex; align-items: center; gap: 12px;
    background: #f8f9fc; border: 1px solid var(--line);
    border-radius: 10px; padding: 10px; margin-bottom: 14px;
}
.shot-area img {
    max-width: 120px; max-height: 100px; border-radius: 6px;
    border: 1px solid var(--line);
}
.shot-meta { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.shot-meta span { font-size: 13px; color: var(--muted); }
.shot-meta span.working { color: var(--accent); }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: #55617a; margin-bottom: 6px; font-weight: 500; }
.field .field-tip { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 6px; }
.field input[type="text"],
.field input[type="date"],
.field input[type="time"],
.field textarea {
    width: 100%; padding: 9px 11px;
    border: 1px solid #d6dbe6; border-radius: 8px;
    font-size: 14px; font-family: inherit; color: var(--text);
    background: #fff; outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79,110,247,.12);
}
.field textarea { resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ===== 灯箱 ===== */
.lightbox {
    position: fixed; inset: 0; z-index: 70;
    background: rgba(10, 14, 24, .82);
    display: none;
    align-items: center; justify-content: center;
    padding: 30px;
    cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img {
    max-width: 92vw; max-height: 88vh;
    border-radius: 8px; box-shadow: 0 10px 50px rgba(0,0,0,.5);
}

/* ===== Toast ===== */
.toast-wrap {
    position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
    z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
    background: #1f2733; color: #fff;
    padding: 9px 18px; border-radius: 999px; font-size: 13px;
    box-shadow: var(--shadow-lg);
    animation: toast-in .25s ease;
}
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}
