/* ============================================================
   邻借点管理后台 · 全局基础与布局框架
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-1);
  background: var(--bg-page);
}

/* ---------- 应用骨架：侧栏 + 主区 ---------- */
.app { display: flex; height: 100vh; overflow: hidden; }

/* 侧栏 */
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--bg-card);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
}
.sidebar .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
}
.logo-mark {
  width: 32px; height: 32px;
  background: var(--brand);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.logo-mark svg { width: 18px; height: 18px; }
.logo-text .t1 { font-size: 14px; font-weight: 600; color: var(--text-1); line-height: 1.3; }
.logo-text .t2 { font-size: 10px; color: var(--text-3); line-height: 1.3; }

.nav { padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 3px;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
  text-decoration: none;
  border: none; background: none;
  font-family: var(--font);
  text-align: left;
}
.nav-item svg { width: 16px; height: 16px; flex: none; }
.nav-item:hover { background: var(--bg-input); }
.nav-item.active { background: var(--brand-light); color: var(--brand); font-weight: 500; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  font-size: 11px;
  color: var(--text-3);
  border-top: 1px solid var(--border-light);
}

/* 主区 */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* 顶栏 */
.header {
  height: var(--header-h);
  flex: none;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 8px;
}
.crumbs { font-size: 13px; color: var(--text-3); display: flex; align-items: center; gap: 8px; flex: 1; }
.crumbs .cur { color: var(--text-1); }
.header-right { display: flex; align-items: center; gap: 16px; }
.bell { position: relative; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; cursor: pointer; }
.bell:hover { background: var(--bg-input); }
.bell svg { width: 18px; height: 18px; }
.bell .badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 14px; height: 14px;
  background: var(--error);
  color: #fff;
  font-size: 9px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}
.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
}
.user-name { font-size: 13px; color: var(--text-2); }

/* 内容区 */
.content { flex: 1; overflow-y: auto; padding: 16px 24px 24px; }

/* ---------- 通用卡片 ---------- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 16px;
}
.card + .card { margin-top: 16px; }
.card-title { font-size: 15px; font-weight: 600; color: var(--text-1); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head-sub { font-size: 12px; color: var(--text-3); font-weight: 400; margin-left: 8px; }

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 30px;
  padding: 0 14px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-2);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.btn-danger { background: var(--error); border-color: var(--error); color: #fff; }
.btn-danger:hover { background: #c03c35; border-color: #c03c35; color: #fff; }
.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; }
.link { color: var(--brand); font-size: 13px; cursor: pointer; background: none; border: none; font-family: var(--font); padding: 0; }
.link:hover { text-decoration: underline; }
.link-danger { color: var(--error); }
.link-success { color: var(--success); }
.link-warning { color: var(--warning); }

/* ---------- 通用标签 ---------- */
.tag {
  display: inline-flex; align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: var(--radius-tag);
  font-size: 12px;
  white-space: nowrap;
}
.tag-green { background: var(--success-bg); color: var(--success-deep); }
.tag-orange { background: var(--warning-bg); color: var(--warning); }
.tag-red { background: var(--error-bg); color: var(--error); }
.tag-blue { background: var(--brand-light); color: var(--brand); }
.tag-gray { background: var(--bg-input); color: var(--text-3); }

/* ---------- 输入控件 ---------- */
.input, .select {
  height: 30px;
  padding: 0 10px;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: var(--radius-input);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-1);
  outline: none;
}
.input::placeholder { color: var(--text-4); }
.input:focus, .select:focus { border-color: var(--brand); background: var(--bg-card); }
.select {
  appearance: none;
  padding-right: 24px;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%238c8c8c' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
}

/* ---------- 筛选条 ---------- */
.filter-bar { display:flex; align-items:center; gap:8px; margin-bottom:12px; flex-wrap:wrap; }
.filter-count { font-size:12px; color:var(--text-3); margin-left:4px; }

/* ---------- 可输入筛选下拉 combobox（v1.16） ---------- */
.combo { position: relative; display: inline-block; }
.combo.disabled { opacity: .5; }
.combo-input { width: 100%; cursor: pointer; padding-right: 24px;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%238c8c8c' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; }
.combo.open .combo-input { border-color: var(--brand); background-color: var(--bg-card); }
.combo-panel { display: none; position: absolute; top: 34px; left: 0; z-index: 60;
  min-width: 100%; max-height: 280px; overflow-y: auto; padding: 4px 0;
  background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-card);
  box-shadow: 0 8px 20px rgba(0,0,0,.08); }
