:root {
  --deck-bg: #08101f;
  --deck-bg-2: #111a35;
  --ink: #1a1d24;
  --muted: #66707d;
  --line: #e5eaf2;
  --panel: rgba(255, 255, 255, 0.97);
  --blue: #3370ff;
  --blue-2: #4d8bff;
  --violet: #5c3ffb;
  --teal: #16a88f;
  --orange: #c76a1f;
  --red: #d84d4d;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  background: var(--deck-bg);
  overflow: hidden;
}

body {
  height: 100%;
  margin: 0;
  color: #fff;
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 11% 5%, rgba(51, 112, 255, 0.34), transparent 28%),
    radial-gradient(circle at 86% 12%, rgba(92, 63, 251, 0.30), transparent 30%),
    linear-gradient(180deg, #111a35 0%, #08101f 58%, #08101f 100%);
  background-attachment: fixed;
  overflow: hidden;
}

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

button,
input,
select,
textarea {
  border-radius: 0;
}

.app-shell {
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  overflow: hidden;
}

.app-shell:has(.side-rail:hover) {
  grid-template-columns: 292px minmax(0, 1fr);
}

.side-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background:
    linear-gradient(180deg, rgba(51, 112, 255, 0.22), rgba(92, 63, 251, 0.10) 44%, transparent),
    rgba(8, 16, 31, 0.88);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
  transition: padding 0.22s ease;
}

.brand-block {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-block > div,
.nav-copy,
.rail-module p,
.rail-actions button span:last-child,
.rail-actions p,
.module-label span:last-child {
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.16s ease, transform 0.16s ease;
  white-space: nowrap;
}

.side-rail.is-collapsed .brand-block > div,
.side-rail.is-collapsed .nav-copy,
.side-rail.is-collapsed .rail-module p,
.side-rail.is-collapsed .rail-actions button span:last-child,
.side-rail.is-collapsed .rail-actions p,
.side-rail.is-collapsed .module-label span:last-child {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-8px);
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  border: 1px solid rgba(111, 168, 255, 0.8);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(51, 112, 255, 0.34);
}

.menu-icon {
  transition: transform 0.28s ease;
}

.nav-item:hover .menu-icon,
.utility-button:hover .menu-icon,
.sync-button:hover .menu-icon {
  transform: rotate(180deg);
}

.brand-block strong {
  display: block;
  font-size: 16px;
}

.brand-block small {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
}

.view-nav {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.nav-item {
  position: relative;
  display: grid;
  width: 100%;
  grid-template-columns: 38px 1fr;
  gap: 2px 12px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
  color: rgba(255, 255, 255, 0.78);
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  cursor: pointer;
  transition: 0.18s ease;
}

.side-rail.is-collapsed .nav-item {
  width: 46px;
  min-height: 46px;
  grid-template-columns: 1fr;
  justify-content: center;
  place-items: center;
  padding: 0;
  background: transparent;
  border-color: transparent;
  border-radius: 14px;
}

.nav-item::before {
  content: "";
  position: absolute;
  inset: 12px auto 12px 0;
  width: 3px;
  background: transparent;
  border-radius: 2px;
}

.side-rail.is-collapsed .nav-item::before {
  display: none;
}

.nav-icon {
  grid-row: span 2;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: rgba(111, 168, 255, 0.95);
  background: rgba(51, 112, 255, 0.13);
  border: 1px solid rgba(111, 168, 255, 0.3);
  border-radius: 10px;
  font-size: 16px;
  font-weight: 900;
}

.side-rail.is-collapsed .nav-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
}

.side-rail.is-collapsed .nav-item.active .nav-icon {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  border-color: rgba(111, 168, 255, 0.75);
  box-shadow: 0 10px 24px rgba(51, 112, 255, 0.25);
}

.nav-copy strong {
  display: block;
  color: inherit;
  font-size: 14px;
}

.nav-copy small {
  display: block;
  color: rgba(255, 255, 255, 0.48);
}

.nav-item:hover,
.nav-item.active {
  color: #fff;
  background: rgba(51, 112, 255, 0.18);
  border-color: rgba(111, 168, 255, 0.58);
}

.nav-item.active::before {
  background: linear-gradient(180deg, var(--blue), var(--violet));
}

.rail-module {
  padding: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
}

