:root {
  --ink: #172033;
  --muted: #667085;
  --line: #d7dee8;
  --panel: #ffffff;
  --bg: #f5f7fa;
  --blue: #1f6feb;
  --blue-soft: #e7f0ff;
  --green: #18794e;
  --green-soft: #ddf4e8;
  --yellow: #a15c00;
  --yellow-soft: #fff3d6;
  --red: #b42318;
  --red-soft: #fde4df;
  --gray-soft: #edf0f4;
  --mapping-row-height: 44px;
}

* {
  box-sizing: border-box;
}

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

.login-view {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  background: #eef2f7;
  padding: 20px;
}

.login-view.active {
  display: grid;
}

.login-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 18px 55px rgba(15, 23, 42, 0.16);
  padding: 28px;
  display: grid;
  gap: 16px;
}

.login-card h1 {
  margin: 0;
  font-size: 26px;
}

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

.login-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

.login-card input {
  width: 100%;
  border: 1px solid var(--line);
  padding: 10px 12px;
  color: var(--ink);
}

.login-message {
  min-height: 20px;
  color: var(--red);
}

.current-user {
  color: var(--muted);
  align-self: center;
}

button,
input,
select {
  font: inherit;
}

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

.primary-sidebar {
  background: #121923;
  color: #fff;
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: stretch;
}

.brand {
  display: flex;
  justify-content: center;
  align-items: center;
}