.combo.open .combo-panel { display: block; }
.combo-opt { padding: 6px 12px; font-size: 13px; color: var(--text-1); cursor: pointer; white-space: nowrap; }
.combo-opt:hover, .combo-opt.hover { background: var(--bg-input); }
.combo-opt.active { color: var(--brand); background: var(--brand-light); font-weight: 600; }
.combo-empty { padding: 12px; font-size: 12px; color: var(--text-3); text-align: center; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
  background: var(--bg-input);
  color: var(--text-2);
  font-weight: 500;
  text-align: left;
  padding: 9px 12px;
  white-space: nowrap;
}
.table tbody td { padding: 11px 12px; border-bottom: 1px solid var(--divider); color: var(--text-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #fafafa; }
.td-title { color: var(--text-1); }
.td-link { color: var(--brand); cursor: pointer; }
.td-link:hover { text-decoration: underline; }
.td-ops { white-space: nowrap; }
.td-ops .op { margin-right: 12px; }
.td-ops .op:last-child { margin-right: 0; }

/* 单元格内物品条 */
.cell-item { display: flex; align-items: center; gap: 10px; }
.cell-thumb {
  width: 40px; height: 40px; flex: none;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--text-4);
  overflow: hidden;
}
.cell-item .meta { display: flex; flex-direction: column; gap: 3px; }
.cell-item .name { color: var(--text-1); }
.cell-item .sub { font-size: 11px; color: var(--text-3); }

/* ---------- 异步加载态 ---------- */
.page-loading {
  padding: 80px 0;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}
.page-error { max-width: 420px; margin: 60px auto; padding: 32px; text-align: center; }
.page-error .card-title { font-weight: 600; font-size: 15px; }

/* 成员/用户头像 */
.cell-user { display: flex; align-items: center; gap: 10px; }
.avatar-sm {
  width: 32px; height: 32px; flex: none;
  border-radius: 50%;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
}
.cell-user .meta { display: flex; flex-direction: column; gap: 2px; }
.cell-user .name { color: var(--text-1); }
.cell-user .sub { font-size: 11px; color: var(--text-3); }

/* ---------- KPI 卡片 ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.kpi { background: var(--bg-card); border-radius: var(--radius-card); padding: 14px 16px; }
.kpi .label { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.kpi .value { font-size: 24px; font-weight: 600; color: var(--text-1); line-height: 1.2; }
.kpi .value.blue { color: var(--brand); }
.kpi .value.green { color: var(--success); }
.kpi .value.orange { color: var(--warning); }
.kpi .value.red { color: var(--error); }
.kpi .extra { font-size: 11px; color: var(--text-3); margin-top: 8px; }
.kpi .extra .up { color: var(--error); }
.kpi .extra .down { color: var(--success); }

/* ---------- 页签 ---------- */
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--divider); margin-bottom: 16px; }
.tab {
  padding: 10px 2px;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  background: none; border-top: none; border-left: none; border-right: none;
  font-family: var(--font);
}
.tab.active { color: var(--brand); font-weight: 500; border-bottom-color: var(--brand); }

/* ---------- 分页 ---------- */
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 14px; }
.page-info { font-size: 12px; color: var(--text-3); margin-right: auto; }
.page-btn {
  min-width: 26px; height: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--bg-card);
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 6px;
  font-family: var(--font);
}
.page-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-btn:disabled { color: var(--text-4); cursor: not-allowed; }

/* ---------- 弹层 ---------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
}
.overlay.open { display: flex; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-modal);
  padding: 20px 24px;
  width: 520px;
  max-height: 86vh;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 17px; font-weight: 600; color: var(--text-1); }
.modal-close { background: none; border: none; font-size: 16px; color: var(--text-3); cursor: pointer; font-family: var(--font); line-height: 1; }
.modal-close:hover { color: var(--text-1); }
.modal-foot { display: flex; justify-content: flex-end; gap: 12px; padding-top: 4px; }
.modal-divider { height: 1px; background: var(--divider); }

/* 抽屉（右侧滑出） */
.overlay.drawer-align { justify-content: flex-end; }
.drawer {
  background: var(--bg-card);
  width: 420px; height: 100%;
  padding: 20px 24px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
}

