:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #fff;
  --line: #d9dee7;
  --text: #1f2937;
  --muted: #667085;
  --blue: #2458c6;
  --green: #16845b;
  --amber: #a05c00;
  --red: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

h1,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
}

.topbar p {
  margin-top: 5px;
  color: var(--muted);
}

.actions,
.toolbar,
.row-top,
.tags,
.links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

button,
a,
select,
input[type="search"] {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
  font: inherit;
}

a {
  display: inline-flex;
  align-items: center;
  color: var(--blue);
  text-decoration: none;
  font-weight: 700;
}

button {
  cursor: pointer;
}

button.secondary {
  color: var(--muted);
}

button.danger-btn {
  border-color: #ffd1cc;
  background: #fff7f5;
  color: var(--red);
  font-weight: 700;
}

main {
  padding: 16px 22px 26px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(108px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.stat {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 13px;
}

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

.stat strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.stat.danger {
  border-color: #ffd1cc;
  background: #fff7f5;
}

.toolbar {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.toolbar input[type="search"] {
  min-width: 280px;
  flex: 1;
}

.check {
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: minmax(340px, 0.38fr) minmax(0, 0.62fr);
  min-height: calc(100vh - 220px);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.list {
  max-height: calc(100vh - 220px);
  overflow: auto;
  border-right: 1px solid var(--line);
}

.issue-row {
  display: block;
  width: 100%;
  min-height: 114px;
  border: 0;
  border-bottom: 1px solid #edf0f5;
  border-radius: 0;
  padding: 12px 14px;
  background: #fff;
  text-align: left;
}

.issue-row:hover,
.issue-row.selected {
  background: #f5f8ff;
}

.issue-row.deleted {
  background: #f7f8fa;
  opacity: 0.58;
}

.issue-row.selected {
  box-shadow: inset 3px 0 0 var(--blue);
}

.row-top {
  justify-content: space-between;
  margin-bottom: 8px;
}

.issue-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.issue-row p {
  margin-top: 6px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.issue-row.deleted strong,
.issue-row.deleted p {
  text-decoration: line-through;
}

.issue-row small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.tag.status-wait {
  color: var(--red);
  background: #fff0ee;
}

.tag.status-done {
  color: var(--green);
  background: #eaf7f1;
}

.tag.quality {
  color: var(--red);
  background: #fff0ee;
}

.tag.refund {
  color: #6842c2;
  background: #f2edff;
}

.tag.logistics {
  color: #175cd3;
  background: #eff8ff;
}

.tag.address {
  color: var(--green);
  background: #eaf7f1;
}

.tag.invoice {
  color: var(--amber);
  background: #fff6e6;
}

.tag.neutral {
  color: var(--muted);
  background: #eef2f7;
}

.detail {
  min-width: 0;
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding: 16px;
  background: #f8fafc;
}

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

.detail-head strong {
  display: block;
  font-size: 18px;
  margin-bottom: 4px;
}

.detail-head small {
  color: var(--muted);
}

.fields {
  margin: 0;
  padding: 12px 0;
}

.fields div {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #e8edf4;
}

.fields dt {
  color: var(--muted);
}

.fields dd {
  margin: 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.links {
  margin: 2px 0 14px;
}

.links button {
  min-height: 34px;
}

.shot {
  max-height: 760px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2f6;
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
}

.empty {
  padding: 18px;
  color: var(--muted);
}

@media (max-width: 960px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

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

  .list,
  .detail {
    max-height: none;
  }

  .list {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
