/* ============================================================
   瑞府维修 · 通用数据表样式（数据 / 备品 / 渗漏 共用）
   ============================================================ */

/* ---------- 基础重置 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, "Microsoft YaHei", sans-serif; background: #f5f7fa; color: #303133; font-size: 14px; -webkit-text-size-adjust: 100%; }

/* ---------- 页面容器 ---------- */
.page { padding: 0 0 24px; }

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  background: #fff; margin: 10px 12px 0; padding: 10px 12px;
  border-radius: 10px; border: 1px solid #e8ecf2;
}
.toolbar label { font-size: 12.5px; color: #7b8290; white-space: nowrap; }
.toolbar input[type=date], .toolbar input[type=text], .toolbar select {
  border: 1px solid #dce1e9; background: #fff; border-radius: 7px;
  padding: 6px 10px; font-size: 13px; color: #303133; outline: none; font-family: inherit;
}
.toolbar input:focus, .toolbar select:focus { border-color: #409eff; box-shadow: 0 0 0 2px rgba(64,158,255,.12); }
.toolbar .sp { flex: 1 1 0; min-width: 4px; }
.toolbar .hint { font-size: 12px; color: #a8abb2; }
.toolbar .stat { font-size: 12.5px; color: #7b8290; white-space: nowrap; }
.toolbar .stat b { color: #303133; font-size: 14px; }

.btn {
  border: 1px solid #dce1e9; background: #fff; color: #3d4450;
  border-radius: 7px; padding: 6px 14px; font-size: 13px; cursor: pointer;
  font-family: inherit; white-space: nowrap; transition: .15s;
}
.btn:hover { border-color: #b9c6d8; background: #f7f9fc; }
.btn.primary { background: #409eff; border-color: #409eff; color: #fff; }
.btn.primary:hover { background: #337ecc; }
.btn.green { background: #67c23a; border-color: #67c23a; color: #fff; }
.btn.green:hover { background: #529b2e; }
.btn.ghost { color: #7b8290; }
.btn:disabled { opacity: .45; cursor: default; }

/* ---------- 统计卡 ---------- */
.stats { display: flex; gap: 10px; margin: 10px 12px 0; flex-wrap: wrap; }
.stat-card {
  background: #fff; border: 1px solid #e8ecf2; border-radius: 10px;
  padding: 10px 18px; flex: 1 1 120px; min-width: 110px; text-align: center;
}
.stat-card .num { font-size: 22px; font-weight: 700; color: #409eff; line-height: 1.2; }
.stat-card .label { font-size: 11.5px; color: #909399; margin-top: 3px; }

/* ---------- 表格 ---------- */
.gt-wrap {
  margin: 10px 12px 0; background: #fff; border: 1px solid #e8ecf2;
  border-radius: 10px; overflow: auto; -webkit-overflow-scrolling: touch;
  box-shadow: 0 1px 3px rgba(16, 32, 64, .04);
}
table.gt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; table-layout: fixed; }

table.gt thead th {
  background: #f7f9fc; color: #5a6472; font-weight: 600; font-size: 12px;
  padding: 9px 10px; text-align: left; white-space: nowrap;
  border-bottom: 1px solid #e8ecf2; position: sticky; top: 0; z-index: 6;
  user-select: none;
}
table.gt thead th.sortable { cursor: pointer; }
table.gt thead th.sortable:hover { background: #eef4ff; color: #409eff; }
table.gt thead th .arw { font-size: 9px; opacity: .45; margin-left: 2px; }
table.gt thead th.nosort { cursor: default; }

/* 第二行：列筛选 */
table.gt tr.frow td {
  background: #fbfcfe; padding: 4px 5px; border-bottom: 1px solid #e8ecf2;
  position: sticky; z-index: 5;
}
table.gt tr.frow input, table.gt tr.frow select {
  width: 100%; min-width: 56px; border: 1px solid #e2e7ee; background: #fff;
  border-radius: 5px; padding: 3px 6px; font-size: 11.5px; color: #303133;
  outline: none; font-family: inherit;
}
table.gt tr.frow input::placeholder { color: #c3c8d1; }
table.gt tr.frow input:focus, table.gt tr.frow select:focus {
  border-color: #409eff; background: #fff; box-shadow: 0 0 0 2px rgba(64,158,255,.1);
}
table.gt tr.frow td.on input, table.gt tr.frow td.on select { border-color: #409eff; background: #f2f8ff; }

/* 单元格 */
table.gt tbody td {
  padding: 6px 10px; border-bottom: 1px solid #f0f3f8; color: #303133;
  vertical-align: middle; line-height: 1.45;
}
table.gt tbody tr:nth-child(even) { background: #fcfdff; }
table.gt tbody tr:hover { background: #f5f9ff; }
table.gt tbody tr.done td { color: #9aa1ac; }
table.gt tbody tr.done td.c-room { text-decoration: line-through; opacity: .7; }
table.gt tbody tr:last-child td { border-bottom: none; }

table.gt td.c-room { font-weight: 600; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.gt td.c-muted { color: #a8abb2; font-size: 12px; }
table.gt td.c-nowrap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.gt td.c-spare { color: #e6a23c; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.gt td.c-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 0; }

/* 固定首列 */
table.gt th.fix, table.gt td.fix {
  position: sticky; left: 0; z-index: 4; background: #fff;
  box-shadow: 1px 0 0 #e8ecf2;
}
table.gt thead th.fix { z-index: 7; background: #f7f9fc; }
table.gt tbody tr:nth-child(even) td.fix { background: #fcfdff; }
table.gt tbody tr:hover td.fix { background: #f5f9ff; }

/* 状态徽章 */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 10px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; cursor: pointer;
  border: 1px solid transparent; transition: .15s;
}
.badge:hover { filter: brightness(.96); }
.badge.done { background: #e8f6e3; color: #4e9c26; border-color: #cdebc0; }
.badge.todo { background: #fef4e6; color: #d08a1d; border-color: #f8e2bd; }

/* ---------- 行内编辑 ---------- */
td.ed { cursor: text; position: relative; }
td.ed:hover { background: #eef6ff; box-shadow: inset 0 0 0 1px #cfe4ff; }
td.ed::after {
  content: '✎'; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: #9dc4f0; opacity: 0; transition: .15s; pointer-events: none;
}
td.ed:hover::after { opacity: 1; }
td.ed.ro { cursor: default; }
td.ed.ro:hover { background: transparent; box-shadow: none; }
td.ed.ro::after { content: ''; }

td.editing { padding: 0 !important; box-shadow: inset 0 0 0 2px #409eff; background: #fff !important; }
td.editing input, td.editing select {
  width: 100%; border: none; outline: none; background: #fff;
  padding: 7px 9px; font-size: 13px; font-family: inherit; color: #303133;
  border-radius: 0; box-sizing: border-box;
}
td.editing select { cursor: pointer; }

td.saving { background: #fffbe6 !important; }
td.saved { animation: okflash .6s ease; }
@keyframes okflash { 0% { background: #e8f6e3; } 100% { background: transparent; } }

/* ---------- 分页 ---------- */
.pager { display: flex; justify-content: center; align-items: center; gap: 6px; padding: 14px 12px 0; flex-wrap: wrap; }
.pager button {
  min-width: 34px; height: 30px; padding: 0 10px; border: 1px solid #dce1e9;
  background: #fff; border-radius: 7px; font-size: 12.5px; color: #4a5160;
  cursor: pointer; font-family: inherit;
}
.pager button:hover:not(:disabled) { border-color: #409eff; color: #409eff; }
.pager button.cur { background: #409eff; border-color: #409eff; color: #fff; font-weight: 600; }
.pager button:disabled { opacity: .4; cursor: default; }
.pager .info { font-size: 12.5px; color: #909399; margin: 0 6px; }

/* ---------- 空状态 / toast ---------- */
.empty-row td { text-align: center; padding: 44px 12px !important; color: #a8abb2; font-size: 13px; }
.toast {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%) translateY(-8px);
  background: #303133; color: #fff; padding: 8px 18px; border-radius: 8px;
  font-size: 13px; z-index: 999; opacity: 0; transition: .25s; pointer-events: none;
  white-space: nowrap; max-width: 90vw; overflow: hidden; text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #f56c6c; }

/* ---------- 手机 ---------- */
@media (max-width: 767px) {
  .toolbar { margin: 8px 8px 0; padding: 9px 10px; gap: 6px; border-radius: 9px; }
  .toolbar .tilde { display: none; }
  .toolbar label { display: none; }
  .toolbar input[type=date] { width: calc(50% - 5px); min-width: 0; flex: 0 0 auto; }
  .toolbar .btn { padding: 5px 10px; font-size: 12px; }
  .toolbar .sp { flex: 1 1 100%; height: 0; min-width: 0; }
  .stats { margin: 8px 8px 0; gap: 6px; }
  .stat-card { padding: 8px 6px; min-width: 72px; flex: 1 1 0; }
  .stat-card .num { font-size: 18px; }
  .stat-card .label { font-size: 10.5px; }
  .gt-wrap { margin: 8px 8px 0; border-radius: 9px; }
  table.gt { font-size: 12.5px; }
  table.gt thead th { padding: 8px 8px; font-size: 11.5px; }
  table.gt tbody td { padding: 6px 8px; }
  .c-desc { max-width: 160px; }
  .toolbar .hint { display: none; }
}
