* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: #f5f6f8; color: #1f2329; font-size: 14px; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, #c0291d, #9c2016); }
.login-card { background: #fff; border-radius: 12px; padding: 32px; width: 320px; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.login-card h1 { color: #c0291d; text-align: center; margin: 0 0 4px; font-size: 20px; }
.login-card .sub { text-align: center; color: #9aa0a6; font-size: 12px; margin-bottom: 20px; }

/* 布局 */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 176px; background: #fff; border-right: 1px solid #ececec; position: fixed; inset: 0 0 0 0; display: flex; flex-direction: column; }
.sidebar .logo { padding: 14px 12px; border-bottom: 1px solid #ececec; color: #c0291d; font-weight: 700; font-size: 13px; }
.sidebar nav { flex: 1; overflow: auto; padding: 6px 0; }
.sidebar nav button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: transparent; color: #4a4f55; font-size: 13px; }
.sidebar nav button.active { background: #fdeceb; color: #c0291d; font-weight: 600; }
.sidebar .me { border-top: 1px solid #ececec; padding: 10px 12px; font-size: 12px; color: #9aa0a6; }
.sidebar .me button { color: #c0291d; border: 0; background: transparent; padding: 0; margin-top: 4px; }

.content { margin-left: 176px; flex: 1; padding: 16px; max-width: 1100px; }

/* 通用控件 */
.btn { background: #c0291d; color: #fff; border: 0; padding: 7px 14px; border-radius: 6px; font-size: 13px; }
.btn:hover { background: #9c2016; }
.btn-ghost { background: #fff; border: 1px solid #d0d3d6; color: #4a4f55; padding: 6px 12px; border-radius: 6px; font-size: 13px; }
.card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.06); overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
th { background: #fafafa; color: #8a9099; font-weight: 500; white-space: nowrap; }
tr:hover td { background: #fcfcfc; }
.link { color: #c0291d; background: none; border: 0; padding: 0 6px; font-size: 13px; }
.link:hover { text-decoration: underline; }
.link-del { color: #d23; }
input.in, select.in, textarea.in { width: 100%; border: 1px solid #d0d3d6; border-radius: 6px; padding: 7px 10px; }
input.in:focus, select.in:focus, textarea.in:focus { outline: none; border-color: #c0291d; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.row > * { margin: 0; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.modal { background: #fff; border-radius: 10px; width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid #ececec; font-weight: 600; }
.modal-body { padding: 16px; }
.modal-foot { padding: 12px 16px; border-top: 1px solid #ececec; display: flex; justify-content: flex-end; gap: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; color: #8a9099; margin-bottom: 4px; }

/* 徽标 */
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; }
.badge-amber { background: #fff4e0; color: #b76e00; }
.badge-blue { background: #e6f0ff; color: #1a6fff; }
.badge-green { background: #e6f7ec; color: #1a9e4b; }
.badge-red { background: #fdeaea; color: #c0291d; }
.badge-purple { background: #f0e9ff; color: #7a3fd6; }
.badge-gray { background: #eef0f2; color: #6b7178; }

/* 照片 */
.photos { display: flex; flex-wrap: wrap; gap: 8px; }
.photo { width: 76px; height: 76px; border: 1px solid #eee; border-radius: 6px; overflow: hidden; position: relative; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo .x { position: absolute; top: 0; right: 0; background: #c0291d; color: #fff; font-size: 12px; padding: 0 5px; display: none; }
.photo:hover .x { display: block; }
.photo-add { width: 76px; height: 76px; border: 2px dashed #d0d3d6; border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #b0b4b8; font-size: 11px; cursor: pointer; }
.stat { border-radius: 8px; padding: 16px; color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.stat .n { font-size: 24px; font-weight: 700; }
.stat .t { font-size: 12px; opacity: .9; margin-top: 4px; }
.toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast div { padding: 8px 16px; border-radius: 6px; color: #fff; font-size: 13px; box-shadow: 0 4px 12px rgba(0,0,0,.15); }

/* 分类筛选按钮 */
.chip { background: #fff; border: 1px solid #d0d3d6; color: #4a4f55; padding: 5px 14px; border-radius: 16px; font-size: 13px; }
.chip:hover { border-color: #c0291d; color: #c0291d; }
.chip-on { background: #c0291d; border-color: #c0291d; color: #fff; }
.chip-on:hover { color: #fff; }

/* ===== 导航可收起（手机端抽屉） ===== */
.sidebar { transition: transform .22s ease; z-index: 50; }
.sidebar .logo { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nav-close { display: none; border: 0; background: transparent; color: #c0291d; font-size: 16px; line-height: 1; padding: 0 4px; }

/* 悬浮“菜单”按钮：导航收起时出现 */
.nav-fab { display: none; position: fixed; left: 10px; top: 10px; z-index: 55; width: 42px; height: 42px; border-radius: 10px; border: 1px solid #e3e5e8; background: #fff; color: #c0291d; font-size: 20px; line-height: 1; box-shadow: 0 2px 8px rgba(0,0,0,.10); }
.layout.nav-closed .nav-fab { display: block; }
.layout.nav-closed .sidebar { transform: translateX(-100%); }
.layout.nav-closed .content { margin-left: 0; }
.nav-backdrop { display: none; }

/* ===== 手机 / 窄屏适配 ===== */
@media (max-width: 820px) {
  .sidebar { width: 220px; transform: translateX(-100%); box-shadow: 0 0 24px rgba(0,0,0,.18); }
  .layout.nav-open .sidebar { transform: none; }
  .layout.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 48; }
  .layout.nav-open .nav-fab { display: none; }
  .nav-fab { display: block; }
  .nav-close { display: block; }

  .content { margin-left: 0 !important; padding: 56px 12px 24px; max-width: 100%; }
  .sidebar nav button { padding: 12px 14px; font-size: 14px; }
  th, td { padding: 7px 9px; }
  .form-grid { grid-template-columns: 1fr; }
  .modal { max-width: 100%; }
  .modal-mask { padding: 10px; }
  .login-card { width: 100%; max-width: 320px; }
  .card { overflow-x: auto; }
  .row { gap: 8px; }
  .btn, .btn-ghost { padding: 8px 14px; }
}

/* ===== 周计划：移动友好两行布局（星期窄列 + 任务占满 + 责任人/状态第二行） ===== */
.wk-list { display: block; }
.wk-row { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f1f1f1; }
.wk-row:last-child { border-bottom: 0; }
.wk-day { flex: 0 0 46px; font-weight: 600; color: #444; font-size: 13px; padding-top: 2px; }
.wk-main { flex: 1 1 auto; min-width: 0; }
.wk-task { white-space: pre-wrap; word-break: break-word; line-height: 1.65; color: #222; }
.wk-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 5px; }
.wk-person { color: #8a9099; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-empty .wk-task { color: #ccc; }
@media (max-width: 600px) {
  .wk-day { flex-basis: 38px; font-size: 12px; }
  .wk-task { font-size: 14px; }
}

/* ===== 周计划编辑弹窗：任务行两行布局（窄星期 + 任务 / 责任人 + 状态） ===== */
.wk-edit { border: 1px solid #e8eaed; border-radius: 8px; padding: 8px; margin-bottom: 8px; background: #fff; }
.wk-edit-top { display: flex; gap: 6px; align-items: flex-start; }
.wk-edit-bottom { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.wk-daysel { flex: 0 0 64px; width: 64px; min-width: 0; padding: 6px 2px; text-align: center; text-align-last: center; font-size: 14px; }
.wk-edit-bottom .link-del { padding: 2px 4px; }
@media (max-width: 600px) {
  .wk-daysel { flex-basis: 56px; width: 56px; font-size: 13px; padding: 6px 0; }
  .wk-edit { padding: 7px; }
  .wk-edit-bottom select { width: 96px !important; font-size: 13px; }
}

/* ===== 通知中心 ===== */
.notif-btn { display: flex; align-items: center; gap: 6px; width: 100%; margin: 6px 0 4px; padding: 9px 14px; border: 0; border-radius: 8px; background: #fff5e6; color: #b5560a; font-size: 14px; font-weight: 600; cursor: pointer; text-align: left; }
.notif-btn:hover { background: #ffe9cc; }
.notif-count { display: inline-block; min-width: 18px; padding: 0 5px; height: 18px; line-height: 18px; border-radius: 9px; background: #e8453c; color: #fff; font-size: 11px; text-align: center; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #1a9e4b; vertical-align: middle; }
