:root {
  --green: #0b7a3b;
  --green-dark: #096a33;
  --orange: #e8631a;
  --text: #1f2329;
  --muted: #b9bcc4;
  --line: #f0f0f2;
  --page-bg: #f4f4f9;
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: #e9eaf0;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* 手机容器：移动端全屏，桌面居中显示 */
.app {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--page-bg);
  overflow-x: hidden;
  box-shadow: 0 0 40px rgba(0,0,0,.08);
}

/* 状态栏 & 导航栏 */
.status-bar {
  height: 36px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f7f7f9;
  font-size: 14px;
  font-weight: 600;
}
.status-icons { display: flex; align-items: center; gap: 5px; }
.battery { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; }
.battery-level { display: inline-block; width: 22px; height: 11px; border: 1.5px solid #333; border-radius: 3px; margin-right: 3px; position: relative; background: linear-gradient(to right, #333 80%, transparent 80%); }

.nav-bar {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: #f7f7f9;
}
.nav-close, .nav-more {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  border-radius: 50%;
}
.nav-close:active, .nav-more:active { background: rgba(0,0,0,.06); }
.nav-title { text-align: center; font-size: 17px; font-weight: 600; line-height: 1.2; }
.nav-subtitle { font-size: 11px; font-weight: 400; color: #888; margin-top: 2px; }

/* 右上角更多菜单（隐蔽入口） */
.nav-more-wrap { position: relative; }
.more-menu {
  display: none;
  position: absolute;
  top: 44px; right: 4px;
  min-width: 130px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.14);
  z-index: 20;
  overflow: hidden;
  padding: 4px 0;
}
.more-menu.open { display: block; animation: fadeIn .15s ease; }
.more-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  font-size: 15px;
  color: #333;
  padding: 12px 18px;
  cursor: pointer;
}
.more-menu button:hover { background: #f5f5f7; }
.more-menu button:active { background: #ececf0; }

/* 登录弹窗 */
.modal-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-mask.open { display: flex; }
.login-modal {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px 22px;
  box-shadow: 0 20px 50px rgba(0,0,0,.2);
  animation: fadeIn .2s ease;
}
.login-icon {
  width: 56px; height: 56px;
  margin: 0 auto 12px;
  background: #e7f5ec;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.login-title { text-align: center; font-size: 19px; font-weight: 600; }
.login-subtitle { text-align: center; font-size: 13px; color: #999; margin: 6px 0 20px; }
.login-field { display: flex; align-items: center; min-height: 50px; border-bottom: 1px solid var(--line); }
.login-label { width: 52px; font-size: 15px; color: #444; flex-shrink: 0; }
.login-field input { flex: 1; min-width: 0; border: none; outline: none; font-size: 15px; background: transparent; }
.login-field input::placeholder { color: var(--muted); }
.login-error { color: #e64340; font-size: 13px; margin: 8px 0 0; text-align: center; min-height: 0; }
.login-error:empty { display: none; }
.login-modal .primary-btn { margin-top: 18px; }
.login-close { display: block; width: 100%; margin-top: 12px; border: none; background: none; color: #999; font-size: 14px; padding: 8px; cursor: pointer; }
.login-hint { text-align: center; font-size: 12px; color: #bbb; margin-top: 10px; }

.logout-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  border: none;
  background: none;
  color: #999;
  font-size: 14px;
  padding: 8px;
  cursor: pointer;
}
.logout-btn:active { color: #666; }

/* 删除确认弹窗 */
.confirm-modal { max-width: 320px; }
.confirm-icon { background: #fdeaea; }
.confirm-actions { display: flex; gap: 12px; margin-top: 20px; }
.confirm-actions .secondary-btn { flex: 1; height: 44px; }
.danger-btn {
  flex: 1;
  height: 44px;
  border: none;
  border-radius: 22px;
  background: #e64340;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}
.danger-btn:active { background: #c93835; }
.danger-btn:disabled { opacity: .6; cursor: not-allowed; }

/* 页面切换 */
.page { display: none; padding-bottom: 24px; }
.page.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 顶部橙色横幅 */
.hero {
  position: relative;
  min-height: 200px;
  padding: 44px 28px 60px;
  background: linear-gradient(125deg, #fff1e0 0%, #ffe2c4 45%, #ffd6ae 100%);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  width: 260px; height: 260px;
  border-radius: 50%;
  background: rgba(255,255,255,.28);
  right: -90px; top: -110px;
}
.hero-text {
  position: relative;
  z-index: 1;
  font-size: 38px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--orange);
  text-shadow: 0 1px 0 rgba(255,255,255,.5);
}
.hero-art {
  position: absolute;
  right: 12px; bottom: -4px;
  filter: drop-shadow(0 10px 10px rgba(200,110,30,.2));
}

/* 卡片 */
.card {
  background: #fff;
  border-radius: 14px;
  margin: -30px 16px 0;
  padding: 6px 18px;
  position: relative;
  z-index: 2;
  box-shadow: 0 6px 20px rgba(80,70,60,.06);
}

/* 表单 */
.form-card { padding-top: 10px; padding-bottom: 22px; }
.field {
  display: flex;
  align-items: center;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
}
.field:last-of-type { border-bottom: none; }
.field label {
  width: 112px;
  flex-shrink: 0;
  font-size: 16px;
  color: #333;
}
.req { color: #e64340; }
.field input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  color: var(--text);
  text-align: right;
}
.field input::placeholder { color: var(--muted); }
.input-wrap { flex: 1; display: flex; align-items: center; justify-content: flex-end; }
.input-wrap input { flex: 1; }
.unit { font-size: 16px; color: #333; margin-left: 6px; }
.form-error { color: #e64340; font-size: 13px; min-height: 0; margin: 4px 0 10px; text-align: center; }
.form-error:empty { display: none; }

.primary-btn {
  width: 100%;
  height: 50px;
  border: none;
  border-radius: 25px;
  background: var(--green);
  color: #fff;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 2px;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.primary-btn:hover { background: var(--green-dark); }
.primary-btn:active { transform: scale(.985); }
.primary-btn:disabled { opacity: .6; cursor: not-allowed; }

.quick-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 20px 16px 0;
}
.sample-btn {
  flex: 1;
  background: #fff;
  border: 1px dashed #c8c8d0;
  color: #8a8a94;
  font-size: 13px;
  padding: 10px 8px;
  border-radius: 18px;
  cursor: pointer;
}
.sample-btn:active { background: rgba(0,0,0,.04); }

/* 数据管理页 */
.manage-form .field label { width: 96px; font-size: 15px; }
.manage-form .field input, .manage-form .field select { font-size: 15px; }
.manage-form-title { font-size: 15px; font-weight: 600; color: var(--orange); padding: 6px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 2px; }
.manage-select {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  text-align: right;
  font-size: 15px;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2px;
}
.manage-btn-row { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.secondary-btn {
  width: 100%;
  height: 44px;
  border: 1px solid #ddd;
  border-radius: 22px;
  background: #fff;
  color: #666;
  font-size: 15px;
  cursor: pointer;
}
.secondary-btn:active { background: #f5f5f5; }
.secondary-btn:disabled,
.logout-btn:disabled,
.record-actions button:disabled { opacity: .5; cursor: not-allowed; }
.record-actions button:disabled:active { background: none; }

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 24px 20px 12px;
  font-size: 16px;
  font-weight: 600;
}
.list-count { font-size: 13px; font-weight: 400; color: #999; }
.list-tools {
  display: flex;
  gap: 8px;
  margin: 0 16px 12px;
}
.list-tools input,
.list-tools select {
  height: 38px;
  border: 1px solid #e4e4e9;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.list-tools input {
  flex: 1;
  min-width: 0;
  padding: 0 12px;
}
.list-tools select {
  width: 104px;
  padding: 0 8px;
}
.list-tools input:focus,
.list-tools select:focus { border-color: #c8c8d0; }
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 16px 16px 0;
  font-size: 13px;
  color: #888;
}
.pager-btn {
  min-width: 72px;
  height: 32px;
  border: 1px solid #e1e1e7;
  border-radius: 16px;
  background: #fff;
  color: #555;
  font-size: 13px;
  cursor: pointer;
}
.pager-btn:disabled { opacity: .4; cursor: not-allowed; }
.record-list { margin: 0 16px; }
.record-item {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 3px 12px rgba(80,70,60,.05);
}
.record-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.record-no { font-size: 15px; font-weight: 600; }
.record-badge { font-size: 12px; padding: 3px 10px; border-radius: 12px; }
.record-badge.valid { background: #e7f5ec; color: var(--green); }
.record-badge.invalid { background: #fdeaea; color: #e64340; }
.record-info { font-size: 13px; color: #777; line-height: 1.8; }
.record-info b { color: #444; font-weight: 500; }
.record-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.record-actions button {
  border: none;
  background: none;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 12px;
}
.btn-edit { color: #1a73b8; }
.btn-delete { color: #e64340; }
.record-actions button:active { background: rgba(0,0,0,.05); }
.empty-list { text-align: center; color: #aaa; font-size: 14px; padding: 30px 10px; }

/* 结果页 */
.result-card { padding: 4px 18px; }
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 17px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.result-row:last-child { border-bottom: none; }
.r-label { flex-shrink: 0; color: #222; }
.r-value { text-align: right; color: #222; line-height: 1.45; word-break: break-all; }
.result-status.valid { color: var(--green); font-weight: 600; }
.result-status.invalid { color: #e64340; font-weight: 600; }

.notice {
  margin: 22px 20px 0;
  font-size: 13px;
  color: #a0a2aa;
  line-height: 1.7;
}
.notice-title { margin-bottom: 2px; }

.bottom-action {
  position: sticky;
  bottom: 0;
  margin-top: 30px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--page-bg) 75%, transparent);
}

/* 提示 */
.toast {
  position: fixed;
  left: 50%; bottom: 90px;
  transform: translateX(-50%) translateY(10px);
  background: rgba(0,0,0,.78);
  color: #fff;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 99;
  max-width: 80%;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 520px) {
  .app { min-height: 100vh; }
}
