/* ===== FH公司ERP系统 - 响应式样式（电脑端 + 手机端通用） ===== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f4f6fb;
  --sidebar-bg: #1e293b;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #2563eb;
  --card-bg: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --footer-bg: #1e293b;
  --footer-text: #94a3b8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }

/* ===== 布局 ===== */
.layout { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
  width: 230px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  transition: transform .25s ease;
  z-index: 1000;
}
.sidebar .brand {
  padding: 18px 20px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
  letter-spacing: 1px;
}
.sidebar nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: var(--sidebar-text);
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active {
  background: var(--sidebar-active);
  color: #fff;
  border-left-color: #fff;
}
.sidebar .side-foot {
  padding: 14px 20px;
  font-size: 12px;
  color: #64748b;
  border-top: 1px solid rgba(255,255,255,.08);
}

/* ===== 侧边栏时钟 ===== */
.side-clock {
  margin: 10px 16px 4px;
  padding: 14px 16px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  text-align: center;
  color: #ffffff;
}
.side-clock .ck-ym { font-size: 13px; color: #ffffff; }
.side-clock .ck-wd { font-size: 13px; color: #ffffff; margin-top: 2px; }
.side-clock .ck-d { font-size: 34px; font-weight: 700; line-height: 1.1; margin: 4px 0; color: #ffffff; }
.side-clock .ck-t { font-size: 16px; font-weight: 600; color: #ffffff; font-variant-numeric: tabular-nums; letter-spacing: 1px; }

/* 本月日期小日历 */
.side-clock .ck-cal {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  font-size: 11px;
}
.side-clock .ck-cal .ck-dow { color: #cbd5e1; font-size: 10px; padding-bottom: 2px; }
.side-clock .ck-cal .ck-day {
  color: #e2e8f0;
  padding: 3px 0;
  border-radius: 4px;
  line-height: 1;
}
.side-clock .ck-cal .ck-day.today { background: #2563eb; color: #fff; font-weight: 700; }
.side-clock .ck-cal .ck-day.muted { color: #64748b; }

/* 主区域 */
.main {
  flex: 1;
  margin-left: 230px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}
.topbar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 900;
}
.topbar .menu-btn {
  display: none;
  background: none; border: none; font-size: 22px;
  cursor: pointer; color: var(--text);
}
.topbar .page-title { font-size: 17px; font-weight: 600; flex: 1; }
.topbar .user-box { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.topbar .user-box .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
}
.topbar .logout-btn {
  background: #f1f5f9; border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.topbar .logout-btn:hover { background: #e2e8f0; }

.content { flex: 1; padding: 20px; min-width: 0; }

/* 卡片 */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
}
.card h2 { font-size: 16px; margin-bottom: 8px; }
.placeholder {
  color: var(--muted);
  text-align: center;
  padding: 60px 20px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  margin-top: 16px;
}

/* 顶部统计格子（首页占位） */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.stat {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 6px; }

/* 遮罩（移动端侧边栏打开时） */
.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 999;
}

/* ===== 底部备案号 ===== */
.site-footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  text-align: center;
  padding: 14px 16px;
  font-size: 13px;
}
.site-footer a { color: var(--footer-text); }

/* ===== 登录页 ===== */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e293b 0%, #2563eb 100%);
  padding: 16px;
}
.login-card {
  background: #fff;
  width: 100%;
  max-width: 380px;
  border-radius: 14px;
  padding: 32px 28px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.login-card .logo {
  text-align: center; font-size: 22px; font-weight: 700; color: var(--primary);
  margin-bottom: 4px;
}
.login-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-card label { display: block; font-size: 13px; color: var(--text); margin: 14px 0 6px; }
.login-card input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; outline: none;
}
.login-card input:focus { border-color: var(--primary); }
.login-card button {
  width: 100%; margin-top: 22px; padding: 12px;
  background: var(--primary); color: #fff; border: none;
  border-radius: 8px; font-size: 15px; cursor: pointer; font-weight: 600;
}
.login-card button:hover { background: var(--primary-dark); }
.login-card .err { color: #dc2626; font-size: 13px; margin-top: 12px; min-height: 18px; text-align: center; }
.login-footer { text-align: center; color: var(--footer-text); font-size: 12px; margin-top: 18px; }

/* ===== 响应式：手机端 ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: 240px; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar .menu-btn { display: block; }
  .content { padding: 14px; }
  .card { padding: 18px; }
  .overlay.show { display: block; }
  .topbar .user-box .name-text { display: none; }
}

/* ===== 业务日志：进行的内容 自动滚动（统一固定速度）===== */
.bl-content-cell { width: 280px; max-width: 280px; overflow: hidden; white-space: nowrap; font-size: 13px; color: #374151; box-sizing: border-box; }
.bl-content-cell .marquee { display: inline-block; padding-left: 100%; will-change: transform; animation: blMarquee linear infinite; animation-duration: var(--mq-dur, 18s); }
.bl-content-cell:hover .marquee { animation-play-state: paused; }
@keyframes blMarquee { 0% { transform: translateX(0); } 100% { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce){ .bl-content-cell .marquee{ animation:none; padding-left:0; } }

/* 内容名称可点击 */
.bl-name-link { color: var(--primary); cursor: pointer; text-decoration: none; }
.bl-name-link:hover { text-decoration: underline; }

/* ===== 日期条：年月小字 + 滑动 ===== */
.daily-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.daily-head .bl-section-title { flex: 1 1 auto; }
.daily-wrap { width: 100%; min-width: 0; }
.date-nav { display: flex; align-items: stretch; gap: 6px; width: 100%; min-width: 0; max-width: 100%; }
.date-strip { flex: 1 1 0; min-width: 0; max-width: 100%; display: flex; gap: 8px; overflow-x: auto; padding: 8px 2px 12px; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; cursor: default; }
.date-arrow { flex: 0 0 auto; align-self: stretch; width: 30px; border: 1px solid var(--border); background: #fff; border-radius: 8px; font-size: 20px; line-height: 1; color: var(--primary); cursor: pointer; display: flex; align-items: center; justify-content: center; user-select: none; }
.date-arrow:hover { background: #eff6ff; }
.date-arrow:active { background: #dbeafe; }
.date-strip::-webkit-scrollbar { height: 6px; }
.date-strip::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.date-chip { position: relative; flex: 0 0 92px; min-width: 92px; text-align: center; padding: 7px 8px 9px; border: 1px solid var(--border); border-radius: 10px; background: #fff; cursor: pointer; user-select: none; }
.date-chip .dot { position: absolute; top: 5px; left: 5px; width: 7px; height: 7px; border-radius: 50%; background: #ef4444; }
.date-chip .d-year { font-size: 10px; color: #cbd5e1; line-height: 1.1; margin-bottom: 1px; }
.date-chip .d-ym { font-size: 11px; color: #94a3b8; line-height: 1.2; }
.date-chip .d-week { font-size: 12px; color: #64748b; margin-top: 1px; }
.date-chip .d-day { font-size: 19px; font-weight: 700; color: #0f172a; line-height: 1.1; margin-top: 1px; }
.date-chip.today { border-color: var(--primary); background: #eff6ff; }
.date-chip.today .d-day { color: var(--primary); }
.date-chip.active { outline: 2px solid var(--primary); }

/* ===== 进度详情弹窗 ===== */
#detailModal { display: none; }
#detailModal.show { display: flex; }
#detailModal .modal { max-width: 560px; }
.detail-row { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px dashed #e2e8f0; font-size: 14px; }
.detail-row .k { width: 92px; color: var(--muted); flex: 0 0 auto; }
.detail-row .v { flex: 1; color: #0f172a; white-space: pre-wrap; word-break: break-word; }
.detail-children { margin-top: 12px; }
.detail-children h4 { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.child-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.child-card .ch-name { font-weight: 600; }

/* 管理员视图：两个导航栏 */
.bl-nav { display: flex; gap: 8px; margin-bottom: 16px; }
.bl-nav-btn { padding: 8px 18px; border: 1px solid var(--border); background: #fff; border-radius: 8px; font-size: 14px; cursor: pointer; color: var(--muted); }
.bl-nav-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.bl-filters { display: flex; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.bl-filters label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.bl-filters select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