.brand-logo-card {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 4px;
  flex: 0 0 auto;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand h1 {
  font-size: 17px;
  margin: 0;
}

.brand p {
  margin: 3px 0 0;
  color: #cbd5e1;
  font-size: 12px;
}

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

.nav-group {
  border: 0;
  min-height: 48px;
  color: #cbd5e1;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.nav-group.active,
.nav-group:hover {
  background: #2b3442;
  color: #fff;
}

.secondary-sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  overflow-y: auto;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 72px;
  width: 276px;
  z-index: 30;
  transform: translateX(-110%);
  opacity: 0;
  pointer-events: none;
  box-shadow: 18px 0 45px rgba(15, 23, 42, 0.16);
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.secondary-sidebar.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.secondary-scrim {
  position: fixed;
  inset: 0;
  z-index: 25;
  border: 0;
  background: rgba(15, 23, 42, 0.18);
  display: none;
  cursor: default;
}

.secondary-scrim.open {
  display: block;
}

.secondary-title {
  display: grid;
  gap: 4px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.secondary-title strong {
  font-size: 20px;
}

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

.secondary-nav {
  display: block;
}

.secondary-group {
  display: none;
}

.secondary-group.active {
  display: block;
}

.secondary-section-title {
  margin: 22px 0 8px;
  color: #98a2b3;
  font-size: 13px;
}

.secondary-section-title:first-child {
  margin-top: 0;
}

.nav-item {
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
  padding: 10px 2px;
  cursor: pointer;
  width: 100%;
  font-size: 16px;
}

.nav-item.active,
.nav-item:hover {
  background: transparent;
  color: var(--blue);
  font-weight: 700;
}

.access-box {
  margin-top: auto;
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.access-box strong {
  color: var(--ink);
  font-size: 12px;
  word-break: break-all;
  margin-bottom: 8px;
}

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

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

.topbar h2 {
  margin: 0;
  font-size: 22px;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.top-actions,
.sync-actions,
.api-demo,
.filters,
.pager {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 8px 12px;
  cursor: pointer;
  min-height: 36px;
}

.btn.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.btn.secondary {
  background: #fff;
}

.btn.danger-light {
  background: var(--red-soft);
  border-color: #f3b4aa;
  color: var(--red);
}

.tab-panel {
  display: none;
}

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

.module-placeholder {
  min-height: 360px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 22px;
  padding: 34px;
}

.placeholder-kicker {
  color: var(--blue);
  font-weight: 700;
  font-size: 13px;
}

.module-placeholder h3 {
  margin: 10px 0 8px;
  font-size: 26px;
}

.module-placeholder p {
  margin: 0;
  color: var(--muted);
}

.placeholder-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.placeholder-steps span {
  border: 1px solid var(--line);
  background: var(--gray-soft);
  padding: 8px 10px;
  font-size: 13px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

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

.metric {
  padding: 14px;
  display: grid;
  gap: 8px;
}

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

.metric strong {
  font-size: 26px;
}

.metric.good {
  background: var(--green-soft);
}

.metric.warn {
  background: var(--yellow-soft);
}

.metric.danger {
  background: var(--red-soft);
}

.section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(760px, 1.7fr) minmax(300px, 0.7fr);
  gap: 14px;
  align-items: start;
}

.dashboard-main-panel {
  grid-row: span 2;
}

.group-project-table-wrap {
  overflow: auto;
  max-height: calc(100vh - 238px);
}

.group-project-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 13px;
}

.group-project-table th,
.group-project-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
}

.group-project-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7f9fc;
  color: #475467;
  font-weight: 700;
}

.group-project-table tbody tr:hover {
  background: #f8fbff;
}

.group-project-table td:first-child {
  min-width: 150px;
}

.group-project-table td:first-child strong {
  display: block;
  font-size: 14px;
}

.group-project-table td:first-child span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.connected-project {
  background: #f3f8ff;
}

.attention-project {
  background: #fffaf0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  font-style: normal;
  font-size: 12px;
  border: 1px solid var(--line);
  background: #fff;
  white-space: nowrap;
}

.status-pill.ok {
  color: var(--green);
  border-color: #a8dfbf;
  background: var(--green-soft);
}

.status-pill.partial,
.status-pill.shared {
  color: var(--yellow);
  border-color: #f2d08a;
  background: var(--yellow-soft);
}

.status-pill.wait {
  color: #475467;
  background: #f2f4f7;
}

.project-board,
.source-list,
.todo-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.project-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(3, minmax(96px, 0.75fr)) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  padding: 12px;
  background: #fff;
}

.project-row > div {
  display: grid;
  gap: 4px;
}

.project-row span,
.source-list span,
.todo-list span {
  color: var(--muted);
  font-size: 12px;
}

.project-row strong,
.source-list strong,
.todo-list strong {
  font-size: 14px;
}

.active-project {
  border-left: 4px solid var(--blue);
}

.muted-project {
  background: #fafbfc;
  color: #8a94a6;
}

.source-list > div {
  display: grid;
  grid-template-columns: 12px minmax(92px, 0.8fr) 1fr;
  gap: 8px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.source-list > div:last-child {
  border-bottom: 0;
}

.source-dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: 50%;
}

.source-dot.ok {
  background: var(--green);
}

.source-dot.warn {
  background: #d79000;
}

.source-dot.wait {
  background: #98a2b3;
}

.todo-list > div {
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.todo-list > div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.panel.wide {
  grid-column: span 2;
}

.panel-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

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

.panel-subheader {
  margin: 18px 14px 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.panel-subheader h4 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
}

.info-list {
  display: grid;
  padding: 8px 14px 14px;
}

.info-list div {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #edf0f4;
}

.info-list div:last-child {
  border-bottom: 0;
}

.info-list span,
label {
  color: var(--muted);
  font-size: 13px;
}

.info-list strong {
  font-size: 14px;
}

.plain-text {
  padding: 12px 14px;
  color: var(--muted);
  line-height: 1.7;
}

.filters {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 12px;
  margin-bottom: 12px;
}

.compact-filters {
  padding: 8px 10px;
  gap: 8px;
  align-items: end;
}

.compact-filters label {
  gap: 3px;
}

.compact-filters input,
.compact-filters select,
.compact-filters .lx-picker-btn,
.compact-filters .btn {
  min-height: 32px;
  padding-top: 5px;
  padding-bottom: 5px;
}

.inline-result {
  color: var(--muted);
  font-size: 12px;
  white-space: pre-line;
  align-self: center;
}

.field-search-label {
  min-width: min(420px, 100%);
}

.field-search-row {
  display: grid;
  grid-template-columns: 104px minmax(180px, 1fr);
  gap: 6px;
}

label {
  display: grid;
  gap: 5px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--ink);
}

.checkbox-label input {
  min-height: auto;
}

select,
input {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  min-height: 36px;
  padding: 7px 9px;
}

.search-label input {
  width: 260px;
}

.lx-picker {
  position: relative;
  min-width: 136px;
}

.lx-picker-btn {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #98a2b3;
  padding: 7px 12px;
  cursor: pointer;
}

.lx-picker.open .lx-picker-btn,
.lx-picker.has-value .lx-picker-btn {
  border-color: #2563eb;
  color: var(--ink);
}

.lx-picker-arrow {
  width: 9px;
  height: 9px;
  border-right: 2px solid #98a2b3;
  border-bottom: 2px solid #98a2b3;
  transform: rotate(45deg) translateY(-2px);
  flex: 0 0 auto;
}

.lx-picker.open .lx-picker-arrow {
  transform: rotate(225deg) translateY(-1px);
}

.lx-picker-panel {
  position: absolute;
  z-index: 50;
  top: calc(100% + 8px);
  left: 0;
  width: min(360px, calc(100vw - 36px));
  max-height: 520px;
  display: none;
  background: #fff;
  border: 1px solid #d8dee8;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  overflow: hidden;
}

.lx-picker.open .lx-picker-panel {
  display: grid;
  grid-template-rows: auto minmax(120px, 1fr) auto;
}

.lx-picker-search {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 0;
}

.lx-picker-search span {
  width: 17px;
  height: 17px;
  border: 2px solid #a8b1c0;
  border-radius: 50%;
  position: relative;
}

.lx-picker-search span::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 2px;
  background: #a8b1c0;
  right: -6px;
  bottom: -4px;
  transform: rotate(45deg);
}

