:root {
  --bg: #f6f7f3;
  --panel: #ffffff;
  --text: #25311f;
  --muted: #6f7b68;
  --line: #e4eadf;
  --green: #4f9d44;
  --green-soft: #e7f4e3;
  --orange: #d77716;
  --orange-soft: #fff0d7;
  --blue: #316c92;
  --blue-soft: #e4f0f6;
  --danger: #b65f47;
  --danger-soft: #fae9e3;
  --shadow: 0 16px 40px rgba(53, 77, 44, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 100vh;
  border-right: 1px solid var(--line);
  background: #fbfcf8;
  padding: 24px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
}

.brand-title {
  font-size: 18px;
  font-weight: 900;
}

.brand-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 7px;
}

.nav-item {
  height: 40px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 0 14px;
  font-weight: 800;
}

.nav-item.active,
.nav-item:hover {
  background: var(--green-soft);
  color: var(--green);
}

.main {
  min-width: 0;
  padding: 26px 30px 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 15px;
}

#viewSubtitle,
.panel-sub,
.hint {
  color: var(--muted);
}

#viewSubtitle {
  margin-top: 8px;
}

.panel-sub {
  margin-top: 6px;
  font-size: 13px;
}

.status-pill {
  min-width: 96px;
  border-radius: 999px;
  background: #f1eee9;
  color: #806d60;
  padding: 9px 14px;
  text-align: center;
  font-size: 13px;
  font-weight: 850;
}

.status-pill.ok {
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.demo {
  background: var(--orange-soft);
  color: var(--orange);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card,
.panel,
.form-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat-card {
  min-height: 102px;
  padding: 18px;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 26px;
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(360px, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
}

.panel {
  padding: 20px;
}

.panel-head,
.subhead,
.delivery-card-head,
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-head {
  margin-bottom: 16px;
}

.primary-btn,
.ghost-btn,
.text-btn,
.link-btn,
.icon-btn {
  min-height: 36px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 850;
}

.primary-btn {
  background: var(--green);
  color: #fff;
  padding: 0 14px;
}

.ghost-btn {
  background: #eef3ea;
  color: #53634c;
  padding: 0 14px;
}

.text-btn,
.link-btn {
  background: transparent;
  color: var(--green);
  padding: 0 6px;
}

.icon-btn {
  width: 34px;
  background: #eef3ea;
  color: #53634c;
  font-size: 20px;
  line-height: 1;
}

.phone-link {
  color: var(--blue);
  font-weight: 850;
  text-decoration: none;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.delivery-toolbar {
  grid-template-columns: repeat(auto-fit, minmax(190px, 240px));
  justify-content: start;
}

.compact-list,
.todo-list,
.modal-list,
.report-lines {
  display: grid;
  gap: 10px;
}

.compact-item,
.todo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.compact-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.todo-item {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 0 12px;
  color: var(--text);
}

.todo-item strong {
  color: var(--orange);
  font-size: 20px;
}

.item-title {
  font-weight: 850;
}

.item-sub {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.amount,
.warn-text {
  color: var(--orange);
  font-weight: 900;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-top: 1px solid var(--line);
  padding: 13px 10px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

td {
  font-size: 14px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 850;
}

.tag.offline {
  background: #f1eee9;
  color: #806d60;
}

.tag.warn {
  background: var(--orange-soft);
  color: var(--orange);
}

.tag.info {
  background: var(--blue-soft);
  color: var(--blue);
}

.tag.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.danger-link {
  color: var(--danger);
}

.wrap-cell {
  max-width: 300px;
  white-space: normal;
  line-height: 1.5;
}

.proof-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 104px;
}

.form-card {
  margin-bottom: 16px;
  padding: 16px;
}

.hidden {
  display: none;
}

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

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.check-label {
  display: flex;
  align-items: center;
  min-height: 40px;
  gap: 9px;
}

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

.wide-label {
  margin-top: 12px;
}

.image-upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.file-label input {
  padding-top: 8px;
}

.image-preview {
  display: grid;
  place-items: center;
  min-height: 126px;
  overflow: hidden;
  border: 1px dashed #cbd9c4;
  border-radius: 8px;
  background: #fbfcf8;
  color: var(--muted);
  font-size: 13px;
}

.image-preview img {
  display: block;
  width: 100%;
  height: 126px;
  object-fit: cover;
}

.table-thumb {
  display: block;
  width: 56px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  color: var(--text);
  outline: 0;
}

input,
select {
  height: 40px;
  padding: 0 11px;
}

textarea {
  min-height: 92px;
  resize: vertical;
  padding: 10px 11px;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #b7dcae;
  box-shadow: 0 0 0 3px rgba(88, 169, 71, 0.12);
}

.subhead {
  margin: 16px 0 10px;
}

.spec-table {
  display: grid;
  gap: 8px;
}

.spec-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) repeat(3, minmax(100px, 0.75fr)) 40px;
  gap: 8px;
  align-items: center;
}

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

.modal-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
  margin: 0 0 16px;
}

.delivery-grid,
.marketing-grid,
.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.delivery-card,
.marketing-card,
.report-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 16px;
}

.admin-log-wrap {
  margin-top: 18px;
}

.delivery-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.delivery-metric {
  border-radius: 8px;
  background: #f2f6ee;
  padding: 12px;
}

.delivery-metric span {
  color: var(--muted);
  font-size: 12px;
}

.delivery-metric strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.delivery-section {
  margin-top: 12px;
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.delivery-section strong {
  color: #314227;
  font-size: 14px;
}

.delivery-order-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 12px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.delivery-note,
.mini-label {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.marketing-card {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.marketing-card p {
  margin-top: 8px;
  color: var(--muted);
}

.marketing-form {
  margin-bottom: 18px;
}

.coupon-admin-head {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.coupon-form {
  border-color: rgba(17, 126, 86, 0.18);
}

.coupon-table-wrap {
  margin-top: 12px;
}

.feature-preview,
.banner-preview {
  margin-top: 12px;
  min-height: 170px;
}

.feature-preview img,
.banner-preview img {
  height: 170px;
}

.mini-label {
  display: inline-flex;
  margin: 0 0 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  padding: 4px 8px;
  font-weight: 850;
}

.hot-label {
  margin-top: 7px;
  background: var(--orange-soft);
  color: var(--orange);
}

.settings-panel,
.payment-panel,
.launch-material-panel {
  max-width: 920px;
  display: grid;
  gap: 14px;
}

.admin-login-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 16px;
}

.ok-text {
  color: var(--green);
  font-weight: 800;
}

.payment-panel,
.launch-material-panel {
  margin-top: 18px;
}

.payment-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.payment-status-card {
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 16px;
}

.payment-status-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.payment-status-card strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

.payment-status-card p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-all;
}

.payment-section-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 14px;
}

.payment-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 16px;
}

.payment-config-list,
.callback-list,
.launch-checklist {
  display: grid;
  gap: 10px;
}

.payment-config-row,
.launch-check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.payment-config-row:first-child,
.launch-check-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.payment-config-row strong,
.launch-check-row strong {
  font-size: 14px;
}

.payment-config-row p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.launch-check-row {
  justify-content: flex-start;
}

.check-dot {
  display: grid;
  flex: none;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--orange-soft);
  color: var(--orange);
  font-size: 12px;
  font-weight: 900;
}

