* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  min-height: 100vh;
}

.view { min-height: 100vh; }

/* ---------- 登录页 ---------- */
.login-view {
  display: flex;
  background: linear-gradient(180deg, #f8fafc, #eef2f7);
}

.login-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  min-height: 100vh;
  padding: 20px 0;
}

.role-list { display: flex; flex-direction: column; gap: 6px; padding: 0 12px; }

.role-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 12px;
  cursor: pointer;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  width: 100%;
  transition: 0.15s;
}
.role-card:hover { border-color: #3b82f6; background: #eff6ff; }
.role-card.active { border-color: #3b82f6; background: #eff6ff; }
.role-icon { font-size: 22px; flex-shrink: 0; }
.role-text { display: flex; flex-direction: column; gap: 2px; }
.role-name { font-weight: bold; font-size: 14px; }
.role-desc { font-size: 11px; color: #64748b; }

.login-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  width: 480px;
  max-width: 92vw;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 36px;
  text-align: center;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
}

.login-box h1 { font-size: 24px; color: #3b82f6; margin-bottom: 6px; }
.subtitle { color: #64748b; font-size: 13px; margin-bottom: 24px; }

.login-form { margin-top: 24px; text-align: left; }

.register-admin-entry { margin-top: 18px; font-size: 12px; color: #64748b; text-align: center; }
.link-btn {
  background: none;
  border: none;
  color: #3b82f6;
  cursor: pointer;
  font-size: 12px;
  text-decoration: underline;
  padding: 0;
}
.login-hint { font-size: 13px; color: #475569; margin-bottom: 10px; }

select, input[type=text], input[type=number], input[type=file], input[type=password] {
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  font-size: 13px;
  margin-bottom: 10px;
}
select:focus, input:focus { outline: none; border-color: #3b82f6; }

.btn {
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13px;
  cursor: pointer;
  font-weight: bold;
}
.btn-primary { background: #3b82f6; color: #ffffff; width: 100%; }
.btn-primary:hover { background: #2563eb; }
.btn-ghost { background: transparent; color: #475569; border: 1px solid #cbd5e1; }
.btn-ghost:hover { border-color: #3b82f6; color: #3b82f6; }
.btn-secondary { background: #e2e8f0; color: #1e293b; }
.btn-secondary:hover { background: #cbd5e1; }
.btn-add { margin-top: 8px; width: 100%; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ---------- 主应用 ---------- */
.app-view { display: flex; }

.app-sidebar {
  width: 200px;
  flex-shrink: 0;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  min-height: 100vh;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
}

/* 左下角个人设置 */
.sidebar-foot {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid #f1f5f9;
}
.sidebar-foot .nav-btn { color: #64748b; }
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 20px 20px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 12px;
}
.sidebar-logo-icon {
  font-size: 26px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.35));
}
img.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  display: block;
  border: 1px solid rgba(59, 130, 246, 0.28);
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
  filter: none;
}
.sidebar-logo-text { display: flex; flex-direction: column; line-height: 1.25; }
.sidebar-logo-brand {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #2563eb, #3b82f6 60%, #6366f1);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sidebar-logo-sub { font-size: 11px; color: #64748b; letter-spacing: 0.5px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; padding: 0 12px; flex: 1 1 auto; overflow-y: auto; }
.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #64748b;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  width: 100%;
}
.nav-btn:hover { color: #1e293b; }
.nav-btn.active { background: #eff6ff; color: #3b82f6; border-color: #bfdbfe; }

.app-content-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 12px 24px;
}
.header-right { display: flex; align-items: center; gap: 12px; }
.current-user { font-size: 13px; color: #475569; }

.app-main { padding: 26px 32px 40px; max-width: 1680px; margin: 0 auto; width: 100%; }

/* 客服页：记录表格放左侧，填写表单贴右侧 */
.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 18px;
  align-items: start;
}
.split-layout .split-main { min-width: 0; }
.split-layout .col-title { margin: 0 0 10px; font-size: 15px; color: #475569; }
.split-layout .split-side { margin-bottom: 0; }
.split-layout .table-wrap { max-height: calc(100vh - 230px); }
@media (max-width: 1200px) {
  .split-layout { grid-template-columns: 1fr; }
}

.panel { display: none; }
.panel.active { display: block; }

.panel h2 { color: #1e293b; margin-bottom: 4px; }

/* 记录页中间的二选一开关 */
.seg-switch {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 6px 0 18px;
}
.seg-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 24px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  font-size: 13px;
  cursor: pointer;
  transition: 0.15s;
  user-select: none;
}
.seg-item:hover { border-color: #bfdbfe; color: #2563eb; }
.seg-item.active { background: #eff6ff; border-color: #bfdbfe; color: #2563eb; font-weight: 700; }
.seg-item input { width: auto; margin: 0; accent-color: #3b82f6; }
.panel-desc { color: #64748b; font-size: 13px; margin-bottom: 16px; }
.panel h3 { margin: 20px 0 10px; color: #475569; font-size: 15px; }

.card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 13px; color: #475569; margin-bottom: 5px; }

/* 横向排布的表单：按行分组，每行 2~3 列 */
.form-grid { display: flex; flex-direction: column; gap: 14px; }
.form-grid-row { display: grid; gap: 16px; }
.form-grid-row.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-row.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .form-row { margin-bottom: 0; }
.form-grid .form-actions { margin-top: 2px; justify-content: center; }
.form-grid .form-actions .btn-primary { min-width: 160px; }
@media (max-width: 1100px) {
  .form-grid-row.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .form-grid-row.cols-2, .form-grid-row.cols-3 { grid-template-columns: 1fr; }
}
.req { color: #e11d48; }
.info-value { font-size: 15px; color: #1e293b; font-weight: bold; }

/* 个人信息：字段横向排一行的卡片 */
.profile-card { padding: 4px; }
.profile-grid { display: flex; flex-wrap: wrap; }
.profile-item {
  flex: 1 1 170px;
  min-width: 0;
  padding: 16px 22px;
  border-left: 1px solid #eef2f7;
}
.profile-item:first-child { border-left: none; }
.profile-label {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.profile-value {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
  word-break: break-word;
}
@media (max-width: 900px) {
  .profile-item { border-left: none; border-top: 1px solid #eef2f7; }
  .profile-item:first-child { border-top: none; }
}

.inline-group { display: flex; align-items: center; gap: 10px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #475569; white-space: nowrap; }
.checkbox-label input { width: auto; margin: 0; }
.inline-group input[type=text] { margin-bottom: 0; }
.inline-group select { margin-bottom: 0; flex: 1; min-width: 0; }

.upload-row .shot-preview {
  margin-top: 8px;
  max-width: 220px;
  max-height: 140px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  display: block;
}

.form-actions { margin-top: 16px; display: flex; gap: 10px; justify-content: flex-end; }
.form-actions .btn-primary { width: auto; }

.table-wrap {
  max-height: 70vh;
  overflow: auto;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 4px;
  scrollbar-width: thin;
  scrollbar-color: #3b82f6 #f1f5f9;
}
.table-wrap::-webkit-scrollbar { width: 8px; height: 8px; }
.table-wrap::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 8px; }
.table-wrap::-webkit-scrollbar-thumb { background: #3b82f6; border-radius: 8px; }
.table-wrap::-webkit-scrollbar-thumb:hover { background: #2563eb; }
.table-wrap thead th { position: sticky; top: 0; background: #ffffff; z-index: 1; }
.table-wrap .summary-bar { position: sticky; bottom: 0; background: #ffffff; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #f1f5f9; white-space: nowrap; }
th { color: #64748b; font-weight: normal; }
tbody tr:hover { background: #f8fafc; }

.mini-table { font-size: 12px; width: 100%; table-layout: fixed; }
.mini-table th, .mini-table td { padding: 6px 8px; white-space: normal; word-break: break-word; }
.mini-table thead { position: sticky; top: 0; background: #ffffff; }
.mini-table td:last-child, .mini-table th:last-child {
  white-space: nowrap;
  text-align: right;
}

/* 老板名单：第一列是可改的编号输入框 */
input.inline-edit-input {
  width: 130px;
  margin: 0;
  padding: 5px 8px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
}
#table-laoban-list td:nth-child(5) .action-link { margin-right: 8px; }
#table-laoban-list td:nth-child(4), #table-laoban-list th:nth-child(4),
#financeTable td:nth-child(4), #financeTable th:nth-child(4) {
  white-space: nowrap;
}

.person-search {
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  font-size: 12px;
  width: 100%;
}
.person-search:focus { outline: none; border-color: #3b82f6; }

.mini-table-wrap {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  scrollbar-width: thin;
  scrollbar-color: #3b82f6 #f1f5f9;
}
.mini-table-wrap::-webkit-scrollbar { width: 8px; }
.mini-table-wrap::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 8px; }
.mini-table-wrap::-webkit-scrollbar-thumb { background: #3b82f6; border-radius: 8px; }
.mini-table-wrap::-webkit-scrollbar-thumb:hover { background: #2563eb; }

.inline-add-form { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.inline-add-form input { margin-bottom: 0; }
.inline-add-form .btn-add { margin-top: 0; }

.thumb-link { color: #3b82f6; cursor: pointer; text-decoration: underline; font-size: 12px; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
}
.badge-pending { background: #f1f5f9; color: #64748b; }
.badge-approved { background: #dbeafe; color: #1d4ed8; }
.badge-rejected { background: #fee2e2; color: #dc2626; }
.badge-done { background: #f1f5f9; color: #475569; }

.manage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  align-items: start;
  gap: 18px;
  margin-bottom: 20px;
}
.manage-grid .card { margin-bottom: 0; }
.manage-grid h3 { margin-top: 0; }

.summary-bar {
  padding: 12px;
  color: #475569;
  font-size: 13px;
  border-top: 1px solid #f1f5f9;
  margin-top: 4px;
}
.summary-bar b { color: #3b82f6; }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 24px;
  width: 320px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.12);
}
.modal-box h3 { margin-bottom: 16px; color: #1e293b; }

.shot-preview-box { width: auto; max-width: 90vw; }
.shot-preview-box img { max-width: 100%; max-height: 70vh; border-radius: 8px; display: block; }

.action-link {
  background: none; border: none; color: #3b82f6; cursor: pointer; font-size: 12px; padding: 0;
  margin-right: 8px;
}
.action-link.danger { color: #e11d48; }

.empty-hint { color: #94a3b8; text-align: center; padding: 20px !important; }
.protected-tag { color: #94a3b8; font-size: 12px; }

.upload-row { border: 1px dashed transparent; border-radius: 8px; padding: 6px; transition: 0.15s; }
.upload-row.drag-over { border-color: #3b82f6; background: #eff6ff; }
.drop-hint { font-size: 12px; color: #94a3b8; margin: -4px 0 6px; }

.pager-bar {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 8px 4px; font-size: 12px; color: #475569;
}
.pager-bar b { color: #3b82f6; }
.pager-bar .btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 底部备案号 */
.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 6px 0;
  text-align: center;
  background: rgba(241, 245, 249, 0.92);
  border-top: 1px solid #e2e8f0;
  font-size: 12px;
  z-index: 50;
}
.site-footer a { color: #94a3b8; text-decoration: none; }
.site-footer a:hover { color: #3b82f6; }
body { padding-bottom: 30px; }