.lx-picker-search input {
  min-height: 40px;
  border: 0;
  border-bottom: 2px solid #2563eb;
  padding: 0 0 2px;
  color: var(--ink);
  outline: 0;
}

.lx-picker-list {
  max-height: 340px;
  overflow: auto;
  padding: 12px 16px;
}

.lx-picker-option {
  min-height: 40px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
  padding: 0 4px;
}

.lx-picker-option input {
  width: 16px;
  height: 16px;
  min-height: 16px;
  accent-color: #2563eb;
}

.lx-picker-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lx-picker-option:hover,
.lx-picker-option:has(input:checked) {
  background: #f4f7ff;
}

.lx-picker-only {
  border: 0;
  background: transparent;
  color: #2563eb;
  font-size: 13px;
  padding: 4px 0 4px 8px;
  cursor: pointer;
  opacity: 0;
}

.lx-picker-option:hover .lx-picker-only,
.lx-picker-option:has(input:checked) .lx-picker-only {
  opacity: 1;
}

.lx-picker-footer {
  border-top: 1px solid #e1e6ef;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  color: #98a2b3;
  font-size: 13px;
}

.lx-picker-footer .btn {
  min-height: 32px;
  padding: 5px 12px;
}

.dimension-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.dimension-tools .btn {
  min-height: 30px;
  padding: 5px 10px;
}

.table-wrap,
.matrix-wrap {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
}

.mapping-table-wrap {
  width: 100%;
  min-width: 760px;
  max-width: 100%;
  max-height: 680px;
}

.table-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: -2px 0 8px;
  color: var(--muted);
  font-size: 12px;
}

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

.table-tools input {
  width: 120px;
  min-height: auto;
  padding: 0;
  accent-color: var(--blue);
}

.table-tools .btn {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 12px;
}

.bulk-edit-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin: 0 0 10px;
  border: 1px solid #dbe3ee;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
}

.bulk-edit-tools strong {
  color: var(--ink);
  font-size: 13px;
}

.bulk-edit-tools label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bulk-edit-tools input,
.bulk-edit-tools select {
  width: 116px;
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.bulk-edit-tools .btn {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px;
}

.mapping-audit-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  padding: 8px 12px;
  margin: -4px 0 8px;
  border: 1px solid #dbe3ee;
  background: #fff;
}

.mapping-audit-bar.has-issue-filter {
  border-color: #9fc0f7;
  background: #f6f9ff;
}

.mapping-audit-summary,
.mapping-audit-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mapping-audit-summary {
  color: var(--muted);
  font-size: 12px;
}

.mapping-audit-summary span {
  color: var(--ink);
  font-weight: 700;
}

.mapping-audit-summary strong {
  color: var(--ink);
  font-size: 15px;
}

.mapping-audit-summary em {
  font-style: normal;
}

.mapping-audit-actions .btn {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 12px;
}

.mapping-audit-samples {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  color: var(--muted);
  font-size: 12px;
}

.mapping-audit-sample {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  max-width: 360px;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid #dbe3ee;
  background: #f8fafc;
  color: var(--ink);
  cursor: pointer;
}

.mapping-audit-sample strong,
.mapping-audit-sample span,
.mapping-audit-sample em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mapping-audit-sample strong {
  max-width: 120px;
}

.mapping-audit-sample span {
  max-width: 90px;
  color: var(--muted);
}

.mapping-audit-sample em {
  max-width: 140px;
  color: var(--yellow);
  font-style: normal;
}

