:root {
  --canvas: #f5f7fb;
  --canvas-deep: #e9edf5;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.88);
  --glass-inset: rgba(246, 248, 252, 0.86);
  --ink: #111827;
  --ink-soft: #4b5563;
  --ink-muted: #8a94a6;
  --hairline: rgba(17, 24, 39, 0.09);
  --hairline-strong: rgba(17, 24, 39, 0.14);
  --blue: #0a84ff;
  --blue-deep: #0066d6;
  --blue-soft: rgba(10, 132, 255, 0.12);
  --green: #30d158;
  --green-deep: #178a38;
  --green-soft: rgba(48, 209, 88, 0.14);
  --red: #ff453a;
  --amber: #ffb340;
  --code-bg: rgba(255, 179, 64, 0.18);
  --focus: rgba(10, 132, 255, 0.24);
  --shadow-panel: 0 24px 70px rgba(36, 45, 66, 0.12);
  --shadow-card: 0 12px 36px rgba(36, 45, 66, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --space: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--canvas);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
  background:
    radial-gradient(circle at 12% 8%, rgba(10, 132, 255, 0.18), transparent 28rem),
    radial-gradient(circle at 86% 14%, rgba(48, 209, 88, 0.16), transparent 24rem),
    linear-gradient(180deg, #fbfcff 0%, var(--canvas) 48%, var(--canvas-deep) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.48) 1px, transparent 1px);
  background-size: 100% 72px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 70%);
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(36px, 6vw, 72px);
  line-height: 0.96;
  font-weight: 760;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
  font-weight: 720;
}

p {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.65;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 48px;
}

.app-shell.locked {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.private-area {
  width: 100%;
}

.top-strip,
.gate-panel,
.input-panel,
.recognition-panel,
.list-section {
  border: 1px solid var(--hairline);
  background: var(--glass);
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(24px) saturate(1.35);
  -webkit-backdrop-filter: blur(24px) saturate(1.35);
}

.top-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: calc(var(--space) * 4);
  min-height: 250px;
  border-radius: var(--radius-xl);
  padding: 34px;
  overflow: hidden;
}

.top-strip::after {
  content: "";
  position: absolute;
  inset: auto 34px 28px 34px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(10, 132, 255, 0.34), transparent);
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--blue-deep);
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 740;
}

.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 5px var(--green-soft);
}

.counter-grid {
  display: grid;
  grid-template-columns: repeat(2, 112px);
  gap: 12px;
}

.counter {
  min-height: 112px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 8px;
  border: 1px solid var(--hairline);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  padding: 18px;
}

.counter span {
  color: var(--blue);
  font-size: 42px;
  font-weight: 780;
  line-height: 0.9;
  letter-spacing: 0;
}

.counter-waiting span {
  color: var(--green-deep);
}

.counter small {
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 680;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(330px, 0.72fr);
  gap: calc(var(--space) * 2);
  margin-top: calc(var(--space) * 2);
}

.input-panel,
.recognition-panel,
.list-section {
  border-radius: var(--radius-lg);
  padding: 22px;
}

.panel-head,
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.compact {
  margin-bottom: 16px;
}

.operator-field,
.gate-form label,
.stack-field {
  display: grid;
  gap: 8px;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 700;
}

.operator-field {
  min-width: 154px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--glass-inset);
  color: var(--ink);
  outline: none;
  box-shadow: inset 0 1px 2px rgba(17, 24, 39, 0.035);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(10, 132, 255, 0.62);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 0 0 5px var(--focus), inset 0 1px 2px rgba(17, 24, 39, 0.03);
}

