* {
      box-sizing: border-box;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    }

    body {
      margin: 0;
      padding: 20px;
      background: #f5f5f7;
    }

    h1 {
      text-align: center;
      margin-bottom: 20px;
      font-size: 24px;
    }

    .container {
      max-width: 1300px;
      margin: 0 auto;
      background: #ffffff;
      border-radius: 12px;
      padding: 20px;
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
    }

    .form-section {
      margin-bottom: 24px;
      border-bottom: 1px solid #eee;
      padding-bottom: 16px;
    }

    .form-grid {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 12px 16px;
    }

    .form-item {
      display: flex;
      flex-direction: column;
      font-size: 13px;
    }

    .form-item label {
      margin-bottom: 4px;
      color: #333;
    }

    .form-item input,
    .form-item select {
      padding: 6px 8px;
      border-radius: 6px;
      border: 1px solid #ccc;
      font-size: 13px;
      outline: none;
    }

    .form-item input:focus,
    .form-item select:focus {
      border-color: #2b73ff;
      box-shadow: 0 0 0 2px rgba(43, 115, 255, 0.15);
    }

    .form-actions {
      margin-top: 12px;
      display: flex;
      gap: 10px;
      justify-content: flex-end;
      align-items: center;
      flex-wrap: wrap;
    }

    button {
      border: none;
      border-radius: 999px;
      padding: 8px 16px;
      font-size: 13px;
      cursor: pointer;
      transition: transform 0.05s ease, box-shadow 0.1s ease, opacity 0.2s ease;
      white-space: nowrap;
    }

    button:active {
      transform: scale(0.97);
      box-shadow: none;
    }

    .btn-primary {
      background: #2b73ff;
      color: #fff;
      box-shadow: 0 4px 10px rgba(43, 115, 255, 0.4);
    }

    .btn-secondary {
      background: #e5e5ea;
      color: #333;
    }

    .btn-danger {
      background: #ff3b30;
      color: #fff;
    }

    .toolbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 8px;
      font-size: 13px;
      gap: 8px;
      flex-wrap: wrap;
    }

    .toolbar input {
      max-width: 260px;
    }

    .filter-panel {
      margin-bottom: 10px;
      padding: 10px 12px;
      border-radius: 10px;
      background: #f8f8fb;
      border: 1px solid #eee;
      font-size: 12px;
    }

    .filter-row {
      display: grid;
      grid-template-columns: repeat(6, minmax(0, 1fr));
      gap: 8px 12px;
      margin-bottom: 8px;
    }

    .filter-item {
      display: flex;
      flex-direction: column;
      font-size: 12px;
    }

    .filter-item label {
      margin-bottom: 2px;
      color: #555;
    }

    .filter-item input,
    .filter-item select {
      padding: 4px 6px;
      border-radius: 6px;
      border: 1px solid #d0d0d7;
      font-size: 12px;
    }

    table {
      width: 100%;
      border-collapse: collapse;
      font-size: 12px;
      margin-top: 8px;
    }

    thead {
      background: #f2f2f7;
    }

    th,
    td {
      padding: 6px 6px;
      border-bottom: 1px solid #eee;
      text-align: left;
      white-space: nowrap;
    }

    th {
      font-weight: 600;
      color: #555;
    }

    tbody tr:nth-child(even) {
      background: #fafafa;
    }

    .status-badge {
      display: inline-flex;
      align-items: center;
      padding: 2px 8px;
      border-radius: 999px;
      font-size: 11px;
    }

    .status-on {
      background: #e6f5e9;
      color: #138000;
    }

    .status-off {
      background: #fdeaea;
      color: #c41c1c;
    }

    .empty-tip {
      text-align: center;
      padding: 20px 0;
      color: #999;
      font-size: 13px;
    }

    .thumb-img {
      width: 40px;
      height: 40px;
      object-fit: cover;
      border-radius: 6px;
      border: 1px solid #eee;
      cursor: pointer;
    }

    #imagePreview {
      margin-top: 4px;
      max-width: 80px;
      max-height: 80px;
      border-radius: 8px;
      border: 1px solid #eee;
      display: none;
    }

    .editing-label {
      color: #ff9500;
      font-size: 12px;
      margin-right: auto;
    }

    @media (max-width: 1100px) {
      .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
      .filter-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
      }
    }

    @media (max-width: 700px) {
      body {
        padding: 10px;
      }
      .form-grid {
        grid-template-columns: 1fr;
      }
      .filter-row {
        grid-template-columns: 1fr 1fr;
      }
      h1 {
        font-size: 20px;
      }
      table {
        font-size: 11px;
      }
    }

    @media (max-width: 480px) {
      .filter-row {
        grid-template-columns: 1fr;
      }
    }
    /* ===== 登录条（商务版） ===== */