.side-rail.is-collapsed .rail-module {
  display: grid;
  place-items: center;
  padding: 0;
  width: 46px;
  min-height: 46px;
  justify-self: center;
  background: transparent;
  border-color: transparent;
}

.module-label,
.eyebrow {
  color: #6fa8ff;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.module-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.module-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(51, 112, 255, 0.2);
  border: 1px solid rgba(111, 168, 255, 0.34);
  border-radius: 8px;
  text-transform: none;
}

.side-rail.is-collapsed .module-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
}

.rail-module p,
.rail-actions p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.68);
  line-height: 1.55;
  font-size: 13px;
}

.rail-actions {
  margin-top: auto;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.utility-button,
.sync-button,
.toolbar button,
.import-button {
  min-height: 40px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.rail-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.side-rail.is-collapsed .rail-actions button {
  display: none;
}

.side-rail.is-collapsed .rail-actions {
  display: none;
}

.utility-button {
  color: #fff;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.24);
}

.sync-button {
  color: #fff;
  font-weight: 800;
  background: linear-gradient(90deg, var(--blue), var(--violet));
  border-color: transparent;
  box-shadow: 0 12px 30px rgba(51, 112, 255, 0.28);
}

button:hover,
.import-button:hover {
  transform: translateY(-1px);
}

.workspace {
  min-width: 0;
  min-height: 0;
  height: 100vh;
  padding: 14px 18px 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.command-header {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) auto;
  gap: 16px;
  align-items: start;
  margin-bottom: 10px;
}

.title-cluster {
  padding: 4px 0;
}

h1 {
  margin: 3px 0 4px;
  color: #fff;
  font-size: clamp(28px, 3.2vw, 42px);
  line-height: 1.04;
  font-weight: 900;
  letter-spacing: 0;
}

.title-cluster p {
  max-width: 760px;
  margin: 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 13px;
  line-height: 1.35;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(98px, 1fr));
  gap: 8px;
}

.header-control {
  min-width: 620px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 14px;
}

.header-sync {
  min-width: 124px;
  min-height: 58px;
  padding: 0 16px;
  gap: 8px;
}

.sync-cluster {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.sync-cluster #syncHint {
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  line-height: 1.3;
  text-align: right;
  max-width: 150px;
}

.metric {
  min-height: 58px;
  padding: 8px 12px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid rgba(229, 234, 242, 0.9);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
}

.metric b {
  display: block;
  color: var(--blue);
  font-size: 28px;
  line-height: 1;
  font-weight: 900;
}

.metric span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 132px 132px 132px auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  margin-bottom: 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(229, 234, 242, 0.96);
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

.data-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}

.data-meta span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  font-size: 11px;
}

.data-meta b {
  color: #6fa8ff;
}

.quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.quick-chip {
  min-height: 30px;
  padding: 0 11px;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
}

.quick-chip.active,
.quick-chip:hover {
  color: #fff;
  background: rgba(51, 112, 255, 0.34);
  border-color: rgba(111, 168, 255, 0.62);
}

.toolbar label {
  display: grid;
  gap: 6px;
}