input,
select {
  height: 44px;
  padding: 0 14px;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-muted) 50%),
    linear-gradient(135deg, var(--ink-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 19px,
    calc(100% - 12px) 19px;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

textarea {
  margin-top: 20px;
  min-height: 210px;
  resize: vertical;
  padding: 15px;
  line-height: 1.65;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.primary-button,
.ghost-button,
.filter,
.delete-button,
.text-link {
  min-height: 42px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0 16px;
  font-weight: 720;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease, border-color 150ms ease;
}

.primary-button {
  border-color: rgba(10, 132, 255, 0.72);
  background: linear-gradient(180deg, #2f9bff 0%, var(--blue) 100%);
  color: #fff;
  box-shadow: 0 12px 24px rgba(10, 132, 255, 0.24);
}

.ghost-button,
.delete-button,
.text-link {
  background: rgba(255, 255, 255, 0.56);
  color: var(--ink);
}

.primary-button:hover,
.ghost-button:hover,
.filter:hover,
.delete-button:hover,
.text-link:hover {
  transform: translateY(-1px);
}

.primary-button:active,
.ghost-button:active,
.filter:active,
.delete-button:active,
.text-link:active {
  transform: translateY(0);
}

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

.preview-item {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.58);
  padding: 14px;
}

.preview-code,
.pickup-code {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border: 1px solid rgba(255, 179, 64, 0.28);
  border-radius: 999px;
  background: var(--code-bg);
  color: #805000;
  font-weight: 780;
  line-height: 1;
}

.preview-code {
  margin-bottom: 9px;
  padding: 7px 10px;
  font-size: 17px;
}

.preview-meta {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.5;
}

.empty-state {
  min-height: 150px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--radius-md);
  color: var(--ink-muted);
  background: rgba(255, 255, 255, 0.42);
  text-align: center;
  padding: 20px;
}

.list-section {
  margin-top: calc(var(--space) * 2);
}

.filters {
  display: inline-flex;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: rgba(238, 242, 248, 0.84);
  padding: 4px;
}

.filter {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  padding: 0 14px;
  box-shadow: none;
}

.filter.active {
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  box-shadow: 0 6px 18px rgba(36, 45, 66, 0.1);
}

.parcel-list {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.parcel-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--hairline);
  border-radius: 20px;
  background: var(--glass-strong);
  box-shadow: var(--shadow-card);
  padding: 14px;
}

.pickup-toggle {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(23, 138, 56, 0.28);
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green-deep);
  font-size: 22px;
  font-weight: 760;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.parcel-card.picked {
  opacity: 0.7;
  box-shadow: none;
}

.parcel-card.picked .pickup-toggle {
  border-color: rgba(23, 138, 56, 0.34);
  background: var(--green);
  color: #fff;
}

.parcel-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pickup-code {
  padding: 8px 11px;
  font-size: 19px;
}

.status-pill {
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink-soft);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 720;
}

.picked .status-pill {
  border-color: rgba(48, 209, 88, 0.22);
  background: var(--green-soft);
  color: var(--green-deep);
}

.address-line {
  margin-top: 8px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

.meta-line {
  margin-top: 5px;
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.5;
}

.delete-button {
  min-height: 36px;
  padding: 0 12px;
  color: var(--red);
}

.gate-panel {
  width: min(640px, 100%);
  border-radius: 32px;
  padding: 34px;
}

.gate-form {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.form-message {
  min-height: 22px;
  color: var(--red);
  font-size: 13px;
}

.admin-shell {
  max-width: 920px;
}

.admin-grid {
  display: grid;
  gap: calc(var(--space) * 2);
  margin-top: calc(var(--space) * 2);
}

.text-link {
  display: inline-flex;
  align-items: center;
  align-self: start;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 24px, 720px);
    padding-top: 14px;
  }

  .top-strip,
  .panel-head,
  .section-head {
    grid-template-columns: 1fr;
    display: grid;
  }

  .top-strip {
    min-height: 0;
    padding: 24px;
  }

  .top-strip::after {
    inset: auto 24px 20px 24px;
  }

  .counter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workbench {
    grid-template-columns: 1fr;
  }

  .operator-field {
    min-width: 0;
  }

  .form-actions,
  .filters {
    width: 100%;
  }

  .form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .filter {
    flex: 1;
  }

  .parcel-card {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .delete-button {
    grid-column: 2;
    justify-self: start;
  }
}

@media (max-width: 460px) {
  .app-shell {
    width: min(100% - 18px, 430px);
  }

  h1 {
    font-size: 34px;
  }

  .top-strip,
  .gate-panel,
  .input-panel,
  .recognition-panel,
  .list-section {
    border-radius: 22px;
    padding: 18px;
  }

  .counter {
    min-height: 92px;
    padding: 14px;
  }

  .counter span {
    font-size: 34px;
  }

  .form-actions {
    grid-template-columns: 1fr;
  }

  .pickup-code {
    max-width: 100%;
    font-size: 17px;
    overflow-wrap: anywhere;
  }
}
