/* 事务助手基础层：壳布局、按钮、表单、列表、弹层、反馈。
   与 tokens.css 一起构成全站一致的骨架；业务页面只加局部样式。 */

* { box-sizing: border-box; }
html { background: var(--canvas); }
body {
  margin: 0;
  background: var(--canvas);
  font-family: var(--font-family);
  color: var(--ink);
  font-size: var(--font-body-size);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-weight: 660; letter-spacing: -0.7px; }
h2, h3 { font-weight: 610; }
a { color: var(--accent); }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

/* ---- 壳 ---- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-width); flex-basis: var(--sidebar-width);
  z-index: 30;
  border-right: 1px solid #e3e8e1;
  background: #eef2ed;
  padding: 24px 16px 20px;
  display: flex; flex-direction: column;
}
.workspace { margin-left: var(--sidebar-width); min-width: 0; width: calc(100% - var(--sidebar-width)); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px; margin-bottom: 22px; font-size: 18px; color: #234b3c; }
.brand-mark {
  display: grid; width: 37px; height: 37px; flex: none; place-items: center;
  color: #fff; background: var(--accent); border-radius: 11px; font-size: 21px; font-weight: 500;
}
.brand small { display: block; color: #6d7a70; font-size: 10px; letter-spacing: 1.6px; font-weight: 450; margin-top: 3px; }
.app-nav { display: block; }
.nav-group-label { font-size: 10px; letter-spacing: 1px; color: #737f76; margin: 17px 12px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 9px 13px; font-size: 13px; font-weight: 470; border-radius: 8px;
  border: 0; background: transparent; text-align: left; color: #4c5850; margin: 4px 0; cursor: pointer;
}
.nav-item:hover { background: #e6ece5; color: #2e5541; }
.nav-item.active { background: #dfe9df; color: #24503d; font-weight: 620; }
.nav-item .nav-count { margin-left: auto; }
.sidebar-bottom { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.env-badge {
  padding: 6px 10px; border: 1px solid #e8d9a8; border-radius: 6px;
  background: #fdf6e3; color: #8a7434; font-size: 11px;
}
.sidebar-account { border-top: 1px solid #dce4da; padding-top: 12px; font-size: 12px; color: #5c6b5f; }

.topbar {
  height: var(--topbar-height); min-height: var(--topbar-height);
  padding: 0 36px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 18px;
  background: #fff; position: sticky; top: 0; z-index: 25;
}
.topbar-left { display: flex; align-items: center; gap: 13px; font-size: 12px; color: #6d7a70; }
.topbar-left .current-page { color: #3d4a41; font-weight: 500; }
.content {
  /* 上下内边距以变量发布：需要“恰好占满一屏”的页面据此算自身高度（如需求页 .req-page）。
     改内边距只改这两个变量，窄屏断点同步改变量 */
  --content-pad-top: 32px;
  --content-pad-bottom: 48px;
  padding: var(--content-pad-top) 36px var(--content-pad-bottom);
  max-width: 1450px;
  margin: 0 auto;
}
.page-heading { display: flex; align-items: center; gap: 18px; margin-bottom: 27px; }
.page-heading h1 { font-size: var(--font-title-size); line-height: 1.3; letter-spacing: -0.7px; }
.page-heading p { font-size: 12px; line-height: 1.7; margin: 9px 0 0; color: var(--muted); }

