:root {
  color-scheme: light;
  --bg: #f6f4f1;
  --panel: #ffffff;
  --soft: #fbfaf8;
  --ink: #1d2527;
  --muted: #69737a;
  --line: #e1d8cf;
  --accent: #0f766e;
  --warm: #d95f3d;
  --pink: #db2777;
  --blue: #2563eb;
  --warn: #b45309;
  --shadow: 0 18px 48px rgba(54, 42, 34, 0.09);
  --shadow-soft: 0 8px 22px rgba(54, 42, 34, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.045) 1px, transparent 1px),
    linear-gradient(0deg, rgba(217, 95, 61, 0.05) 1px, transparent 1px),
    var(--bg);
  background-size: 34px 34px;
  color: var(--ink);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

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

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(255, 252, 248, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 28px rgba(54, 42, 34, 0.06);
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 16px;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.topbar-actions,
.filter-row,
.card-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

button,
.topbar-actions a {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 13px;
  background: linear-gradient(135deg, var(--accent), #0f8d78);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  box-shadow: var(--shadow-soft);
}

button.secondary,
.topbar-actions a,
.filter {
  border-color: var(--line);
  background: #fff;
  color: var(--accent);
}

.pin-input {
  width: 128px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 11px;
}

.filter.active {
  background: linear-gradient(135deg, var(--accent), #0f8d78);
  color: #fff;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.layout {
  width: min(1280px, calc(100% - 32px));
  margin: 20px auto 44px;
  display: grid;
  gap: 16px;
}

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

.summary-grid article,
.panel,
.material-card,
.request-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.summary-grid article::before,
.panel::before,
.material-card::before,
.request-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--warm), var(--accent), var(--blue));
}

.summary-grid article {
  min-height: 96px;
  padding: 16px;
  background: linear-gradient(180deg, #ffffff, #fffbf6);
}

.summary-grid span,
.panel-head span,
.form-note,
label,
.small {
  color: var(--muted);
  font-size: 13px;
}

.summary-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 32px;
  line-height: 1.1;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 16px;
  align-items: start;
}

.main-column,
.side-column,
.material-list,
.request-list {
  display: grid;
  gap: 16px;
}

.panel {
  padding: 18px;
  background: rgba(255, 255, 255, 0.94);
}

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

.panel-head.compact {
  margin-bottom: 10px;
}

.sticky-panel {
  position: sticky;
  top: 86px;
}

.material-card {
  display: grid;
  grid-template-columns: 172px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  background: linear-gradient(180deg, #fff, #fbfaf8);
  box-shadow: var(--shadow-soft);
}

.material-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(54, 42, 34, 0.08);
}

.image-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  background: #fff7ed;
  color: var(--warm);
  font-size: 12px;
  font-weight: 800;
}

.material-card pre,
.request-card pre,
.template-box {
  overflow: auto;
  margin: 10px 0 0;
  padding: 11px;
  border-radius: 8px;
  background: #172026;
  color: #f5f0e9;
  font-size: 12px;
  white-space: pre-wrap;
}

.material-card pre {
  max-height: 180px;
}

.request-card {
  padding: 14px;
  background: linear-gradient(180deg, #fff, #fbfaf8);
}

.request-card h3 {
  margin-bottom: 5px;
}

.request-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

form {
  display: grid;
  gap: 11px;
}

.request-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #fbfaf8);
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(217, 95, 61, 0.22);
  border-color: rgba(217, 95, 61, 0.62);
}

textarea {
  min-height: 112px;
  resize: vertical;
}

.wide {
  grid-column: 1 / -1;
}

.copy-buffer {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #fff7ed, #ecfdf5);
}

.empty {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

@media (max-width: 980px) {
  .workspace,
  .material-card,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .sticky-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .topbar,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .request-form {
    grid-template-columns: 1fr;
  }
}
