:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #111827;
  --muted: #64748b;
  --border: #dce3ec;
  --primary: #1262d6;
  --primary-dark: #0e4fb1;
  --ok: #0f8a4b;
  --error: #c62828;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei UI", sans-serif;
  letter-spacing: 0;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 14px calc(124px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  min-width: 38px;
  min-height: 34px;
  padding: 0 9px;
  border-color: #bcd3ff;
  background: #edf4ff;
  color: var(--primary);
  font-size: 13px;
}

.refresh-btn {
  min-width: 48px;
  border-color: #b7e2c9;
  background: #eaf8ef;
  color: var(--ok);
}

.refresh-btn.refreshing {
  border-color: #bcd3ff;
  background: #edf4ff;
  color: var(--primary);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

.photo-mode .topbar {
  margin-bottom: 8px;
}

.photo-mode .eyebrow {
  margin-bottom: 2px;
}

.photo-mode h1 {
  font-size: 24px;
  line-height: 1.1;
}

.photo-mode .section-head {
  margin-bottom: 10px;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid #f1c9c9;
  border-radius: 999px;
  background: #fff1f1;
  color: var(--error);
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 800;
}

.status-pill.ok {
  border-color: #b7e2c9;
  background: #eaf8ef;
  color: var(--ok);
}

button {
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  font-weight: 800;
}

button:active { transform: translateY(1px); }
button:disabled {
  border-color: #d7deea;
  background: #e7edf5;
  color: #8794a7;
  opacity: 1;
}

.ghost-btn {
  width: 100%;
  margin-top: 8px;
  background: #eef2f7;
}

.feature-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.primary-entry { margin-bottom: 16px; }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: max(6px, env(safe-area-inset-bottom));
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr 54px 1fr;
  align-items: center;
  gap: 8px;
  width: min(calc(100% - 44px), 360px);
  transform: translateX(-50%);
  border: 1px solid rgba(214, 224, 237, 0.86);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  padding: 5px 10px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
  overflow: hidden;
  --nav-x: 10px;
  --nav-w: 76px;
}

.nav-indicator {
  position: absolute;
  left: 0;
  top: 50%;
  z-index: 0;
  width: var(--nav-w);
  height: 38px;
  border-radius: 999px;
  background: rgba(18, 98, 214, 0.12);
  transform: translateX(var(--nav-x)) translateY(-50%);
  transition:
    transform 320ms cubic-bezier(0.2, 0.9, 0.2, 1),
    width 320ms cubic-bezier(0.2, 0.9, 0.2, 1),
    height 220ms ease,
    background-color 220ms ease,
    border-radius 220ms ease;
  box-shadow: none;
}

.bottom-nav-btn {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  min-width: 0;
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  box-shadow: none;
  transition:
    color 220ms ease,
    transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.bottom-nav-btn::before {
  content: "";
  display: block;
  width: 18px;
  height: 16px;
  color: currentColor;
  opacity: 0.92;
}

#navOrders::before {
  border: 2px solid currentColor;
  border-radius: 5px;
  box-shadow: inset 0 5px 0 rgba(100, 116, 139, 0.16);
}

#navRecords::before {
  border: 2px solid currentColor;
  border-radius: 999px;
  box-shadow: inset 0 0 0 5px #fff, inset 0 0 0 7px currentColor;
}

.bottom-nav-btn strong {
  font-size: 12px;
  line-height: 1;
}

.nav-dot {
  position: absolute;
  top: 5px;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: transparent;
}

.bottom-nav-btn.active {
  color: var(--primary);
  transform: none;
}

.bottom-nav-btn.active .nav-dot {
  background: var(--primary);
}

.bottom-camera-btn {
  position: relative;
  z-index: 1;
  justify-self: center;
  align-self: center;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  width: 48px;
  height: 38px;
  min-height: 38px;
  margin-top: 0;
  margin-bottom: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--primary);
  font-size: 10px;
  box-shadow: none;
  transition:
    color 220ms ease,
    transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.bottom-camera-btn strong {
  font-size: 11px;
  line-height: 1;
}