/* ---- 按钮 ---- */
.btn {
  min-height: 36px; display: inline-flex; justify-content: center; align-items: center; gap: 6px;
  padding: 8px 13px; font-size: 12px; font-weight: 500; border-radius: var(--radius-control);
  cursor: pointer; background: #fff; color: #3f4c43; border: 1px solid #cdd7cd;
}
.btn:hover { background: #f4f7f1; border-color: #b9cbbd; color: #315b43; }
.btn.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { color: #5d6a63; background: transparent; border-color: transparent; }
.btn.ghost:hover { background: #edf2eb; color: var(--accent); }
.btn.small { min-height: 30px; font-size: 11px; padding: 5px 10px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- 共享工具类（优化批次 6 收编：原只在 calendar/requirements.css 定义，
   其他页跨页依赖其“碰巧已加载”；冷启动直链 #/reports、#/team 曾无样式） ---- */
.muted { color: var(--muted, #78857d); font-size: 12px; }

.module-loading {
  border: 1px dashed var(--line, #e5eae5);
  border-radius: 9px;
  background: #fafbf7;
  color: #94a18f;
  padding: 22px 24px;
  font-size: 13px;
}

.link-button {
  border: none; background: none; color: var(--accent, #276653); font-size: 12px;
  cursor: pointer; padding: 3px 4px; text-decoration: underline;
}
.link-button:disabled { color: #b0bab0; cursor: not-allowed; text-decoration: none; }

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}

/* ---- 表单 ---- */
.field { display: block; margin: 0 0 19px; font-size: 12px; color: #3d4a41; font-weight: 500; }
.field > span:first-child { display: block; margin-bottom: 8px; }
input, select, textarea {
  border: 1px solid #dce4da; border-radius: var(--radius-control); min-height: 38px;
  font-size: 13px; background: #fff; color: var(--ink); padding: 9px 11px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #72a58a; box-shadow: 0 0 0 3px #e7f0e9; }
textarea { resize: vertical; line-height: 1.75; min-height: 96px; }
.field-help { display: block; font-weight: 400; font-size: 11px; color: var(--muted); margin: 6px 0 0; }
.form-error { color: var(--danger); font-size: 12px; margin: 8px 0 0; }

/* ---- 列表 ---- */
.table-container { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); overflow: auto; box-shadow: var(--shadow); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; font-size: 11px; background: #f8faf5; color: #94a187; padding: 11px 14px; border-bottom: 1px solid #e8eee0; }
.data-table td { padding: 14px; border-bottom: 1px solid #ecf1e5; vertical-align: middle; }

/* ---- 状态与反馈 ---- */
.badge { font-size: 11px; border: 1px solid #e7ece3; border-radius: 5px; background: #f5f7f1; color: #73816f; padding: 3px 7px; }
.empty-state { color: #94a18f; font-size: 13px; line-height: 1.8; border: 1px dashed #dfe6da; border-radius: 9px; background: #fafbf7; padding: 25px; }
.notice { padding: 14px 16px; border-radius: var(--radius-control); background: #f3f6f0; border: 1px solid #e2e9df; color: #72826f; font-size: 12px; line-height: 1.75; }
.module-missing { border: 1px solid #e8ddcb; background: #fffaf2; color: #8a7434; border-radius: var(--radius); padding: 22px 24px; font-size: 13px; line-height: 1.9; }
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #264e3c; color: #fff; border-radius: 10px; padding: 13px 21px; font-size: 12px;
  box-shadow: 0 8px 30px #21372a1c; z-index: 100;
}

/* ---- 弹层 ---- */
.overlay { position: fixed; inset: 0; background: #25372c38; backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 90; }
.dialog { width: min(600px, calc(100vw - 48px)); max-height: calc(100vh - 60px); display: flex; flex-direction: column; background: #fff; border-radius: 16px; border: 1px solid #fff8; box-shadow: 0 24px 80px #15281b30; }
.dialog-header { padding: 24px 27px 19px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-header h2 { font-size: 20px; margin: 0; }
.dialog-header > .btn { flex: 0 0 auto; white-space: nowrap; } /* 标题再长也不把“关闭”挤成竖排 */
.dialog-body { padding: 24px 27px; overflow: auto; }
.dialog-footer { border-top: 1px solid var(--line); padding: 17px 27px; background: #fcfdfb; display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 1240px) {
  :root { --sidebar-width: 188px; }
  .sidebar { padding-inline: 12px; }
  .content { --content-pad-top: 28px; --content-pad-bottom: 40px; padding: var(--content-pad-top) 26px var(--content-pad-bottom); }
  .topbar { padding-inline: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---- 登录 / 待加入（AD 增量 2026-10-19）---- */
.auth-mode .app-nav { visibility: hidden; }
.auth-mode .sidebar-account { visibility: hidden; }
.auth-card {
  max-width: 380px; margin: 9vh auto 0; background: #ffffff;
  border: 1px solid #dce4da; border-radius: var(--radius); padding: 30px 32px;
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form h1 { font-size: 20px; margin: 0 0 4px; }
.auth-form .field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #5c6b5f; }
.auth-form input {
  border: 1px solid #cfd8cd; border-radius: 6px; padding: 9px 11px; font-size: 14px;
  background: #fbfcfb;
}
.auth-message { color: #a4483c; font-size: 13px; line-height: 1.6; }
.auth-help { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 2px 0 0; }
.auth-actions { display: flex; gap: 10px; margin-top: 6px; }
.join-card p { font-size: 13px; line-height: 1.8; margin: 8px 0; color: #42503f; }

/* ---- 外壳对齐原型终版：导航图标/选中点/账户/顶栏 ---- */
.nav-item .ui-icon { width: 18px; height: 18px; flex: none; display: inline-flex; }
.nav-item .ui-icon svg { display: block; width: 18px; height: 18px; }
.nav-item span { width: auto; text-align: left; line-height: 1.5; }
.nav-active-dot { width: 5px; height: 5px; border-radius: 50%; margin-left: auto; }
.nav-item.active .nav-active-dot { background: #3f765c; }

.sidebar-account { display: flex; align-items: center; gap: 9px; }
.sidebar-account .avatar {
  height: 32px; width: 32px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: #d9e6dc; color: #3d6651; font-size: 12px; font-weight: 600;
}
.sidebar-account .account-meta { min-width: 0; }
.sidebar-account strong { font-size: 12px; font-weight: 600; display: block; color: #3c4a41; }
.sidebar-account small { display: block; font-size: 10px; margin-top: 3px; color: #8b978d; }
.sidebar-account .btn { margin-left: auto; }

.topbar-left .breadcrumb-group { color: #6d7a70; font-size: 12px; }
.top-date { color: var(--muted); font-size: 11px; display: flex; align-items: center; }
.top-user-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: 999px; background: #eef3ec; color: #50665a; font-size: 12px;
}

/* ---- 批次 12：导航可收起（顶栏按钮切换，窄条只留图标） ---- */
.nav-toggle {
  border: 1px solid #dfe5df; background: #fff; color: #4c5850;
  width: 30px; height: 30px; border-radius: 7px; cursor: pointer;
  font-size: 14px; line-height: 1; margin-right: 10px; flex: none;
}
.nav-toggle:hover { background: #eef2ed; }
.nav-collapsed .sidebar { width: 56px; padding: 18px 8px 14px; }
.nav-collapsed .workspace {
  margin-left: 56px; width: calc(100% - 56px);
}
.nav-collapsed .brand > div:not(.brand-mark) { display: none; }
.nav-collapsed .brand { justify-content: center; padding: 0; }
.nav-collapsed .nav-group-label,
.nav-collapsed .sidebar-account,
.nav-collapsed .env-badge { display: none; }
.nav-collapsed .nav-item { justify-content: center; padding: 10px 0; gap: 0; }
.nav-collapsed .nav-item span { display: none; }

/* ---- 批次 14：页面级快捷菜单浮层（fixed，不受滚动容器裁剪） ---- */
.wp-pop-menu {
  position: fixed;
  z-index: 60;
  min-width: 150px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 5px;
  background: #fff;
  border: 1px solid #dfe3e8;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgb(30 38 49 / 14%);
}
.wp-pop-menu-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: #34383d;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.wp-pop-menu-item:hover { background: #f4f5f6; }
.wp-pop-menu-item.is-current { color: var(--accent, #276653); font-weight: 600; }
.wp-pop-menu-item.is-danger { color: #b3261e; }
.wp-pop-menu-section {
  padding: 7px 12px 3px;
  color: #8b929b;
  font-size: 12px;
  font-weight: 600;
  border-top: 1px solid #eef0f3;
}
.wp-pop-menu-section:first-child { border-top: 0; }
/* 多选筛选的复选行（需求页「阶段」多选，2026-11-23）：勾选后面板保持打开 */
.wp-pop-menu-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.wp-pop-menu-check input { flex: none; margin: 0; accent-color: var(--accent, #276653); }
.wp-pop-menu-check.is-checked { color: #1f2a24; font-weight: 600; }

/* ---- 分段排期弹窗（2026-11-24；需求页与团队日程页共用，表单脚本按需加载） ---- */
.req-part-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line, #e5eae5);
  border-radius: 8px;
}
.req-part-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.req-part-owner { color: var(--muted, #78857d); font-size: 12.5px; }
.req-part-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: #56665c;
  white-space: nowrap;
}
.req-part-date input[type="date"] { flex: none; min-width: 0; width: 150px; }
.req-part-actions .btn { min-height: 30px; }
