:root {
  color-scheme: light;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f2ee;
  color: #1d1b18;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

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

.header h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.header p {
  margin: 0;
  color: #5b534a;
}

.stats {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.stat {
  background: #fff;
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-label {
  color: #6a635a;
  font-weight: 600;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
}

.filter {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  padding: 12px;
  border-radius: 14px;
  background: #fff7e6;
  margin-bottom: 16px;
}

.filter .actions {
  align-items: flex-end;
}

.batch {
  border: 1px dashed #e0a138;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 16px;
  display: grid;
  gap: 12px;
}

.quick {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 14px;
  background: #fff7e6;
}

.quick-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.lookup {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.batch-title {
  font-weight: 700;
}

.batch-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  align-items: start;
}

.card {
  display: block;
  padding: 20px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.12);
}

.form {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.form-stacked {
  display: grid;
  gap: 18px;
}

.card-block {
  background: #fff;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.07);
  display: grid;
  gap: 12px;
}

.card-title {
  font-weight: 700;
  font-size: 16px;
}

.card-sub {
  background: #fff7e6;
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.form-row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.field-group {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.field-label {
  font-weight: 600;
}

.radio-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

label.hidden {
  display: none;
}

.form .full {
  grid-column: 1 / -1;
}

input,
textarea,
select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d3cfc9;
  font-size: 14px;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid #e0a138;
  border-color: #e0a138;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button,
.ghost,
.btn {
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  background: #e0a138;
  color: #1d1b18;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.ghost {
  background: #fff;
  border: 1px solid #d3cfc9;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
}

.panel {
  background: #fff;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.07);
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}

.panel-title span {
  color: #6a635a;
  font-size: 13px;
}

.order-list {
  display: grid;
  gap: 12px;
}

.order-card {
  border: 1px solid #eee6dc;
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fef9f0;
}

.order-check {
  display: flex;
  align-items: center;
}

.order-check input {
  width: 18px;
  height: 18px;
}

.order-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.order-card .order-actions form {
  margin: 0;
}

.qr {
  position: relative;
}

.qr summary {
  list-style: none;
  cursor: pointer;
}

.qr img {
  margin-top: 8px;
  width: 120px;
  height: 120px;
  border-radius: 12px;
  border: 1px solid #eee6dc;
}

.danger {
  background: #d9644a;
  color: #fff;
}

.danger:hover {
  opacity: 0.9;
}

.badge {
  background: #2f7d5f;
  color: #fff;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.tag-runner {
  background: #d9644a;
  color: #fff;
}

.tag-self {
  background: #2f7d5f;
  color: #fff;
}

.order-info {
  display: grid;
  gap: 6px;
}

.order-title {
  font-weight: 700;
}

.order-meta {
  color: #5b534a;
  font-size: 13px;
}

.order-note {
  color: #7a6a58;
  font-size: 12px;
}

.empty {
  color: #7a6a58;
  margin: 0;
}

.links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.alert {
  background: #ffe7db;
  border: 1px solid #f1c1a5;
  color: #7a3b1a;
  padding: 10px 12px;
  border-radius: 10px;
  margin: 12px 0;
}

.quick-groups {
  display: grid;
  gap: 16px;
}

.quick-group h3 {
  margin: 0 0 8px;
  font-size: 15px;
  color: #6a635a;
}

.quick-group .links {
  margin-top: 0;
}

.summary {
  background: #fff7e6;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  display: grid;
  gap: 8px;
}

.hint {
  margin: 0;
  color: #6a635a;
  font-size: 12px;
}

.template-tools {
  display: grid;
  gap: 8px;
}

.tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-row .tool {
  padding: 6px 12px;
  font-size: 12px;
}

.preview {
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed #e0a138;
  background: #fff;
  white-space: pre-wrap;
  font-size: 12px;
  color: #4b433b;
}

.receipt-preview {
  display: flex;
  justify-content: center;
  padding: 12px 0;
}

.receipt-paper {
  width: min(320px, 100%);
  background: linear-gradient(180deg, #ffffff 0%, #fdf9f1 100%);
  border: 1px solid #eee6dc;
  border-radius: 8px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
  padding: 12px 10px;
  position: relative;
}

.receipt-paper::before,
.receipt-paper::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  background: repeating-linear-gradient(
    90deg,
    #fff 0,
    #fff 6px,
    #f3ede4 6px,
    #f3ede4 12px
  );
}

.receipt-paper::before {
  top: -6px;
  border-radius: 8px 8px 0 0;
}

.receipt-paper::after {
  bottom: -6px;
  border-radius: 0 0 8px 8px;
}

.receipt-paper .preview {
  border: none;
  background: transparent;
  padding: 0;
  font-family: "Courier New", "Noto Sans SC", "PingFang SC", "Microsoft YaHei",
    monospace;
  line-height: 1.4;
}

.items-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 8px;
  align-items: center;
}

.items-grid.items-edit {
  grid-template-columns: 2fr 1fr 1fr auto;
}

.item-controls {
  display: flex;
  gap: 6px;
}

.item-controls .ghost {
  padding: 6px 10px;
  font-size: 14px;
}

.items-head {
  font-weight: 700;
  color: #6a635a;
  font-size: 12px;
}

.items-grid input {
  width: 100%;
}

.table-section {
  margin-bottom: 32px;
}

.table-section table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #eee6dc;
  font-size: 13px;
}

th {
  background: #fdf4e3;
}

.table-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .page {
    padding: 20px 16px 40px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  .order-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .order-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .panel {
    padding: 16px;
  }

  th,
  td {
    font-size: 12px;
  }
}
