html {
  -webkit-text-size-adjust: 100%;
}

:root {
  --bg: #f4f6f7;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #69727d;
  --line: #dfe4e8;
  --accent: #f97316;
  --accent-strong: #c2410c;
  --accent-soft: #fff3e7;
  --danger: #a33a3a;
  --shadow: 0 12px 28px rgba(31, 41, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  display: flex;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.sidebar {
  width: 206px;
  background: #231a14;
  color: #eef4f3;
  padding: 24px 18px;
  position: fixed;
  inset: 0 auto 0 0;
  overflow: hidden;
  z-index: 0;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(35, 26, 20, 0.5), rgba(35, 26, 20, 0.86)), url("/static/car-sidebar.png");
  background-size: cover;
  background-position: center bottom;
  opacity: 0.5;
  z-index: -2;
}

.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(24, 16, 11, 0.42);
  z-index: -1;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: #fff3e7;
  color: #c2410c;
  border-radius: 8px;
  font-weight: 800;
}

.brand span {
  display: block;
  color: #d5c6ba;
  font-size: 12px;
  margin-top: 4px;
}

.nav-link {
  display: block;
  color: #eadfd5;
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 6px;
}

.nav-link.active,
.nav-link:hover {
  background: #3a2a20;
  color: #ffffff;
}

.account-box {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  color: #fff8f2;
  font-size: 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 14px;
}

.account-box span {
  display: block;
  color: #d5c6ba;
  margin: 4px 0 8px;
}

.link-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: #ffb37a;
  cursor: pointer;
  font: inherit;
}

.main {
  margin-left: 206px;
  width: calc(100% - 206px);
  padding: 26px 28px;
  max-width: 1560px;
}

.command-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.command-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.view-title {
  color: var(--muted);
  font-size: 13px;
}

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

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

.icon-button {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  box-shadow: var(--shadow);
}

.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn.danger {
  border-color: #f2c5c5;
  color: var(--danger);
  background: #fff7f7;
}

.btn.danger:hover {
  border-color: #d79b9b;
  background: #fff1f1;
}

.history-icon {
  font-size: 17px;
  line-height: 1;
}

h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 760;
}

h2 {
  margin: 0 0 16px;
  font-size: 18px;
}

