/* M1 项目与 Brief 工作台样式 */
h1 { margin: 0 0 16px; font-size: 22px; }
h2 { margin: 0 0 12px; font-size: 16px; }
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.spacer { flex: 1; }

table.grid { width: 100%; border-collapse: collapse; background: white; }
table.grid th, table.grid td { border: 1px solid #e3e8f2; padding: 10px 12px; font-size: 14px; text-align: left; vertical-align: top; }
table.grid th { background: #f0f4fa; font-weight: 600; white-space: nowrap; }
table.grid td.actions a { margin-right: 8px; }
table.grid form.inline { display: inline-flex; gap: 6px; align-items: center; margin-right: 8px; }

.btn { display: inline-block; padding: 7px 14px; border-radius: 6px; border: 1px solid #35507e; background: #1c3d6e; color: white; font-size: 14px; text-decoration: none; cursor: pointer; }
.btn:hover { background: #2a5292; color: white; }
.btn.secondary { background: white; color: #1c3d6e; }
.btn.secondary:hover { background: #eef3fb; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.danger { background: #a02b2b; border-color: #a02b2b; }
.btn.danger:hover { background: #b93838; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.badge-draft { background: #eef1f6; color: #475467; }
.badge-pending { background: #fff4e0; color: #9a5b00; }
.badge-approved { background: #e2f4e8; color: #176b37; }
.badge-published { background: #e0edff; color: #1c4fa1; }
.badge-progress { background: #e7e0ff; color: #4b32b8; }
.badge-done { background: #d9f2e5; color: #0d6a3f; }
.badge-archived { background: #ececec; color: #666; }
.badge-active { background: #e2f4e8; color: #176b37; }

form.panel { background: white; border: 1px solid #dfe5ef; padding: 20px; margin-bottom: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(280px, 1fr)); gap: 14px 24px; }
.form-grid label { display: block; font-size: 13px; color: #475467; margin-bottom: 4px; }
.form-grid input[type="text"], .form-grid input[type="number"], .form-grid input[type="datetime-local"],
.form-grid textarea, .form-grid select { width: 100%; padding: 7px 10px; border: 1px solid #cfd8e6; border-radius: 6px; font-size: 14px; box-sizing: border-box; font-family: inherit; }
.form-grid textarea { min-height: 64px; resize: vertical; }
.form-grid .full { grid-column: 1 / -1; }
.checkbox-row { display: flex; gap: 14px; flex-wrap: wrap; padding-top: 4px; }
.checkbox-row label { display: inline-flex; gap: 4px; align-items: center; font-size: 14px; color: #172033; margin: 0; }

.field-grid { display: grid; grid-template-columns: repeat(3, minmax(200px, 1fr)); gap: 12px 20px; }
.field-grid .item { border: 1px solid #eef1f6; background: #fafbfe; padding: 10px 12px; border-radius: 6px; }
.field-grid .item .k { font-size: 12px; color: #667085; margin-bottom: 4px; }
.field-grid .item .v { font-size: 14px; word-break: break-all; }
/* 三列固定 200px 在手机宽度下溢出、第三列被裁掉，窄屏改为自适应两列（更窄时一列）。 */
@media (max-width: 800px) {
  .field-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

.hint { border-radius: 6px; padding: 10px 14px; font-size: 14px; margin-bottom: 12px; line-height: 1.7; }
.hint.error { background: #fdecec; border: 1px solid #f2b8b5; color: #8f2020; }
.hint.conflict { background: #fff4e0; border: 1px solid #f4cf8e; color: #9a5b00; }
.hint.missing { background: #fdecec; border: 1px solid #f2b8b5; color: #8f2020; }
.hint.ok { background: #e9f7ef; border: 1px solid #b8e6c9; color: #176b37; }
.hint.note { background: #eef3fb; border: 1px solid #c9d8ef; color: #1c3d6e; }

.brief-parse-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.brief-parse-actions form { margin: 0; }
.brief-parse-actions button:disabled { cursor: wait; opacity: .65; }
.quick-entry-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.quick-entry-grid .btn { text-align: center; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 3px solid #c9d8ef; padding: 6px 0 6px 14px; margin-left: 6px; font-size: 14px; line-height: 1.7; }
.timeline li .meta { color: #667085; font-size: 12px; }
.section-row { display: flex; gap: 20px; flex-wrap: wrap; }
.section-row > section { flex: 1 1 340px; margin-bottom: 20px; }

/* Brief 详情页保持控制台的轻量层级：页面本身不再包一张整页卡片。 */
.page-ui > section.brief-detail {
  max-width: 100%;
  margin: 0;
  padding: 0 4px 28px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.brief-detail,
.brief-detail * { min-width: 0; }
.brief-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 4px 0 18px;
  border-bottom: 1px solid var(--line);
}
.brief-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
.brief-title-row h1 { max-width: 100%; margin: 0; overflow-wrap: anywhere; }
.brief-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.brief-copy-form { display: inline-flex; align-items: center; gap: 8px; }
.brief-copy-form input { width: 88px; max-width: 100%; }
.brief-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, .85fr);
  align-items: start;
  gap: 28px;
}
.brief-main,
.brief-aside { min-width: 0; }
.brief-section,
.quick-entry-card {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.brief-columns > .brief-main > .brief-section:first-child,
.brief-columns > .brief-aside > .brief-section:first-child { margin-top: 0; }
.brief-section h2,
.quick-entry-card h2 { margin-bottom: 14px; }
.brief-field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 24px;
  margin: 0;
}
.brief-field {
  padding: 11px 0 12px;
  border-bottom: 1px solid #edf1f5;
}
.brief-field dt,
.brief-kpi-row dt { margin-bottom: 4px; color: var(--text3); font-size: 12px; }
.brief-field dd,
.brief-kpi-row dd { margin: 0; color: var(--text); font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.brief-subvalue { display: block; margin-top: 2px; color: var(--text3); font-size: 12px; }
.brief-copy-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 24px; }
.brief-copy-field h3 { margin: 0 0 6px; font-size: 13px; color: var(--navy); }
.brief-copy-field p { margin: 0; line-height: 1.75; overflow-wrap: anywhere; white-space: pre-wrap; }
.brief-kpi-list { margin: 0; }
.brief-kpi-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 11px 0 12px; border-bottom: 1px solid #edf1f5; }
.brief-kpi-row dt { margin: 0; }
.brief-kpi-row dd { font-weight: 650; text-align: right; }
.brief-status-note { font-size: 13px; line-height: 1.65; }
.brief-transition-list { display: grid; gap: 10px; }
.transition-form { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.transition-controls { display: grid; grid-template-columns: auto minmax(88px, 100px) minmax(0, 1fr); align-items: center; gap: 8px; }
.transition-controls input { width: 100%; box-sizing: border-box; }
.transition-controls .transition-comment { min-width: 0; }
.brief-entry-note { margin-bottom: 12px; font-size: 13px; }
.brief-detail .quick-entry-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.brief-detail .quick-entry-grid .btn { width: 100%; box-sizing: border-box; text-align: center; }
.brief-records { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 28px; }
.brief-records > .brief-section { min-width: 0; }
.brief-detail .timeline { margin: 0; padding-left: 0; }
.brief-detail .timeline li { overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .quick-entry-grid { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  .brief-columns { grid-template-columns: 1fr; gap: 0; }
  .brief-columns > .brief-aside > .brief-section:first-child { margin-top: 22px; }
}

@media (max-width: 700px) {
  .brief-header { flex-direction: column; gap: 14px; }
  .brief-actions { justify-content: flex-start; }
  .brief-field-grid,
  .brief-copy-grid,
  .brief-records { grid-template-columns: 1fr; }
  .brief-detail .quick-entry-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .page-ui > section.brief-detail { padding-right: 0; padding-left: 0; }
  .brief-title-row h1 { font-size: 20px; }
  .brief-actions { width: 100%; }
  .brief-actions > a,
  .brief-copy-form { flex: 1 1 auto; }
  .brief-actions > a { min-width: 0; }
  .brief-copy-form { min-width: 180px; }
  .brief-copy-form input { flex: 1 1 auto; min-width: 0; }
  .transition-controls { grid-template-columns: 1fr; align-items: stretch; }
  .transition-controls .btn { width: 100%; }
}

/* 项目工作台：内容区上限 1560px，视口 <1600px 时十列表格开始互相挤压。
   操作列收窄为一个按钮宽，列内控件纵向排列并垂直居中，按钮/输入框撑满列宽，
   避免「采购管理员」等文字被截断；≥1600px 维持原有横向排列。
   表格同时保留最小列宽，挤压时在卡片内横向滚动，而不是把表头折成多行。 */
@media (max-width: 1599px) {
  .page-ui table.grid.projects-grid {
    /* 收紧左右内边距 + 保底列宽：表头保持单行，放不下时在卡片内横向滚动。 */
    min-width: 1060px;
  }

  .page-ui table.grid.projects-grid th,
  .page-ui table.grid.projects-grid td {
    padding-left: 8px;
    padding-right: 8px;
  }

  .page-ui table.grid.projects-grid td.actions {
    width: 116px;
    white-space: normal;
    vertical-align: middle;
    text-align: center;
  }

  .page-ui table.grid.projects-grid td.actions > * {
    width: 100%;
    margin: 0 0 6px;
    box-sizing: border-box;
  }

  .page-ui table.grid.projects-grid td.actions > :last-child {
    margin-bottom: 0;
  }

  .page-ui table.grid.projects-grid td.actions > form.inline {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-right: 0;
  }

  .page-ui table.grid.projects-grid td.actions > form.inline input,
  .page-ui table.grid.projects-grid td.actions > form.inline button {
    width: 100%;
    min-width: 0;
  }
}