.inline-edit {
  width: 100%;
  min-width: 72px;
  height: 28px;
  border: 1px solid transparent;
  background: transparent;
  padding: 3px 6px;
  font: inherit;
  color: inherit;
}

.inline-edit:hover,
.inline-edit:focus {
  border-color: var(--line);
  background: #fff;
  outline: none;
}

.inline-edit.compact {
  min-width: 48px;
}

.inline-edit.wide {
  min-width: 180px;
}

.product-center-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1.2fr) minmax(360px, 0.8fr);
  gap: 12px;
  margin-bottom: 12px;
}

.product-action-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  margin-bottom: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.product-action-bar .btn {
  min-height: 30px;
  padding: 5px 10px;
}

.product-action-bar .btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.product-tool-drawer {
  display: none;
}

.product-tool-drawer.open {
  display: block;
}

.product-tool-panel {
  display: none;
}

.product-tool-panel.active {
  display: block;
}

.product-import-panel {
  grid-column: 1 / -1;
}

.product-entry-form,
.product-sync-form,
.product-import-form {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
}

.product-entry-form input,
.product-entry-form select {
  width: 150px;
}

.product-entry-form label:nth-child(4) input {
  width: 210px;
}

.product-import-form input[type="file"] {
  width: 360px;
  padding: 5px 8px;
}

.inline-check {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  color: var(--ink);
}

.inline-check input {
  width: auto;
}

.compact-wrap {
  margin-bottom: 10px;
}

.import-hint {
  margin: -2px 14px 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.product-sync-form select {
  width: 150px;
}

.product-sync-form input[list] {
  width: 170px;
}

.product-sync-form input[type="number"] {
  width: 74px;
}

.mini-output {
  min-height: 30px;
  margin: 0 12px 10px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  white-space: pre-wrap;
}

.plan-create-bar {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 12px;
  margin-bottom: 12px;
}

.inline-create-bar {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px dashed #b9c6d8;
  background: #fbfcfe;
  align-items: end;
}

.inline-create-bar label,
.inline-create-bar #createPlanBtn {
  display: none;
}

.inline-create-bar.open label,
.inline-create-bar.open #createPlanBtn {
  display: grid;
}

.add-plan-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.collapsed-admin-panel {
  display: none;
}

.purchase-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1.1fr) minmax(420px, 0.9fr);
  gap: 12px;
  margin-bottom: 12px;
}

.purchase-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 10px;
  padding: 12px 14px;
}

.purchase-form .wide-field {
  grid-column: 1 / -1;
}

.cycle-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(76px, 1fr));
  gap: 10px;
  padding: 12px 14px 4px;
}

.cycle-form input,
.purchase-form input,
.purchase-form select {
  width: 100%;
}

.purchase-form .btn {
  align-self: end;
  width: fit-content;
}

.purchase-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 14px;
  flex-wrap: wrap;
}

.purchase-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.purchase-summary div {
  background: #fff;
  border: 1px solid var(--line);
  padding: 10px 12px;
}

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

.purchase-summary strong {
  font-size: 20px;
}

.production-summary {
  grid-template-columns: repeat(5, minmax(130px, 1fr));
}

.production-entry-panel {
  margin-bottom: 12px;
}

.production-form {
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  gap: 10px;
  padding: 12px 14px;
  align-items: end;
}

.production-form input,
.production-form select {
  width: 100%;
}

.user-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  padding: 12px 14px;
  align-items: end;
}

.user-form input,
.user-form select {
  width: 100%;
}

.user-form .wide-field {
  grid-column: span 2;
}

.production-form .wide-field {
  grid-column: span 3;
}

.production-actions {
  display: flex;
  gap: 8px;
  align-items: end;
}

.production-tables {
  display: grid;
  gap: 12px;
}

.production-summary-table-wrap {
  max-height: 360px;
}

.summary-rate-field {
  display: flex;
  align-items: center;
  gap: 4px;
}

.summary-rate-field input {
  width: 86px;
  height: 30px;
  border: 1px solid var(--line);
  padding: 4px 8px;
  font-size: 20px;
  font-weight: 700;
}

.summary-rate-field b {
  font-size: 18px;
}

.purchase-table-wrap {
  max-height: 680px;
}

.ops-table-wrap {
  max-height: 680px;
}

.lingxing-config {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
  padding: 12px 14px 4px;
}

.lingxing-config label:first-child {
  grid-column: span 2;
}

.lingxing-config .btn {
  align-self: end;
  width: fit-content;
}