/* ---------- 表单 ---------- */
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field > label { font-size: 13px; font-weight: 500; color: var(--text-1); }
.form-field .req { color: var(--error); margin-right: 4px; }
.form-field .input, .form-field .select { width: 100%; }
.form-row { display: flex; gap: 12px; }
.form-row .form-field { flex: 1; }
.field-tip { font-size: 12px; color: var(--text-3); }
.textarea {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: var(--radius-input);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-1);
  resize: vertical;
  outline: none;
}
.textarea::placeholder { color: var(--text-4); }
.textarea:focus { border-color: var(--brand); background: var(--bg-card); }

/* 分段选择 */
.seg-group { display: flex; gap: 8px; }
.seg {
  flex: 1;
  height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--bg-card);
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  font-family: var(--font);
}
.seg.active {
  background: var(--brand-light);
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 500;
}

/* chip 多选 */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  height: 26px;
  padding: 0 10px;
  display: inline-flex; align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--bg-card);
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  font-family: var(--font);
}
.chip.active { background: var(--brand-light); border-color: var(--brand); color: var(--brand); }
.chip.add { color: var(--text-3); border-style: solid; }

/* 单选组 */
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
}
.radio-opt .dot {
  width: 14px; height: 14px; flex: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  position: relative;
}
.radio-opt.active { border-color: var(--brand); background: var(--brand-light); color: var(--text-1); }
.radio-opt.active .dot { border-color: var(--brand); }
.radio-opt.active .dot::after {
  content: "";
  position: absolute; inset: 2px;
  border-radius: 50%;
  background: var(--brand);
}

/* 物品条（弹窗内） */
.item-strip {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  background: var(--bg-input);
  border-radius: var(--radius-card);
}
.item-strip .thumb {
  width: 44px; height: 44px; flex: none;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--text-4);
}
.item-strip .meta { display: flex; flex-direction: column; gap: 4px; }
.item-strip .name { font-size: 14px; font-weight: 500; color: var(--text-1); }
.item-strip .sub { font-size: 12px; color: var(--text-3); }

/* 提示条 */
.tip-bar {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.5;
}
.tip-bar .dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 6px; flex: none; }
.tip-green { background: var(--success-bg); color: var(--success-deep); }
.tip-green .dot { background: var(--success); }
.tip-purple { background: var(--brand-light); color: var(--text-2); }

/* 占位图 */
.img-placeholder {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  color: var(--text-4);
  font-size: 11px;
}

/* ============================================================
   登录页（独立容器 #login-root，与 .app 骨架互斥显示）
   ============================================================ */
#login-root {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
  padding: 24px;
}

.login-wrap {
  width: 380px;
  max-width: 100%;
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-modal);
  padding: 40px 36px 36px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-logo {
  width: 48px; height: 48px;
  background: var(--brand);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  align-self: center;
}
.login-logo svg { width: 26px; height: 26px; }

.login-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-1);
  text-align: center;
}
.login-sub {
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
  margin-top: -10px;
}

.login-card .form-field { margin-top: 4px; }

.login-card .btn { height: 38px; font-size: 14px; margin-top: 4px; }

.login-error {
  min-height: 18px;
  font-size: 12px;
  color: var(--error);
  text-align: center;
  line-height: 1.5;
}

/* ============================================================
   顶栏用户菜单（修改密码 / 退出登录）
   ============================================================ */
.header-right { position: relative; }
.header-right .user-menu-btn {
  background: none; border: none;
  font-size: 11px; color: var(--text-3);
  cursor: pointer; padding: 4px;
  font-family: var(--font);
  line-height: 1;
}
.header-right .user-menu-btn:hover { color: var(--text-1); }

.user-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 132px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-card);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  padding: 4px;
  z-index: 90;
}
.user-menu.open { display: block; }
.user-menu-item {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-1);
  cursor: pointer;
  border-radius: 3px;
  text-decoration: none;
}
.user-menu-item:hover { background: var(--bg-input); }
.user-menu-item.danger { color: var(--error); }

/* ---------- 修改密码弹窗错误提示 ---------- */
.pw-error {
  min-height: 16px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--error);
  line-height: 1.5;
}

