:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #eef5f1;
  --ink: #1f2933;
  --muted: #667085;
  --line: #d9e1dc;
  --green: #175d50;
  --green-2: #21796a;
  --blue: #245f9c;
  --amber: #b86b00;
  --red: #b42318;
  --ok: #067647;
  --shadow: 0 10px 30px rgba(24, 40, 36, 0.1);
  color-scheme: light;
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(23, 93, 80, 0.07), transparent 210px),
    var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

#app {
  width: 100%;
  min-height: 100vh;
}

.shell {
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 0 1px rgba(23, 93, 80, 0.08);
}

.login-shell {
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 30px 20px 26px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
}

.brand-panel {
  display: grid;
  gap: 16px;
}

.brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: white;
  box-shadow: var(--shadow);
}

.brand-title {
  margin: 0;
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: 0;
}

.brand-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.login-form,
.panel,
.card,
.modal-sheet,
.toast {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-form {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 13px;
  color: var(--muted);
}

.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 0 12px;
}

.input-row input,
.input-row select,
.input-row textarea {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.input-row textarea {
  min-height: 78px;
  padding: 12px 0;
  resize: vertical;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.icon-btn,
.seg-btn,
.qty-btn,
.tab-btn {
  min-height: 42px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition:
    transform 150ms ease,
    background 150ms ease,
    border-color 150ms ease;
}

.primary-btn:active,
.secondary-btn:active,
.ghost-btn:active,
.icon-btn:active,
.seg-btn:active,
.qty-btn:active,
.tab-btn:active {
  transform: translateY(1px);
}

.primary-btn {
  color: #fff;
  background: var(--green);
  padding: 0 16px;
  font-weight: 700;
}

.primary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.secondary-btn {
  color: var(--green);
  background: var(--surface-2);
  border: 1px solid #bed4cc;
  padding: 0 14px;
  font-weight: 700;
}

.ghost-btn {
  color: var(--ink);
  background: transparent;
  padding: 0 10px;
}

.icon-btn {
  width: 42px;
  color: var(--ink);
  background: #eef1ef;
}

.topbar {
  min-height: 76px;
  padding: max(14px, env(safe-area-inset-top)) 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--green);
  color: white;
}

.warehouse-name {
  font-size: 12px;
  opacity: 0.8;
}

.page-title {
  margin-top: 3px;
  font-size: 20px;
  font-weight: 800;
}

.content {
  padding: 16px 14px 96px;
  display: grid;
  gap: 14px;
}

.panel {
  padding: 14px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.section-head h2,
.section-head h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

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

.small {
  font-size: 12px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 12px;
  min-height: 90px;
}

.stat-label {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.stat-value {
  margin-top: 10px;
  font-size: 24px;
  font-weight: 850;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.quick-action {
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 10px 6px;
  cursor: pointer;
}

.quick-action span {
  font-size: 12px;
  white-space: nowrap;
}

.list {
  display: grid;
  gap: 10px;
}

.card {
  padding: 12px;
}

.card-row,
.line-row,
.between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-main {
  min-width: 0;
}

.card-title {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.card-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.badge {
  flex: 0 0 auto;
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.badge.ok {
  color: var(--ok);
  background: #e8f6ee;
  border-color: #b9e5c8;
}

.badge.warn {
  color: var(--amber);
  background: #fff4df;
  border-color: #f3cd8c;
}

.badge.danger {
  color: var(--red);
  background: #fff1f0;
  border-color: #f4b8b3;
}

.badge.info {
  color: var(--blue);
  background: #eaf2fb;
  border-color: #c3d9ef;
}

.hero-strip {
  min-height: 102px;
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(14, 70, 62, 0.9), rgba(23, 93, 80, 0.6)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='720' height='240' viewBox='0 0 720 240'%3E%3Crect width='720' height='240' fill='%23d8e7df'/%3E%3Cg fill='%23a0b8ad'%3E%3Crect x='38' y='58' width='110' height='92' rx='4'/%3E%3Crect x='170' y='36' width='120' height='114' rx='4'/%3E%3Crect x='315' y='72' width='92' height='78' rx='4'/%3E%3Crect x='430' y='44' width='118' height='106' rx='4'/%3E%3Crect x='570' y='66' width='96' height='84' rx='4'/%3E%3C/g%3E%3Cpath d='M0 174h720v66H0z' fill='%2389a79a'/%3E%3Cg stroke='%23799488' stroke-width='8'%3E%3Cpath d='M32 195h656'/%3E%3Cpath d='M80 210h580'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  padding: 16px;
  display: grid;
  align-content: end;
  color: white;
}

.hero-strip strong {
  font-size: 20px;
}

.hero-strip span {
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.85;
}

.scan-frame {
  aspect-ratio: 4 / 3;
  width: 100%;
  overflow: hidden;
  border-radius: 8px;
  border: 1px dashed #9bb8ad;
  background:
    linear-gradient(90deg, transparent 0 12px, rgba(255, 255, 255, 0.2) 12px 14px, transparent 14px),
    #173f39;
  position: relative;
  display: grid;
  place-items: center;
  color: #d8eee6;
}

.scan-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-reticle {
  width: 68%;
  aspect-ratio: 1.8;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  position: absolute;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.product-preview {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.product-thumb {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
  background: var(--blue);
}

.product-thumb.host {
  background: #21796a;
}

.product-thumb.frame {
  background: #8a5a22;
}

.product-thumb.tile {
  background: #245f9c;
}

.product-thumb.part {
  background: #6f536f;
}

.searchbar {
  display: flex;
  gap: 8px;
}

.searchbar .input-row {
  flex: 1;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  background: #e9eeeb;
  border-radius: 8px;
}

.segmented.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.seg-btn {
  background: transparent;
  color: var(--muted);
  min-height: 38px;
}

.seg-btn.active {
  background: #fff;
  color: var(--green);
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(31, 41, 51, 0.08);
}

.order-lines,
.movement-lines {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.line-row {
  padding: 9px 0;
  border-top: 1px solid #edf0ee;
}

.line-row:first-child {
  border-top: 0;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 7px;
}

.qty-btn {
  width: 34px;
  min-height: 34px;
  background: #eef1ef;
  color: var(--ink);
}

.qty-value {
  min-width: 26px;
  text-align: center;
  font-weight: 800;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  width: min(100%, 460px);
  transform: translateX(-50%);
  padding: 8px 8px max(8px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(10px);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
}

.tab-btn {
  min-height: 58px;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
}

.tab-btn.active {
  color: var(--green);
  background: #e9f3ef;
  font-weight: 800;
}

.empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 20px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(11, 22, 19, 0.44);
  display: grid;
  align-items: end;
}

.modal-sheet {
  width: min(100%, 460px);
  max-height: 88vh;
  overflow: auto;
  margin: 0 auto;
  border-radius: 8px 8px 0 0;
  padding: 16px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 86px;
  z-index: 60;
  transform: translateX(-50%);
  width: min(calc(100% - 28px), 432px);
  padding: 12px 14px;
  font-weight: 700;
}

.toast.success {
  border-color: #aeddbd;
  color: var(--ok);
}

.toast.error {
  border-color: #efb4ae;
  color: var(--red);
}

.hidden {
  display: none !important;
}

@media (min-width: 760px) {
  body {
    padding: 24px 0;
  }

  .shell,
  .login-shell {
    min-height: calc(100vh - 48px);
    border-radius: 8px;
    overflow: hidden;
  }

  .bottom-nav {
    bottom: 24px;
    border-radius: 0 0 8px 8px;
  }
}