.bottom-camera-btn.active {
  background: transparent;
  color: #fff;
  transform: none;
}

.bottom-nav.nav-state-photo .nav-indicator {
  border-radius: 16px;
  background: var(--primary-dark);
  height: 38px;
}

.camera-glyph {
  position: relative;
  width: 21px;
  height: 15px;
  border: 2px solid currentColor;
  border-radius: 6px;
}

.camera-glyph::before {
  content: "";
  position: absolute;
  left: 4px;
  top: -7px;
  width: 9px;
  height: 5px;
  border-radius: 4px 4px 0 0;
  background: currentColor;
}

.camera-glyph::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  transform: translate(-50%, -50%);
  border: 2px solid currentColor;
  border-radius: 999px;
}

.search-input,
.sort-select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 750;
}

.search-input {
  margin-bottom: 10px;
  padding: 0 12px;
}

.sort-select {
  margin-bottom: 12px;
  padding: 0 10px;
}

.date-strip {
  display: flex;
  gap: 7px;
  margin: 0 0 12px;
  overflow-x: auto;
  padding-bottom: 3px;
}

.date-chip {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  min-width: 84px;
  min-height: 44px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
}

.date-chip b,
.date-chip span {
  display: block;
  line-height: 1.15;
}

.date-chip span {
  font-size: 11px;
  font-weight: 800;
  opacity: 0.82;
}

.date-chip.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 10px;
}

.filter-chip {
  min-width: 0;
  min-height: 40px;
  padding: 0 6px;
  border-radius: 8px;
  font-size: 13px;
}