.launch-check-row.done .check-dot {
  background: var(--green-soft);
  color: var(--green);
}

.launch-check-row strong {
  flex: 1;
}

.launch-check-row em {
  flex: none;
  color: var(--orange);
  font-style: normal;
  font-size: 12px;
  font-weight: 850;
}

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

.launch-progress {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 16px;
}

.launch-progress strong {
  font-size: 15px;
}

.launch-progress p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.progress-track {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #e5ecdf;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 0.18s ease;
}

.material-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 16px;
}

.material-group.done {
  border-color: #b7d7a8;
}

.material-group-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.material-group-head h3 {
  font-size: 15px;
}

.material-group-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.material-group-head span {
  flex: none;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 850;
}

.material-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.material-row {
  position: relative;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.material-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.material-row strong {
  font-size: 14px;
}

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

.material-row em {
  color: var(--orange);
  font-style: normal;
  font-size: 12px;
  font-weight: 850;
}

.material-row.done .check-dot {
  background: var(--green-soft);
  color: var(--green);
}

.material-row.done strong,
.material-row.done em {
  color: var(--green);
}

.hint {
  font-size: 13px;
  line-height: 1.6;
}

.empty {
  min-height: 96px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(37, 49, 31, 0.34);
  padding: 24px;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(760px, 100%);
  max-height: min(720px, 90vh);
  overflow: auto;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(37, 49, 31, 0.22);
  padding: 20px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.detail-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 12px;
}

.detail-grid span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.delivery-confirm-form,
.sms-send-form {
  display: grid;
  gap: 14px;
}

.proof-preview {
  display: grid;
  place-items: center;
  min-height: 130px;
  overflow: hidden;
  border: 1px dashed #cbd9c4;
  border-radius: 8px;
  background: #fbfcf8;
  color: var(--muted);
  font-size: 13px;
}

.proof-preview img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
}

.refund-proof-list {
  display: grid;
  gap: 12px;
  margin: 12px 0 16px;
}

.proof-path {
  border: 1px dashed #cbd9c4;
  border-radius: 8px;
  background: #fbfcf8;
  color: var(--muted);
  padding: 12px;
  word-break: break-all;
  line-height: 1.5;
}

.receipt {
  overflow: auto;
  border-radius: 8px;
  background: #25311f;
  color: #fff;
  padding: 16px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(18px);
  opacity: 0;
  pointer-events: none;
  border-radius: 999px;
  background: #25311f;
  color: #fff;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 800;
  transition: all 0.18s ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@media (max-width: 1280px) {
  .stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav {
    display: flex;
    overflow-x: auto;
  }

  .nav-item {
    flex: none;
    min-width: 92px;
  }

  .delivery-grid,
  .marketing-grid,
  .report-grid,
  .payment-status-grid,
  .payment-section-grid,
  .launch-material-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .spec-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 20px 14px 34px;
  }

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

  .topbar-actions,
  .toolbar,
  .detail-grid,
  .stat-grid {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .topbar-actions,
  .panel-head,
  .marketing-card {
    align-items: flex-start;
    flex-direction: column;
  }
}
