:root {
  --primary: #1f4e8c;
  --primary-d: #163963;
  --bg: #f2f5f9;
  --panel: #ffffff;
  --line: #e2e8f0;
  --text: #1f2937;
  --muted: #6b7280;
  --danger: #d64545;
  --ok: #2f9e57;
  --warn: #d98a00;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif; color: var(--text); background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 15px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; width: 100%; background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }

.btn { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 9px 14px; font-size: 14px; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-d); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.sm { padding: 5px 9px; font-size: 13px; }
.btn.block { width: 100%; }
.tl-actions { margin-top: 8px; text-align: right; }

/* 登录 */
/* 注意：WebView/手机端 100vh 与可视区不一致且 flex 居中会裁切顶部，
   故用 100dvh 兜底 + overflow-y 可滚 + margin:auto 居中，保证任何屏都能看全 */
.auth-screen { min-height: 100vh; min-height: 100dvh; display: flex; overflow-y: auto; background: linear-gradient(135deg, #1f4e8c, #2f6fb0); padding: 16px; }
.auth-card { margin: auto; background: #fff; width: 100%; max-width: 380px; border-radius: 14px; padding: 26px 22px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-logo { text-align: center; margin-bottom: 18px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.auth-logo-img { width: 96px; height: 96px; object-fit: contain; display: block; }
.auth-logo-text { font-size: 22px; font-weight: 700; color: var(--primary); }
.auth-form { display: flex; flex-direction: column; gap: 11px; }
.auth-form .btn { margin-top: 4px; }
.auth-link { display: block; text-align: center; font-size: 13px; color: var(--primary); text-decoration: none; margin-top: 8px; }
.auth-link:hover { text-decoration: underline; }
.form-msg { font-size: 13px; min-height: 16px; color: var(--danger); }
.hint { font-size: 12px; color: var(--muted); margin: 0; }
.auth-ver { text-align: center; font-size: 12px; color: var(--muted); margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.dev-info { text-align: center; font-size: 10px; color: rgba(107,114,128,.7); margin-top: 6px; word-break: break-all; line-height: 1.5; }
.server-row { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.server-row label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 6px; }

/* 应用布局 */
.app-screen { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 30; height: 54px; background: var(--primary); color: #fff; display: flex; align-items: center; padding: 0 12px; gap: 10px; }
.topbar-title { font-weight: 600; font-size: 16px; flex: 1; }
.topbar-unit-sep { font-weight: 400; margin: 0 6px; opacity: .85; }
.topbar-unit { font-weight: 400; font-size: 12px; opacity: .9; }
.unit-switch { background: transparent; border: none; border-bottom: 1px dashed rgba(255,255,255,.7); color: #fff; font-size: 12px; outline: none; cursor: pointer; max-width: 200px; padding: 1px 2px; }
.unit-switch option { color: #333; }
.nav-toggle { background: transparent; border: none; color: #fff; font-size: 22px; display: none; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.bell { position: relative; background: transparent; border: none; font-size: 20px; }
.badge { position: absolute; top: -4px; right: -6px; background: var(--danger); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 5px; min-width: 16px; }
.tl-time { color: var(--primary); font-weight: 600; margin-left: 6px; }
.voice-btn { background: var(--primary); color: #fff; border: none; border-radius: 6px; cursor: pointer; }
.voice-btn:hover { background: var(--primary-d); }
.user-chip { font-size: 13px; }
.bell-wrap { position: relative; }
.notif-panel { position: absolute; top: 38px; right: 0; width: 240px; max-width: 85vw; max-height: 360px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.18); z-index: 60; }
.notif-item { padding: 8px 11px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif-item:hover { background: #f7f9fc; }
.notif-item .ni-kind { font-size: 11px; color: var(--primary); font-weight: 600; }
.notif-item .ni-title { font-size: 12px; margin-top: 1px; }
.notif-item .ni-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.notif-empty { padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }
.notif-header { padding: 10px 14px; font-weight: 600; font-size: 14px; border-bottom: 2px solid var(--line); background: #f7f9fc; border-radius: 10px 10px 0 0; }
.notif-sum { display: flex; flex-wrap: wrap; gap: 4px 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.notif-sum span { background: #fff7e6; border: 1px solid #ffe7ba; color: #d46b08; border-radius: 20px; padding: 1px 8px; }
.notif-sum b { font-size: 12px; }
.late-unread { background: #fff7e6; border: 1px solid #ffe7ba; color: #d46b08; border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; font-size: 13px; cursor: pointer; }
.late-unread:hover { background: #fff1d6; }
.late-unread b { font-size: 14px; }
.layout { display: flex; min-height: calc(100vh - 54px); }
.sidebar { width: 220px; background: var(--panel); border-right: 1px solid var(--line); padding: 10px; flex-shrink: 0; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar-install { margin-top: auto; padding-top: 12px; }
.sidebar-install .btn { font-size: 13px; text-align: center; }
.nav-item { position: relative; text-align: left; border: none; background: transparent; padding: 11px 12px; border-radius: 8px; font-size: 14px; color: var(--text); }
.nav-item:hover { background: #eef2f7; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-badge { position: absolute; top: 4px; right: 8px; min-width: 17px; height: 17px; line-height: 17px; padding: 0 4px; border-radius: 9px; background: #ff4d4f; color: #fff; font-size: 11px; text-align: center; box-shadow: 0 0 0 2px #fff; }
.nav-item.active .nav-badge { box-shadow: 0 0 0 2px var(--primary); }
.content { flex: 1; padding: 16px; overflow: auto; }

/* 卡片/面板 */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.panel h3 { margin: 0 0 12px; font-size: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.panel-head h3 { margin: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 140px; }
.field label { font-size: 12px; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; }
th { color: var(--muted); font-weight: 600; background: #f7f9fc; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; background: #eef2f7; color: var(--muted); }
.tag.ok { background: #e6f6ec; color: var(--ok); }
.tag.warn { background: #fdf3e0; color: var(--warn); }
.tag.danger { background: #fdeaea; color: var(--danger); }

/* 时间轴 */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.tl-item { position: relative; margin-bottom: 16px; }
.tl-item::before { content: ""; position: absolute; left: -21px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--primary); }
.tl-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.od-sel { margin: 0 0 6px 8px; cursor: pointer; }
.od-sel input { width: 16px; height: 16px; cursor: pointer; }
.tl-date { font-size: 12px; color: var(--muted); }
.tl-kind { font-size: 12px; font-weight: 700; color: var(--primary); }
.tl-when { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.tl-title { font-weight: 600; margin: 2px 0; }
.tl-imgs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tl-imgs img { width: 76px; height: 76px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.tl-imgs a { display: inline-block; }
.tl-img { cursor: zoom-in; }
#lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: none; align-items: center; justify-content: center; z-index: 9999; }
#lightbox img { max-width: 94vw; max-height: 94vh; object-fit: contain; border-radius: 4px; }
/* 移动端打印：长图预览，供长按保存/转发 */
#sheet-box { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 10000; background: rgba(0,0,0,.8); }
#sheet-box .sheet-mask { position: absolute; inset: 0; }
#sheet-box .sheet-panel { position: relative; background: #fff; border-radius: 8px; padding: 12px; max-width: 94vw; max-height: 92vh; display: flex; flex-direction: column; align-items: center; overflow: auto; }
#sheet-box .sheet-tip { font-size: 13px; color: var(--primary); margin-bottom: 8px; text-align: center; }
#sheet-box .sheet-img { max-width: 100%; height: auto; display: block; }
#sheet-box .sheet-close { margin-top: 10px; }
/* 打印图片：屏幕隐藏打印区，打印时只显示图片 */
#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; position: static; width: 100%; }
  /* 每张图片单独占一页，且不跨页截断 */
  #print-area .pa-page {
    page-break-after: always;
    break-after: page;
    page-break-inside: avoid;
    break-inside: avoid;
    text-align: center;
    margin: 0;
    padding: 0;
  }
  #print-area .pa-page:last-child { page-break-after: auto; break-after: auto; }
  #print-area .pa-page img { max-width: 100%; height: auto; display: block; margin: 0 auto; page-break-inside: avoid; break-inside: avoid; }
}
.tl-img-wrap { position: relative; display: inline-block; }
.tl-img-wrap .btn.xs { position: absolute; top: 2px; right: 2px; padding: 0 6px; font-size: 11px; line-height: 18px; border-radius: 4px; opacity: .9; }
.btn.xs { padding: 2px 8px; font-size: 12px; }
.tl-time { font-size: 12px; color: var(--muted); font-weight: 600; }
.tl-person { font-size: 12px; color: var(--muted); }
.tl-work { border-left: 4px solid var(--primary); }
.tl-life { border-left: 4px solid #2e9e6b; }
/* 中间轴时间轴：左工作 / 中轴(链接点) / 右生活 */
.tl-axis-head { display: flex; font-weight: 700; color: var(--muted); font-size: 13px; margin-bottom: 8px; padding: 0 4px; }
.tl-axis-head .tl-h-work { flex: 1; text-align: left; color: var(--primary); }
.tl-axis-head .tl-h-axis { flex: 0 0 120px; text-align: center; }
.tl-axis-head .tl-h-life { flex: 1; text-align: right; color: #2e9e6b; }
.tl-axis-wrap { position: relative; }
.tl-axis-wrap::before { content: ""; position: absolute; left: calc(50% + 60px); top: 0; bottom: 0; width: 2px; background: var(--line); }
.tl-row { display: flex; align-items: stretch; margin-bottom: 16px; }
.tl-side { flex: 1; min-width: 0; padding: 0 10px; }
.tl-side-left { text-align: right; }
.tl-side-right { text-align: left; }
.tl-axis-node { flex: 0 0 120px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 14px; position: relative; }
.tl-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--primary); margin-bottom: 4px; z-index: 1; }
.tl-dot-life { background: #2e9e6b; box-shadow: 0 0 0 2px #2e9e6b; }
.tl-axis-time { font-size: 12px; color: var(--muted); text-align: center; }
.tl-axis-time .tl-date { font-size: 12px; color: var(--muted); }
.tl-axis-time .tl-time { margin-left: 0; display: block; }
@media (max-width: 640px) {
  .tl-axis-head { display: none; }
  .tl-row { flex-direction: column; }
  .tl-axis-wrap::before { display: none; }
  .tl-axis-node { flex: 0 0 auto; flex-direction: row; gap: 6px; align-items: center; padding-top: 0; }
  .tl-side { padding: 0; text-align: left; }
  .tl-side-left { text-align: left; }
  .tl-axis-time .tl-time { display: inline; margin-left: 6px; }
  /* 手机竖屏信息框缩小，保证完整显示不超屏 */
  .notif-panel { width: 180px; max-width: 80vw; max-height: 45vh; }
  .notif-item { padding: 6px 9px; }
  .notif-item .ni-kind { font-size: 10px; }
  .notif-item .ni-title { font-size: 11px; }
  .notif-item .ni-sub { font-size: 10px; }
}

/* 工作日志列表单栏时间轴（轴线在左侧圆点处） */
.tl-axis { position: relative; padding-left: 22px; }
.tl-axis::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl-row { position: relative; }
.tl-row .tl-dot { position: absolute; left: -22px; top: 4px; margin: 0; }
@media (max-width: 640px) {
  .tl-axis { padding-left: 22px; }
}

/* 手机竖屏时提示横屏查看时间轴 */
.rotate-tip { display: none; }
@media (max-width: 640px) and (orientation: portrait) {
  .timeline-view .tl-axis-head,
  .timeline-view .tl-axis-wrap { display: none; }
  .rotate-tip {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 14px; padding: 40px 16px; text-align: center; color: var(--muted);
    border: 1px dashed var(--line); border-radius: 12px; margin-top: 12px; min-height: 220px;
  }
  .rotate-tip .rotate-ico { font-size: 54px; animation: rotspin 2.4s linear infinite; }
  .rotate-tip .btn { margin-top: 4px; }
}
@keyframes rotspin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* 图片网格 */
.img-grid { display: flex; gap: 6px; flex-wrap: wrap; }
.img-grid img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

/* 震屏 */
@keyframes shake { 0%,100%{transform:translate(0,0)} 20%{transform:translate(-8px,4px)} 40%{transform:translate(8px,-4px)} 60%{transform:translate(-6px,-3px)} 80%{transform:translate(6px,3px)} }
.shake { animation: shake .5s linear 0s 2; }
.alarm-overlay { position: fixed; inset: 0; background: rgba(214,69,69,.12); pointer-events: none; z-index: 50; }

.empty { text-align: center; color: var(--muted); padding: 30px; }
.person-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.person-pick .chip { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 6px 12px; font-size: 13px; }
.person-pick .chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .sidebar { position: fixed; left: 0; top: 54px; bottom: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; width: 200px; box-shadow: 2px 0 12px rgba(0,0,0,.15); }
  .sidebar.open { transform: translateX(0); }
  .split { grid-template-columns: 1fr; }
  .user-chip { font-size: 12px; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* 通用模态框 */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.modal-box { position: relative; width: min(520px, 92vw); max-height: 86vh; overflow: auto; background: var(--panel); border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal-title { padding: 14px 18px; font-size: 16px; font-weight: 700; border-bottom: 1px solid var(--line); }
.modal-body { padding: 16px 18px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); text-align: right; }

/* 图片选择预览与来源面板 */
.pick-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pick-thumb { position: relative; width: 72px; height: 72px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #f5f5f5; }
.pick-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pick-thumb a { display: block; width: 100%; height: 100%; cursor: zoom-in; }
.pick-del { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; line-height: 18px; padding: 0; border: none; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 14px; cursor: pointer; }
.overlay-center { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.45); }
.overlay-center.hidden { display: none; }
.img-picker { width: min(320px, 90vw); background: #fff; border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.img-picker-title { font-weight: 700; text-align: center; margin-bottom: 4px; }

/* 图片选择（下载/打印：全部或某一张） */
.pick-all { display: block; width: 100%; padding: 10px; border: 1px solid var(--primary); border-radius: 8px; color: var(--primary); font-weight: 600; text-align: center; cursor: pointer; background: #fff; }
.pick-all:active { opacity: .7; }
.pick-list { display: flex; flex-wrap: wrap; gap: 8px; max-height: 44vh; overflow: auto; }
.pick-item { width: 86px; text-align: center; border: 1px solid var(--line); border-radius: 8px; padding: 4px; cursor: pointer; background: #fff; }
.pick-item img { width: 100%; height: 76px; object-fit: cover; border-radius: 6px; background: #f5f5f5; display: block; }
.pick-item span { display: block; font-size: 12px; color: #555; margin-top: 4px; }
.pick-item:active { background: #f0f0f0; }
.pick-cancel { padding: 10px; border: none; border-radius: 8px; background: #eee; cursor: pointer; width: 100%; font-size: 14px; color: #555; margin-top: 2px; }
.pick-cancel:active { background: #ddd; }

/* 六件实事统计 */
.sf-stats-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.sf-ym { font-size: 13px; color: #888; }
.sf-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sf-unit-label { font-size: 13px; color: #666; }
.sf-unit-sel { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; background: #fff; color: var(--text); max-width: 60%; }
.sf-export-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; background: #f7f8fa; border: 1px solid var(--line); border-radius: 10px; }
.sf-exp-label { font-size: 13px; color: #666; font-weight: 600; }
.sf-exp-date { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff; color: var(--text); }
.sf-exp-tilde { font-size: 13px; color: #888; }
.sf-exp-name { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff; color: var(--text); width: 140px; }
.sf-exp-fact { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff; color: var(--text); }
.sf-exp-sep { color: #ccc; margin: 0 2px; }
.sf-stats-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 12px; }
.sf-stat { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 16px 10px; text-align: center; }
.sf-stat.clickable { cursor: pointer; }
.sf-stat.clickable:active { background: #f3f7ff; }
.sf-stat-num { font-size: 28px; font-weight: 700; color: var(--primary); }
.sf-stat-label { font-size: 13px; color: #777; margin-top: 4px; }
.sf-sub { font-size: 13px; color: #888; margin-bottom: 6px; }
.sf-defs { display: flex; flex-wrap: wrap; gap: 6px; }
.sf-back { margin-bottom: 10px; }
.sf-user-list { display: flex; flex-direction: column; gap: 8px; }
.sf-user-item { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 10px 14px; cursor: pointer; font-size: 14px; }
.sf-user-item:active { background: #f3f7ff; }
.sf-detail-item { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; background: #fff; }
.sf-detail-item.ok { border-left: 4px solid #52c41a; }
.sf-detail-item.no { border-left: 4px solid #fa8c16; }
.sf-detail-title { font-weight: 600; margin-bottom: 4px; }
.sf-log { border-top: 1px dashed var(--line); padding-top: 6px; margin-top: 6px; font-size: 13px; }