.filter-chip.active {
  border-color: var(--primary);
  background: #e9f1ff;
  color: var(--primary);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.small-btn {
  min-height: 38px;
  padding: 0 14px;
  font-size: 14px;
}

.feature-tab.active,
.size-btn.active,
.confirm-btn {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.view { display: none; }
.view.active { display: block; }

.watermark-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin: -4px 0 10px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: linear-gradient(135deg, #eff6ff, #ffffff);
  padding: 9px 10px;
  color: #35506f;
  font-size: 12px;
  font-weight: 760;
}

.watermark-note strong {
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 950;
}

.watermark-note span {
  min-width: 0;
  line-height: 1.35;
}

.empty-panel,
.photo-picker {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}

.order-list {
  display: grid;
  gap: 9px;
  margin-bottom: 12px;
}

.order-list.grid-mode {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.order-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  padding: 11px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.order-card.uploaded-card {
  border-color: #b7e2c9;
  background: linear-gradient(180deg, #f7fff9, #ffffff);
}

.list-mode .order-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.list-mode .order-card .order-main,
.list-mode .order-card .order-badges {
  grid-column: 2;
}

.list-mode .order-card .order-sections {
  grid-column: 1 / -1;
}

.list-mode .order-card .preview-box {
  grid-row: 1 / span 3;
}

.grid-mode .order-card {
  padding: 9px;
}

.grid-mode .order-sections section,
.grid-mode .detail-block {
  display: none;
}

.grid-mode .order-main strong {
  font-size: 18px;
}

.grid-mode .order-main span {
  font-size: 12px;
}

.preview-box {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid #dbe5f2;
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  cursor: zoom-in;
  position: relative;
}

.preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 160ms ease;
}

.preview-box img.loaded {
  opacity: 1;
}

.preview-loading {
  background:
    linear-gradient(90deg, rgba(226, 232, 240, 0.45), rgba(248, 250, 252, 0.92), rgba(226, 232, 240, 0.45)),
    #f8fafc;
  background-size: 220% 100%;
  animation: previewShimmer 1.15s linear infinite;
}

.preview-empty {
  padding: 8px;
  background: linear-gradient(135deg, #eef4fb, #ffffff);
  text-align: center;
  word-break: break-word;
}

.preview-error {
  border-color: #f1c9c9;
  background: #fff8f8;
  color: var(--error);
}

.preview-box span {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 4px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  white-space: nowrap;
}

.preview-mark {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(100, 116, 139, 0.18);
  border-top-color: rgba(18, 98, 214, 0.58);
  border-radius: 999px;
  background: transparent !important;
  padding: 0 !important;
  animation: previewSpin 900ms linear infinite;
}

.preview-box img.loaded + span {
  display: none;
}

@keyframes previewShimmer {
  from { background-position: 180% 0; }
  to { background-position: -40% 0; }
}

@keyframes previewSpin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.uncoded-card {
  border-color: #f1c9c9;
  background: #fffafa;
}

.order-main strong,
.order-main span {
  display: block;
  min-width: 0;
}

.order-main strong {
  margin-bottom: 5px;
  color: var(--text);
  font-size: 24px;
  line-height: 1.1;
}

.order-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.photo-chip {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 9px;
  border-color: #b7e2c9;
  border-radius: 999px;
  background: #eaf8ef;
  color: var(--ok);
  font-size: 12px;
}

.uploaded-card .photo-chip {
  border-color: #b7e2c9;
  background: #0f8a4b;
  color: #fff;
}

.order-main span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

.order-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.age-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 8px;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 900;
}

.age-fresh {
  border-color: #b7e2c9;
  background: #eaf8ef;
  color: var(--ok);
}

.age-warm {
  border-color: #ffdca8;
  background: #fff7e8;
  color: #b35c00;
}

.age-hot {
  border-color: #f5b6b6;
  background: #fff1f1;
  color: var(--error);
}

.age-unknown {
  border-color: #d7deea;
  background: #eef2f7;
  color: var(--muted);
}

.age-work {
  border-color: #bcd3ff;
  background: #edf4ff;
  color: var(--primary);
}

.age-done {
  border-color: #b7e2c9;
  background: #eaf8ef;
  color: var(--ok);
}

.order-sections {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.list-mode .order-sections {
  gap: 7px;
  margin-top: 8px;
}

.list-mode .order-sections h3,
.list-mode .detail-block {
  display: none;
}

.order-sections section {
  min-width: 0;
}

.order-sections h3 {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.info-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.info-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-height: 30px;
  border: 1px solid #dbe5f2;
  border-radius: 8px;
  background: #f8fafc;
  padding: 5px 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.25;
  word-break: break-word;
}

.list-mode .info-chip {
  min-height: 27px;
  padding: 4px 7px;
  font-size: 12px;
}

.list-mode .info-chip b {
  font-size: 10px;
}

.info-chip b {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
}

.detail-block {
  border: 1px solid #dbe5f2;
  border-radius: 8px;
  background: #f8fafc;
  padding: 9px 10px;
}

.detail-block b,
.detail-block span {
  display: block;
}

.detail-block b {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.detail-block span {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
  word-break: break-word;
}

.order-fields {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.order-field {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 8px;
  align-items: start;
}

.order-field b {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.order-field span {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
  word-break: break-word;
}

.uncoded-block {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.hidden { display: none !important; }


.trade-picker {
  aspect-ratio: 4 / 4.55;
  border: 1px solid var(--border);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(18, 98, 214, 0.08), rgba(15, 138, 75, 0.04)),
    #fff;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04), inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}

.trade-picker:active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(18, 98, 214, 0.12);
}

.trade-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.empty-panel {
  display: grid;
  gap: 8px;
  place-items: center;
  min-height: 220px;
  color: var(--muted);
}

.empty-panel strong {
  color: var(--text);
  font-size: 22px;
}

.photo-picker {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  margin-bottom: 12px;
}

.photo-picker::before {
  content: "";
  position: absolute;
  inset: 11px;
  z-index: 1;
  border: 2px dashed rgba(18, 98, 214, 0.28);
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
  pointer-events: none;
}

.photo-picker::after {
  content: "\70b9\8fd9\91cc\62cd\7167";
  position: absolute;
  left: 50%;
  top: 16px;
  z-index: 1;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
  pointer-events: none;
}

.photo-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.photo-picker img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #101827;
}

.photo-picker img.ready { display: block; }

.photo-picker:has(img.ready)::after {
  content: "\70b9\56fe\5ba1\6838 / \91cd\62cd";
  color: var(--ok);
}

.photo-picker span {
  position: absolute;
  z-index: 2;
  inset: auto auto 18px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.9);
  color: #fff;
  padding: 9px 14px;
  font-size: 17px;
  font-weight: 900;
}

.trade-photo-state {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 3;
  border: 1px solid #d7e0ec;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  padding: 6px 9px;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.trade-photo-state.ready {
  border-color: #b7e2c9;
  background: #eaf8ef;
  color: var(--ok);
}

#photoView .confirm-btn {
  min-height: 58px;
  margin-top: 4px;
  font-size: 20px;
}
  border: 1px solid #dce6f2;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
  padding: 10px;
}

@keyframes trackPulse {
  0%, 100% {
    transform: perspective(560px) rotateX(0deg) scale(1);
    opacity: 0.72;
  }
  50% {
    transform: perspective(560px) rotateX(7deg) scale(0.965);
    opacity: 1;
  }
}

@keyframes scanLine {
  0%, 100% { transform: translateY(0); opacity: 0.28; }
  50% { transform: translateY(calc(100% + 180px)); opacity: 1; }
}

.size-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.size-btn {
  min-width: 0;
  min-height: 56px;
  font-size: 18px;
}

.confirm-btn {
  width: 100%;
  min-height: 56px;
  font-size: 18px;
}

#tradeUpload:disabled {
  background: #dfe7f1;
  color: #718096;
}

.confirm-btn:not(:disabled):active { background: var(--primary-dark); }

.status-line {
  min-height: 24px;
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}

.status-line.ok { color: var(--ok); font-weight: 800; }
.status-line.error { color: var(--error); font-weight: 800; }
.status-line.busy { color: var(--primary); font-weight: 800; }

.queue-panel {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  padding: 12px;
}

.queue-title {
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: 900;
}

.queue-list {
  display: grid;
  gap: 8px;
}

.queue-empty {
  color: var(--muted);
  font-size: 14px;
}

.queue-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
}

.queue-main strong,
.queue-main span {
  display: block;
  min-width: 0;
}

.queue-main span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-state {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.queue-state em {
  justify-self: end;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 900;
}

.queue-state button {
  min-height: 30px;
  border-color: #f1c9c9;
  background: #fff1f1;
  color: var(--error);
  padding: 0 10px;
  font-size: 12px;
}

.queue-item.uploading {
  border-color: #bcd3ff;
  background: #edf4ff;
}

.queue-item.error {
  border-color: #f1c9c9;
  background: #fff8f8;
}

.queue-item.uploading em { color: var(--primary); }
.queue-item.done em { color: var(--ok); }
.queue-item.error em { color: var(--error); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: end center;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  background: rgba(15, 23, 42, 0.38);
}

.modal.hidden { display: none; }

.modal-panel {
  width: min(100%, 520px);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  padding: 14px;
}

.detail-sheet {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 8px;
  max-height: min(calc(100dvh - 28px - env(safe-area-inset-bottom)), 760px);
  overflow: hidden;
  border-radius: 14px 14px 8px 8px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
}

#orderDetailBody {
  min-height: 0;
  overflow: auto;
  padding: 0 1px 8px;
}

.sheet-handle {
  width: 46px;
  height: 5px;
  margin: 0 auto 12px;
  border-radius: 999px;
  background: #cbd5e1;
}

.detail-preview .preview-box {
  max-height: 300px;
  aspect-ratio: 4 / 3;
  margin-bottom: 12px;
  background: #f8fafc;
}

.detail-sheet h2 {
  margin: 0;
  font-size: 24px;
}

.detail-sub {
  margin: 5px 0 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.detail-sheet > .confirm-btn {
  margin-top: 0;
  min-height: 56px;
  font-size: 20px;
}

.detail-sheet > .ghost-btn {
  margin-top: 0;
  min-height: 48px;
  background: #f2f6fb;
}

.modal-title {
  margin-bottom: 12px;
  font-size: 20px;
  font-weight: 900;
}

.modal-input {
  width: 100%;
  min-height: 48px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  font: inherit;
  font-size: 17px;
}

#voiceCodeBtn {
  margin: 0 0 10px;
  touch-action: none;
  user-select: none;
}

#voiceCodeBtn.recording {
  border-color: var(--error);
  background: #fff1f1;
  color: var(--error);
}

