:root{ --blue:#2d6cdf; --green:#3aa76d; --red:#e74c3c; --gray:#999; --bg:#fafafa; }
*{ box-sizing: border-box; }
body{ margin:0; font:14px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC","Segoe UI", Roboto, "Helvetica Neue", Arial; color:#222; background:#fff; }
.topbar{ display:flex; align-items:center; justify-content:space-between; padding:12px 20px; border-bottom:1px solid #eee; }
.topbar .brand{ font-weight:600; }
.topbar .whoami{ color:#555; }
.topbar .logout{ color:#555; text-decoration:none; }
.container{ max-width:1200px; margin:0 auto; padding:16px; }
.footer{ text-align:right; color:#aaa; padding:8px 20px; border-top:1px solid #eee; background:#fff; }
.layout{ display:flex; gap:16px; }
.sidebar{ width:220px; border-right:1px solid #eee; padding-right:12px; }
.sidebar a{ display:block; padding:10px 8px; color:#222; text-decoration:none; border-radius:10px; }
.sidebar a.active{ background:#f3f6ff; color:#1a4fb0; }
.sidebar a.disabled{ color:#ccc; pointer-events:none; }
.content{ flex:1; }
h2{ font-size:18px; margin:8px 0 12px; }
table{ width:100%; border-collapse: collapse; }
th,td{ border-bottom:1px solid #f0f0f0; padding:10px; text-align:left; vertical-align:top; }
button, .btn{ background:var(--blue); border:none; color:#fff; padding:8px 12px; border-radius:8px; cursor:pointer; }
button.danger{ background:var(--red); }
button.tag{ background:#eef2ff; color:#1a4fb0; }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea { width:100%; padding:8px; border:1px solid #e6e6e6; border-radius:8px; background:#fff; }
.row{ display:flex; gap:8px; align-items:center; margin:8px 0; }
.col{ display:flex; gap:8px; flex-direction:column; max-width:680px; }
.hint{ color:#777; font-size:12px; }
.login{ display:flex; align-items:center; justify-content:center; gap:80px; min-height:100vh; background:var(--bg); }
.login .left-brand h1{ font-size:36px; margin:0 0 12px; }
.login .left-brand .line{ height:4px; width:180px; background:linear-gradient(90deg,#ff6b6b,#ffd93d,#6bcBef,#51cf66); border-radius:999px;}
.login .login-card{ background:#fff; padding:24px; border-radius:16px; box-shadow:0 6px 24px rgba(0,0,0,0.06); width:420px; }
.login .entry-buttons{ display:flex; flex-direction:column; gap:8px; margin-bottom:8px; }
.login .entry-buttons button{ width:100%; }
.login .select-row{ display:flex; gap:6px; align-items:center; }
.error{ color:#e74c3c; margin-top:8px; }
.thumb{ height:84px; border:1px solid #eee; border-radius:8px; }

/* ====== 积分管理：S 系数输入框变窄 ====== */
input[name="s_factor"],
input[name="scoef"],
input[name="s"],
input#s_factor,
input#scoef,
input#s,
input[type="number"] {
  width: 25% !important; /* 现在宽度的 1/4 */
  max-width: 140px !important;
  min-width: 88px !important;
  box-sizing: border-box;
  flex: 0 0 auto !important; /* 防止 flex 布局把它拉伸 */
}

/* ===== 积分导入页面：两行表单精细布局 ===== */
.points-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 16px;
  row-gap: 14px;
}

/* 统一标签宽度与对齐 */
.points-form label {
  width: 64px;
  text-align: right;
  color: #555;
}

/* 第1行控件：宽度更克制 */
.points-form select {
  width: 280px;
  max-width: 280px;
}

/* S 系数：保持窄 */
.points-form input[name="s_factor"] {
  width: 120px;
  max-width: 120px;
  box-sizing: border-box;
}

/* 第2行：文件选择区 */
.points-form input[type="file"] {
  max-width: 420px;
}

/* 换行分隔块 */
.points-form .full {
  flex-basis: 100%;
  height: 0;
}

/* 预览 + 提示 */
.points-form .actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.points-form .actions .hint {
  color: #666;
  font-size: 14px;
}

/* 窄屏自适应（≤640px）：纵向堆叠，控件全宽 */
@media (max-width: 640px) {
  .points-form label {
    width: auto;
    text-align: left;
  }
  .points-form select,
  .points-form input[name="s_factor"],
  .points-form input[type="file"] {
    width: 100%;
    max-width: 100%;
  }
}

/* === 表格类选择器（在现有全局 table 样式基础上增强） === */
.table { width: 100%; border-collapse: collapse; }

/* 紧凑模式：行内边距更小 */
.table-tight th, .table-tight td { padding: 6px 8px; }

/* 斑马纹：奇数行淡灰背景 */
.table-striped tbody tr:nth-child(odd) { background: #f9fafb; }

/* ===== 查询客户：筛选栏紧凑布局 ===== */
.filters{
  display:grid;
  grid-template-columns: 1fr 1fr 1fr auto; /* 三个控件 + 按钮 */
  gap: 12px 16px;
  align-items:center;
  margin-bottom: 12px;
}
.filters .filter{
  display:grid;
  grid-template-columns: auto 2fr; /* 标签 : 输入 = 1 : 2  （输入≈2/3宽）*/
  align-items:center;
  column-gap:8px;
  min-width: 240px; /* 防止过窄 */
}
.filters label{
  white-space:nowrap;
  font-weight: 500;
}
.filters select,
.filters input{
  width:100%;
  box-sizing:border-box;
  height: 34px;
  padding: 4px 8px;
}
.filters .actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
}
.filters .actions button{
  height: 34px;
  padding: 0 16px;
}

/* 响应式：窄屏改为两列或一列 */
@media (max-width: 1100px){
  .filters{ grid-template-columns: 1fr 1fr auto; }
}
@media (max-width: 820px){
  .filters{ grid-template-columns: 1fr; }
  .filters .actions{ justify-content:flex-start; }
}

/* === 修正：查询客户页面，小区下拉框高度对齐 input === */
.top-filters select {
  height: 40px;          /* 与输入框统一 */
  line-height: 40px;
  padding: 0 12px;
  box-sizing: border-box;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* === 修正：查询客户页面的小区下拉框高度 === */
#filters select[name="community"] {
  height: 44px !important;      /* 稍微比 input 高一点，保证视觉对齐 */
  line-height: 44px !important;
  padding: 0 12px !important;
  box-sizing: border-box;
}

/* === customers_query: 搜索条控件等高（最小影响域） === */
#customers-search .field { height: 40px; line-height: 40px; box-sizing: border-box; }
#customers-search select.field {
  padding: 0 10px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}
#customers-search input.field { padding: 0 10px; }

/* ===== customers_query 页面：查询条等高（只作用本页） ===== */
#customers-search{
  display: grid;
  grid-template-columns: 240px 1fr 1fr auto; /* 下拉 / 输入 / 输入 / 按钮 */
  gap: 12px;
  align-items: center; /* 垂直对齐 */
}

#customers-search .field{
  height: 44px !important;          /* 兜底统一高度 */
  box-sizing: border-box;
  padding: 0 12px;
  font-size: 14px;
  line-height: 44px;                 /* 对 input 生效，select 不依赖它 */
}

#customers-search select.field{
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;                  /* 降低系统样式差异 */
  background-clip: padding-box;
}
/* ===== customers_query 页面：修正 stats 与查询条重叠 ===== */
#customers-search{
  margin-bottom: 12px;      /* 给表单与下方统计留出间距 */
}
#customers-search + .stats{
  display: block;
  margin-top: 8px;
  clear: both;              /* 兜底，防止受旧版浮动/负边距影响 */
  position: relative;       /* 防止极端主题把它绝对定位 */
  z-index: 0;
}
/* ===== customers_query 页面：修正 stats 覆盖查询条（最终兜底） ===== */
#customers-search{
  display: grid;
  grid-template-columns: 240px 1fr 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;     /* 拉开与统计块的距离 */
  position: relative;      /* 创建层叠上下文 */
  z-index: 2;              /* 确保表单在 stats 之上 */
}
#customers-search .field{
  height: 44px !important;
  box-sizing: border-box;
  padding: 0 12px;
  font-size: 14px;
  line-height: 44px;
}
#customers-search select.field{
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-clip: padding-box;
}

/* 统计信息块：一定排在表单下方，且层级更低 */
#customers-search + .stats{
  display: block !important;
  margin-top: 4px;
  clear: both;
  position: relative;
  z-index: 0;              /* 比 #customers-search 低 */
}
/* ===== customers_query 页面：最终兜底，防止统计行覆盖搜索条 ===== */
#customers-search{
  margin-bottom: 16px;         /* 与统计行拉开距离 */
  position: relative;
  z-index: 2;                   /* 表单层级更高，保证可输入 */
}
/* 统计信息块：固定为正常文流中的块状元素，清除任何上浮/定位/负边距影响 */
#customers-search + .stats{
  display: block !important;
  position: static !important;
  float: none !important;
  clear: both !important;
  margin: 8px 0 0 0 !important;
  top: auto !important;
  left: auto !important;
  z-index: 0 !important;
}
/* ===== customers_query 页面：最终垫片，强制在表单下方留出空间 ===== */
#customers-search::after{
  content: "";
  display: block;
  height: 20px;         /* 需要更大就改 24/28 */
  clear: both;
}
/* 确保统计行是正常文流块级元素 */
#customers-search + .stats{
  display:block !important;
  position:static !important;
  margin:0 0 8px 0 !important;
  float:none !important;
  top:auto !important;
  left:auto !important;
  z-index:0 !important;
}
/* customers_query：把搜索条与汇总信息再拉开 */
#customers-search{ margin-bottom: 20px !important; }
#customers-search::after{ height: 28px !important; } /* 原来20px，改成28px */
/* customers_query：极简分页条 */
#customers-pager{ margin-top:16px; display:flex; gap:12px; align-items:center; }
#customers-pager .pager-form{ display:inline-block; }
#customers-pager .pager-info{ opacity:.8; font-size:14px; }
#customers-pager .btn[disabled]{ opacity:.5; cursor:not-allowed; }
/* === notices.html：“展示样式”单行 + 控件稍窄（最小影响域） === */
.notice-form-row { display:flex; align-items:center; gap:8px; flex-wrap:nowrap; }
.notice-form-row > label { white-space: nowrap; }          /* “展示样式”四字不换行 */
.notice-form-row .notice-style-input { width:240px; max-width:240px; }  /* 右侧选择框稍窄 */
/* === 强覆盖：notices.html “展示样式”行强制单行 & 控件定宽 === */
.notice-form-row { 
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: nowrap !important;
}
.notice-form-row > label { 
  white-space: nowrap !important; 
  margin-right: 8px !important;
  flex: 0 0 auto !important;
}
.notice-form-row select.notice-style-input {
  width: 240px !important;
  max-width: 240px !important;
  flex: 0 0 auto !important;
}
/* === notices.html：展示样式行使用两列网格，强制单行排列 === */
.notice-form-row {
  display: grid !important;
  grid-template-columns: max-content 260px !important; /* 左标签自适应，右侧控件260px */
  align-items: center !important;
  column-gap: 12px !important;
}
.notice-form-row > label {
  white-space: nowrap !important;
  margin: 0 !important;
}
.notice-form-row select.notice-style-input {
  width: 100% !important;      /* 占满右侧260px那一列 */
  max-width: 100% !important;
  display: block !important;
}
/* === notices.html 专用：展示样式行（保持单行、控件定宽） === */
.notice-form-row{
  display:grid;                 /* 左标签 + 右控件两列 */
  grid-template-columns:max-content 260px;
  align-items:center;
  column-gap:12px;
}
.notice-form-row > label{ white-space:nowrap; margin:0 8px 0 0; }
.notice-form-row select.notice-style-input,
.notice-form-row #display_type{
  width:100%; max-width:100%; display:block;  /* 占满右侧 260px 列 */
}

/* === Hotfix: customers_query 下拉框初始不可见（Safari 受 appearance:none 影响）=== */
/* 2025-09-16 */
#customers-search select.field{
  border: 1px solid #e6e6e6 !important;
  background: #fff !important;
  border-radius: 8px !important;
  outline: none;
}
#customers-search select.field:focus{
  border-color: #cfd3dc !important;
}

/* === Hotfix v2: 恢复本页下拉的系统外观，防止 appearance:none 造成初始不可见 === */
/* 2025-09-16 */
#customers-search select.field{
  -webkit-appearance: menulist !important;
  -moz-appearance: menulist !important;
  appearance: auto !important;
  border: 1px solid #e6e6e6 !important;
  background: #fff !important;
  border-radius: 8px !important;
  color: #222;
}
#customers-search select.field:focus{
  border-color: #cfd3dc !important;
  outline: none;
}

/* 表格中的选择框：保持原生尺寸，确保可点击 */
.table input[type="checkbox"]{
  width:auto;
  padding:0;
  border:none;
  border-radius:0;
  background:transparent;
  cursor:pointer;
  vertical-align:middle;
}