.pairing-box {
  margin: 12px 14px 4px;
  padding: 12px;
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.pairing-box select {
  width: 170px;
}

.pairing-box input[list] {
  width: 170px;
}

.pairing-box input[type="number"] {
  width: 86px;
}

.plan-create-bar input {
  width: 180px;
}

.sales-manual-panel {
  margin-bottom: 12px;
}

.sales-lx-tabs {
  display: flex;
  align-items: center;
  gap: 26px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: #fff;
}

.sales-lx-tab {
  height: 40px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-weight: 500;
  padding: 0 2px;
}

.sales-lx-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.sales-lx-filterbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.sales-lx-filterbar label {
  gap: 0;
  font-size: 0;
}

.sales-lx-filterbar input,
.sales-lx-filterbar select,
.sales-lx-filterbar .lx-picker-btn {
  min-height: 32px;
  height: 32px;
  min-width: 92px;
  padding: 5px 10px;
  font-size: 13px;
}

.sales-lx-filterbar .btn {
  min-height: 32px;
  padding: 5px 12px;
}

.sales-metric-switch {
  display: inline-flex;
  align-items: center;
}

.metric-switch-btn {
  min-height: 32px;
  padding: 5px 12px;
  border: 1px solid #cbd5e1;
  border-right: 0;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.metric-switch-btn:first-child {
  border-radius: 4px 0 0 4px;
}

.metric-switch-btn:last-child {
  border-right: 1px solid #cbd5e1;
  border-radius: 0 4px 4px 0;
}

.metric-switch-btn.active {
  color: var(--blue);
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.sales-date-range,
.sales-search-row {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.sales-date-range input {
  width: 118px;
  min-width: 118px;
}

.sales-date-range input + input {
  margin-left: 6px;
}

.sales-search-row select {
  width: 86px;
  min-width: 86px;
}

.sales-search-row input {
  width: 180px;
  min-width: 180px;
}

.sales-data-summary {
  display: none;
}

.sales-record-panel {
  display: none;
}

.sync-version-note {
  margin: 10px 0;
  padding: 8px 10px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
}

.store-master-filterbar {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.store-master-filterbar label {
  width: 180px;
}

.store-master-filterbar input,
.store-master-filterbar select {
  min-height: 32px;
  padding: 5px 8px;
}

.store-master-summary {
  margin: 12px 0;
}

.store-master-panel {
  margin-top: 0;
}

.store-master-table-wrap {
  max-height: calc(100vh - 300px);
  overflow: auto;
}

.store-master-table th,
.store-master-table td {
  height: 34px;
  padding: 6px 10px;
  font-weight: 400;
}

.store-master-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef4fb;
  font-weight: 500;
}

.sales-pivot-panel {
  margin: 0 0 12px;
  border-top: 0;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 206px);
  min-height: 430px;
}

.sales-pivot-hidden-select {
  display: none;
}

.sales-pivot-header {
  position: relative;
  justify-content: flex-end;
  align-items: center;
  min-height: 40px;
  padding: 6px 12px;
  background: #f7f9fc;
}

.sales-pivot-tabs {
  display: none;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}

.sales-pivot-tab {
  min-height: 30px;
  padding: 5px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.sales-pivot-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.sales-pivot-tools {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.compact-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.compact-check input {
  width: 14px;
  height: 14px;
  min-height: auto;
  padding: 0;
}

.icon-tool-btn {
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-tool-btn:hover {
  border-color: var(--line);
  background: #f8fafc;
  color: var(--blue);
}

.column-config-panel {
  position: absolute;
  top: 34px;
  right: 0;
  z-index: 30;
  display: none;
  width: 260px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
}

.column-config-panel.open {
  display: block;
}

.column-config-panel header,
.column-config-panel footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.column-config-panel footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
}

.column-config-panel header button {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.column-config-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  max-height: 280px;
  overflow: auto;
  padding: 10px 12px;
}

.column-config-list label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  color: var(--ink);
  font-size: 12px;
}

.column-config-list input {
  width: 14px;
  height: 14px;
  min-height: auto;
  padding: 0;
}

.sales-pivot-wrap {
  flex: 1;
  min-height: 320px;
  max-height: none;
  overflow: auto;
  border-top: 0;
}

.sales-pivot-table {
  table-layout: fixed;
  border-collapse: collapse;
}

.sales-pivot-table th,
.sales-pivot-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  height: 34px;
  padding: 5px 8px;
  font-weight: 400;
}

.sales-pivot-table th {
  position: relative;
  background: #eef4fb;
  font-weight: 500;
}

.sales-pivot-table .number-cell {
  background: transparent;
  font-weight: 400;
}

.sales-pivot-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 2;
  border-top: 1px solid #cbd5e1;
  background: #fff;
  color: var(--ink);
  font-weight: 400;
}

.sales-pivot-table tbody tr:hover td {
  background: #f6faff;
}

.sales-child-row td {
  background: #fbfdff;
  color: #475569;
}

.sales-child-row td:first-child,
.sales-child-row td:nth-child(7),
.sales-child-row td:nth-child(8) {
  padding-left: 22px;
}

.sales-expand-btn {
  width: 22px;
  height: 22px;
  margin-right: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--blue);
  cursor: pointer;
  line-height: 18px;
}

.sales-col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  cursor: col-resize;
}

