:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --line: #dbe3ef;
  --text: #17233d;
  --muted: #62728a;
  --accent: #1f6fff;
  --accent-dark: #155bd6;
  --accent-soft: #e8f0ff;
  --sidebar: #102a43;
  --sidebar-2: #163956;
  --warning: #c56a20;
  --danger: #c24141;
  --shadow: 0 12px 32px rgba(31, 55, 88, 0.08);
  --radius: 8px;
  font-family:
    "Avenir Next", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  min-height: 100dvh;
  background:
    linear-gradient(180deg, #edf5ff 0, var(--bg) 260px),
    var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  --sidebar-width: 252px;
  --content-offset: 296px;
  display: block;
  min-height: 100dvh;
  transition: --content-offset 0.22s ease;
}

.app-shell.menu-collapsed {
  --sidebar-width: 78px;
  --content-offset: 116px;
}

.sidebar {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 8;
  width: var(--sidebar-width);
  height: calc(100dvh - 36px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 20px;
  padding: 18px 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--sidebar) 0%, #0b1f35 100%);
  color: #eef6ff;
  box-shadow: 0 24px 70px rgba(11, 31, 53, 0.28);
  transition:
    width 0.22s ease,
    border-radius 0.22s ease,
    padding 0.22s ease;
}

.brand {
  display: grid;
  grid-template-columns: 44px 1fr 34px;
  gap: 12px;
  align-items: center;
  padding: 8px 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  letter-spacing: 0;
}

.brand-logo {
  width: 42px;
  height: 42px;
  display: block;
}

.brand strong,
.brand span {
  display: block;
  white-space: nowrap;
}

.brand span {
  margin-top: 3px;
  color: #a8bdd4;
  font-size: 12px;
}

.sidebar-toggle {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  color: #eef6ff;
}

.sidebar-toggle span {
  position: absolute;
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition:
    transform 0.2s ease,
    width 0.2s ease;
}

.sidebar-toggle span:first-child {
  transform: translateY(-4px);
}

.sidebar-toggle span:last-child {
  transform: translateY(4px);
}

.nav-list {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: visible;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(156, 198, 255, 0.36) transparent;
}

.nav-list::-webkit-scrollbar {
  width: 5px;
}

.nav-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(156, 198, 255, 0.34);
}

.nav-group {
  position: relative;
  display: grid;
  gap: 2px;
}

.nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  padding: 0 12px 0 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #c3d4e7;
  text-align: left;
}

.nav-caret {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: #93abc4;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
}

.nav-caret:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-caret svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-group.expanded .nav-caret {
  transform: rotate(90deg);
}