.login-bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:16px;
  padding:12px 16px;
  border-radius:12px;
  border:1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  flex-wrap:wrap;
}

[data-theme="dark"] .login-bar{
  background: color-mix(in srgb, var(--surface) 78%, #0b1220);
  box-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

.login-left{
  display:flex;
  align-items:center;
  gap:10px;
  min-width: 200px;
}

.login-title{
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.login-status{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-size:12px;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid var(--border2);
  background: color-mix(in srgb, var(--thead) 80%, transparent);
  color: var(--muted2);
  line-height: 1.2;
}

.login-status::before{
  content:"";
  width:7px;
  height:7px;
  border-radius:50%;
  background: currentColor;
  opacity:.75;
}

/* 状态（偏商务：克制、低饱和） */
.login-status.viewer{ color: var(--muted2); }
.login-status.editor{ color: #1f4ed8; background: rgba(31,78,216,0.10); border-color: rgba(31,78,216,0.22); }
.login-status.admin{ color: #0f7a2a; background: rgba(15,122,42,0.10); border-color: rgba(15,122,42,0.22); }

.login-center{
  flex: 1;
  display:flex;
  justify-content:center;
  min-width: 260px;
}

.login-center input{
  width: min(520px, 100%);
  height: 36px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  font-size: 13px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.login-center input::placeholder{
  color: var(--muted);
  opacity: .7;
}

.login-center input:focus{
  outline:none;
  border-color:#1f4ed8;
  box-shadow: 0 0 0 3px rgba(31,78,216,0.14);
}

.login-right{
  display:flex;
  align-items:center;
  gap:10px;
}

.login-right button{
  height: 36px;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 600;
}

.login-right .btn-primary{
  background: #1f4ed8;
  border: 1px solid #1f4ed8;
}

[data-theme="dark"] .login-right .btn-primary{
  background: #2b5ce8;
  border-color: #2b5ce8;
}

.login-right .btn-secondary{
  background: transparent;
  border: 1px solid var(--border);
}

.login-right button:hover{
  opacity: .96;
}

.login-right button:active{
  transform: translateY(0);
  opacity: .92;
}


/* 小屏适配 */
@media (max-width: 600px) {
  .login-bar{
    flex-direction: column;
    align-items: stretch;
  }

  .login-center{
    justify-content: stretch;
  }

  .login-center input{
    width: 100%;
  }

  .login-right{
    justify-content: flex-end;
    flex-wrap: wrap;
  }
}
  
/* ===== 主题（亮色/暗黑） ===== */
:root{
  --bg:#f5f5f7;
  --surface:#ffffff;
  --surface2:#f8f8fb;
  --text:#111827;
  --muted:#555;
  --muted2:#666;
  --border:#eee;
  --border2:#d0d0d7;
  --thead:#f2f2f7;
  --row-even:#fafafa;
  --btn-secondary-bg:#e5e5ea;
  --btn-secondary-text:#333;
  --shadow:0 10px 30px rgba(0,0,0,0.06);
  --shadow-soft:0 6px 20px rgba(0,0,0,0.05);
}

[data-theme="dark"]{
  --bg:#0b0f14;
  --surface:#111827;
  --surface2:#0f172a;
  --text:#e5e7eb;
  --muted:#a1a1aa;
  --muted2:#a1a1aa;
  --border:rgba(255,255,255,0.12);
  --border2:rgba(255,255,255,0.18);
  --thead:rgba(255,255,255,0.06);
  --row-even:rgba(255,255,255,0.03);
  --btn-secondary-bg:rgba(255,255,255,0.08);
  --btn-secondary-text:#e5e7eb;
  --shadow:0 10px 30px rgba(0,0,0,0.45);
  --shadow-soft:0 6px 20px rgba(0,0,0,0.35);
}

/* 使用变量覆盖现有配色（尽量不改原结构） */
body{ background: var(--bg); color: var(--text); }
h1, h2{ color: var(--text); }

.container{
  background: var(--surface);
  box-shadow: var(--shadow);
}
.form-section{ border-bottom: 1px solid var(--border); }

.form-item label{ color: var(--muted); }
.filter-item label{ color: var(--muted); }
th{ color: var(--muted); }

.login-bar{
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}
.login-title{ color: var(--text); }
.login-status.viewer{
  background: var(--thead);
  color: var(--muted2);
}

.filter-panel{
  background: var(--surface2);
  border: 1px solid var(--border);
}

thead{ background: var(--thead); }
tbody tr:nth-child(even){ background: var(--row-even); }

th, td{ border-bottom: 1px solid var(--border); }

.form-item input,
.form-item select,
.filter-item input,
.filter-item select,
.toolbar input,
.login-center input{
  background: rgba(255,255,255,0.85);
  color: #111827;
}
[data-theme="dark"] .form-item input,
[data-theme="dark"] .form-item select,
[data-theme="dark"] .filter-item input,
[data-theme="dark"] .filter-item select,
[data-theme="dark"] .toolbar input,
[data-theme="dark"] .login-center input{
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-color: var(--border2);
}

.form-item input,
.form-item select,
.filter-item input,
.filter-item select,
.toolbar input,
.login-center input{
  border: 1px solid var(--border2);
}

.btn-secondary{
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
}

.thumb-img{ border: 1px solid var(--border); }

[data-theme="dark"] .status-on{
  background: rgba(19,128,0,0.18);
  color: #86efac;
}
[data-theme="dark"] .status-off{
  background: rgba(196,28,28,0.18);
  color: #fca5a5;
}

  
/* ===== Toast 提示 ===== */
#pc-toast-box{
  position:fixed;top:20px;right:20px;z-index:99999;
  display:flex;flex-direction:column;gap:12px;
}
.pc-toast{
  min-width:220px;max-width:360px;
  padding:14px 18px;border-radius:14px;
  background:var(--surface);color:var(--text);
  box-shadow:0 12px 30px rgba(0,0,0,.25);
  display:flex;gap:10px;align-items:flex-start;
  animation:toastIn .25s ease-out;
}
.pc-toast.success{border-left:4px solid #22c55e}
.pc-toast.error{border-left:4px solid #ef4444}
@keyframes toastIn{
  from{transform:translateX(40px);opacity:0}
  to{transform:none;opacity:1}
}


/* ===== 表格滚动容器（方案一 + 表头固定 方案二）===== */
.table-wrapper{
  max-height:60vh;
  overflow:auto;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--surface);
}
.table-wrapper table{
  border-collapse:separate;
  border-spacing:0;
}
.table-wrapper thead th{
  position:sticky;
  top:0;
  z-index:3;
  background:var(--thead);
}
/* 滚动条优化 */
.table-wrapper::-webkit-scrollbar{width:8px;height:8px}
.table-wrapper::-webkit-scrollbar-thumb{
  background:rgba(0,0,0,.25);
  border-radius:4px;
}
[data-theme="dark"] .table-wrapper::-webkit-scrollbar-thumb{
  background:rgba(255,255,255,.25);
}



/* ===== Dense (信息密度更高) 布局覆盖 ===== */
:root{
  --hover-bg: rgba(0,0,0,0.03);
  --editing-outline: rgba(43,115,255,0.45);
}
[data-theme="dark"]{
  --hover-bg: rgba(255,255,255,0.06);
}

body{
  padding: 0;
  background: var(--bg);
}

/* 顶部吸顶栏：标题 + 登录 */
.app-header{
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.app-header-inner{
  max-width: 1500px;
  margin: 0 auto;
  padding: 12px 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 10px;
}
.app-title{
  margin: 0;
  width: 100%;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.8px;
  text-align: center;
  padding: 14px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255,255,255,0.78));
  border: 1px solid var(--border);
  border-bottom-color: rgba(0,0,0,0.10);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}


.login-bar{
  margin: 0;
  padding: 6px 8px;
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
}
.login-title{ font-size: 12px; }
.login-status{ font-size: 12px; padding: 2px 8px; }


/* 主体：左表单 + 右表格 */
.container{
  max-width: 1500px;
  margin: 10px auto 16px;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.container.no-edit{
  grid-template-columns: 1fr;
}
.container.no-edit #listSection{
  grid-column: 1 / -1;
}
#listSection{ min-width: 0; }

.section-title{
  font-size: 13px;
  margin: 0 0 10px;
  font-weight: 700;
}

/* 表单更紧凑 */
.form-section{
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}
.form-grid{
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
}
.form-item{ font-size: 12px; }
.form-item label{
  margin-bottom: 2px;
  font-size: 11px;
}
.form-item input,
.form-item select{
  padding: 5px 7px;
  font-size: 12px;
  border-radius: 8px;
}
.form-actions{ margin-top: 8px; gap: 8px; }

/* 左侧表单吸顶，减少来回滚动 */
@media (min-width: 1151px){
  #editSection{
    position: sticky;
    top: 64px;
    align-self: start;
    max-height: calc(100vh - 84px);
    overflow: auto;
  }
}

/* 工具栏/筛选更紧凑 */
.toolbar{
  margin-top: 0;
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 12px;
}
.toolbar input{
  padding: 5px 7px;
  font-size: 12px;
  border-radius: 8px;
}
.filter-panel{
  padding: 8px 10px;
  border-radius: 10px;
  margin-bottom: 8px;
}
.filter-row{ gap: 6px 10px; }
.filter-item label{
  margin-bottom: 2px;
  font-size: 11px;
}
.filter-item input,
.filter-item select{
  padding: 5px 7px;
  font-size: 12px;
  border-radius: 8px;
}

/* 表格更密 */
.table-wrapper{ max-height: 72vh; }
th, td{
  padding: 4px 6px;
  font-size: 12px;
}
tr:hover td{ background: var(--hover-bg); }

/* 备注允许换行（其它列仍保持紧凑） */
td.col-remark, th.col-remark{
  white-space: normal !important;
  max-width: 240px;
  line-height: 1.25;
}

/* 正在编辑的行高亮 */
tr.row-editing{
  outline: 2px solid var(--editing-outline);
  outline-offset: -2px;
  background: var(--hover-bg);
}

/* 操作按钮更小 */
.btn-primary,
.btn-secondary,
.btn-danger{
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 10px;
}
.btn-edit,
.btn-delete{
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 8px;
}

/* 分页栏：从内联样式迁移到 class */
.pagination{
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  font-size: 12px;
}

/* 小屏回到单列 */
@media (max-width: 1150px){
  .container{ grid-template-columns: 1fr; }
  #editSection{ position: static; max-height: none; overflow: visible; }
}


/* 标题独立占一行，登录条在下一行靠右 */
.app-header .login-bar{align-self: flex-end;}

/* 暗黑模式下抬头更沉稳 */
[data-theme="dark"] .app-title{
  background: linear-gradient(180deg, rgba(17,24,39,0.98), rgba(17,24,39,0.70));
  border-bottom-color: rgba(255,255,255,0.10);
  box-shadow: 0 8px 22px rgba(0,0,0,0.28);
}

/* 登录条独占一行（整行容器），内容靠右 */
.app-header .login-bar{
  width: 100%;
  align-self: stretch;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.06);
}
[data-theme="dark"] .app-header .login-bar{
  box-shadow: 0 6px 18px rgba(0,0,0,0.22);
}


/* =========================
   弹窗（高密度后台风格）
   ========================= */
body.modal-open{
  overflow: hidden;
}

.modal.hidden{ display: none; }

.modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: start center;
  padding: 14px 10px;
}

.modal-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.38);
  backdrop-filter: blur(2px);
}

.modal-dialog{
  position: relative;
  width: min(980px, 96vw);
  max-height: calc(100vh - 28px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.22);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,255,255,0.85));
  border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .modal-head{
  background: linear-gradient(180deg, rgba(17,24,39,0.98), rgba(17,24,39,0.78));
}

.modal-title{
  font-size: 14px;
  font-weight: 900;
  letter-spacing: .4px;
}

.modal-close{
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover{ filter: brightness(0.98); }
.modal-close:active{ transform: translateY(1px); }

.modal-body{
  padding: 10px 12px 12px;
  overflow: auto;
}

/* 弹窗里隐藏表单原本的 H2（用 modal-title 替代） */
.modal .form-section h2{ display: none; }

/* 弹窗内表单更紧凑一点 */
.modal .form-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.modal .form-actions{ padding-top: 10px; }


/* 表格：标题/内容居中显示（高密度后台） */
.table-wrapper table th,
.table-wrapper table td{
  text-align: center;
  vertical-align: middle;
}

.table-wrapper table td .btn-edit,
.table-wrapper table td .btn-del{
  margin-left: 4px;
  margin-right: 4px;
}
