/* ============ 日报系统 全局样式 ============ */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --success: #16a34a;
  --warning: #d97706;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --bg: #f1f5f9;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 14px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.container-narrow { max-width: 560px; margin: 0 auto; padding: 0 16px; }

/* ---------- 顶部导航 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-in {
  display: flex; align-items: center; gap: 16px;
  height: 58px;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 17px; }
.brand .logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  color: #fff; font-weight: 700; font-style: normal;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.nav { display: flex; gap: 4px; flex: 1; }
.nav-item {
  padding: 7px 14px; border-radius: 8px; color: var(--muted);
  font-size: 14px; font-weight: 500; white-space: nowrap;
}
.nav-item:hover { background: #f1f5f9; color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.user-box { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.u-name { color: var(--muted); font-size: 13px; }
.u-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.hide { display: none !important; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 8px;
  padding: 8px 16px; font-size: 14px; cursor: pointer;
  background: #fff; color: var(--text); border-color: var(--border);
  transition: all .15s; line-height: 1.4; user-select: none;
}
.btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f1f5f9; color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }

.icon-btn {
  border: none; background: transparent; color: var(--muted);
  width: 28px; height: 28px; border-radius: 6px; cursor: pointer; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: #f1f5f9; color: var(--primary); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field > label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 13px; color: #334155; }
.field .required::after { content: " *"; color: var(--danger); }
.input, .textarea, .select {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 14px; background: #fff; color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s; font-family: inherit;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.textarea { resize: vertical; min-height: 76px; }
.select { appearance: auto; }
.form-row { display: flex; gap: 12px; }
.form-row .field { flex: 1; }
.hint { color: var(--muted); font-size: 12px; }

/* ---------- 卡片 / 区块 ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 18px; }
.card-body.p0 { padding: 0; }

.page-head { margin: 20px 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-title { font-size: 20px; font-weight: 700; }

/* ---------- 表格 ---------- */
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { background: #f8fafc; color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }
.table .actions { white-space: nowrap; text-align: right; }

/* ---------- 标签 / 状态 ---------- */
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 500; line-height: 1.6;
}
.tag-green { background: #dcfce7; color: #15803d; }
.tag-red { background: #fee2e2; color: #b91c1c; }
.tag-blue { background: #dbeafe; color: #1d4ed8; }
.tag-gray { background: #f1f5f9; color: #475569; }

/* ---------- Tab ---------- */
.tabbar { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 10px; background: #fff; }
.tabbar .tab {
  padding: 11px 16px; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; white-space: nowrap;
}
.tabbar .tab.active { color: var(--primary); border-color: var(--primary); font-weight: 600; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fadeIn .18s;
}
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 520px;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25); animation: popIn .18s;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title { font-size: 16px; font-weight: 600; }
/* flex:1 + min-height:0 让内容区自行滚动，保证底部按钮始终可见、可点击 */
.modal-body {
  padding: 18px; overflow-y: auto; flex: 1 1 auto; min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 12px 18px; border-top: 1px solid var(--border);
  flex-shrink: 0; background: #fff; border-radius: 0 0 14px 14px;
}
.modal-close { border: none; background: none; font-size: 22px; color: var(--muted); cursor: pointer; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.modal-close:hover { background: #f1f5f9; color: var(--text); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(-8px) scale(.98); } }

/* ---------- 提示 ---------- */
.toast-box { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 999; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #0f172a; color: #fff; padding: 9px 18px; border-radius: 8px;
  font-size: 13px; box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
  animation: fadeIn .18s; max-width: 80vw;
}
.toast.success { background: #15803d; }
.toast.error { background: #b91c1c; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; color: var(--muted); padding: 36px 16px; }
.empty .empty-icon {
  width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 50%;
  background: #f1f5f9; display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #94a3b8;
}

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 45%, #06b6d4 100%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 18px;
  padding: 36px 32px; box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
}
.login-logo {
  width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 16px;
  background: linear-gradient(135deg, #2563eb, #06b6d4); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700;
}
.login-title { text-align: center; font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.login-tip { margin-top: 14px; text-align: center; color: var(--muted); font-size: 12px; }

/* ---------- 日期工具条 ---------- */
.date-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.date-bar .today-btn { font-weight: 600; }
.date-tag { font-size: 15px; font-weight: 600; min-width: 118px; text-align: center; }

/* ---------- 日报条目 ---------- */
.report-item { padding: 14px 18px; }
.report-item + .report-item { border-top: 1px solid var(--border); }
.report-top { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; }
.report-proj { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.report-ops { display: flex; gap: 2px; flex-shrink: 0; }
.report-sec { margin-top: 7px; font-size: 13.5px; color: #334155; white-space: pre-wrap; word-break: break-word; }
.report-sec .sec-label { color: var(--muted); font-weight: 600; margin-right: 6px; }
.report-plan { margin-top: 7px; }
.report-meta { margin-top: 8px; font-size: 12px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.hours-badge { background: var(--primary-light); color: var(--primary); padding: 1px 8px; border-radius: 12px; font-weight: 600; }

/* ---------- 日历 ---------- */
.cal-card { overflow: hidden; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; flex-wrap: wrap; }
.cal-month { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.cal-nav { display: flex; gap: 6px; align-items: center; }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  border-top: 1px solid var(--border);
  user-select: none;
}
.cal-wd {
  text-align: center; padding: 8px 0; font-size: 12px; color: var(--muted);
  background: #f8fafc; border-bottom: 1px solid var(--border); font-weight: 600;
}
.cal-wd.wkend, .cal-cell.wkend .cal-num { color: #94a3b8; }
.cal-cell {
  position: relative; min-height: 66px; padding: 6px; cursor: pointer;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  background: #fff; display: flex; flex-direction: column; gap: 3px;
  transition: background .12s;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: #f8fafc; }
.cal-cell.other { background: #fafbfc; }
.cal-cell.other .cal-num { color: #cbd5e1; }
.cal-cell.today .cal-num {
  background: var(--primary); color: #fff; border-radius: 50%;
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.cal-cell.selected { background: var(--primary-light); box-shadow: inset 0 0 0 1.5px var(--primary); }
.cal-num { font-size: 13px; color: var(--text); font-weight: 500; }
.cal-marks { display: flex; flex-wrap: wrap; gap: 3px; margin-top: auto; }
.cal-dot {
  font-size: 10px; padding: 0 5px; border-radius: 9px; line-height: 15px; font-weight: 600; white-space: nowrap;
}
.cal-dot.mine { background: var(--primary); color: #fff; }
.cal-dot.mine.hastext { padding: 0 6px; }
.cal-dot.others { background: #fef3c7; color: #b45309; }
.day-foot { display: flex; justify-content: center; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 8px 0; border-top: 1px solid var(--border); }

/* ---------- 列表小卡 ---------- */
.mini-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.mini-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: #fff; }
.mini-card .mc-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.mini-card .mc-body { font-size: 13px; color: #334155; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- 其他 ---------- */
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.flex { display: flex; align-items: center; gap: 8px; }
.spread { justify-content: space-between; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12px; }
.error-text { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; text-align: center; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 0 30px; }
.week-info { font-size: 12px; color: var(--muted); }

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .topbar-in { height: 52px; gap: 10px; }
  .brand b { display: none; }
  .nav-item { padding: 6px 10px; font-size: 13px; }
  .u-name { display: none; }
  .card-body { padding: 14px; }
  .report-item { padding: 12px 14px; }
  .cal-cell { min-height: 52px; padding: 4px; }
  .cal-num { font-size: 12px; }
  .cal-dot { font-size: 9px; }
  .form-row { flex-direction: column; gap: 0; }
  .page-title { font-size: 17px; }
  /* 弹窗：手机上更紧凑，内容超高时只在内容区滚动，按钮常驻 */
  .modal-mask { padding: 12px; }
  .modal { max-height: 86vh; }
  .modal-head { padding: 12px 14px; }
  .modal-body { padding: 14px; }
  .modal-foot { padding: 10px 14px; gap: 8px; }
}

/* ========== 项目任务(WBS)页 ========== */
.wbs-stats { display: flex; gap: 12px; margin: 0 0 14px; flex-wrap: wrap; }
.wbs-stat {
  flex: 1; min-width: 132px; background: #fff; border: 1px solid var(--line, #e6e9f0);
  border-radius: 10px; padding: 10px 16px; cursor: pointer; transition: box-shadow .15s;
}
.wbs-stat:hover { box-shadow: 0 2px 8px rgba(15, 23, 42, .06); }
.wbs-stat.active { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59, 130, 246, .15); }
.wbs-stat-label { font-size: 12px; color: #7c8698; }
.wbs-stat-num { font-size: 22px; font-weight: 700; color: #1f2a44; }
.wbs-stat-num.is-blue { color: #3b82f6; }
.wbs-stat-num.is-red { color: #ef4444; }
.wbs-stat-num.is-gray { color: #9aa4b5; }

/* 进度条 */
.wbs-prog {
  display: inline-block; vertical-align: middle; position: relative;
  width: 120px; height: 8px; background: #eef0f6; border-radius: 99px;
  overflow: hidden; margin-right: 8px;
}
.wbs-prog i {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px;
  background: #3b82f6; transition: width .2s;
}
.wbs-prog.ok i { background: #22a06b; }
.wbs-prog.mid i { background: #f59e0b; }
.wbs-prog.done i { background: #22a06b; }

/* 进度条 range 控件 */
input.range {
  width: 100%; accent-color: #3b82f6; margin: 6px 0 2px;
}

/* 任务弹窗摘要 */
.wbs-summary {
  background: #f6f8fc; border: 1px solid #eef1f7; border-radius: 8px;
  padding: 10px 12px; font-size: 14px; color: #1f2a44;
}

/* 进展历史条目 */
.wbs-log {
  padding: 10px 12px; border: 1px solid #eef1f7; border-radius: 8px;
  margin-bottom: 10px; background: #fff;
}
.wbs-log .flex { display: flex; justify-content: space-between; align-items: center; }
.wbs-log-content { margin-top: 6px; font-size: 14px; line-height: 1.6; color: #1f2a44; white-space: pre-wrap; word-break: break-all; }
.wbs-log-remark { margin-top: 4px; font-size: 13px; color: #7c8698; }

/* 任务按项目分组（可折叠） */
tbody.wbs-group { border-top: 1px solid var(--border); }
tbody.wbs-group tr.wbs-group-head td {
  background: #f6f8fc; padding: 9px 14px; cursor: pointer;
  user-select: none; font-size: 14px; color: #1f2a44;
}
tbody.wbs-group tr.wbs-group-head:hover td { background: #edf1f8; }
.wbs-arrow {
  display: inline-block; width: 0; height: 0;
  border-left: 6px solid #94a3b8;
  border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  margin-right: 9px; transition: transform .18s;
}
tbody.wbs-group.collapsed .wbs-arrow { transform: rotate(-90deg); }
tbody.wbs-group.collapsed tr:not(.wbs-group-head) { display: none; }
.wbs-group-sum { margin-left: 10px; font-size: 12px; color: #7c8698; font-weight: 400; }
.wbs-group-sum .is-blue { color: #3b82f6; }
.wbs-group-sum .is-red { color: #ef4444; }

/* ========== WBS 移动端（卡片式分组列表） ========== */
@media (max-width: 720px) {
  /* 页头按钮区可换行 */
  body[data-page="wbs"] .page-head > .flex { flex-wrap: wrap; justify-content: flex-end; }
  /* 统计卡 2 列 */
  body[data-page="wbs"] .wbs-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
  body[data-page="wbs"] .wbs-stat { min-width: 0; padding: 8px 12px; }
  body[data-page="wbs"] .wbs-stat-label { font-size: 11px; }
  body[data-page="wbs"] .wbs-stat-num { font-size: 19px; }
  /* 筛选：项目/状态各半行，责任人整行，「我的任务」+ 按钮各占一行 */
  body[data-page="wbs"] #fProject,
  body[data-page="wbs"] #fStatus { flex: 1 1 0; min-width: 0 !important; }
  body[data-page="wbs"] #fOwner { flex-basis: 100%; min-width: 0 !important; }
  body[data-page="wbs"] #mineWrap { flex: 1 1 100%; }
  body[data-page="wbs"] #btnSearch,
  body[data-page="wbs"] #btnReset { flex: 1; }
  /* 列表卡片容器去横滚、提示文案收起 */
  body[data-page="wbs"] .table-scroll { overflow: visible; }
  body[data-page="wbs"] .card-head { flex-wrap: wrap; }
  body[data-page="wbs"] .card-head .text-sm { display: none; }

  /* 项目分组块 */
  .wbs-mgroup + .wbs-mgroup { border-top: 8px solid #f1f5f9; }
  .wbs-mhead {
    display: flex; align-items: center; gap: 6px;
    padding: 13px 16px; background: #f8fafc; cursor: pointer;
    user-select: none; -webkit-tap-highlight-color: transparent;
  }
  .wbs-mhead .wbs-arrow { margin-right: 2px; flex-shrink: 0; }
  .wbs-mgroup.collapsed .wbs-arrow { transform: rotate(-90deg); }
  .wbs-mhead-main { flex: 1; min-width: 0; }
  .wbs-mname { display: block; font-weight: 700; font-size: 15px; color: #1f2a44; }
  .wbs-mstats { font-size: 12px; color: #7c8698; }
  .wbs-mstats .is-blue, .wbs-mstats .is-red { font-weight: 600; }
  .wbs-mgroup.collapsed > .wbs-card { display: none; }

  /* 任务卡片 */
  .wbs-card { background: #fff; padding: 12px 16px; border-bottom: 1px solid #eef1f7; }
  .wbs-card:last-child { border-bottom: none; }
  .wbs-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .wbs-card-owner { font-size: 13px; color: #334155; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
  .wbs-card-tel { color: #94a3b8; font-size: 12px; }
  .wbs-card-name { font-size: 15px; font-weight: 600; color: #1f2a44; margin-top: 8px; line-height: 1.5; word-break: break-word; }
  .wbs-my { padding: 0 6px; flex: none; }
  .wbs-card-lastprog {
    margin-top: 8px; font-size: 13px; color: #64748b; background: #f8fafc;
    border-left: 3px solid #cbd5e1; padding: 6px 9px; border-radius: 0 6px 6px 0;
    line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .wbs-card-meta { margin-top: 8px; font-size: 12px; color: #94a3b8; }
  .wbs-card-meta .is-red { color: #ef4444; font-weight: 600; }
  .wbs-card-prog { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
  .wbs-card-prog .wbs-prog { flex: 1; width: auto; margin-right: 0; height: 10px; }
  .wbs-card-prog > b { font-size: 13px; color: #1f2a44; min-width: 38px; text-align: right; flex: none; }
  .wbs-card-ops { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
  .wbs-card-ops .btn { flex: 1 1 calc(50% - 4px); padding: 9px 6px; font-size: 14px; }
  .wbs-card-ops .btn-danger { background: #fff; color: #dc2626; border-color: #fecaca; }
  .wbs-card-ops .btn-danger:active { background: #fef2f2; }
}