.sales-col-resizer:hover {
  background: rgba(37, 99, 235, 0.14);
}

.sales-pivot-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}

.sales-pivot-summary {
  color: var(--muted);
  font-weight: 400;
}

.sales-pivot-pager {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sales-pivot-pager select,
.sales-pivot-pager input {
  height: 30px;
  min-height: 30px;
  padding: 4px 8px;
}

.sales-pivot-pager input {
  width: 64px;
}

.sales-pivot-total {
  color: var(--blue);
  font-weight: 400;
}

.sales-trend-line {
  display: block;
  width: 150px;
  height: 28px;
}

.sales-trend-line polyline {
  fill: none;
  stroke: var(--blue);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sales-manual-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  padding: 12px 14px;
}

.sales-manual-form label {
  width: 138px;
}

.sales-manual-form input,
.sales-manual-form select {
  width: 100%;
}

.sales-manual-form .manual-note {
  width: 210px;
}

.manual-sync-note {
  min-height: 36px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  width: 160px;
}

.plan-save-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 8px 0;
  background: var(--bg);
}

.plan-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.plan-summary div {
  background: #fff;
  border: 1px solid var(--line);
  padding: 10px 12px;
}

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

.plan-summary strong {
  font-size: 20px;
}

.sales-plan-wrap {
  max-height: 680px;
}

.data-table,
.matrix-table,
.sales-plan-table,
.purchase-table,
.ops-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.sales-plan-table {
  min-width: 1380px;
  table-layout: fixed;
}

.purchase-table {
  min-width: 2280px;
  table-layout: fixed;
}

.ops-table {
  min-width: 1280px;
  table-layout: fixed;
}

.sales-plan-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #e8f1fb;
  white-space: nowrap;
}

.purchase-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #e8f1fb;
  white-space: nowrap;
}

.ops-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #e8f1fb;
  white-space: nowrap;
}

.purchase-table input,
.ops-table input {
  width: 100%;
  min-height: 30px;
  padding: 5px 7px;
}

.purchase-table input[type="number"],
.ops-table input[type="number"] {
  text-align: right;
}

.purchase-table input[readonly] {
  background: #f7f9fc;
  color: #344054;
}

.purchase-table th:nth-child(1),
.purchase-table td:nth-child(1) {
  width: 74px;
}

.purchase-table th:nth-child(2),
.purchase-table td:nth-child(2),
.purchase-table th:nth-child(3),
.purchase-table td:nth-child(3) {
  width: 76px;
}

.purchase-table th:nth-child(4),
.purchase-table td:nth-child(4) {
  width: 140px;
}

.purchase-table th:nth-child(5),
.purchase-table td:nth-child(5) {
  width: 210px;
}

.purchase-table th:nth-child(6),
.purchase-table td:nth-child(6) {
  width: 130px;
}

.purchase-table th:nth-child(7),
.purchase-table td:nth-child(7) {
  width: 170px;
}

.purchase-table th:nth-child(8),
.purchase-table td:nth-child(8) {
  width: 140px;
}

.purchase-table th:nth-child(n + 9):nth-child(-n + 18),
.purchase-table td:nth-child(n + 9):nth-child(-n + 18) {
  width: 88px;
}

.purchase-table th:nth-child(19),
.purchase-table td:nth-child(19),
.purchase-table th:nth-child(20),
.purchase-table td:nth-child(20) {
  width: 128px;
}

.purchase-table th:nth-child(21),
.purchase-table td:nth-child(21) {
  width: 160px;
}

.purchase-name,
.purchase-code {
  word-break: break-word;
  white-space: normal;
}

