:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f5f7fb;
  color: #1f2937;
}

#app {
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
}

button + button {
  margin-top: 8px;
}

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

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
}

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

.layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-header {
  padding: 16px;
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
  color: #fff;
}

.page-header h1 {
  margin: 0 0 6px;
  font-size: 22px;
}

.header-tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 10px 0 2px;
  margin-top: 12px;
  scrollbar-width: none;
}

.header-tabs::-webkit-scrollbar {
  display: none;
}

.header-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 10px 14px;
  border-radius: 999px;
  color: #cbd5e1;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.18);
  transition: all 0.2s ease;
}

.header-tab:hover {
  color: #fff;
  background: rgba(37, 99, 235, 0.22);
  border-color: rgba(96, 165, 250, 0.42);
}

.header-tab.active {
  color: #fff;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  border-color: rgba(59, 130, 246, 0.7);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.24);
}

.page-content {
  padding: 16px;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

.header-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.header-actions button {
  width: 100%;
  text-align: center;
}

.sidebar {
  padding: 16px;
  background: #0f172a;
  color: #e2e8f0;
}

.sidebar h1 {
  margin: 0 0 12px;
  font-size: 20px;
}

.sidebar button {
  width: 100%;
  text-align: left;
}

.sidebar button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.content {
  padding: 16px;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

.card {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  margin-bottom: 20px;
}

.form-section {
  padding: 4px 0 2px;
}

.form-section + .form-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #e5e7eb;
}

.form-section h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

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

.field--half {
  grid-column: span 1;
}

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

.form-actions button {
  width: 100%;
}

.form-actions button:first-child {
  grid-column: 1 / -1;
}

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

.home-actions button {
  width: 100%;
}

.home-actions button:first-child {
  grid-column: 1 / -1;
  min-height: 52px;
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.22);
}

.page-header-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.page-header-action {
  min-width: 110px;
  padding-inline: 14px;
}

.form-card label {
  display: block;
  margin: 12px 0 6px;
  font-size: 13px;
  color: #475569;
}

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

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

  .field,
  .field--full {
    grid-column: 1 / -1;
  }

  .field--half {
    grid-column: span 1;
  }
}

.field label {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 6px;
}

.form-card label:has(+ input[data-field="goodsName"])::after,
.form-card label:has(+ input[data-field="brandRequirement"])::after,
.form-card label:has(+ input[data-field="itemNo"])::after,
.form-card label:has(+ input[data-field="spec"])::after,
.form-card label:has(+ input[data-field="quantity"])::after,
.form-card label:has(+ input[data-field="customer"])::after,
.form-card label:has(+ input[data-field="customerGroup"])::after,
.form-card label:has(+ textarea[data-field="customerRemark"])::after,
.form-card label:has(+ textarea[data-field="customerAddress"])::after,
.form-card label:has(+ select[data-field="dutyMember"])::after,
.form-card label:has(+ input[data-field="dutyMember"])::after,
.form-card label:has(+ select[data-field="campus"])::after,
.form-card label:has(+ select[data-field="orderType"])::after,
.form-card label:has(+ select[data-field="canPrice"])::after,
.form-card label:has(+ input[data-field="costPrice"])::after,
.form-card label:has(+ input[data-field="suggestedPrice"])::after,
.form-card label:has(+ select[data-field="supplierOption"])::after,
.form-card label:has(+ input[data-field="leadTime"])::after,
.form-card label:has(+ select[data-field="customerWillOrder"])::after,
.form-card label:has(+ input[data-field="dealSalePrice"])::after,
.form-card label:has(+ input[data-field="dealSaleTotal"])::after,
.form-card label:has(+ textarea[data-field="noDealReason"])::after,
.form-card label:has(+ input[data-field="trackingNo"])::after,
.form-card label:has(+ input[data-field="arrivalTime"])::after,
.form-card label:has(+ input[data-field="storageMethod"])::after,
.form-card label:has(+ input[data-field="goodsCategory"])::after,
.form-card label:has(+ input[data-field="invoiceNo"])::after {
  content: " *";
  color: #dc2626;
  font-weight: 700;
}

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

.list-card {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  border-radius: 16px;
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  color: #111827;
}

.list-card + .list-card {
  margin-top: 0;
}

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

