:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #f8fbff;
  --line: #d9e2ec;
  --text: #162333;
  --muted: #65758b;
  --accent: #174ea6;
  --accent-strong: #123f85;
  --accent-soft: #e8f0fe;
  --ok: #137333;
  --warning: #b06000;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --shadow: 0 18px 45px rgba(28, 42, 58, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

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

button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 9px 11px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 78, 166, 0.14);
}

.admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #0f1724;
  color: #fff;
  padding: 18px;
}

.brand {
  display: grid;
  gap: 6px;
  margin-bottom: 24px;
}

.brand-logo {
  display: block;
  width: 148px;
  max-width: 100%;
  height: auto;
  margin-bottom: 8px;
  border-radius: 6px;
  background: #fff;
  padding: 8px 10px;
}

.brand span {
  color: #9bb7ff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand strong {
  font-size: 22px;
}

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

.nav-button {
  width: 100%;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
  padding: 0 12px;
  font-weight: 800;
}

.nav-button:hover,
.nav-button.active {
  background: #1d2b42;
  color: #fff;
}

.main {
  min-width: 0;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

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

h1 {
  margin-bottom: 6px;
  font-size: 28px;
}

h2 {
  margin-bottom: 4px;
  font-size: 20px;
}

.topbar p,
.panel-head p,
.hint {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.toolbar,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.secondary-button,
.danger-button {
  padding: 0 14px;
  font-weight: 800;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

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

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

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

.view {
  display: none;
}

.view.active {
  display: block;
}

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

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

.summary-card {
  padding: 14px;
}

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

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.panel {
  overflow: hidden;
}

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

.panel-head.stacked {
  display: grid;
}

.panel-head span {
  color: var(--muted);
  font-size: 13px;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 160px 180px;
  gap: 10px;
}

.table-wrap {
  overflow: auto;
}

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

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

th {
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

td {
  font-size: 14px;
}

.raw-vision-cell {
  max-width: 360px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.split {
  display: grid;
  grid-template-columns: 380px 1fr;
  min-height: 620px;
}

.customer-list {
  border-right: 1px solid var(--line);
  background: #fbfdff;
  overflow: auto;
}

.customer-row {
  display: grid;
  width: 100%;
  min-height: auto;
  gap: 7px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.customer-row:hover,
.customer-row.active {
  background: var(--accent-soft);
}

.customer-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-row small {
  color: var(--muted);
  line-height: 1.4;
}

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

.badge.A {
  background: #fff4d6;
  color: #8a4b00;
}

.badge.B {
  background: #e8f0fe;
  color: var(--accent);
}

.badge.C {
  background: #eef2f6;
  color: #53616c;
}

.detail-pane {
  min-width: 0;
  padding: 16px;
  overflow: auto;
}

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

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

.detail-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

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

.detail-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

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

label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.settings-panel {
  display: grid;
  gap: 14px;
  max-width: 720px;
  padding: 16px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 20;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  border-radius: 8px;
  background: #162333;
  color: #fff;
  padding: 10px 14px;
  box-shadow: var(--shadow);
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
  }

  .nav-list {
    grid-template-columns: repeat(3, 1fr);
  }

  .summary-grid,
  .filters,
  .split,
  .detail-grid,
  .edit-form {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }

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