:root {
  --bg: #0a0a0f;
  --card: #12121a;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #1e1e2e;
  --danger: #ef4444;
  --ok: #22c55e;
  --warn: #f59e0b;
  --border: #2a2a3c;
  --shadow: 0 14px 40px rgba(99, 102, 241, .2);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, #1e1e3f, transparent 28rem), var(--bg);
  padding-bottom: 92px;
}
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: rgba(10, 10, 15, .92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(42, 42, 60, .7);
}
.eyebrow { margin: 0 0 3px; color: var(--primary); font-size: 12px; font-weight: 700; letter-spacing: .08em; }
h1 { margin: 0; font-size: 24px; }
h2 { margin: 0 0 10px; font-size: 18px; }
main { max-width: 1080px; margin: 0 auto; padding: 14px; }
.module-tabs {
  position: sticky;
  top: 73px;
  z-index: 25;
  display: grid;
  grid-template-columns: repeat(6, minmax(72px, 1fr));
  gap: 8px;
  margin: -2px 0 12px;
  padding: 8px;
  overflow-x: auto;
  border: 1px solid rgba(42, 42, 60, .9);
  border-radius: 22px;
  background: rgba(18, 18, 26, .92);
  box-shadow: 0 10px 30px rgba(99, 102, 241, .15);
  backdrop-filter: blur(16px);
}
.module-tab {
  color: #94a3b8;
  background: #1a1a26;
  border: 1px solid #2a2a3c;
  white-space: nowrap;
  box-shadow: none;
}
.module-tab.active {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 10px 24px rgba(99, 102, 241, .4);
}
.module-panel { display: none; animation: panelIn .18s ease-out; }
.module-panel.active { display: block; }
@keyframes panelIn { from { opacity: .2; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.card {
  background: var(--card);
  border: 1px solid rgba(42, 42, 60, .95);
  border-radius: 22px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.hero { background: linear-gradient(145deg, #1a1a26, #12121a); }
.hero p, .hint { color: var(--muted); line-height: 1.7; margin: 8px 0; }
.hero-actions, .button-row, .section-title { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.hero-actions { justify-content: flex-start; flex-wrap: wrap; margin-top: 14px; }
.wrap { flex-wrap: wrap; justify-content: flex-start; }
button, .file-label {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 800;
  cursor: pointer;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
}
.primary { color: white; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.secondary { color: #a5b4fc; background: var(--secondary); }
.ghost { color: var(--primary); background: transparent; border: 1px solid var(--primary); }
.danger { color: white; background: var(--danger); }
.small { padding: 8px 10px; min-height: 36px; font-size: 13px; }
.file-label input { display: none; }
.hidden { display: none !important; }
.status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #1e1e2e;
  color: #a5b4fc;
  font-weight: 700;
}
.form-row { display: grid; gap: 7px; margin: 10px 0; }
.form-row label { color: #d1d5db; font-weight: 800; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  font-size: 15px;
  outline: none;
  background: #1a1a26;
  color: var(--text);
}
textarea {
  min-height: 145px;
  resize: vertical;
  line-height: 1.55;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99, 102, 241, .2); }
.market-city-select {
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #1a1a26;
  color: var(--text);
  font-size: 15px;
  min-width: 120px;
}
.market-city-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, .2);
}
.mini-hint { margin-top: -4px; font-size: 12px; }
input[readonly] { color: #d1d5db; background: #1e1e2e; font-weight: 800; }
.receipt-edit-input { width: 100%; min-width: 74px; border: 1px solid #374151; border-radius: 10px; padding: 8px 9px; font: inherit; background: #1a1a26; color: var(--text); }
.receipt-edit-input.note { min-width: 150px; }
.receipt-delete-btn { border: none; background: #3d1a1a; color: #fca5a5; border-radius: 10px; padding: 8px 10px; font-weight: 800; }
.preview-input { width: 100%; min-width: 74px; border: 1px solid #374151; border-radius: 10px; padding: 8px 9px; font: inherit; background: #1a1a26; color: var(--text); }
.table-wrap { width: 100%; overflow-x: auto; border-radius: 16px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; min-width: 760px; background: #12121a; }
th, td { padding: 10px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; vertical-align: top; }
th { background: #1e1e2e; color: #d1d5db; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.metric {
  border-radius: 16px;
  padding: 12px;
  background: #1a1a26;
  border: 1px solid var(--border);
}
.metric strong { display: block; font-size: 20px; margin-top: 4px; }
.tag { display: inline-block; border-radius: 999px; padding: 3px 8px; font-size: 12px; font-weight: 800; }
.tag.ok { background: #062e18; color: #4ade80; }
.tag.warn { background: #2e1f06; color: #fbbf24; }
.tag.bad { background: #2e0606; color: #fca5a5; }
.bottom-nav {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 40;
  display: none;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  padding: 8px;
  border-radius: 22px;
  background: rgba(15, 15, 20, .95);
  box-shadow: 0 16px 45px rgba(0, 0, 0, .5);
  backdrop-filter: blur(16px);
}
.bottom-nav .module-tab {
  min-height: 42px;
  padding: 9px 2px;
  border: 0;
  border-radius: 16px;
  color: #94a3b8;
  background: transparent;
  font-size: 13px;
}
.bottom-nav .module-tab.active { background: rgba(99, 102, 241, .3); box-shadow: none; }
.bottom-nav .module-tab:active { background: rgba(99, 102, 241, .2); }

/* 单位缺失提示样式 */
.unit-missing {
  border: 2px solid var(--warn);
  background: #2e1f06;
  animation: pulse 2s infinite;
}
.unit-missing option {
  background: #1a1a26;
}
.unit-hint {
  display: block;
  font-size: 11px;
  color: var(--warn);
  margin-top: 4px;
  font-weight: 600;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@media (max-width: 720px) {
  body { padding-bottom: 88px; }
  h1 { font-size: 21px; }
  main { padding: 10px; }
  .app-header { padding: 12px 14px; }
  .module-tabs {
    top: 62px;
    display: flex;
    gap: 8px;
    margin: 0 0 10px;
    padding: 7px;
    border-radius: 18px;
  }
  .module-tabs .module-tab { flex: 0 0 auto; min-width: 86px; padding: 10px 12px; }
  .bottom-nav { display: grid; }
  .section-title { align-items: flex-start; flex-direction: column; }
  .hero-actions, .button-row { width: 100%; flex-wrap: wrap; }
  button, .file-label { flex: 1; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 14px; border-radius: 18px; }
}