.number-cell {
  text-align: right;
  font-weight: 700;
  background: #f7f9fc;
}

.sales-plan-table th:nth-child(1),
.sales-plan-table th:nth-child(2),
.sales-plan-table th:nth-child(3) {
  z-index: 4;
}

.sales-plan-table th:nth-child(1),
.sales-plan-table .model-cell {
  position: sticky;
  left: 0;
  z-index: 3;
}

.sales-plan-table th:nth-child(2),
.sales-plan-table .account-cell {
  position: sticky;
  left: 96px;
  z-index: 3;
}

.sales-plan-table th:nth-child(3),
.sales-plan-table .metric-name {
  position: sticky;
  left: 228px;
  z-index: 2;
}

.sales-plan-table th:nth-child(1),
.sales-plan-table td:nth-child(1) {
  width: 96px;
}

.sales-plan-table th:nth-child(2),
.sales-plan-table td:nth-child(2) {
  width: 132px;
}

.sales-plan-table th:nth-child(3),
.sales-plan-table td:nth-child(3) {
  width: 120px;
}

.sales-plan-table th:nth-child(n + 4):nth-child(-n + 15),
.sales-plan-table td:nth-child(n + 4):nth-child(-n + 15) {
  width: 76px;
}

.sales-plan-table th:nth-child(16),
.sales-plan-table td:nth-child(16) {
  width: 90px;
}

.sales-plan-table th:nth-child(17),
.sales-plan-table td:nth-child(17) {
  width: 104px;
}

.plan-history-cell {
  text-align: center;
  background: #fff;
}

.sales-plan-table input {
  width: 100%;
  min-height: 30px;
  padding: 5px 7px;
}

.sales-plan-table input[type="number"] {
  text-align: right;
}

.sales-plan-table .metric-name {
  font-weight: 700;
  color: var(--ink);
  background: #fbfcfe;
}

.metric-name-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.metric-name-inner em {
  display: inline-block;
  margin-left: 6px;
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
  font-size: 11px;
}

.metric-order-actions {
  display: inline-flex;
  gap: 3px;
}

.metric-order-actions button {
  width: 20px;
  height: 20px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  padding: 0;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

.metric-order-actions button:hover {
  color: var(--blue);
  border-color: #aac7f5;
}

.sales-plan-table .api-readonly-input {
  background: #f4f7fb;
  color: #475467;
  cursor: default;
}

.sales-plan-table .metric-total {
  text-align: right;
  font-weight: 700;
  background: #f7f9fc;
}

.sales-plan-table .plan-row td {
  background: #fbfdff;
}

.sales-plan-table .done-row td {
  background: #f7fbff;
}

.sales-plan-table .history-row td {
  background: #fff;
}

.sales-plan-table .account-cell,
.sales-plan-table .model-cell {
  font-weight: 700;
  background: #eef6fc;
  vertical-align: middle;
}

.sales-plan-table .group-gap td {
  height: 8px;
  padding: 0;
  background: var(--bg);
  border-right: 0;
}

.sales-plan-table .empty-cell {
  text-align: center;
  color: var(--muted);
  height: 90px;
  background: #fff;
}

.data-table {
  table-layout: fixed;
}

.data-table .select-col {
  text-align: center;
  vertical-align: middle;
}

.select-col input {
  min-height: auto;
  width: 15px;
  height: 15px;
  padding: 0;
  accent-color: var(--blue);
}

th,
td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 8px;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #e8f1fb;
  text-align: left;
  white-space: nowrap;
  height: 34px;
}

td {
  background: #fff;
}

.data-table td {
  white-space: nowrap;
  height: var(--mapping-row-height);
  max-height: var(--mapping-row-height);
  overflow: hidden;
}

.data-table th {
  position: sticky;
  min-width: 74px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table th .col-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  z-index: 3;
}

.data-table th .col-resizer:hover {
  background: rgba(31, 111, 235, 0.16);
}

body.resizing-col {
  cursor: col-resize;
  user-select: none;
}

.sku-cell {
  max-width: 280px;
  white-space: normal;
  word-break: break-word;
}

.status {
  display: inline-block;
  padding: 3px 8px;
  font-size: 12px;
  border: 1px solid var(--line);
}

.status-已确认,
.status-已匹配 {
  background: var(--green-soft);
  color: var(--green);
  border-color: #a8ddbe;
}

.status-待确认,
.status-未匹配 {
  background: var(--yellow-soft);
  color: var(--yellow);
  border-color: #f2d091;
}

