/* ===== 仓库助手 · 网页版 · 基础框架 ===== */
:root {
  --primary: #1a6fbf;
  --primary-dark: #155a99;
  --green: #00a870;
  --orange: #e07c00;
  --red: #d54941;
  --purple: #7b61ff;
  --cyan: #13c2c2;
  --gray: #8a8f99;

  --bg: #eef3f9;
  --card: #ffffff;
  --line: #eceff3;
  --text: #1f2329;
  --text-2: #5c6470;
  --text-3: #98a0ab;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 16px rgba(26, 111, 191, .08);
  --tabbar-h: 58px;
  --navbar-h: 46px;
  --app-max-width: 480px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: #dfe5ec;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

/* 手机外壳 */
.phone {
  width: 100%;
  max-width: var(--app-max-width);
  height: 100%;
  background: var(--bg);
  box-shadow: 0 0 40px rgba(0, 0, 0, .12);
  overflow: hidden;
}

.app {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ===== 导航栏 ===== */
.navbar {
  flex: none;
  height: calc(var(--navbar-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  padding-left: 8px;
  padding-right: 12px;
  position: relative;
  z-index: 20;
}

.navbar.transparent {
  background: transparent;
  color: var(--text);
}

.nav-back {
  display: flex;
  width: 48px;
  height: 44px;
  align-items: center;
  font-size: 40px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  flex: none;
}

.nav-title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.nav-right {
  min-width: 48px;
  text-align: right;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  flex: none;
}

/* ===== 内容区 ===== */
.view {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom);
}

.view.with-tabbar {
  padding-bottom: var(--tabbar-h);
}

/* ===== 底部 TabBar ===== */
.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 30;
}

.tabbar[hidden] {
  display: none;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  color: #9aa1ab;
  font-size: 11px;
  position: relative;
}

.tab-item .tab-ico {
  font-size: 19px;
  line-height: 1;
  transition: transform .18s;
}

.tab-item.active {
  font-weight: 600;
}

.tab-item.active .tab-ico {
  transform: translateY(-1px) scale(1.12);
}

.tab-item.active::before {
  content: "";
  position: absolute;
  top: 3px;
  width: 26px;
  height: 3px;
  border-radius: 3px;
  background: currentColor;
}

/* ===== 通用容器 / 卡片 ===== */
.page {
  padding-bottom: 24px;
}

.container {
  padding: 0 12px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 12px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 4px 8px;
  font-size: 13px;
  color: var(--text-3);
  font-weight: 500;
}

/* ===== 列表行 ===== */
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #fff;
}

.row+.row {
  border-top: 1px solid var(--line);
}

.row .row-main {
  flex: 1;
  min-width: 0;
}

.row .row-title {
  font-size: 15px;
  font-weight: 500;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.row .row-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

.row .row-value {
  font-size: 14px;
  color: var(--text-2);
}

.row .row-arrow {
  color: #c6ccd4;
  font-size: 18px;
}

.row.tappable {
  cursor: pointer;
}

.row.tappable:active {
  background: #f5f8fb;
}

/* ===== 徽标 / 标签 ===== */
.badge {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  height: 18px;
  line-height: 18px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  text-align: center;
}

.badge.orange {
  background: var(--orange);
}

.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11px;
  background: #eef2f7;
  color: var(--text-2);
}

.tag.blue {
  background: #e8f2fc;
  color: var(--primary);
}

.tag.green {
  background: #e6f7f2;
  color: var(--green);
}

.tag.orange {
  background: #fdf3e4;
  color: var(--orange);
}

.tag.red {
  background: #fde8e7;
  color: var(--red);
}

.tag.purple {
  background: #f0eeff;
  color: var(--purple);
}

/* ===== 表单 ===== */
.form-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.form-row {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 14px;
  gap: 10px;
  background: #fff;
}

.form-row+.form-row {
  border-top: 1px solid var(--line);
}

.form-row .f-label {
  width: 88px;
  flex: none;
  font-size: 14px;
  color: var(--text-2);
}

.form-row .f-label.required::before {
  content: "*";
  color: var(--red);
  margin-right: 2px;
}

.form-row .f-ctrl {
  flex: 1;
  min-width: 0;
  text-align: right;
}

.form-row .f-value {
  font-size: 14px;
}

.form-row .f-arrow {
  color: #c6ccd4;
  font-size: 18px;
  flex: none;
}

.form-row.tall {
  align-items: flex-start;
  padding-top: 12px;
  padding-bottom: 12px;
}

input.ipt,
select.ipt,
textarea.ipt {
  width: 100%;
  border: none;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  text-align: right;
  padding: 0;
}

textarea.ipt {
  text-align: left;
  min-height: 62px;
  resize: none;
}

input.ipt::placeholder,
textarea.ipt::placeholder {
  color: #bcc3cc;
}

/* ===== 按钮 ===== */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  width: 100%;
  font-family: inherit;
}

.btn:active {
  opacity: .85;
}

.btn.ghost {
  background: #f2f5f8;
  color: var(--text-2);
}

.btn.danger {
  background: var(--red);
}

