:root {
  color-scheme: light;
  --bg: #f4efe6;
  --card: #fffaf2;
  --card-strong: #fff6e8;
  --text: #2b2218;
  --muted: #7f6d59;
  --line: rgba(93, 68, 40, 0.14);
  --accent: #b64926;
  --accent-strong: #8f3418;
  --accent-soft: #f6d7bf;
  --success: #2f7a4d;
  --shadow: 0 10px 30px rgba(87, 56, 22, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 213, 175, 0.55), transparent 32%),
    linear-gradient(180deg, #f8f2e8 0%, #f2ecdf 100%);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

.screen {
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 8px 2px 14px;
}

.screen-login {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.hero-card {
  background: linear-gradient(160deg, #fff6e8 0%, #ffe9d1 100%);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.muted,
.status-text {
  color: var(--muted);
}

.error-text {
  margin: 0;
  color: #c13515;
}

.stack {
  display: grid;
  gap: 12px;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.task-top-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.split {
  justify-content: space-between;
}

.field-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.text-input {
  width: 100%;
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(93, 68, 40, 0.18);
  background: #fff;
  padding: 0 14px;
  font-size: 16px;
}

.text-input.compact {
  min-height: 40px;
  font-size: 14px;
}

button,
.secondary-link {
  min-height: 44px;
  border-radius: 14px;
  border: 0;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}

button:active,
.secondary-link:active {
  transform: scale(0.98);
}

.primary-button {
  width: 100%;
  background: var(--accent);
  color: #fffdf8;
}

.secondary-button,
.secondary-link {
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.danger-button {
  background: rgba(193, 53, 21, 0.12);
  color: #a12a10;
  padding: 0 16px;
}

.ghost-button {
  min-width: 72px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--accent-strong);
  border: 1px solid rgba(182, 73, 38, 0.12);
  padding: 0 16px;
}

.controls-card {
  margin-bottom: 14px;
}

.debug-row {
  margin-top: 12px;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.warehouse-grid,
.task-list {
  display: grid;
  gap: 2px;
}

.task-table-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  align-items: center;
  gap: 2px;
  padding: 2px 4px;
  margin-bottom: 2px;
  border-radius: 8px;
  background: rgba(245, 239, 230, 0.98);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  backdrop-filter: blur(10px);
}

.task-table-head.pick-head {
  grid-template-columns: minmax(0, 1fr) 50px 36px 28px;
}

.task-table-head.receive-head {
  grid-template-columns: minmax(0, 1fr) 36px 28px;
}

.task-table-head.inventory-head {
  grid-template-columns: minmax(0, 1fr) 48px 48px 48px 50px;
}

.task-table-head > div {
  white-space: nowrap;
  text-align: center;
}

.task-table-head > div:first-child {
  text-align: left;
}

.inventory-list {
  display: grid;
  gap: 2px;
  margin-top: 2px;
}

.warehouse-card {
  background: var(--card-strong);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.warehouse-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.warehouse-header h2,
.task-item h2 {
  margin: 0;
  font-size: 21px;
}

.warehouse-counts {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.count-chip {
  flex: 1;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(93, 68, 40, 0.1);
}

.count-chip strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

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

.task-item {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.task-item.compact {
  padding: 2px 4px;
  border-radius: 10px;
}

.task-item.done {
  opacity: 0.72;
  background: rgba(255, 248, 241, 0.9);
}

.task-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 50px 36px 28px;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.task-row.receive-row {
  grid-template-columns: minmax(0, 1fr) 36px 28px;
}

.task-name-block {
  min-width: 0;
  display: block;
}

.task-name-block h2 {
  margin: 0;
  font-size: 13px;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-metric {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 1px;
  white-space: nowrap;
}

.task-metric-label {
  color: var(--muted);
  font-size: 9px;
  line-height: 1;
}

.task-metric strong {
  font-size: 12px;
  line-height: 1.1;
}

.task-quantity-cell {
  display: grid;
  justify-items: center;
  gap: 1px;
  white-space: nowrap;
}

.task-metric-plan.readonly {
  gap: 2px;
}

.task-quantity-button {
  min-height: 24px;
  min-width: 46px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(182, 73, 38, 0.12);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
}

.task-item.compact .task-action {
  min-width: 28px;
  min-height: 24px;
  padding: 0 4px;
  font-size: 12px;
  flex-shrink: 0;
  white-space: nowrap;
  border-radius: 8px;
}

.task-item.compact .task-action.completed {
  background: rgba(47, 122, 77, 0.12);
  color: var(--success);
}

.task-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.meta-card {
  padding: 12px;
  border-radius: 14px;
  background: #fff8ef;
  border: 1px solid rgba(93, 68, 40, 0.1);
}

.meta-card span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.meta-card strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.task-action {
  width: 100%;
  background: var(--success);
  color: #fff;
}

.task-action.receive {
  background: #346ea6;
}

.empty-card {
  text-align: center;
}

.task-item.removing {
  opacity: 0;
  transform: translateX(16px);
}

.inventory-section-title {
  margin: 0 0 12px;
  font-size: 18px;
}

.inventory-editor-card {
  padding: 0;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.inventory-create-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: end;
}

.inventory-create-action {
  grid-column: 1 / -1;
  width: 100%;
}

.inventory-record-card {
  padding: 2px 4px;
  border-radius: 10px;
}

.inventory-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px 48px 48px 50px;
  gap: 2px;
  align-items: center;
}

.inventory-name-cell {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.inventory-name-input,
.inventory-cell-input {
  min-height: 24px;
  border-radius: 8px;
  padding: 0 6px;
  font-size: 12px;
}

.inventory-id-text {
  margin: 0;
  font-size: 9px;
  line-height: 1.1;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inventory-row-save {
  min-width: 0;
  min-height: 24px;
  padding: 0 4px;
  font-size: 12px;
  border-radius: 8px;
}

@media (max-width: 420px) {
  h1 {
    font-size: 24px;
  }

  .task-row {
    grid-template-columns: minmax(0, 1fr) 46px 34px 26px;
    gap: 2px;
  }

  .task-name-block h2 {
    font-size: 12px;
  }

  .task-item.compact .task-action {
    min-width: 26px;
    min-height: 22px;
    font-size: 11px;
  }

  .task-meta {
    grid-template-columns: 1fr;
  }

  .warehouse-actions,
  .warehouse-counts {
    grid-template-columns: 1fr;
    display: grid;
  }

  .task-table-head.inventory-head,
  .inventory-row {
    grid-template-columns: minmax(0, 1fr) 44px 44px 44px 46px;
  }

  .inventory-create-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .inventory-create-grid {
    grid-template-columns: 1fr;
  }
}