.voice-hint {
  margin: -2px 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.record-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}

.record-stats span {
  display: grid;
  gap: 2px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px 4px 7px;
  color: var(--muted);
  font-size: 17px;
  font-weight: 900;
  text-align: center;
}

.records-empty {
  min-height: 260px;
  border: 1px dashed #cbd7e6;
  border-radius: 8px;
  background: #f8fafc;
  padding: 18px;
}

.records-empty .confirm-btn {
  width: min(100%, 260px);
  background: var(--primary);
  color: #fff;
}

#refreshOrders {
  display: none;
}

.record-stats b {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.record-item {
  display: grid;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  padding: 12px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.record-day {
  display: grid;
  gap: 8px;
}

.record-day-title {
  margin: 6px 2px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.record-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.record-head em {
  flex: 0 0 auto;
  border: 1px solid #b7e2c9;
  border-radius: 999px;
  background: #eaf8ef;
  color: var(--ok);
  padding: 4px 8px;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.record-item strong {
  color: var(--text);
  font-size: 18px;
}

.record-item span,
.record-item small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-files {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.record-files small {
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #f8fafc;
  padding: 7px 8px;
  color: var(--text);
}

.record-path {
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #f8fafc;
  padding: 7px 8px;
}

.record-path summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  list-style: none;
}

.record-path summary::-webkit-details-marker {
  display: none;
}

.record-path small {
  display: block;
  margin-top: 6px;
  white-space: normal;
  word-break: break-all;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.inline-check input {
  width: 18px;
  height: 20px;
}

.modal-sizes { margin-bottom: 12px; }

.image-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
  background: rgba(15, 23, 42, 0.9);
}

.image-preview-modal.hidden {
  display: none;
}

.image-preview-body {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
}

.image-preview-body img {
  display: block;
  max-width: 100%;
  max-height: 88vh;
  border-radius: 8px;
  object-fit: contain;
  background: #111827;
}

.image-preview-color {
  display: grid;
  place-items: center;
  width: min(88vw, 520px);
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text);
  font-size: 22px;
  font-weight: 900;
  text-align: center;
}

.image-preview-color span {
  max-width: 80%;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  padding: 10px 14px;
}

.image-preview-close {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: 14px;
  width: 44px;
  min-height: 44px;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 28px;
  line-height: 1;
}

.trade-review-modal {
  grid-template-rows: 1fr auto;
  align-items: stretch;
}

.trade-review-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: min(100%, 520px);
  justify-self: center;
  padding-top: 12px;
}

@media (max-width: 360px) {
  .app-shell { padding-inline: 10px; }
  .topbar { align-items: flex-start; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
  h1 { font-size: 22px; }
  .filter-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-list.grid-mode { grid-template-columns: 1fr; }
  .size-grid { grid-template-columns: 1fr; }
}

@media (orientation: landscape) and (max-height: 540px) {
  .app-shell {
    width: min(100%, 760px);
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }
  .topbar { margin-bottom: 10px; }
  .trade-picker { aspect-ratio: 4 / 2.6; }
  .detail-sheet { max-height: calc(100dvh - 18px - env(safe-area-inset-bottom)); }
  .detail-preview .preview-box { max-height: 210px; }
}
