/* ===== 全局样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', sans-serif;
  background: #f7f8fa;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* ===== 登录/注册页面 ===== */
.login-page, .register-page {
  min-height: 100vh;
  background: #fff;
  display: flex;
  flex-direction: column;
  padding: 40px 24px 20px;
}
.login-header {
  text-align: center;
  padding: 30px 0 40px;
}
.login-header .logo {
  width: 64px; height: 64px;
  background: #07c160;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 16px;
  color: #fff;
}
.login-header h1 { font-size: 22px; color: #333; font-weight: 600; }
.login-header p { font-size: 14px; color: #999; margin-top: 6px; }
.form-card {
  background: #fff;
  border-radius: 12px;
  padding: 0;
}
.form-item {
  display: flex;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #f5f5f5;
}
.form-item label {
  width: 68px;
  font-size: 14px;
  color: #333;
  flex-shrink: 0;
  font-weight: 500;
}
.form-item input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  color: #333;
  padding: 4px 0;
}
.form-item input::placeholder { color: #ccc; }
.btn-primary {
  display: block;
  width: 100%;
  margin: 30px 0 16px;
  padding: 14px;
  background: #07c160;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 17px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 2px;
}
.btn-primary:active { background: #06ad56; }
.btn-link {
  text-align: center;
  font-size: 14px;
  color: #07c160;
  cursor: pointer;
}
.login-tip {
  text-align: center;
  margin-top: 16px;
  color: #ccc;
  font-size: 13px;
}

/* ===== 超级管理员登录后：选择进入哪个界面 ===== */
.entry-choose-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 999;
}
.entry-choose-box {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 16px;
  padding: 28px 20px 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  text-align: center;
}
.entry-choose-avatar { font-size: 44px; line-height: 1; }
.entry-choose-nick {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin-top: 8px;
}
.entry-choose-tip {
  font-size: 13px;
  color: #999;
  margin: 6px 0 18px;
}
.entry-choose-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #eee;
  border-radius: 12px;
  margin-bottom: 12px;
  cursor: pointer;
  background: #fafbfc;
  text-align: left;
  transition: all 0.15s;
}
.entry-choose-item:active {
  background: #eef7f1;
  border-color: #07c160;
  transform: scale(0.98);
}
.entry-choose-icon { font-size: 26px; flex-shrink: 0; }
.entry-choose-info { flex: 1; min-width: 0; }
.entry-choose-title {
  font-size: 15px;
  font-weight: 600;
  color: #333;
}
.entry-choose-desc {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
}
.entry-choose-arrow {
  font-size: 22px;
  color: #ccc;
  flex-shrink: 0;
}
.entry-choose-cancel {
  margin-top: 6px;
  font-size: 13px;
  color: #999;
  cursor: pointer;
  padding: 8px;
}
.entry-choose-cancel:active { color: #666; }

/* ===== 手机端首页 ===== */
.home-page {
  min-height: 100vh;
  background: #f7f8fa;
  padding-bottom: 70px;
}

/* 顶部导航 */
.top-bar {
  position: sticky;
  top: 0;
  background: #fff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
  border-bottom: 1px solid #f0f0f0;
  min-height: 48px;
}

.top-bar .top-bar-spacer { width: 34px; flex-shrink: 0; }
.top-bar .title { font-size: 20px; font-weight: 700; color: #f5a623; text-transform: uppercase; letter-spacing: 2px; display: flex; align-items: baseline; gap: 6px; position: absolute; left: calc(50% + 0px); transform: translateX(-50%); white-space: nowrap; }
.top-bar .title .title-ver { font-size: 12px; font-weight: 400; color: #4da6ff; text-transform: none; letter-spacing: 0; cursor: pointer; }
.top-bar .user-btn {
  width: 34px; height: 34px;
  background: #f0f0f0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  margin-left: auto;
}

/* 搜索区 */
.search-bar {
  padding: 12px 16px;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}
.search-bar .search-input-wrap {
  flex: 1;
  position: relative;
}
.search-bar .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: #bbb;
  pointer-events: none;
}
.search-bar input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: #f7f8fa;
  color: #333;
}
.search-bar input::placeholder { color: #bbb; }
.search-bar .search-btn {
  padding: 10px 18px;
  background: #07c160;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.search-bar .search-btn:active { background: #06ad56; }

/* 分类 */
.category-row {
  padding: 0 16px 12px;
  background: #fff;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cat-tag {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  background: #f7f8fa;
  color: #666;
  border: none;
  transition: all 0.2s;
}
.cat-tag.active {
  background: #07c160;
  color: #fff;
}

/* 统计卡片 */
.stats-row {
  padding: 14px 16px;
  display: flex;
  gap: 10px;
}
.stat-card {
  flex: 1;
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}
.stat-card .num { font-size: 22px; font-weight: 700; color: #333; }
.stat-card .label { font-size: 12px; color: #999; margin-top: 4px; }

/* 物料列表 */
.item-list { padding: 0 16px; }
.item-card {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: background 0.15s;
}
.item-card:active { background: #f9f9f9; }
.item-left {
  width: 48px; height: 48px;
  background: #e8f8ef;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  margin-right: 14px;
}
.item-info { flex: 1; min-width: 0; }
.item-name { font-size: 15px; font-weight: 500; color: #333; margin-bottom: 4px; }
.item-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item-cat {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  background: #fff3e0;
  color: #e65100;
}
.item-group-tag {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}
.item-desc { font-size: 12px; color: #bbb; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-right { text-align: right; flex-shrink: 0; margin-left: 12px; }
.stock-row { display: flex; align-items: center; gap: 6px; }
.stock-num { font-size: 20px; font-weight: 700; color: #07c160; }
.stock-num.low { color: #ee0a24; }
.stock-unit { font-size: 12px; color: #999; }
.take-btn {
  margin-top: 8px;
  padding: 6px 16px;
  background: #07c160;
  color: #fff;
  border: none;
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
}
.take-btn:active { background: #06ad56; }
.take-btn:disabled { background: #ddd; color: #999; }
.feedback-btn {
  padding: 6px 16px;
  background: #fff;
  color: #ff9800;
  border: 1px solid #ff9800;
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
  flex: 1;
}
.feedback-btn:active { background: #fff3e0; }

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #ccc;
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state .text { font-size: 15px; }

/* 底部 */
.bottom-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 10px 16px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid #f0f0f0;
  z-index: 50;
}
.bottom-bar button {
  width: 100%;
  padding: 12px;
  border: none;
  background: #f7f8fa;
  color: #333;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  font-weight: 500;
}
.bottom-bar button:active { background: #eee; }

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-box {
  background: #fff;
  border-radius: 14px;
  width: 85%;
  max-width: 300px;
  padding: 24px 20px 20px;
}
.modal-box h3 { font-size: 17px; margin-bottom: 16px; text-align: center; font-weight: 600; }
.modal-box .item-detail {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px;
  background: #f7f8fa;
  border-radius: 8px;
}
.modal-box .item-detail .icon {
  width: 44px; height: 44px;
  background: #e8f8ef;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.modal-box .item-detail .info .name { font-size: 15px; font-weight: 500; color: #333; }
.modal-box .item-detail .info .stock { font-size: 12px; color: #999; }
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 12px 0;
}
.stepper button {
  width: 36px; height: 36px;
  border: 1px solid #ddd;
  border-radius: 50%;
  background: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
}
.stepper button:active { background: #f5f5f5; }
.stepper .val {
  font-size: 22px; font-weight: 600; min-width: 36px; width: 50px;
  text-align: center; color: #333;
  border: none; outline: none; background: transparent;
  -moz-appearance: textfield;
}
.stepper .val::-webkit-inner-spin-button,
.stepper .val::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}
.modal-box .remark-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #eee;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  margin: 8px 0;
  background: #f7f8fa;
}
.modal-box .remark-input:focus { border-color: #07c160; background: #fff; }
.modal-btns {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}
.modal-btns button {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  border: none;
  font-weight: 500;
}
.btn-cancel { background: #f7f8fa; color: #666; }
.btn-cancel:active { background: #eee; }
.btn-ok { background: #07c160; color: #fff; }
.btn-ok:active { background: #06ad56; }

/* ===== 弹出面板（底部） ===== */
.panel-mask {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  animation: fadeIn 0.2s;
}
.panel-bottom {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 24px 16px;
  z-index: 101;
  max-height: 65vh;
  overflow-y: auto;
  animation: slideUp 0.25s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.panel-bottom .panel-title {
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 16px;
  color: #333;
}
.panel-bottom .panel-close {
  position: absolute;
  top: 14px; right: 16px;
  font-size: 20px;
  color: #999;
  cursor: pointer;
  width: 30px; height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.record-item {
  padding: 14px 0;
  border-bottom: 1px solid #f5f5f5;
  display: flex;
  align-items: center;
  gap: 12px;
}
.record-item .r-icon {
  width: 40px; height: 40px;
  background: #e8f8ef;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.record-item .r-info { flex: 1; min-width: 0; }
.record-item .r-name { font-size: 14px; color: #333; font-weight: 500; }
.record-item .r-time { font-size: 12px; color: #bbb; margin-top: 2px; }
.record-item .r-qty { font-size: 16px; font-weight: 600; color: #07c160; white-space: nowrap; }
.user-panel { text-align: center; }
.user-panel .avatar {
  width: 64px; height: 64px;
  background: #07c160;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 12px auto;
  color: #fff;
}
.user-panel .nick { font-size: 18px; font-weight: 600; color: #333; margin-bottom: 20px; }
.btn-danger {
  padding: 10px 30px;
  background: #fff;
  color: #ee0a24;
  border: 1px solid #ffccc7;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.btn-danger:active { background: #fff1f0; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,122,255,0.18);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #34c759;
  padding: 12px 28px;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  z-index: 200;
  pointer-events: none;
  animation: toastIn 0.35s cubic-bezier(0.21, 1.02, 0.58, 1);
  box-shadow: 0 8px 32px rgba(0,122,255,0.12);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px) scale(0.92); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* ===== Loading ===== */
.loading-wrap {
  text-align: center;
  padding: 60px 20px;
  color: #bbb;
}
.spinner {
  display: inline-block;
  width: 28px; height: 28px;
  border: 3px solid #e0e0e0;
  border-top-color: #07c160;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 管理后台 ===== */
.admin-page {
  display: flex;
  min-height: 100vh;
}
.admin-sidebar {
  width: 180px;
  background: #1a1a2e;
  color: #fff;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.admin-sidebar .logo {
  padding: 16px;
  font-size: 16px;
  font-weight: bold;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  text-align: center;
}
/* 侧边栏项目切换 */
.admin-sidebar .project-switch {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.admin-sidebar .project-switch .ps-label {
  font-size: 12px; color: rgba(255,255,255,0.5);
  margin-bottom: 6px;
}
.admin-sidebar .project-switch .ps-btn {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(250,84,28,0.16); color: #ff9c6e;
  padding: 8px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.admin-sidebar .project-switch .ps-btn:active { background: rgba(250,84,28,0.28); }
.admin-sidebar .project-switch .ps-btn .arrow { font-size: 12px; opacity: 0.8; }
.admin-sidebar .menu-item {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: 0.2s;
}
.admin-sidebar .menu-item:hover { background: rgba(255,255,255,0.06); }
.admin-sidebar .menu-item.active {
  background: rgba(255,255,255,0.1);
  border-left-color: #07c160;
  color: #07c160;
}
.admin-sidebar .logout-btn {
  margin-top: auto;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  color: #ee0a24;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.admin-main {
  margin-left: 180px;
  flex: 1;
  padding: 20px;
}
.admin-main h2 {
  font-size: 20px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.admin-main h2 button {
  padding: 6px 16px;
  background: #07c160;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.data-table {
  width: 100%;
  background: #fff;
  border-radius: 8px;
  border-collapse: collapse;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.data-table th {
  background: #fafafa;
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
  color: #666;
  border-bottom: 1px solid #eee;
}
.data-table td {
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid #f5f5f5;
}
.data-table .action-btns button {
  margin-right: 6px;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid #ddd;
  background: #fff;
}
.data-table .action-btns .del { color: #ee0a24; border-color: #ee0a24; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; background: #e8f4fd; color: #1890ff; }

/* Admin Modal */
.admin-modal-mask {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.admin-modal {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  width: 420px;
  max-width: 90vw;
}
.admin-modal h3 { margin-bottom: 16px; }
.admin-modal .field { margin-bottom: 12px; }
.admin-modal .field label { display: block; font-size: 13px; color: #666; margin-bottom: 4px; }
.admin-modal .field input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
}
.admin-modal .field input:focus { border-color: #07c160; }
.admin-modal .btns {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}
.admin-modal .btns button {
  padding: 7px 18px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}
