/* PC 端布局 */
.layout { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 218px; flex: none; background: var(--c-main); color: #fff;
  display: flex; flex-direction: column; padding: 16px 10px; overflow-y: auto;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
/* 品牌 Logo 图：白底托底，避免深色侧边栏把图压看不清 */
.sidebar .brand .logo {
  width: 34px; height: 34px; border-radius: 10px; background: #fff;
  object-fit: contain; padding: 3px; flex: none;
}
.sidebar .brand .nm { font-weight: 700; font-size: 14px; line-height: 1.25; }
.sidebar .brand .sub { font-size: 11px; color: #A9A9B8; }
.sidebar .menu-title { font-size: 11px; color: #8E8E9C; padding: 12px 10px 6px; }
.sidebar .nav-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 10px;
  cursor: pointer; font-size: 13.5px; color: #D6D6DE; margin-bottom: 2px; transition: all .16s;
}
.sidebar .nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar .nav-item.active { background: var(--c-accent); color: #fff; font-weight: 600; }
.sidebar .nav-item .ic { width: 18px; text-align: center; font-size: 15px; }
.sidebar .nav-item .bdg { margin-left: auto; background: #F2685F; color: #fff; border-radius: 10px; font-size: 11px; padding: 0 6px; }
.sidebar .nav-item.locked { color: #6E6E7C; opacity: .6; }
.sidebar .nav-item.locked:hover { background: rgba(255, 255, 255, .05); color: #9A9AA8; }
.sidebar .nav-item .lk { margin-left: auto; font-size: 11px; }
.role-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 20px; font-size: 12px; background: var(--c-accent-soft); color: var(--c-accent-ink); }
.sidebar .foot { margin-top: auto; font-size: 11px; color: #7C7C8B; padding: 10px; line-height: 1.7; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 58px; flex: none; background: #fff; border-bottom: 1px solid var(--c-line);
  display: flex; align-items: center; padding: 0 18px; gap: 14px;
}
.topbar .crumb { font-size: 15px; font-weight: 700; }
.topbar .crumb span { color: var(--c-text-3); font-weight: 400; font-size: 12px; margin-left: 6px; }
.biz-switch { display: flex; background: var(--c-bg); border-radius: 10px; padding: 3px; }
.biz-switch div {
  padding: 5px 12px; border-radius: 8px; cursor: pointer; font-size: 12.5px; color: var(--c-text-2); transition: all .18s;
}
.biz-switch div.on { background: #fff; color: var(--c-text); box-shadow: var(--shadow); font-weight: 600; }
.biz-switch div.on[data-biz="yangwan"] { color: #D9527A; }
.biz-switch div.on[data-biz="guanxu"] { color: #2A7F9E; }
/* 归属子业务线的账号：登录即锁定，不提供切换 */
.biz-switch.locked { background: transparent; padding: 0; }
.biz-lock {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--c-text-2); background: var(--c-bg); cursor: default;
}
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--c-text-2); position: relative; transition: background .18s;
}
.icon-btn:hover { background: var(--c-bg); }
.dot { position: absolute; top: 6px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--c-danger); border: 1.5px solid #fff; }

.view { flex: 1; overflow-y: auto; padding: 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.page-head h2 { font-size: 20px; }
.page-head .sub { color: var(--c-text-3); font-size: 12.5px; margin-top: 2px; }

/* 工作台 */
.welcome {
  background: linear-gradient(120deg, var(--c-main) 0%, var(--c-main-soft) 60%, var(--c-accent) 160%);
  color: #fff; border-radius: var(--r-lg); padding: 18px 22px; position: relative; overflow: hidden;
}
.welcome h2 { font-size: 20px; }
.welcome .sub { font-size: 12.5px; opacity: .82; margin-top: 4px; }
.welcome .stats { display: flex; gap: 26px; margin-top: 14px; position: relative; z-index: 2; }
.welcome .stats b { font-size: 22px; display: block; line-height: 1.2; }
.welcome .stats span { font-size: 12px; opacity: .8; }
.dash-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; align-items: start; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head h3 { font-size: 14.5px; display: flex; align-items: center; gap: 6px; }
.card-head .more { font-size: 12px; color: var(--c-text-3); cursor: pointer; }
.list-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--c-line);
}
.list-item:last-child { border-bottom: none; }
.list-item .t { font-size: 13px; line-height: 1.45; }
.list-item .s { font-size: 11.5px; color: var(--c-text-3); }

.todo-item { display: flex; gap: 10px; padding: 10px; border-radius: var(--r-sm); background: var(--c-bg); margin-bottom: 8px; align-items: center; }
.todo-item:hover { background: var(--c-accent-soft); }
.todo-item .tt { flex: 1; min-width: 0; }
.todo-item .tt .t { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.alert-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); margin-bottom: 6px; background: var(--c-bg); }
.alert-item.high { background: #FDECEA; }
.alert-item.mid { background: #FFF6EC; }

.proj-card { position: relative; overflow: hidden; }
.proj-card .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.proj-card .bar.yw { background: #FF9BB3; }
.proj-card .bar.gx { background: #54B8D8; }
.progress { height: 6px; border-radius: 6px; background: var(--c-bg); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 6px; background: var(--c-accent); transition: width .4s; }

/* 筛选条 */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.chips { display: inline-flex; background: #fff; border-radius: 10px; padding: 3px; box-shadow: var(--shadow); }
.chips div { padding: 5px 12px; border-radius: 8px; font-size: 12.5px; cursor: pointer; color: var(--c-text-2); }
.chips div.on { background: var(--c-accent-soft); color: var(--c-accent-ink); font-weight: 600; }
.search { width: 220px; position: relative; }
.search .input { padding-left: 32px; }
.search .ic { position: absolute; left: 10px; top: 9px; color: var(--c-text-3); }

/* 表格 */
.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
.tb th { text-align: left; font-weight: 600; color: var(--c-text-2); font-size: 12px; padding: 10px 10px; border-bottom: 1px solid var(--c-line); white-space: nowrap; }
.tb td { padding: 11px 10px; border-bottom: 1px solid var(--c-line); vertical-align: middle; }
.tb tr:hover td { background: #FCFCFD; }
.tb .act a { color: var(--c-accent-ink); cursor: pointer; margin-right: 10px; font-size: 12.5px; }

/* 看板 */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: start; }
.kanban .col { background: var(--c-bg); border-radius: var(--r-md); padding: 10px; min-height: 120px; }
.kanban .col h4 { font-size: 13px; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.kanban .col h4 .n { font-size: 11px; color: var(--c-text-3); font-weight: 400; }
.ktask { background: #fff; border-radius: var(--r-sm); padding: 10px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: grab; }
.ktask:active { cursor: grabbing; }
.ktask .t { font-size: 13px; }
.ktask .m { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 11.5px; color: var(--c-text-3); }
.ktask.drop-hint { outline: 2px dashed var(--c-accent); }

/* 文档库 */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.doc-card { background: #fff; border-radius: var(--r-md); padding: 14px; box-shadow: var(--shadow); cursor: pointer; transition: all .2s; position: relative; }
.doc-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.doc-card .fic { font-size: 26px; }
.doc-card .nm { font-size: 13px; margin-top: 6px; word-break: break-all; line-height: 1.45; height: 37px; overflow: hidden; }
.doc-card .mt { font-size: 11.5px; color: var(--c-text-3); margin-top: 4px; }
.folder-card { background: #fff; border-radius: var(--r-md); padding: 14px; box-shadow: var(--shadow); cursor: pointer; transition: all .2s; }
.folder-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.folder-card.locked { background: linear-gradient(180deg, #FFF7F9 0%, #fff 100%); }
.wm { position: relative; }
.wm-grid {
  position: absolute; inset: 0; pointer-events: none; opacity: .16; color: var(--c-main);
  font-size: 12px; transform: rotate(-18deg); overflow: hidden; line-height: 2.6; letter-spacing: 2px;
}

/* 时间轴 */
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--c-line); }
.timeline .node { position: relative; padding-bottom: 14px; }
.timeline .node::before { content: ''; position: absolute; left: -17px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--c-line); }
.timeline .node.done::before { background: var(--c-ok); border-color: var(--c-ok); }
.timeline .node.now::before { background: var(--c-accent); border-color: var(--c-accent); }

/* 登录页 */
.login-wrap { height: 100vh; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.login-wrap::before {
  content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, var(--c-accent-soft) 0%, transparent 68%); top: -120px; right: -80px;
}
.login-card { width: 400px; background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-hover); padding: 32px; position: relative; z-index: 2; }
.login-card h1 { font-size: 22px; }
.login-card .tip { font-size: 12px; color: var(--c-text-3); margin: 6px 0 20px; }
.demo-accounts { margin-top: 16px; border-top: 1px dashed var(--c-line); padding-top: 12px; }
.demo-accounts .row { justify-content: space-between; font-size: 12px; color: var(--c-text-2); cursor: pointer; padding: 3px 0; }
.demo-accounts .row:hover { color: var(--c-accent-ink); }

/* 通知面板 */
.pop-panel {
  position: absolute; top: 52px; right: 12px; width: 340px; background: #fff; border-radius: var(--r-md);
  box-shadow: var(--shadow-hover); z-index: 800; overflow: hidden;
}
.pop-panel .h { padding: 12px 14px; border-bottom: 1px solid var(--c-line); display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 13px; }
.pop-panel .b { max-height: 380px; overflow: auto; }
.pop-panel .n { padding: 10px 14px; border-bottom: 1px solid var(--c-line); font-size: 12.5px; }
.pop-panel .n.un { background: var(--c-accent-soft); }
.pop-panel .n .t { font-weight: 600; }
.pop-panel .n .c { color: var(--c-text-3); font-size: 11.5px; }

@media (max-width: 1180px) {
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr; }
  .grid.c4 { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- 手机端：侧边栏改抽屉 ---------- */
#menuBtn { display: none; }
.nav-mask { position: fixed; inset: 0; background: rgba(30, 30, 36, .42); z-index: 870; display: none; animation: fade .18s ease; }
.nav-mask.show { display: block; }

@media (max-width: 768px) {
  .layout { height: 100dvh; }
  #menuBtn { display: flex; flex: none; }

  /* 抽屉侧边栏 */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 258px; z-index: 880;
    transform: translateX(-100%); transition: transform .24s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, .24); padding-bottom: env(safe-area-inset-bottom);
  }
  .sidebar.open { transform: translateX(0); }
  .main { width: 100%; min-width: 0; }

  /* 顶栏压缩：标题省略、次要信息让位 */
  .topbar { height: 54px; padding: 0 12px; gap: 8px; }
  .topbar .crumb { font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .crumb span { display: none; }
  .role-chip { display: none; }
  .biz-switch { max-width: 42vw; overflow-x: auto; }
  .biz-switch div { padding: 4px 9px; font-size: 11.5px; white-space: nowrap; }
  /* 内联 min-width 的卡片（如项目看板）在窄屏放行，避免撑破屏幕 */
  .card[style*="min-width"] { min-width: 0 !important; }

  .view { padding: 12px; }
  .page-head { margin-bottom: 10px; }
  .page-head h2 { font-size: 17px; }

  /* 多列布局收敛为单列 */
  .dash-grid, .grid.c2, .grid.c3, .kanban { grid-template-columns: 1fr; }
  .grid.c4, .doc-grid { grid-template-columns: repeat(2, 1fr); }

  /* 宽表格横向滚动，不再撑破容器 */
  .card { padding: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tb { min-width: max-content; }
  .tb th, .tb td { padding: 9px 8px; }

  .search { width: 100%; }
  .filters { gap: 6px; }
  .welcome { padding: 14px 16px; }
  .welcome h2 { font-size: 17px; }
  .welcome .stats { gap: 18px; }
  .welcome .stats b { font-size: 19px; }

  /* 弹层与登录页自适应 */
  .login-card { width: calc(100% - 32px); padding: 24px; }
  .pop-panel { width: auto; left: 10px; right: 10px; }
  .dialog .dlg-head { padding: 14px 16px; }
  .dialog .dlg-body { padding: 16px; }
  .dialog .dlg-foot { padding: 10px 16px; }
  /* 窄屏上抽屉直接铺满，不然 520px 会把表单挤变形 */
  .drawer { width: 100% !important; }
  .drawer .dlg-body { padding: 16px; }
  .field.half { flex: 1 1 100% !important; }

  /* 触摸目标放大 */
  .btn { height: 36px; }
  .nav-item { padding: 12px 11px; }
}