.status-冲突 {
  background: var(--red-soft);
  color: var(--red);
  border-color: #f3b4aa;
}

.status-停售 {
  background: var(--gray-soft);
  color: #667085;
}

.row-actions {
  display: flex;
  gap: 6px;
}

.row-actions button {
  border: 1px solid var(--line);
  background: #fff;
  padding: 4px 7px;
  cursor: pointer;
  font-size: 12px;
}

.copyable {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px;
  min-width: 120px;
  padding-right: 18px;
}

.copyable-text {
  word-break: break-word;
}

.copyable > .copy-btn {
  position: absolute;
  top: -1px;
  right: 0;
}

.copy-btn {
  position: relative;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border: 0;
  background: transparent;
  color: #98a2b3;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, color 0.12s ease;
}

.copyable:hover > .copy-btn,
.copyable:focus-within > .copy-btn,
.field-row:hover > .copy-btn,
.field-row:focus-within > .copy-btn {
  opacity: 0.9;
  pointer-events: auto;
}

.copy-btn:hover {
  color: var(--blue);
  background: transparent;
  opacity: 1;
}

.copy-btn::before,
.copy-btn::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 7px;
  border: 1.3px solid currentColor;
  background: transparent;
}

.copy-btn::before {
  left: 4px;
  top: 6px;
}

.copy-btn::after {
  left: 7px;
  top: 3px;
  background: inherit;
}

.pager {
  margin-top: 10px;
  justify-content: flex-end;
}

.legend {
  display: flex;
  gap: 18px;
  align-items: center;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.dot {
  width: 10px;
  height: 10px;
  display: inline-block;
  margin-right: -12px;
}

.dot.confirmed {
  background: var(--green);
}

.dot.pending {
  background: #d79000;
}

.dot.conflict {
  background: var(--red);
}

.dot.stopped {
  background: #98a2b3;
}

.matrix-title {
  padding: 12px;
  background: #fbfcfe;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}

.matrix-cell {
  min-width: 150px;
  max-width: 210px;
  line-height: 1.45;
}

.matrix-cell strong {
  display: block;
  margin-bottom: 4px;
}

.matrix-cell .small {
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}

.matrix-cell.confirmed {
  background: var(--green-soft);
}

.matrix-cell.pending {
  background: var(--yellow-soft);
}

.matrix-cell.conflict {
  background: var(--red-soft);
}

.matrix-cell.stopped {
  background: var(--gray-soft);
}

.code-output {
  margin: 12px 14px 14px;
  padding: 12px;
  min-height: 120px;
  overflow: auto;
  background: #101828;
  color: #e4edf7;
  font-size: 12px;
  line-height: 1.5;
}

.code-output.large {
  min-height: 260px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #152238;
  color: #fff;
  padding: 10px 14px;
  opacity: 0;
  transform: translateY(8px);
  transition: 0.18s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(15, 23, 42, 0.45);
  z-index: 20;
}

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

.modal {
  width: min(880px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.modal-card {
  width: min(880px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.plan-history-card {
  width: min(720px, 100%);
}

.history-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.history-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #fbfcfe;
}

.history-item span {
  color: var(--muted);
  text-align: right;
  font-size: 12px;
}

.history-item p {
  grid-column: 1 / -1;
  margin: 0;
  line-height: 1.5;
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #fbfcfe;
  border-bottom: 1px solid var(--line);
}

.modal-footer {
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

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

.field-row {
  display: grid;
  grid-template-columns: 1fr 16px;
  gap: 6px;
  align-items: center;
}

.wide-field,
.modal-check {
  grid-column: span 2;
}

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

  .primary-sidebar {
    padding: 10px;
  }

  .secondary-sidebar {
    left: 0;
    width: min(320px, 86vw);
  }

  .primary-nav {
    grid-template-columns: repeat(6, minmax(48px, 1fr));
  }

  .brand {
    display: none;
  }

  .metric-grid,
  .section-grid,
  .dashboard-layout,
  .purchase-grid,
  .production-form,
  .user-form,
  .purchase-summary {
    grid-template-columns: 1fr;
  }

  .dashboard-main-panel {
    grid-row: span 1;
  }

  .purchase-form,
  .cycle-form,
  .sales-manual-form {
    grid-template-columns: 1fr;
  }

  .panel.wide {
    grid-column: span 1;
  }

  .modal-body {
    grid-template-columns: 1fr;
  }

  .wide-field,
  .modal-check {
    grid-column: span 1;
  }
}