.btn.green {
  background: var(--green);
}

.btn.sm {
  height: 34px;
  font-size: 13px;
  border-radius: 8px;
  width: auto;
  padding: 0 14px;
}

.bottom-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(238, 243, 249, 0), var(--bg) 40%);
}

/* ===== 空态 ===== */
.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

.empty .empty-ico {
  font-size: 40px;
  display: block;
  margin-bottom: 10px;
  opacity: .5;
}

/* ===== 弹层 ===== */
.overlay-root {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100%;
  max-width: var(--app-max-width);
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none;
}

.mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  pointer-events: auto;
  animation: fade .18s ease;
}

@keyframes fade {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-radius: 18px 18px 0 0;
  pointer-events: auto;
  max-height: 74%;
  display: flex;
  flex-direction: column;
  animation: up .22s ease;
}

@keyframes up {
  from {
    transform: translateY(100%)
  }

  to {
    transform: translateY(0)
  }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  font-weight: 600;
  flex: none;
}

.sheet-body {
  overflow-y: auto;
  padding: 4px 0;
}

.sheet-foot {
  flex: none;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
  border-top: 1px solid var(--line);
}

.dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  max-width: 84%;
  background: #fff;
  border-radius: 14px;
  pointer-events: auto;
  overflow: hidden;
  animation: pop .18s ease;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(.94)
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1)
  }
}

.dialog-body {
  padding: 24px 20px 18px;
  text-align: center;
}

/* ===== 滚轮日期选择器 ===== */
.dp {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 320px;
  max-width: 86%;
  background: #fff;
  border-radius: 14px;
  pointer-events: auto;
  overflow: hidden;
  animation: pop .18s ease;
}

.dp-title {
  text-align: center;
  font-size: 15px;
  color: #333;
  padding: 16px 0 10px;
}

.dp-cols {
  position: relative;
  display: flex;
  height: 200px;
  overflow: hidden;
  margin: 0 12px;
}

.dp-focus {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  margin-top: -20px;
  height: 40px;
  background: #f3f4f6;
  border-radius: 8px;
  pointer-events: none;
}

.dp-fade {
  position: absolute;
  left: 0;
  right: 0;
  height: 60px;
  pointer-events: none;
  z-index: 2;
}

.dp-fade.top {
  top: 0;
  background: linear-gradient(to bottom, #fff 15%, rgba(255, 255, 255, 0));
}

.dp-fade.bottom {
  bottom: 0;
  background: linear-gradient(to top, #fff 15%, rgba(255, 255, 255, 0));
}

.dp-col {
  flex: 1;
  position: relative;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.dp-list {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  margin-top: -20px;
  list-style: none;
  padding: 0;
  margin-left: 0;
  will-change: transform;
}

.dp-list li {
  position: relative;
  height: 40px;
  line-height: 40px;
  text-align: center;
  font-size: 15px;
  color: #a0a5ad;
  white-space: nowrap;
}

.dp-list li.on {
  color: #222;
  font-weight: 500;
}

.dp-foot {
  display: flex;
  gap: 12px;
  padding: 16px 16px 18px;
}

.dp-btn {
  flex: 1;
  height: 42px;
  border: 0;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
}

.dp-btn.cancel {
  background: #f2f3f5;
  color: #333;
}

.dp-btn.ok {
  background: var(--main, #1a6fbf);
  color: #fff;
}

/* 日期选择展示框（替代原生 type=date） */
.date-pick {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--text, #333);
  cursor: pointer;
  line-height: 22px;
}

.date-pick.empty {
  color: #b6bcc6;
}

.date-pick.ta-r {
  text-align: right;
  display: block;
}

.dialog-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.dialog-text {
  font-size: 13px;
  color: var(--text-2);
  white-space: pre-wrap;
  text-align: left;
  max-height: 50vh;
  overflow-y: auto;
}

.dialog-ipt {
  margin-top: 14px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

.dialog-foot {
  display: flex;
  border-top: 1px solid var(--line);
}

.dialog-foot .df-btn {
  flex: 1;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  color: var(--text-2);
}

.dialog-foot .df-btn+.df-btn {
  border-left: 1px solid var(--line);
}

.dialog-foot .df-btn.primary {
  color: var(--primary);
  font-weight: 600;
}

.dialog-foot .df-btn.danger {
  color: var(--red);
  font-weight: 600;
}

/* ===== Toast ===== */
.toast-root {
  position: fixed;
  left: 50%;
  top: 42%;
  width: 100%;
  max-width: var(--app-max-width);
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(0, 0, 0, .78);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  max-width: 76%;
  text-align: center;
  animation: fade .18s ease;
}

/* ===== 其它工具 ===== */
.flex {
  display: flex;
}

.between {
  justify-content: space-between;
}

.wrap {
  flex-wrap: wrap;
}

.grow {
  flex: 1;
}

.muted {
  color: var(--text-3);
}

.small {
  font-size: 12px;
}

.b {
  font-weight: 600;
}

.right {
  text-align: right;
}

.mt8 {
  margin-top: 8px;
}

.mt12 {
  margin-top: 12px;
}

.nowrap {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