.nav-icon {
  display: block;
  width: 20px;
  height: 20px;
  justify-self: center;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  z-index: 20;
  display: none;
  min-width: max-content;
  transform: translateY(-50%);
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 12px 28px rgba(31, 55, 88, 0.16);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.nav-item:hover,
.nav-item.active,
.nav-group.active > .nav-item {
  background: rgba(47, 124, 255, 0.14);
  color: #ffffff;
}

.nav-item.active,
.nav-group.active > .nav-item {
  box-shadow: inset 2px 0 0 #4ea0ff;
}

.subnav {
  display: none;
  gap: 2px;
  margin: 0 0 4px 46px;
  padding-left: 10px;
  border-left: 1px solid rgba(156, 198, 255, 0.22);
}

.nav-group.expanded > .subnav {
  display: grid;
}

.subnav-item {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #93abc4;
  font-size: 13px;
  text-align: left;
}

.subnav-item:hover,
.subnav-item.active {
  background: rgba(47, 124, 255, 0.12);
  color: #ffffff;
}

.user-menu {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
}

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

.user-meta strong,
.user-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-meta span {
  margin-top: 3px;
  color: #a8bdd4;
  font-size: 12px;
}

.logout-button {
  grid-column: 1 / -1;
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  color: #eef6ff;
  font-weight: 700;
}

.logout-button:hover {
  background: rgba(255, 255, 255, 0.14);
}

.app-shell.menu-collapsed .sidebar {
  padding-inline: 10px;
  border-radius: 22px;
}

.app-shell.menu-collapsed .brand {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 10px;
  padding: 4px 0 14px;
}

.app-shell.menu-collapsed .brand-copy,
.app-shell.menu-collapsed .nav-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.app-shell.menu-collapsed .nav-caret {
  display: none;
}

.app-shell.menu-collapsed .sidebar-toggle {
  width: 42px;
  height: 34px;
}

.app-shell.menu-collapsed .sidebar-toggle span:first-child {
  width: 11px;
  transform: translate(-3px, -3px) rotate(-35deg);
}

.app-shell.menu-collapsed .sidebar-toggle span:last-child {
  width: 11px;
  transform: translate(-3px, 3px) rotate(35deg);
}

.app-shell.menu-collapsed .nav-list {
  gap: 8px;
}

.app-shell.menu-collapsed .nav-group {
  display: grid;
}

.app-shell.menu-collapsed .nav-item {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  min-height: 46px;
  padding: 0;
}

.app-shell.menu-collapsed .nav-icon {
  width: 21px;
  height: 21px;
}

.app-shell.menu-collapsed .nav-item.active,
.app-shell.menu-collapsed .nav-item:hover {
  background: rgba(47, 124, 255, 0.22);
}

.app-shell.menu-collapsed .nav-item:hover::after {
  display: block;
}

.app-shell.menu-collapsed .nav-item.active {
  box-shadow: none;
}

.app-shell.menu-collapsed .subnav {
  position: absolute;
  left: calc(100% + 12px);
  top: 0;
  z-index: 22;
  display: none;
  min-width: 168px;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(31, 55, 88, 0.18);
}

.app-shell.menu-collapsed .nav-group.expanded > .subnav {
  display: none;
}

.app-shell.menu-collapsed .has-children:hover .nav-item::after {
  display: none;
}

.app-shell.menu-collapsed .has-children:hover .subnav {
  display: grid;
}

.app-shell.menu-collapsed .has-children.expanded:hover .subnav {
  display: grid;
}

.app-shell.menu-collapsed .subnav::before {
  content: attr(aria-label);
  padding: 4px 8px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.app-shell.menu-collapsed .subnav-item {
  min-height: 34px;
  color: var(--text);
}

.app-shell.menu-collapsed .subnav-item:hover,
.app-shell.menu-collapsed .subnav-item.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.app-shell.menu-collapsed .user-menu {
  display: none;
  border: 0;
  background: transparent;
}

.app-shell.menu-collapsed .user-meta,
.app-shell.menu-collapsed .logout-button {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(9, 23, 40, 0.42);
  backdrop-filter: blur(4px);
}

.modal-backdrop.open {
  display: grid;
}

.confirm-modal {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  width: min(420px, 100%);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(11, 31, 53, 0.22);
}

.confirm-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff4e8;
  color: var(--warning);
  font-weight: 900;
}

.confirm-modal h2 {
  margin: 0;
  font-size: 20px;
}

.confirm-modal p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.confirm-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.product-modal {
  width: min(640px, 100%);
  max-height: calc(100dvh - 48px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(11, 31, 53, 0.22);
}

.product-modal-header,
.product-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.product-modal-header {
  margin-bottom: 18px;
}

.product-modal-header h2 {
  margin: 0;
  font-size: 22px;
}

.product-form {
  display: grid;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

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

.form-status {
  min-height: 20px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
}

.product-modal-actions {
  justify-content: flex-end;
  padding-top: 4px;
}

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

.danger-button:hover {
  background: #a73535;
}

.main {
  min-width: 0;
  padding: 26px 28px 28px var(--content-offset);
  transition: padding-left 0.22s ease;
}

.topbar,
.section-toolbar,
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  min-height: 70px;
  margin-bottom: 22px;
}

.topbar h1,
.section-toolbar h2,
.panel h2,
.drawer h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 32px;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar-actions,
.card-actions,
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button,
.text-button,
.icon-button {
  min-height: 38px;
  border-radius: var(--radius);
  transition:
    transform 0.16s ease,
    background 0.16s ease,
    border-color 0.16s ease;
}

.primary-button:active,
.ghost-button:active,
.icon-button:active {
  transform: scale(0.98);
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  padding: 0 14px;
  font-weight: 700;
}

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

.ghost-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0 13px;
}

.icon-button {
  width: 38px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 20px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-weight: 700;
}

.small {
  min-height: 32px;
  padding-inline: 10px;
  font-size: 13px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

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

.metric {
  display: grid;
  gap: 6px;
  min-height: 122px;
  padding: 20px 22px;
  box-shadow: 0 10px 26px rgba(31, 55, 88, 0.06);
}

.metric span,
.metric em,
.panel p,
.product-card span,
.task-card span,
.lead-stack span,
.stage span,
.audit-grid span {
  color: var(--muted);
}

.metric strong {
  font-size: 34px;
  line-height: 1;
}

.metric em {
  font-size: 12px;
  font-style: normal;
}

.workspace-grid,
.lead-layout,
.sequence-board,
.analytics-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 16px;
}

.panel {
  padding: 22px;
}

.panel.large {
  min-width: 0;
}

.panel-header {
  margin-bottom: 16px;
}

.panel-header p,
.section-toolbar p {
  margin: 4px 0 0;
  font-size: 13px;
}

.task-list,
.lead-stack,
.contact-list,
.timeline,
.drawer-actions {
  display: grid;
  gap: 10px;
}

.task-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.task-card:hover,
.data-table tbody tr:hover,
.stage article:hover {
  background: var(--accent-soft);
}

.task-card strong,
.task-card span {
  display: block;
}

.task-card span {
  margin-top: 4px;
}

.task-card small {
  color: var(--warning);
  font-weight: 700;
}

.task-card.priority {
  border-color: rgba(31, 111, 255, 0.35);
  background: #f7faff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.lead-stack article,
.contact-list article,
.audit-grid article,
.insight-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

meter {
  width: 100%;
  height: 8px;
  margin-top: 10px;
  accent-color: var(--accent);
}

.section-toolbar {
  margin-bottom: 14px;
  padding: 16px 0;
}

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

.relationship-panel {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(320px, 0.52fr);
  gap: 14px;
  margin-bottom: 14px;
}

.relationship-map,
.relationship-insights {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.relationship-map {
  position: relative;
  min-height: 330px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(219, 227, 239, 0.42) 1px, transparent 1px),
    linear-gradient(0deg, rgba(219, 227, 239, 0.42) 1px, transparent 1px),
    radial-gradient(circle at 50% 48%, #eef5ff 0, #ffffff 46%, #f7f9fc 100%);
  background-size:
    42px 42px,
    42px 42px,
    auto;
}

.map-node {
  position: absolute;
  z-index: 2;
  width: 178px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 30px rgba(31, 55, 88, 0.1);
}

.map-node strong,
.map-node span {
  display: block;
}

.map-node strong {
  font-size: 14px;
  line-height: 1.35;
}

.map-node span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.node-core {
  left: 50%;
  top: 50%;
  width: 190px;
  transform: translate(-50%, -50%);
  border-color: rgba(31, 111, 255, 0.32);
  background: linear-gradient(135deg, #ffffff, #edf4ff);
  box-shadow:
    0 18px 34px rgba(31, 111, 255, 0.14),
    inset 4px 0 0 var(--accent);
}

.node-procurement {
  left: 7%;
  top: 14%;
}

.node-technical {
  right: 8%;
  top: 12%;
}

.node-finance {
  right: 10%;
  bottom: 12%;
}

.node-distributor {
  left: 8%;
  bottom: 14%;
}

.map-line {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(31, 111, 255, 0.15), rgba(31, 111, 255, 0.55));
  transform-origin: left center;
}

.line-core-procurement {
  width: 31%;
  transform: rotate(210deg);
}

.line-core-technical {
  width: 30%;
  transform: rotate(330deg);
}

.line-core-finance {
  width: 30%;
  transform: rotate(31deg);
}

.line-core-distributor {
  width: 31%;
  transform: rotate(150deg);
}

.relationship-insights {
  padding: 18px;
}

.panel-header.compact {
  margin-bottom: 12px;
}

.panel-header.compact h3 {
  margin: 0;
  font-size: 20px;
}

.relationship-score {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

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

.relationship-list article {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.relationship-list strong,
.relationship-list span {
  display: block;
}

.relationship-list span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.product-card {
  overflow: hidden;
}

.product-body {
  display: grid;
  gap: 14px;
  padding: 16px 16px 12px;
}

.product-title {
  display: grid;
  gap: 5px;
}

.product-title span,
.product-fields dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.product-title strong {
  display: block;
  font-size: 16px;
  line-height: 1.35;
}

.product-fields {
  display: grid;
  gap: 10px;
  margin: 0;
}

.product-fields div {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.product-fields dt,
.product-fields dd {
  margin: 0;
}

.product-fields dd {
  min-width: 0;
  color: var(--text);
  line-height: 1.5;
}

.product-card .card-actions {
  margin-inline: 16px;
  margin-bottom: 16px;
}

.product-image {
  height: 150px;
  border-bottom: 1px solid var(--line);
}

.product-a {
  background:
    radial-gradient(circle at 74% 32%, rgba(255, 255, 255, 0.66) 0 8%, transparent 9%),
    linear-gradient(135deg, #174ea6, #4ea0ff);
}

.product-b {
  background:
    linear-gradient(90deg, transparent 10%, rgba(255, 255, 255, 0.35) 10% 13%, transparent 13% 23%),
    linear-gradient(135deg, #243b64, #c7d8f2);
}

.product-c {
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.7) 0 18%, transparent 19%),
    linear-gradient(135deg, #2f6fd6, #dce8ff);
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 10px 11px;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(31, 111, 255, 0.18);
  border-color: rgba(31, 111, 255, 0.55);
}

textarea {
  min-height: 116px;
  resize: vertical;
  line-height: 1.5;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.data-table th,
.data-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.data-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.table-panel {
  margin-bottom: 16px;
  padding: 0;
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.table-toolbar h3 {
  margin: 0;
}

.table-toolbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.table-scroll {
  overflow-x: auto;
}

.table-panel .data-table {
  border: 0;
  border-radius: 0;
}

.table-panel .data-table th,
.table-panel .data-table td {
  white-space: nowrap;
}

.table-panel .data-table td:nth-child(5),
.table-panel .data-table td:nth-child(6) {
  max-width: 340px;
  white-space: normal;
  line-height: 1.45;
}

.contact-methods {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.contact-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #f1f5f9;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.contact-text {
  user-select: all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.customer-profile-table th,
.customer-profile-table td {
  white-space: normal;
  vertical-align: top;
}

.customer-profile-table {
  min-width: 1420px;
  table-layout: fixed;
}

.customer-profile-table th:nth-child(1),
.customer-profile-table td:nth-child(1) {
  width: 120px;
}

.customer-profile-table th:nth-child(2),
.customer-profile-table td:nth-child(2) {
  width: 110px;
}

.customer-profile-table th:nth-child(3),
.customer-profile-table td:nth-child(3) {
  width: 160px;
}

.customer-profile-table th:nth-child(4),
.customer-profile-table td:nth-child(4) {
  width: 170px;
}

.customer-profile-table th:nth-child(5),
.customer-profile-table td:nth-child(5),
.customer-profile-table th:nth-child(6),
.customer-profile-table td:nth-child(6),
.customer-profile-table th:nth-child(7),
.customer-profile-table td:nth-child(7) {
  width: 86px;
}

.customer-profile-table th:nth-child(8),
.customer-profile-table td:nth-child(8),
.customer-profile-table th:nth-child(9),
.customer-profile-table td:nth-child(9) {
  width: 116px;
}

.customer-profile-table th:nth-child(10),
.customer-profile-table td:nth-child(10) {
  width: 260px;
}

.customer-profile-table th:nth-child(11),
.customer-profile-table td:nth-child(11) {
  width: 104px;
}

.customer-note-cell {
  max-width: 260px;
  line-height: 1.5;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.customer-detail-body {
  display: grid;
  gap: 14px;
}

.customer-detail-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.customer-detail-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.customer-detail-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.customer-detail-list span {
  color: var(--muted);
  font-size: 13px;
}

.customer-detail-list strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  word-break: break-all;
}

.customer-detail-empty {
  margin: 0;
  padding: 28px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  text-align: center;
}

.customer-orders-table {
  margin-top: 4px;
}

.table-action-cell {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.table-action-cell .text-button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.5;
}

.maintenance-detail-modal {
  width: min(720px, calc(100vw - 32px));
}

.maintenance-detail-body {
  display: grid;
  gap: 18px;
}

.maintenance-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(135deg, #f8fbff 0%, #eef5ff 100%);
}

.maintenance-detail-head h3 {
  margin: 0 0 4px;
  font-size: 20px;
}

.maintenance-detail-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.maintenance-status-badge {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.maintenance-status-badge.is-pending {
  background: #fff4e8;
  color: #c56a20;
}

.maintenance-status-badge.is-approved {
  background: #e8f8ef;
  color: #15803d;
}

.maintenance-diff-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.maintenance-diff-card {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.maintenance-diff-before {
  background: #fff7f7;
  border-color: #f3d6d6;
}

.maintenance-diff-after {
  background: #f3fbf6;
  border-color: #cce8d6;
}

.maintenance-diff-label {
  display: inline-block;
  margin-bottom: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.maintenance-diff-before .maintenance-diff-label {
  background: #fdecec;
  color: #b42318;
}

.maintenance-diff-after .maintenance-diff-label {
  background: #e7f8ee;
  color: #15803d;
}

.maintenance-diff-card p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

.maintenance-diff-arrow {
  display: grid;
  place-items: center;
  color: var(--accent-dark);
  font-size: 22px;
  font-weight: 700;
}

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

.maintenance-meta-grid div {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.maintenance-meta-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.maintenance-meta-grid strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

@media (max-width: 720px) {
  .maintenance-diff-grid {
    grid-template-columns: 1fr;
  }

  .maintenance-diff-arrow {
    transform: rotate(90deg);
  }

  .maintenance-meta-grid {
    grid-template-columns: 1fr;
  }
}

.compact-panel {
  box-shadow: none;
}

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

.summary-strip article {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.summary-strip strong,
.summary-strip span {
  display: block;
}

.summary-strip strong {
  color: var(--accent-dark);
  font-size: 24px;
}

.summary-strip span {
  margin-top: 4px;
  font-weight: 700;
}

.summary-strip p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.score {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  min-height: 28px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 800;
}

.score.high {
  background: #eaf2ff;
  color: var(--accent-dark);
}

.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(190px, 1fr));
  gap: 12px;
}

.stage {
  min-height: 420px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafd;
}

.stage h3 {
  margin: 2px 0 12px;
  font-size: 14px;
}

.stage article {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.tag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0 20px;
}

.tag-row span {
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
}

.timeline article {
  display: grid;
  grid-template-columns: 68px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

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

.timeline p {
  margin: 0;
}

.composer {
  margin-top: 16px;
}

.insight-list {
  display: grid;
  gap: 10px;
  margin: 16px 0;
  padding-left: 18px;
  line-height: 1.55;
}

.sequence-step {
  display: grid;
  gap: 5px;
  padding: 14px;
  margin-top: 10px;
  border-left: 3px solid var(--line);
  background: #f8fafd;
}

.sequence-step.active {
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

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

.funnel {
  display: grid;
  gap: 10px;
}

.funnel-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  min-height: 42px;
  align-items: center;
  padding: 0 12px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.funnel-row::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--w);
  background: rgba(31, 111, 255, 0.16);
}

.funnel-row span,
.funnel-row strong {
  position: relative;
}

.product-workspace-full {
  display: block;
  margin-bottom: 16px;
}

.product-workspace,
.customer-layout,
.system-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.55fr);
  gap: 16px;
  margin-bottom: 16px;
}

.customer-layout.bottom,
.system-grid {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.72fr);
}

.product-list-panel,
.detail-panel {
  min-width: 0;
}

.detail-image {
  height: 180px;
  margin: 10px 0 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.detail-list {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.detail-list div {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.detail-list dt,
.detail-list dd {
  margin: 0;
}

.detail-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-list dd {
  line-height: 1.5;
}

.compact-input {
  max-width: 260px;
}

.status-pill,
.tag-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(31, 111, 255, 0.16);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.selected-row {
  background: #f3f8ff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.product-analysis-panel,
.search-panel,
.confirm-panel {
  margin-bottom: 16px;
}

.analysis-grid,
.form-grid,
.score-grid,
.integration-grid,
.analytics-grid.three {
  display: grid;
  gap: 12px;
}

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

.analysis-grid.single {
  grid-template-columns: 1fr;
}

.analysis-grid article,
.score-card,
.integration-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.analysis-grid strong,
.analysis-grid span,
.score-card strong,
.score-card span,
.integration-card strong,
.integration-card p {
  display: block;
}

.analysis-grid span,
.score-card p,
.integration-card p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.lead-layout {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.46fr);
  margin-bottom: 16px;
}

.task-score {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-weight: 900;
}

.score-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.score-card strong {
  color: var(--accent-dark);
  font-size: 30px;
  line-height: 1;
}

.selectable-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
  padding: 0;
}

.confirm-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.maintenance-list,
.tag-cloud {
  display: grid;
  gap: 10px;
}

.maintenance-item {
  display: grid;
  grid-template-columns: 190px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.maintenance-item span {
  color: var(--muted);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
}

.tag-pill {
  border-color: var(--line);
  background: #ffffff;
  color: var(--text);
}

.progress-board {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}

.progress-page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.45fr);
  gap: 16px;
  margin-bottom: 16px;
}

.stage-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.stage-header h3 {
  margin: 0;
  font-size: 18px;
}

.stage-header p {
  margin: 5px 0 0;
  font-size: 13px;
}

.stage-header > span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 800;
}

.opportunity-card p {
  margin: 0;
}

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

.insight-list h3 {
  margin: 0;
}

.insight-card {
  list-style: none;
  margin: 0;
  color: var(--text);
}

.integration-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.integration-card {
  display: grid;
  gap: 14px;
  align-content: space-between;
}

.action-modal-message {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  line-height: 1.6;
}

.sales-follow-customer {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
}

.sales-follow-customer strong {
  color: var(--text);
}

.sales-select-list {
  margin: 0;
  padding: 0;
  border: 0;
}

.sales-select-list legend {
  margin-bottom: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.sales-select-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
}

.sales-select-item:has(input:checked) {
  border-color: rgba(31, 111, 255, 0.45);
  background: var(--accent-soft);
}

.sales-select-name {
  flex: 1;
  font-weight: 700;
  color: var(--text);
}

.sales-select-role {
  color: var(--muted);
  font-size: 13px;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 10;
  width: 390px;
  height: 100dvh;
  padding: 18px;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: -24px 0 44px rgba(31, 55, 88, 0.14);
  transform: translateX(105%);
  transition: transform 0.24s ease;
}

.drawer.open {
  transform: translateX(0);
}

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

.drawer-body {
  display: grid;
  gap: 18px;
  padding-top: 18px;
}

.mini-score {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
}

.mini-score strong {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 26px;
}

.mini-score span {
  color: var(--accent-dark);
  font-weight: 700;
}

@media (max-width: 1280px) {
  body {
    min-width: 1040px;
  }

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

  .product-workspace,
  .customer-layout,
  .system-grid,
  .lead-layout,
  .analytics-grid,
  .analytics-grid.three,
  .integration-grid,
  .analysis-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .competitiveness-layout,
  .recommendation-columns,
  .product-analysis-metrics,
  .analysis-hero {
    grid-template-columns: 1fr;
  }

  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }
}

/* Import Modal - File Upload */
.import-modal {
  width: min(620px, calc(100vw - 48px));
  max-height: calc(100dvh - 64px);
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 24px;
  overflow: hidden;
}

.import-modal .product-form {
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.import-modal .product-modal-header {
  align-items: flex-start;
  margin-bottom: 18px;
}

.import-title-block {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
}

.import-title-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(31, 111, 255, 0.18);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.import-title-icon svg,
.file-upload-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.import-modal .icon-button {
  flex: 0 0 auto;
}

.file-upload-area {
  display: grid;
  place-items: center;
  min-height: 150px;
  padding: 26px 22px;
  border: 1.5px dashed rgba(31, 111, 255, 0.28);
  border-radius: var(--radius);
  background: #f7faff;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.file-upload-area:hover {
  border-color: var(--accent);
  background: #f1f6ff;
}

.file-upload-area.dragover {
  border-color: var(--accent);
  background: #ebf3ff;
}

.file-upload-area.has-file {
  border-color: rgba(31, 111, 255, 0.46);
  background: #eef5ff;
}

.file-upload-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--accent-dark);
  box-shadow: 0 10px 24px rgba(31, 55, 88, 0.08);
}

.file-upload-area p {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 15px;
}

.file-upload-hint {
  font-size: 13px !important;
  color: var(--muted) !important;
}

.file-upload-area .file-name {
  font-weight: 600;
  color: var(--accent-dark);
  margin-top: 8px;
}

/* Import Format Guide */
.import-format-guide {
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 8px;
  padding: 14px;
}

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

.import-format-header span {
  flex: 0 0 auto;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
}

.import-format-title {
  margin: 0 0 4px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.import-format-desc {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.import-format-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.import-format-table th,
.import-format-table td {
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.import-format-table th {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--text);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.import-format-table td {
  color: var(--text);
}

.import-format-table td code {
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--accent-dark);
}

.import-format-note {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.import-modal .product-modal-actions {
  position: sticky;
  bottom: 0;
  margin: 2px -2px 0;
  padding: 14px 2px 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), var(--surface) 38%);
}

/* Product Image Upload */
.product-image-upload {
  margin-bottom: 18px;
}

.image-upload-preview {
  border: 2px dashed var(--line);
  border-radius: 10px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  overflow: hidden;
  background: var(--sidebar-bg);
}

.image-upload-preview:hover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.04);
}

.image-upload-preview.has-image {
  border-style: solid;
  border-color: var(--line);
  background: transparent;
}

.image-upload-preview.has-image:hover {
  border-color: var(--accent);
}

.image-upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.image-upload-placeholder svg {
  color: var(--line-strong);
  margin-bottom: 4px;
}

.image-upload-placeholder span {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.image-upload-placeholder small {
  font-size: 12px;
  color: var(--muted);
}

.image-upload-change {
  margin-top: 8px;
  font-size: 13px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
}

.image-upload-change:hover {
  text-decoration: underline;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==========================================================================
   Config Layout & Tabs
   ========================================================================== */

.config-tabs {
  display: flex;
  flex-direction: column;
}

.tab-list {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.tab-item {
  padding: 10px 24px;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: -1px;
  border-radius: 8px 8px 0 0;
}

.tab-item:hover {
  color: var(--text);
  background: var(--surface-2);
}

.tab-item.active {
  color: var(--accent);
  background: var(--surface);
  border-color: var(--line);
  border-bottom-color: var(--surface);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.config-panel {
  display: flex;
  flex-direction: column;
  max-width: 600px;
}

.config-panel:has(.basic-config-form),
.config-panel:has(.ai-usage-panel) {
  max-width: 760px;
}

.basic-config-form {
  display: grid;
  gap: 22px;
}

.config-card-header,
.config-save-bar,
.logo-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.config-card-header h3,
.config-card-header p,
.logo-setting p,
.config-save-bar span {
  margin: 0;
}

.config-card-header p,
.logo-setting p,
.config-save-bar span {
  color: var(--muted);
}

.basic-config-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 16px;
}

.setting-field,
.logo-setting {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.setting-field span,
.logo-setting span {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.setting-field input {
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.setting-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.system-logo-preview {
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(255, 255, 255, 0.92)),
    var(--surface);
  box-shadow: 0 10px 24px rgba(31, 55, 88, 0.08);
}

.system-logo-preview img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.config-save-bar {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.ai-usage-panel {
  display: grid;
  gap: 18px;
}

.ai-usage-summary {
  display: grid;
  gap: 8px;
  padding: 22px;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(255, 255, 255, 0.94));
}

.ai-usage-summary span,
.ai-usage-summary em,
.usage-breakdown span,
.package-card span,
.package-card em,
.package-service p {
  color: var(--muted);
}

.ai-usage-summary strong {
  font-size: 42px;
  line-height: 1;
}

.ai-usage-summary em,
.package-card em {
  font-style: normal;
}

.usage-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
}

.usage-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.usage-breakdown,
.package-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.usage-breakdown div,
.package-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.usage-breakdown div {
  display: grid;
  gap: 6px;
  padding: 16px;
}

.usage-breakdown strong {
  font-size: 20px;
}

.package-service {
  display: grid;
  gap: 14px;
}

.package-service h3,
.package-service p {
  margin: 0;
}

.package-card {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.package-card strong {
  font-size: 22px;
}

.package-card.featured {
  border-color: rgba(37, 99, 235, 0.3);
  box-shadow: 0 16px 38px rgba(37, 99, 235, 0.12);
}

@media (max-width: 900px) {
  .basic-config-grid,
  .package-grid {
    grid-template-columns: 1fr;
  }

  .config-card-header,
  .config-save-bar,
  .logo-preview-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* ==========================================================================
   Role Permissions
   ========================================================================== */

.role-permissions {
  margin-top: 12px;
}

.role-permissions-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px 0;
}

.permission-group {
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
}

.permission-group:last-child {
  margin-bottom: 0;
}

.permission-group > .checkbox-label {
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  margin: 0;
}

.permission-group > .checkbox-label:last-child {
  border-bottom: none;
}

.permission-sub-items {
  padding: 12px 14px 12px 38px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin: 0;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 0;
  font-weight: normal;
  color: var(--text);
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

/* ==========================================================================
   Product Gallery
   ========================================================================== */

.product-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 16px;
}

.product-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(31, 55, 88, 0.08);
}

.product-card-image {
  height: 160px;
  background-size: cover;
  background-position: center;
  background-color: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.product-card-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 4px;
}

.product-card-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.product-card-desc {
  margin: 0 0 12px 0;
  font-size: 13px;
  color: var(--muted);
}

.product-card-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text);
  flex: 1;
}

.product-card-meta strong {
  color: var(--muted);
  font-weight: normal;
  margin-right: 4px;
}

.product-card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* ==========================================================================
   AI Insight Box
   ========================================================================== */

.ai-insight-box {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #f7fbff 0%, #ffffff 100%);
  border: 1px solid #cfe0ff;
  border-radius: var(--radius);
  padding: 18px 20px;
}

.ai-insight-box p {
  margin: 0 0 12px 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.ai-insight-box p:last-child {
  margin-bottom: 0;
}

.ai-insight-box strong {
  color: var(--accent-dark);
}

.analysis-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.42fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 16px;
  padding: 22px;
  border: 1px solid #cfe0ff;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(31, 111, 255, 0.11), rgba(255, 255, 255, 0) 46%),
    #ffffff;
  box-shadow: var(--shadow);
}

.analysis-hero-copy {
  min-width: 0;
}

.analysis-hero h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.analysis-hero p {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.analysis-hero-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.analysis-hero-tags span {
  padding: 7px 10px;
  border: 1px solid rgba(31, 111, 255, 0.16);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.analysis-hero-actions {
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
}

.analysis-page-stack {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}

.analysis-panel {
  overflow: hidden;
  border-color: #d6e4f5;
}

.analysis-panel-header {
  margin: -18px -18px 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfdff 0%, #f6f9fd 100%);
}

.competitiveness-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.competitiveness-score {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 20px;
  border: 1px solid rgba(31, 111, 255, 0.18);
  border-radius: 14px;
  background:
    radial-gradient(circle at top, rgba(31, 111, 255, 0.16), transparent 58%),
    #ffffff;
  text-align: center;
}

.competitiveness-score strong {
  color: var(--accent-dark);
  font-size: 52px;
  line-height: 1;
}

.competitiveness-score span {
  font-weight: 800;
  color: var(--text);
}

.competitiveness-score small {
  color: var(--muted);
}

.score-meter {
  width: 100%;
  height: 8px;
  margin-top: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef7;
}

.score-meter span {
  display: block;
  width: var(--score);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #39a0ff);
}

.small-meter {
  height: 6px;
  min-width: 72px;
}

.product-analysis-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.product-analysis-metrics article {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.analysis-product-switcher {
  display: grid;
  gap: 4px;
  min-width: 100%;
}

.analysis-product-switcher span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.analysis-product-switcher select {
  min-height: 36px;
  background: #ffffff;
  font-weight: 700;
}

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

.recommendation-columns article {
  border: 1px solid #d6e4f5;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff 0%, #f9fbfe 100%);
  padding: 16px 18px;
}

.recommendation-columns h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 14px;
}

.recommendation-columns h4 span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
}

.recommendation-columns ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.analysis-table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.analysis-customer-table {
  min-width: 980px;
  border: 0;
  border-radius: 0;
}

.analysis-customer-table th {
  background: #f5f8fc;
}

.analysis-customer-table td {
  vertical-align: top;
}

.analysis-customer-table td span {
  color: var(--muted);
}

.analysis-customer-table td:nth-child(4) {
  min-width: 260px;
  line-height: 1.55;
}

.table-rank {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark) !important;
  font-weight: 900;
}

.table-match-score {
  display: grid;
  gap: 6px;
  min-width: 92px;
}

.table-match-score strong {
  color: var(--accent-dark);
  font-size: 22px;
  line-height: 1;
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: #fbfdff;
  color: var(--muted);
  font-size: 13px;
}

.table-pagination div {
  display: flex;
  gap: 8px;
}

.table-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.54;
}

/* ==========================================================================
   AI Assistant
   ========================================================================== */

.assistant-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background: var(--accent);
  color: white;
  border: none;
  box-shadow: 0 8px 24px rgba(31, 111, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.assistant-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(31, 111, 255, 0.4);
  background: var(--accent-dark);
}

.assistant-fab:active {
  transform: translateY(0);
}

.assistant-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 360px;
  height: 520px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(16, 42, 67, 0.15);
  display: flex;
  flex-direction: column;
  z-index: 90;
  overflow: hidden;
  border: 1px solid var(--line);
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform-origin: bottom right;
}

.assistant-window[aria-hidden="true"] {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

.assistant-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #f8fbff 0%, #ffffff 100%);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.assistant-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
  font-size: 15px;
}

.assistant-title svg {
  color: var(--accent);
}

.assistant-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface-2);
}

.message {
  display: flex;
  max-width: 85%;
}

.message.assistant {
  align-self: flex-start;
}

.message.user {
  align-self: flex-end;
}

.message-content {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.message.assistant .message-content {
  background: var(--surface);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.message.user .message-content {
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}

.assistant-input-area {
  padding: 16px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex;
  gap: 12px;
  align-items: center;
}

.assistant-input-area input {
  flex: 1;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  outline: none;
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.assistant-input-area input:focus {
  border-color: var(--accent);
}

.assistant-input-area .primary-button {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#customer-graph .section-toolbar {
  margin-bottom: 18px;
}

.graph-layout {
  position: relative;
  display: block;
  min-height: calc(100dvh - 180px);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid #1e293b;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  background: #020617;
}

.graph-sidebar {
  position: absolute;
  top: 16px;
  left: 16px;
  bottom: 16px;
  width: 320px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  pointer-events: none;
}

.graph-sidebar > * {
  pointer-events: auto;
}

.graph-card {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(24px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
}

.graph-card-detail {
  flex: 1;
  min-height: 180px;
}

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

.graph-card-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: #f8fafc;
}

.graph-legend {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.graph-legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  color: #cbd5e1;
  font-size: 13px;
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.graph-legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--dot);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot) 18%, transparent), 0 0 14px var(--glow);
}

.graph-detail {
  min-height: 120px;
}

.graph-detail-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 120px;
  text-align: center;
  color: #94a3b8;
}

.graph-detail-placeholder-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(30, 41, 59, 0.5);
  color: #60a5fa;
  font-size: 18px;
}

.graph-detail-empty p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}

.graph-detail-card {
  padding: 2px 0 0;
}

.graph-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.graph-detail-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 18px;
  flex-shrink: 0;
}

.graph-detail-type {
  display: inline-block;
  margin-bottom: 4px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.graph-detail-card h4 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
  color: #f8fafc;
}

.graph-detail-meta {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.5);
  color: #cbd5e1;
  font-size: 13px;
  line-height: 1.55;
}