.toolbar label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select,
textarea {
  min-height: 40px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

input,
select {
  padding: 0 11px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(51, 112, 255, 0.28);
  outline-offset: 0;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.import-button {
  position: relative;
  display: inline-grid;
  place-items: center;
}

.import-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.content-grid {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 14px;
  align-items: stretch;
}

.matrix-panel,
.inspector {
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.matrix-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.matrix-topline {
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: #f4f6fa;
  border-bottom: 1px solid var(--line);
}

.matrix-topline strong {
  color: var(--blue);
}

.matrix-topline span {
  color: var(--muted);
  font-size: 12px;
}

.table-viewport {
  min-height: 0;
  flex: 1;
  max-height: none;
  overflow: auto;
}

table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
  table-layout: fixed;
}

th:nth-child(1), td:nth-child(1) { width: 23%; }
th:nth-child(2), td:nth-child(2) { width: 8%; }
th:nth-child(3), td:nth-child(3) { width: 16%; }
th:nth-child(4), td:nth-child(4) { width: 8%; }
th:nth-child(5), td:nth-child(5) { width: 11%; }
th:nth-child(6), td:nth-child(6) { width: 18%; }
th:nth-child(7), td:nth-child(7) { width: 16%; }

th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 12px;
  color: var(--muted);
  text-align: left;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  background: #f8fafd;
  border-bottom: 1px solid var(--line);
}

th:first-child {
  color: var(--blue);
}

td {
  padding: 7px 10px;
  color: var(--ink);
  vertical-align: top;
  border-bottom: 1px solid #eef2f7;
  font-size: 12px;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover td,
tbody tr.selected td {
  background: #f0f6ff;
}

tbody tr.selected td:first-child {
  box-shadow: inset 4px 0 0 var(--blue);
}

.customer-name {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.record-line,
.muted-line {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.customer-cell .record-line {
  display: none;
}

.signal-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
}

.score-bar {
  width: 58px;
  height: 4px;
  background: #e5eaf2;
  border-radius: 3px;
  overflow: hidden;
}

.score-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #6fa8ff);
}

.score-text {
  color: var(--muted);
  font-size: 10px;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 6px;
  color: #364144;
  background: #f0f6ff;
  border: 1px solid #d8e4f5;
  border-radius: 6px;
  font-size: 10px;
  line-height: 1.1;
  white-space: nowrap;
}

.pill.hot {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
  max-width: 42px;
  white-space: normal;
}

.pill.k24 {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.pill.synced {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.pill.warn {
  color: #fff;
  background: var(--orange);
  border-color: var(--orange);
}

.context-cell,
.stage-cell {
  max-width: 170px;
  overflow-wrap: anywhere;
}

.score-cell {
  color: var(--blue);
  font-weight: 900;
  white-space: nowrap;
}

.mark-tools {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.action-select {
  min-height: 26px;
  padding: 0 7px;
  font-size: 11px;
  border-radius: 6px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}

.segmented button {
  min-height: 24px;
  padding: 2px 3px;
  color: var(--ink);
  background: #f8fafd;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  font-size: 10px;
  white-space: nowrap;
}

.segmented button.active[data-status="已推荐"] {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.segmented button.active[data-status="提前Name"] {
  color: #fff;
  background: var(--orange);
  border-color: var(--orange);
}

.segmented button.active[data-status="未标记"] {
  color: #fff;
  background: #99a1ad;
  border-color: #99a1ad;
}

textarea {
  width: 100%;
  min-height: 28px;
  max-height: 28px;
  padding: 5px 7px;
  line-height: 1.25;
  resize: vertical;
  font-size: 11px;
}

.progress {
  max-width: 330px;
  white-space: normal;
}

.progress p {
  display: -webkit-box;
  max-height: 38px;
  margin: 4px 0 0;
  color: var(--ink);
  line-height: 1.35;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.progress a {
  display: inline-block;
  margin-top: 4px;
  color: var(--blue);
  font-weight: 800;
  font-size: 11px;
}

.inspector {
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.inspector-empty,
.inspector-body {
  padding: 22px;
}

.scope-mark {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  color: var(--blue);
  border: 1px solid #d8e4f5;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.strategy-card {
  margin: 16px 0 6px;
  padding: 14px;
  color: var(--ink);
  background: linear-gradient(180deg, #f0f6ff 0%, #f8fafd 100%);
  border: 1px solid #d8e4f5;
  border-left: 4px solid var(--blue);
  border-radius: 10px;
  box-shadow: none;
}

.strategy-card span {
  display: block;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.strategy-card strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.1;
}

.strategy-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.inspector h2 {
  margin: 10px 0 8px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.18;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.inspector p {
  color: var(--muted);
  line-height: 1.58;
}

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

.detail-block:first-of-type {
  border-top: 0;
}

.detail-block h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.detail-kv {
  padding: 9px;
  background: #f8fafd;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-kv span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.detail-kv strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 14px;
}

.note-editor {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.note-editor span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.note-editor textarea {
  min-height: 64px;
  max-height: none;
  resize: vertical;
  font-size: 13px;
  line-height: 1.5;
}

.empty {
  padding: 42px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1180px) {
  html,
  body {
    height: auto;
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .side-rail {
    position: static;
    height: auto;
  }

  .workspace {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .content-grid,
  .command-header,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .header-control {
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .header-sync {
    min-height: 44px;
  }

  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inspector {
    position: static;
    min-height: auto;
    max-height: none;
  }

  .content-grid {
    flex: none;
  }

  .table-viewport {
    max-height: 62vh;
  }
}