p {
  color: var(--muted);
  margin: 8px 0 0;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

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

.metric {
  padding: 18px;
}

.metric span {
  color: var(--muted);
  display: block;
  font-size: 13px;
}

.metric strong {
  display: block;
  font-size: 30px;
  margin-top: 8px;
}

.metric.compact strong {
  font-size: 24px;
}

.panel {
  padding: 16px;
  margin-bottom: 18px;
  overflow-x: auto;
}

.import-hints {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.lookup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.field-note {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.name-check-head,
.name-check-cell {
  display: flex;
  align-items: center;
  gap: 14px;
}

.name-check-cell {
  cursor: pointer;
}

.name-check-head input,
.name-check-cell input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 15px;
  height: 15px;
  min-width: 15px;
  min-height: 15px;
  max-width: 15px;
  max-height: 15px;
  padding: 0;
  box-sizing: border-box;
  vertical-align: middle;
  margin: 0;
  flex: 0 0 auto;
  cursor: pointer;
  position: relative;
  z-index: 2;
  border: 2px solid #cfd8df;
  border-radius: 5px;
  background: #ffffff;
  display: inline-grid;
  place-items: center;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.name-check-head input:hover,
.name-check-cell input:hover {
  border-color: var(--accent);
}

.name-check-head input:checked,
.name-check-cell input:checked {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.14);
}

.name-check-head input:checked::after,
.name-check-cell input:checked::after {
  content: "✓";
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transform: none;
}

.name-check-cell span,
.name-check-head span {
  min-width: 0;
}

tr.row-selected td {
  background: #fff6ee;
}

.selection-count {
  color: var(--muted);
  font-size: 13px;
  align-self: center;
  white-space: nowrap;
}

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

.data-panel {
  min-height: 320px;
}

.side-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 18px;
}

.flow-list {
  list-style: none;
  counter-reset: flow;
  padding: 0;
  margin: 0;
}

.flow-list li {
  counter-increment: flow;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  column-gap: 12px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.flow-list li::before {
  content: counter(flow);
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.flow-list strong {
  display: block;
  font-size: 14px;
  line-height: 1.35;
}

.flow-copy {
  min-width: 0;
}

.flow-list span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.quick-actions {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.grid.two {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 18px;
}

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

.grid.three table {
  min-width: 460px;
}

.grid.three .panel {
  max-height: 360px;
}

.analytics-grid .panel {
  max-height: none;
}

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

.panel-head h2 {
  margin: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.process-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.process-step {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
}

.process-step.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
}

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

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

.timeline-item {
  border-left: 3px solid var(--accent);
  padding-left: 10px;
  color: var(--muted);
  font-size: 13px;
}

.timeline-item strong {
  display: block;
  color: var(--text);
  margin-bottom: 3px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: #52616b;
  font-size: 13px;
  font-weight: 700;
  background: #f8fafb;
}

td {
  font-size: 13px;
  line-height: 1.45;
}

.actions {
  white-space: nowrap;
}

.actions a {
  margin-right: 12px;
}

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  max-width: 760px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: -6px 0 14px;
}

.tab-link {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 13px;
  font-size: 14px;
}

.tab-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tab-link.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
}

.toolbar input {
  max-width: 520px;
}

input,
select,
textarea,
button {
  width: 100%;
  border: 1px solid #cfd8dc;
  border-radius: 8px;
  padding: 10px 11px;
  font: inherit;
  background: #ffffff;
  -webkit-appearance: none;
  appearance: none;
}

textarea {
  resize: vertical;
}

.btn {
  border: 1px solid #cbd5d9;
  background: #ffffff;
  color: var(--text);
  border-radius: 8px;
  padding: 9px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  cursor: pointer;
  font-size: 14px;
  width: auto;
}

.action-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: -6px 0 16px;
}

.btn.primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn.primary:hover {
  background: var(--accent-strong);
}

.btn.subtle {
  background: #f8fafb;
}

.btn.danger {
  color: #ffffff;
  background: var(--danger);
  border-color: var(--danger);
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 70% 10%, #fff3e7 0, #f4f6f7 36%, #eceff1 100%);
}

.auth-card {
  width: min(440px, calc(100vw - 32px));
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.auth-brand {
  color: var(--text);
  margin-bottom: 20px;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.auth-alt {
  margin-top: 16px;
  color: var(--muted);
}

.auth-error {
  margin-top: 12px;
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #991b1b;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}

.notice-banner {
  margin-bottom: 14px;
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #9a3412;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}

.import-panel p {
  margin-bottom: 12px;
}

.import-form {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.import-form input[type="file"] {
  max-width: 420px;
}

.mobile-log-list {
  display: none;
}

.mobile-log-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  background: #ffffff;
}

.mobile-log-card p {
  margin: 8px 0;
}

.mobile-log-head,
.mobile-log-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.mobile-log-head span,
.mobile-log-meta {
  color: var(--muted);
  font-size: 12px;
}

.desktop-table-wrap {
  display: block;
}

.inline-form {
  display: contents;
}

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

label span {
  display: block;
  color: #4d5963;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 7px;
}

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

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

.delete-row {
  margin-top: 12px;
}

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

.detail-item {
  border-bottom: 1px solid var(--line);
  padding: 0 0 12px;
}

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

.detail-item strong {
  font-weight: 500;
  white-space: pre-wrap;
}

.product-media {
  max-width: 360px;
  max-height: 260px;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: block;
}

@media (max-width: 900px) {
  body {
    display: block;
  }

  .sidebar {
    position: static;
    width: 100%;
    padding-bottom: 18px;
  }

  .sidebar nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .brand {
    margin-bottom: 20px;
  }

  .account-box {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    margin-top: 18px;
  }

  .main {
    margin-left: 0;
    width: 100%;
    padding: 18px;
  }

  .metrics,
  .grid.two,
  .grid.three,
  .content-grid,
  .record-grid,
  .process-bar,
  .form-grid,
  .detail {
    grid-template-columns: 1fr;
  }

  .page-head,
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .page-actions {
    width: 100%;
  }

  .command-bar,
  .panel-head,
  .action-row,
  .form-actions,
  .tabs {
    flex-direction: column;
    align-items: stretch;
  }

  .page-head .btn,
  .toolbar .btn,
  .command-group .btn,
  .form-actions .btn,
  .action-row .btn,
  .import-form .btn {
    width: 100%;
  }

  .import-form {
    flex-direction: column;
    align-items: stretch;
  }

  .tabs {
    gap: 10px;
  }

  table {
    min-width: 560px;
  }

  .panel,
  .side-panel {
    -webkit-overflow-scrolling: touch;
  }

  .detail-item strong,
  .metric strong {
    word-break: break-word;
  }

  .desktop-table-wrap {
    display: none;
  }

  .mobile-log-list {
    display: block;
  }
}