.list-card-head strong {
  min-width: 0;
}

.list-card-head > span {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #2563eb;
  background: #dbeafe;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.sub-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.sub-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  height: 36px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  border-radius: 999px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

.sub-tabs .sub-tab + .sub-tab {
  margin-top: 0;
}

.sub-tab.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.22);
}

.todo-list {
  gap: 14px;
}

.todo-card {
  padding: 18px;
}

.todo-card .list-card-head {
  margin-bottom: 10px;
}

.todo-card .todo-status-pill--pending {
  color: #dc2626;
  background: #fee2e2;
}

.todo-card .todo-status-pill--done {
  color: #2563eb;
  background: #dbeafe;
}

.todo-content {
  line-height: 1.7;
}

.todo-meta {
  margin-top: 8px;
}

.todo-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 8px;
  border-radius: 999px;
  background: #ef4444;
  vertical-align: middle;
}

.list-item {
  padding: 12px 0;
  border-bottom: 1px solid #e5e7eb;
}

.muted {
  color: #6b7280;
  font-size: 13px;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.attachment-image-link {
  display: inline-flex;
}

.attachment-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f8fafc;
  min-width: min(100%, 320px);
}

.attachment-meta {
  min-width: 0;
}

.attachment-name {
  color: #0f172a;
  word-break: break-all;
  font-weight: 600;
}

.attachment-thumb {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #dbeafe;
  background: #fff;
}

.attachment-download {
  color: #1d4ed8;
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
}

.attachment-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 1800;
  background: rgba(15, 23, 42, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.attachment-preview-panel {
  width: min(100%, 900px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
  background: #0f172a;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.35);
}

.attachment-preview-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  background: rgba(15, 23, 42, 0.96);
  color: #ffffff;
}

.attachment-preview-title {
  font-size: 14px;
  font-weight: 700;
  word-break: break-all;
}

.attachment-preview-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow: auto;
  background: #020617;
}

.attachment-preview-image {
  max-width: 100%;
  max-height: calc(92vh - 72px);
  object-fit: contain;
  border-radius: 12px;
  background: #ffffff;
}

.attachment-summary-card {
  margin-top: 10px;
  padding: 14px;
  border: 1px solid #dbe5f3;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff 0%, #f8fafc 100%);
}

.attachment-summary-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.attachment-summary-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.attachment-summary-pending {
  margin-top: 6px;
  color: #b45309;
  font-size: 12px;
}

.attachment-legacy-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #ffffff;
  color: #475569;
  border: 1px solid #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
}

.attachment-list--pending {
  display: grid;
  gap: 10px;
}

.attachment-item--pending {
  grid-template-columns: 1fr auto;
}

.attachment-pending-card {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f8fafc;
}

.attachment-pending-meta {
  min-width: 0;
}

.attachment-thumb--pending {
  display: block;
}

.attachment-manager-overlay {
  position: fixed;
  inset: 0;
  z-index: 1700;
  background: rgba(15, 23, 42, 0.56);
  display: flex;
  justify-content: center;
  align-items: stretch;
}