.graph-detail-links {
  margin-top: 12px;
}

.graph-detail-links-title {
  display: block;
  margin-bottom: 8px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
}

.graph-detail-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.graph-detail-card li {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  font-size: 13px;
  line-height: 1.45;
}

.graph-relation-tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rel) 25%, transparent);
  border: 1px solid color-mix(in srgb, var(--rel) 40%, transparent);
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 700;
}

.graph-panel {
  position: absolute;
  inset: 0;
}

.graph-canvas-wrap {
  position: absolute;
  inset: 0;
  background: transparent;
}

.graph-canvas-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(31, 111, 255, 0.14), transparent 42%),
    linear-gradient(180deg, #0f172a 0%, #020617 100%);
  pointer-events: none;
}

.graph-canvas-wrap canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.graph-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  pointer-events: none;
}

.graph-overlay-top,
.graph-overlay-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.graph-mode-badge {
  padding: 6px 12px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(10px);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.graph-zoom-label {
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(10px);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.graph-hint {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.68);
  backdrop-filter: blur(10px);
  color: #94a3b8;
  font-size: 12px;
}

.graph-zoom-controls {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.graph-zoom-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(10px);
  color: #e2e8f0;
  font-size: 18px;
  font-weight: 700;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    transform 0.16s ease;
}

.graph-zoom-btn:hover {
  background: rgba(30, 41, 59, 0.92);
  border-color: rgba(125, 211, 252, 0.45);
}

.graph-zoom-btn:active {
  transform: scale(0.96);
}

.customs-form-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

@media (max-width: 1400px) {
  .graph-sidebar {
    position: relative;
    top: 0;
    left: 0;
    bottom: auto;
    width: 100%;
    max-height: 400px;
    z-index: 10;
  }

  .graph-layout {
    display: flex;
    flex-direction: column;
  }

  .graph-panel,
  .graph-canvas-wrap {
    position: relative;
    min-height: 520px;
  }

  .customs-form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