.attachment-manager-panel {
  position: relative;
  width: min(100%, 960px);
  height: 100dvh;
  max-height: 100dvh;
  background: #eef3f9;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.attachment-manager-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}

.attachment-manager-body {
  padding: 16px;
  display: grid;
  gap: 16px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.attachment-manager-section {
  margin-top: 12px;
}

.attachment-manager-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.attachment-picker-button {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #e0ecff;
  color: #1d4ed8;
  font-weight: 600;
  cursor: pointer;
  border: 0;
}

.attachment-picker-button--doc {
  background: #e8f5e9;
  color: #166534;
}

.attachment-picker-button input {
  position: absolute;
  inset: 0;
  opacity: 0.01;
  cursor: pointer;
}

.attachment-upload-mask {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: rgba(255, 255, 255, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.attachment-upload-dialog {
  width: min(100%, 320px);
  padding: 24px 20px;
  border-radius: 18px;
  background: #0f172a;
  color: #ffffff;
  text-align: center;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.28);
}

.attachment-upload-title {
  margin-top: 14px;
  font-size: 16px;
  font-weight: 700;
}

.attachment-upload-progress {
  margin-top: 8px;
  font-size: 22px;
  font-weight: 700;
}

.attachment-spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto;
  border-radius: 999px;
  border: 4px solid rgba(255, 255, 255, 0.22);
  border-top-color: #ffffff;
  animation: attachment-spin 0.9s linear infinite;
}

@keyframes attachment-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.debug-block {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 14px;
  margin: 12px 0 0;
}

.form-error {
  border: 1px solid #ef4444;
  background: #fff1f2;
  color: #991b1b;
  margin-bottom: 14px;
}

code {
  background: #eef2ff;
  padding: 2px 6px;
  border-radius: 6px;
}

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

.timeline-item {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 12px;
  align-items: start;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.timeline-dot {
  width: 14px;
  height: 14px;
  margin-top: 4px;
  border-radius: 999px;
  background: #cbd5e1;
  box-shadow: 0 0 0 4px #e2e8f0;
}

.timeline-item.completed .timeline-dot {
  background: #16a34a;
  box-shadow: 0 0 0 4px #dcfce7;
}

.timeline-item.active .timeline-dot {
  background: #2563eb;
  box-shadow: 0 0 0 4px #dbeafe;
}

.timeline-item.doing .timeline-dot {
  background: #2563eb;
  box-shadow: 0 0 0 4px #dbeafe;
}

.timeline-item.done .timeline-dot {
  background: #16a34a;
  box-shadow: 0 0 0 4px #dcfce7;
}

.timeline-item.todo .timeline-dot {
  background: #cbd5e1;
  box-shadow: 0 0 0 4px #e2e8f0;
}

.timeline-body {
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.timeline-content {
  padding-bottom: 2px;
}

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

.timeline-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.timeline-status {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}

.timeline-meta {
  margin-top: 6px;
  color: #475569;
  font-size: 13px;
}

.timeline-note {
  margin-top: 4px;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.5;
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  z-index: 60;
  padding: 12px;
}

.drawer-panel {
  width: min(100%, 980px);
  max-height: 92vh;
  overflow: auto;
  background: #f5f7fb;
  border-radius: 20px 20px 16px 16px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.24);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 16px 8px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 1;
}

.drawer-content {
  padding: 12px 12px 18px;
}

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

.oncall-preview-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.oncall-preview-item {
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  color: #334155;
}

.oncall-preview-item--active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
}

.oncall-editor {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

.oncall-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 14px 0 16px;
}

.oncall-editor-modal,
.oncall-confirm-modal {
  width: min(100%, 760px);
}

.compact-card {
  margin: 0;
}

.home-actions--stack {
  display: grid;
  gap: 10px;
}

.oncall-editor-list {
  display: grid;
  gap: 8px;
}

.oncall-editor-row {
  display: grid;
  grid-template-columns: 28px 1fr auto auto auto;
  gap: 10px;
  align-items: center;
}

.oncall-editor-index {
  color: #64748b;
  font-size: 13px;
  text-align: center;
}

.mini-button {
  min-width: 36px;
  min-height: 27px;
  padding: 0 6px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 27px;
  text-align: center;
  box-sizing: border-box;
}

.oncall-editor-actions .mini-button {
  min-width: 28px;
}

.oncall-editor-actions button + button,
.oncall-editor-row button + button {
  margin-top: 0;
}

.oncall-editor-actions .mini-button:nth-child(1),
.oncall-editor-actions .mini-button:nth-child(2) {
  background: #e2e8f0;
  color: #1e293b;
}

.oncall-editor-actions .mini-button:nth-child(3) {
  background: #0f766e;
  color: #ffffff;
}

.oncall-editor-row .mini-button {
  margin-top: 0;
}

.oncall-editor-row .mini-button:not(.mini-button--danger) {
  background: #dbeafe;
  color: #1d4ed8;
}

.mini-button--danger {
  background: #fee2e2;
  color: #b91c1c;
}

.toast-message {
  position: fixed;
  top: 88px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1500;
  background: rgba(17, 24, 39, 0.94);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.2;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
}

@media (min-width: 900px) {
  .header-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .content {
    padding: 24px;
  }

  .page-content {
    padding: 24px;
  }

  .drawer-overlay {
    align-items: center;
  }

  .drawer-panel {
    border-radius: 20px;
  }
}
