﻿:root {
  --bg: #f3f5f7;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --ink: #16202a;
  --muted: #667485;
  --line: #dbe2ea;
  --blue: #1f5fd1;
  --green: #16845c;
  --amber: #a86412;
  --red: #bd3b34;
  --side: #17212d;
  --side-2: #223041;
  --shadow: 0 10px 28px rgba(22, 32, 42, .08);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

.lead-module-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.lead-module-tabs .btn {
  min-width: 116px;
}

.lead-report-filter {
  padding: 13px 14px 11px;
  border: 1px solid #bad0eb;
  border-radius: 9px;
  background: #f8fbff;
}

.lead-report-filter-row {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.lead-report-filter-title {
  display: flex;
  align-items: center;
  height: 36px;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}

.lead-report-mode-switch {
  display: inline-flex;
  overflow: hidden;
  height: 36px;
  border: 1px solid #c5d3e3;
  border-radius: 7px;
  background: #fff;
}

.lead-report-mode-switch button {
  min-width: 70px;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid #dbe4ee;
  background: #fff;
  color: #38526d;
  cursor: pointer;
}

.lead-report-mode-switch button:last-child {
  border-right: 0;
}

.lead-report-mode-switch button.active {
  background: #2563eb;
  color: #fff;
}

.lead-report-field {
  display: grid;
  gap: 4px;
  min-width: 175px;
}

.lead-report-field > span {
  height: 16px;
  color: #536b84;
  font-size: 11px;
}

.lead-report-field input,
.lead-report-field select {
  width: 100%;
  height: 36px;
  padding: 7px 10px;
  border: 1px solid #cbd8e7;
  border-radius: 6px;
  background: #fff;
  color: #18324d;
  font: inherit;
}

.lead-report-owner-field {
  min-width: 165px;
}

.lead-report-month-fields,
.lead-report-custom-fields {
  display: flex;
  align-items: end;
  gap: 8px;
}

.lead-report-year-field {
  min-width: 112px;
}

.lead-report-month-field {
  min-width: 100px;
}

.lead-report-query,
.lead-report-current-month {
  height: 36px;
}

.lead-report-range-note {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed #cedded;
  color: #52708e;
  font-size: 12px;
}

.lead-conversion-funnel {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 9px;
  margin-top: 14px;
}

.lead-conversion-step {
  position: relative;
  min-height: 112px;
  padding: 14px 9px 11px;
  border: 1px solid #cbdced;
  border-radius: 9px;
  background: linear-gradient(180deg, #fff, #f8fbff);
  text-align: center;
}

.lead-conversion-step::after {
  content: "›";
  position: absolute;
  top: 36px;
  right: -10px;
  z-index: 2;
  color: #8da6c0;
  font-size: 23px;
}

.lead-conversion-step:last-child::after {
  display: none;
}

.lead-conversion-step > span {
  display: block;
  font-weight: 700;
}

.lead-conversion-step > strong {
  display: block;
  margin: 5px 0 2px;
}

.lead-conversion-step em {
  color: #64748b;
  font-size: 12px;
  font-style: normal;
}

.lead-report-number {
  padding: 0;
  border: 0;
  background: transparent;
  color: #153f71;
  font: inherit;
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
}

.lead-report-number:hover {
  color: #2563eb;
  text-decoration: underline;
}

.lead-report-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-top: 10px;
}

.lead-report-kpis article {
  padding: 12px 14px;
  border: 1px solid #d8e2ee;
  border-radius: 9px;
  background: #fff;
  color: #465e76;
}

.lead-report-kpis strong {
  display: block;
  margin-top: 4px;
  color: #122e4c;
  font-size: 21px;
}

.lead-report-kpis .lead-report-number {
  font-size: 21px;
}

.lead-report-table-panel {
  margin-top: 10px;
  padding: 13px;
  border: 1px solid #d8e2ee;
  border-radius: 9px;
  background: #fff;
}

.lead-report-table-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.lead-report-table-head span {
  color: #2563eb;
  font-size: 12px;
}

.lead-report-table {
  min-width: 1080px;
}

.lead-report-table th,
.lead-report-table td {
  text-align: left;
}

.lead-report-table .lead-report-number {
  font-size: 14px;
}

.lead-report-person-type {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.lead-report-person-type.promotion {
  background: #eff6ff;
  color: #1d4ed8;
}

.lead-report-person-type.sales {
  background: #ecfdf5;
  color: #047857;
}

.lead-report-money {
  color: #153f71;
  font-weight: 800;
  white-space: nowrap;
}

.lead-report-total-row td {
  background: #f8fbff;
  font-weight: 800;
}

.lead-conversion-detail-dialog {
  width: min(1120px, calc(100vw - 44px));
}

.lead-conversion-detail-dialog .dialog-head p {
  margin: 4px 0 0;
  color: #64748b;
}

@media (max-width: 1180px) {
  .lead-conversion-funnel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .lead-conversion-step:nth-child(3)::after {
    display: none;
  }
}

@media (max-width: 760px) {
  .lead-report-filter-row,
  .lead-report-month-fields,
  .lead-report-custom-fields {
    align-items: stretch;
    flex-direction: column;
  }
  .lead-report-filter-title,
  .lead-report-mode-switch,
  .lead-report-field,
  .lead-report-query,
  .lead-report-current-month {
    width: 100%;
  }
  .lead-report-mode-switch button {
    flex: 1;
  }
  .lead-conversion-funnel,
  .lead-report-kpis {
    grid-template-columns: minmax(0, 1fr);
  }
  .lead-conversion-step::after {
    display: none;
  }
  .lead-report-table-head {
    flex-direction: column;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  overflow: hidden;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100vh;
  overflow-y: auto;
  padding: 14px 10px;
  color: #eef5fb;
  background: var(--side);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px 14px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 38px;
  border-radius: 7px;
  background: var(--blue);
  font-size: 12px;
  font-weight: 800;
}
.brand-copy {
  min-width: 0;
  display: grid;
  align-content: center;
  row-gap: 3px;
}
.brand-copy strong,
.brand-copy span {
  display: block;
  line-height: 1.2;
  white-space: nowrap;
}
.brand-copy strong { font-size: 14px; }
.brand-copy span { color: #aeb9c6; font-size: 12px; }
.nav { display: grid; gap: 5px; }
.nav button,
.nav a {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  color: #c8d3df;
  background: transparent;
  line-height: 1;
  text-align: left;
  text-decoration: none;
}
.nav a {
  display: flex;
  align-items: center;
}
.nav button.active, .nav button:hover, .nav a:hover {
  color: #fff;
  background: var(--side-2);
}
.nav button.external-nav,
.nav a.external-nav {
  margin-top: 8px;
  border: 0;
  color: #c8d3df;
  background: transparent;
  font-weight: 600;
}
.nav button.external-nav:hover,
.nav a.external-nav:hover {
  color: #fff;
  background: var(--side-2);
}
.nav button.logout-nav {
  margin-top: 8px;
}
.sidebar-note {
  margin-top: auto;
  padding: 10px;
  border-radius: 7px;
  background: var(--side-2);
}
.sidebar-note span, .sidebar-note strong {
  display: block;
  font-size: 12px;
}
.sidebar-note span { color: #aeb9c6; margin-bottom: 6px; }
.sidebar-profile-btn {
  width: 100%;
  height: 30px;
  margin-top: 10px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 6px;
  color: #e6eef7;
  background: rgba(255,255,255,.06);
  font-size: 12px;
  font-weight: 700;
}
.sidebar-profile-btn:hover {
  background: rgba(255,255,255,.12);
}
.sidebar-profile-btn.hidden {
  display: none;
}

.main {
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
}
.search, .field input, .field select, .field textarea, .cell-input {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
.search { width: 280px; padding: 0 12px; }
.field textarea { height: 76px; padding: 8px 10px; resize: vertical; }
.field textarea.spec-textarea { min-height: 118px; }
.field textarea.spec-textarea.compact {
  height: 58px;
  min-height: 58px;
}
.field textarea.auto-grow-textarea { min-height: 96px; overflow: hidden; resize: vertical; }
.field input, .field select { width: 100%; padding: 0 10px; }
.bank-image-upload {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px dashed transparent;
  border-radius: 7px;
}
.bank-image-upload:focus,
.bank-image-upload.dragging {
  border-color: #0284c7;
  background: #f8fcff;
  outline: none;
}
.bank-image-upload .muted {
  font-size: 12px;
}
.bank-image-preview {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}
.bank-image-preview.hidden { display: none; }
.bank-image-preview img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
}
.bank-image-preview span {
  color: var(--muted);
  font-size: 12px;
  word-break: break-word;
}
.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  align-items: center;
}
.password-field input {
  border-radius: 6px 0 0 6px;
}
.password-eye {
  height: 38px;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 6px 6px 0;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 800;
}
.password-eye.active {
  background: #e8f1ff;
  color: var(--primary);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 74px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
}
.btn.primary { border-color: var(--blue); color: #fff; background: var(--blue); }
.btn.danger { border-color: #ffd6d2; color: var(--red); background: #fff6f5; }
.btn.small { min-width: 0; height: 30px; padding: 0 8px; font-size: 12px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.action-cell {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 5px;
  min-width: max-content;
}
.customer-actions { justify-content: center; }

.view { display: grid; gap: 16px; }
.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.panel-body { padding: 16px; }

.dashboard-analysis-toolbar .panel-head,
.dashboard-follow-report .panel-head,
.dashboard-maintenance-panel .panel-head {
  align-items: center;
}
.dashboard-month-field {
  display: grid;
  gap: 4px;
  min-width: 180px;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}
.dashboard-month-field input {
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.dashboard-follow-metrics {
  grid-template-columns: repeat(7, minmax(130px, 1fr));
}
.dashboard-stage-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  gap: 8px;
}
.dashboard-stage-grid article {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid #dbe5f0;
  border-radius: 10px;
  background: #f8fafc;
}
.dashboard-stage-grid span {
  color: var(--muted);
  font-size: 12px;
}
.dashboard-stage-grid strong {
  font-size: 22px;
}
.dashboard-maintenance-table {
  width: 100%;
  min-width: 980px;
}
@media (max-width: 1366px) {
  .dashboard-follow-metrics,
  .dashboard-stage-grid {
    grid-template-columns: repeat(4, minmax(130px, 1fr));
  }
}

.whatsapp-body {
  display: grid;
  gap: 14px;
}
.whatsapp-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.whatsapp-summary article {
  display: grid;
  gap: 4px;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
}
.whatsapp-summary span,
.whatsapp-summary em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}
.whatsapp-summary strong {
  font-size: 22px;
}
.whatsapp-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 12px;
  min-height: 640px;
}
.whatsapp-sidebar,
.whatsapp-chat {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.whatsapp-sidebar {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 12px;
}
.whatsapp-section-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.whatsapp-section-title span {
  color: var(--muted);
  font-size: 12px;
}
.whatsapp-account-list,
.whatsapp-conversation-list {
  display: grid;
  gap: 8px;
}
.whatsapp-account-list article,
.whatsapp-conversation-list button,
.muted-box {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  text-align: left;
}
.whatsapp-conversation-list button.active {
  border-color: #93c5fd;
  background: #eff6ff;
}
.whatsapp-account-list span,
.whatsapp-conversation-list span,
.whatsapp-account-list em,
.whatsapp-conversation-list em,
.muted-box {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}
.whatsapp-filters {
  display: grid;
  gap: 8px;
}
.whatsapp-filters .search,
.whatsapp-filters select {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.whatsapp-chat {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}
.whatsapp-chat-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}
.whatsapp-chat-head h3 {
  margin: 0;
}
.whatsapp-chat-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.whatsapp-message-list {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  padding: 14px;
  overflow-y: auto;
  background: #f8fafc;
}
.whatsapp-message-list article {
  max-width: 78%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.whatsapp-message-list article.out {
  margin-left: auto;
  border-color: #bfdbfe;
  background: #eff6ff;
}
.whatsapp-message-meta {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}
.whatsapp-message-list p {
  margin: 0;
  line-height: 1.55;
  white-space: pre-wrap;
}
.whatsapp-message-list blockquote {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-left: 3px solid var(--blue);
  background: rgba(255,255,255,.72);
  color: #334155;
  white-space: pre-wrap;
}
.whatsapp-composer {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
}
.whatsapp-composer label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}
.whatsapp-composer textarea {
  width: 100%;
  min-height: 86px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  resize: vertical;
}
.whatsapp-composer .summary-row {
  grid-column: 1 / -1;
}

.ai-assistant-body {
  display: grid;
  gap: 14px;
  padding-top: 14px;
}
.ai-agent-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.ai-agent-overview article {
  display: grid;
  gap: 5px;
  min-height: 82px;
  padding: 13px;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #fff;
}
.ai-agent-overview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.ai-agent-overview strong {
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
}
.ai-agent-overview em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}
.ai-assistant-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px;
  align-items: start;
}
.ai-assistant-form,
.ai-assistant-side {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}
.ai-assistant-form .summary-row {
  justify-content: flex-start;
  margin: 12px 0;
}
.ai-assistant-form .form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.ai-workbench-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
}
.ai-workbench-head h3,
.ai-workbench-head p {
  margin: 0;
}
.ai-workbench-head h3 {
  color: var(--ink);
  font-size: 16px;
}
.ai-workbench-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}
.ai-agent-badge {
  white-space: nowrap;
  padding: 5px 9px;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  background: #f0fdf4;
  color: #166534;
  font-size: 12px;
  font-weight: 800;
}
.ai-example-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.ai-example-chip {
  display: grid;
  gap: 5px;
  min-height: 72px;
  padding: 9px 10px;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #f8fafc;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.ai-example-chip:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}
.ai-example-chip strong {
  color: #1d4ed8;
  font-size: 12px;
}
.ai-example-chip span {
  color: #334155;
  font-size: 12px;
  line-height: 1.35;
}
.ai-assistant-form textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  line-height: 1.45;
  padding: 9px 10px;
  resize: vertical;
}
.ai-side-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.ai-assistant-side h3 {
  margin: 0;
  font-size: 15px;
}
.ai-agent-guide {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}
.ai-agent-guide h3 {
  color: #1e40af;
}
.ai-agent-guide ol {
  margin: 0;
  padding-left: 18px;
  color: #334155;
  font-size: 12px;
  line-height: 1.55;
}
.ai-record-list {
  display: grid;
  gap: 8px;
}
.ai-record-list article {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}
.ai-record-list strong {
  color: var(--ink);
}
.ai-record-list span,
.ai-record-list p,
.ai-record-list em {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.product-knowledge-body {
  display: grid;
  gap: 16px;
}
.knowledge-workflow {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.knowledge-workflow div {
  display: grid;
  gap: 5px;
  min-height: 76px;
  padding: 14px;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #f8fafc;
}
.knowledge-workflow strong {
  color: var(--ink);
  font-size: 15px;
}
.knowledge-workflow span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.knowledge-product-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: stretch;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.knowledge-maintenance-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.knowledge-product-selector {
  display: grid;
  grid-template-columns: 110px minmax(180px, 260px) minmax(260px, 1fr) minmax(260px, 1fr);
  gap: 8px;
  align-items: center;
}
.knowledge-product-selector .product-select-label {
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #dbe5f0;
  border-radius: 7px;
  background: #f1f6fb;
  color: #334155;
  font-weight: 800;
  white-space: nowrap;
}
.knowledge-product-selector select,
.knowledge-product-selector input {
  width: 100%;
  height: 40px;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}
.knowledge-selected-product {
  color: var(--muted);
  font-size: 12px;
}
.knowledge-selected-product strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
}
.product-knowledge-layout {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(420px, 1.08fr);
  gap: 14px;
  align-items: start;
}
.product-knowledge-form,
.product-knowledge-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 14px;
}
.knowledge-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.knowledge-section-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
}
.knowledge-section-head span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.product-knowledge-form .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.product-knowledge-form .field.wide {
  grid-column: 1 / -1;
}
.product-knowledge-form textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  line-height: 1.45;
  padding: 9px 10px;
  resize: vertical;
}
.knowledge-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}
.knowledge-form-actions span {
  max-width: 520px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.product-knowledge-list {
  display: grid;
  gap: 0;
}
.knowledge-card-list {
  display: grid;
  gap: 10px;
}
.knowledge-card-list article {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}
.knowledge-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.knowledge-card-head > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.knowledge-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex-shrink: 0;
}
.knowledge-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.knowledge-preview-meta span {
  padding: 4px 8px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
}
.knowledge-preview-content {
  white-space: pre-wrap;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  margin-bottom: 12px;
  line-height: 1.6;
}
.knowledge-structured-meta {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}
.knowledge-structured-meta strong {
  color: #1d4ed8;
  font-size: 13px;
}
.knowledge-structured-meta p {
  margin: 0;
  color: #1f2937;
  line-height: 1.55;
  white-space: pre-wrap;
}
.knowledge-structured-meta div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.knowledge-structured-meta span {
  width: auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1e40af;
  font-size: 12px;
}
.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}
.product-knowledge-list strong {
  color: var(--ink);
}
.product-knowledge-list span,
.product-knowledge-list p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.knowledge-attachment-list {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}
.knowledge-attachment-list > strong {
  color: #334155;
  font-size: 12px;
}
.knowledge-attachment-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid #dbe5f0;
  border-radius: 7px;
  background: #fff;
}
.knowledge-attachment-thumb,
.knowledge-attachment-icon {
  width: 52px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
  overflow: hidden;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
}
.knowledge-attachment-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.knowledge-attachment-meta {
  display: grid;
  gap: 7px;
  min-width: 0;
}
.knowledge-attachment-meta > span {
  color: var(--ink);
  overflow-wrap: anywhere;
}
.knowledge-attachment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.knowledge-file-names {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.knowledge-missing-file {
  padding: 8px 10px;
  border: 1px solid #fed7aa;
  border-radius: 7px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 12px;
  line-height: 1.5;
}
.knowledge-qa-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}
.knowledge-chat-window {
  display: grid;
  gap: 12px;
  min-height: 260px;
  max-height: 480px;
  overflow-y: auto;
  padding: 14px;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #f8fafc;
}
.knowledge-chat-row {
  display: flex;
}
.knowledge-chat-row.user {
  justify-content: flex-end;
}
.knowledge-chat-row.assistant {
  justify-content: flex-start;
}
.knowledge-chat-bubble {
  display: grid;
  gap: 7px;
  max-width: min(760px, 78%);
  padding: 12px 14px;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #fff;
}
.knowledge-chat-row.user .knowledge-chat-bubble {
  border-color: #bfdbfe;
  background: #eff6ff;
}
.knowledge-chat-row.assistant .knowledge-chat-bubble {
  border-color: #bbf7d0;
  background: #f0fdf4;
}
.knowledge-chat-bubble strong {
  color: var(--ink);
  font-size: 13px;
}
.knowledge-chat-bubble p {
  margin: 0;
  color: #1f2937;
  line-height: 1.55;
  white-space: pre-wrap;
}
.knowledge-chat-bubble details {
  margin-top: 4px;
}
.knowledge-chat-bubble summary {
  cursor: pointer;
  color: #2563eb;
  font-size: 12px;
  font-weight: 800;
}
.knowledge-chat-bubble label,
.knowledge-chat-composer {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}
.knowledge-chat-bubble textarea,
.knowledge-chat-composer textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  line-height: 1.45;
  padding: 9px 10px;
  resize: vertical;
}
.knowledge-chat-composer {
  margin-top: 12px;
}
.knowledge-chat-composer > label {
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}
.knowledge-chat-empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #fff;
}
.knowledge-qa-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.knowledge-answer-grid {
  margin-top: 12px;
}
.ai-answer-result {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #f8fafc;
}
.ai-answer-question,
.ai-answer-main {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}
.ai-answer-question strong,
.ai-answer-main strong {
  color: var(--ink);
  font-size: 13px;
}
.ai-answer-question p,
.ai-answer-main p {
  margin: 0;
  color: #1f2937;
  line-height: 1.55;
  white-space: pre-wrap;
}
.ai-agent-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ai-agent-status span {
  padding: 5px 9px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
}
.ai-answer-main {
  border-color: #bbf7d0;
  background: #f0fdf4;
}
.ai-source-list {
  display: grid;
  gap: 8px;
}
.ai-source-list article {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #fff;
}
.ai-source-list strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}
.ai-source-list span,
.ai-source-list p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.ai-action-list {
  display: grid;
  gap: 7px;
}
.ai-action-list span {
  padding: 8px 10px;
  border: 1px solid #fed7aa;
  border-radius: 7px;
  background: #fff7ed;
  color: #9a3412;
  line-height: 1.45;
}
.ai-file-result-list {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}
.ai-file-result-list article {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  background: #fff;
}
.ai-file-result-list article > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.ai-file-result-list strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}
.ai-file-result-list span {
  color: var(--muted);
  font-size: 12px;
}
.ai-answer-detail {
  display: grid;
  gap: 8px;
}
.ai-answer-detail summary {
  cursor: pointer;
  color: #2563eb;
  font-size: 12px;
  font-weight: 800;
}
.ai-answer-detail label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}
.ai-answer-detail textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  line-height: 1.45;
  padding: 9px 10px;
  resize: vertical;
}
@media (max-width: 1100px) {
  .ai-assistant-layout,
  .ai-agent-overview,
  .ai-example-grid,
  .product-knowledge-layout,
  .knowledge-product-card,
  .knowledge-product-selector,
  .knowledge-workflow {
    grid-template-columns: 1fr;
  }
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
.metric {
  min-height: 92px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}
.metric span { display: block; color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin-top: 9px; font-size: 28px; line-height: 1; }
.metric em { display: block; margin-top: 8px; color: var(--muted); font-style: normal; font-size: 12px; }
.ok { color: var(--green) !important; }
.warn { color: var(--amber) !important; }
.bad { color: var(--red) !important; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr); gap: 16px; }
.data-workbench { display: grid; gap: 16px; }
.import-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.import-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 158px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.import-card strong { font-size: 15px; }
.import-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.import-card-head span {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  color: #2563eb;
  background: #eff6ff;
  font-size: 12px;
}
.import-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.sales-summary,
.task-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.summary-link-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 360px;
  max-width: 100%;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.summary-link-card:hover {
  border-color: #b9d0ff;
  background: #f8fbff;
}
.summary-link-card strong {
  font-size: 18px;
}
.task-toolbar {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) repeat(4, 128px) 84px;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
}
.task-toolbar .search,
.task-toolbar .filter-select {
  width: 100%;
  height: 40px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  background-color: #fff !important;
  color: var(--ink) !important;
  outline: none !important;
  box-shadow: none !important;
}
.task-toolbar .filter-select {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position: calc(100% - 15px) 16px, calc(100% - 10px) 16px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
  font-size: 14px;
}
.task-toolbar .btn {
  width: 100%;
  height: 40px;
}
.lead-summary-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.lead-summary-grid article {
  min-height: 92px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.lead-summary-grid span,
.lead-summary-grid em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}
.lead-summary-grid strong {
  display: block;
  margin: 7px 0;
  color: #0f172a;
  font-size: 32px;
  line-height: 1;
}
.lead-summary-grid .attention-card {
  border-left: 4px solid #2563eb;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .06);
}
.lead-summary-grid .attention-card.primary { background: #eff6ff; border-color: #2563eb; }
.lead-summary-grid .attention-card.danger { background: #fff1f2; border-color: #e11d48; }
.lead-summary-grid .attention-card.success { background: #ecfdf5; border-color: #059669; }
.lead-summary-grid .attention-card.warning { background: #fffbeb; border-color: #d97706; }
.lead-summary-grid .attention-card.info { background: #f0fdfa; border-color: #0d9488; }
.lead-summary-grid .attention-card.danger strong { color: #be123c; }
.lead-summary-grid .attention-card.success strong { color: #047857; }
.lead-summary-grid .attention-card.warning strong { color: #b45309; }
.lead-summary-grid .attention-card.info strong { color: #0f766e; }
.lead-stage-strip {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.lead-stage-strip button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.lead-stage-strip button.active {
  border-color: #2563eb;
  background: #dbeafe;
  box-shadow: inset 0 0 0 1px #2563eb;
}
.lead-stage-strip strong {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: left;
}
.lead-stage-strip span {
  min-width: 28px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e0ecff;
  color: #1d4ed8;
  font-weight: 800;
  text-align: center;
}
.lead-task-filter {
  grid-template-columns: repeat(10, minmax(0, 1fr)) 64px;
  align-items: center;
}
.lead-task-filter.customer-task-filter {
  grid-template-columns: repeat(7, minmax(0, 1fr)) 64px;
}
.lead-task-filter .task-filter-clear {
  width: 64px;
  min-width: 64px;
  justify-self: end;
  padding-inline: 8px;
}
.task-date-range {
  grid-column: span 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  width: 100%;
  min-width: 0;
  height: 40px;
}
.task-date-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  width: 100%;
  min-width: 0;
  height: 40px;
  padding-left: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}
.task-date-field .search {
  min-width: 0;
  height: 38px;
  padding: 0 6px;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}
.task-date-caption {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.task-date-separator {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.followup-type-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.followup-type-tabs .btn { min-width: 132px; }
.followup-type-tabs .btn span {
  margin-left: 6px;
  font-weight: 800;
}
.inactive-days-input {
  width: 100%;
  min-width: 112px;
}
.lead-task-table-wrap {
  border-radius: 7px;
  background: #fff;
}
.lead-task-table {
  min-width: 1320px;
  table-layout: fixed;
}
.lead-task-table .lead-col-name { width: 17%; }
.lead-task-table .lead-col-stage { width: 9%; }
.lead-task-table .lead-col-priority { width: 6%; }
.lead-task-table .lead-col-status { width: 9%; }
.lead-task-table .lead-col-last { width: 14%; }
.lead-task-table .lead-col-next { width: 16%; }
.lead-task-table .lead-col-owner { width: 7%; }
.lead-task-table .lead-col-records { width: 5%; }
.lead-task-table .lead-col-actions { width: 17%; }
.lead-task-table th,
.lead-task-table td {
  vertical-align: middle;
}
.lead-task-table td {
  height: 66px;
}
.lead-task-table .clip {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.lead-task-actions {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.lead-task-actions .btn.small {
  min-width: 50px;
  padding: 0 7px;
}
.lead-work-list {
  display: grid;
  gap: 10px;
}
.lead-work-table-wrap {
  margin-top: 12px;
}
.lead-work-table {
  width: 100%;
  min-width: 1480px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #d9e2ec;
  border-radius: 7px;
  overflow: hidden;
}
.lead-work-table col.lead-col-code { width: 8%; }
.lead-work-table col.lead-col-owner { width: 6%; }
.lead-work-table col.lead-col-created { width: 7%; }
.lead-work-table col.lead-col-customer { width: 12%; }
.lead-work-table col.lead-col-stage { width: 8%; }
.lead-work-table col.lead-col-content { width: 14%; }
.lead-work-table col.lead-col-follow-date { width: 8%; }
.lead-work-table col.lead-col-next { width: 14%; }
.lead-work-table col.lead-col-due { width: 8%; }
.lead-work-table col.lead-col-priority { width: 6%; }
.lead-work-table col.lead-col-status { width: 7%; }
.lead-work-table col.lead-col-actions { width: 17%; }
.owner-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  max-width: 100%;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #1e40af;
  font-weight: 800;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.lead-work-table .lead-source-cell strong,
.lead-work-table .lead-source-cell span {
  display: block;
}
.lead-work-table th,
.lead-work-table td {
  height: 64px;
  padding: 10px 12px;
  border-right: 1px solid #d9e2ec;
  border-bottom: 1px solid #d9e2ec;
  line-height: 1.45;
  vertical-align: middle;
  text-align: center;
  white-space: normal;
  word-break: break-word;
}
.lead-work-table th:last-child,
.lead-work-table td:last-child {
  border-right: 0;
}
.lead-work-table th {
  height: 44px;
  background: var(--soft);
  border-bottom: 1px solid #d9e2ec;
}
.lead-work-table tbody tr {
  background: #fff;
}
.lead-work-table tbody td {
  background: #fff;
}
.lead-work-table tbody tr:last-child td {
  border-bottom: 0;
}
.lead-work-table tbody tr:hover td {
  background: #f8fbff;
}
.lead-work-table td > strong,
.lead-work-table td > span,
.lead-work-table td > div {
  max-width: 100%;
}
.lead-work-table .lead-task-actions {
  display: grid;
  grid-template-columns: repeat(3, 60px);
  justify-content: center;
  align-items: center;
  gap: 6px;
  white-space: normal;
}
.lead-work-table .lead-task-actions .btn.small {
  width: 60px;
  min-width: 60px;
  height: 30px;
  padding: 0;
}
.lead-work-table td:nth-child(4),
.lead-work-table td:nth-child(6) {
  line-height: 1.55;
  white-space: normal;
  word-break: break-word;
}
.lead-work-table td:nth-child(6) strong {
  display: block;
  line-height: 1.55;
  white-space: normal;
  word-break: break-word;
}
.lead-work-card {
  display: grid;
  grid-template-columns: 150px minmax(220px, .75fr) minmax(420px, 1.35fr) minmax(280px, .85fr);
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
}
.lead-work-code,
.lead-work-customer {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.lead-work-customer span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.lead-work-code span,
.lead-work-customer span {
  color: var(--muted);
}
.lead-work-code strong,
.lead-work-customer strong {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text);
}
.lead-work-code strong {
  font-size: 13px;
}
.lead-work-customer strong {
  font-size: 16px;
}
.lead-work-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.lead-work-title .muted {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.lead-work-title strong {
  font-size: 16px;
  color: var(--text);
}
.lead-work-main p {
  min-height: 20px;
  margin: 0 0 12px;
  color: var(--muted);
}
.lead-work-next {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 8px;
  line-height: 1.6;
}
.lead-work-next span {
  color: var(--muted);
}
.lead-work-next strong {
  min-width: 0;
  color: var(--text);
}
.overdue-text {
  display: inline-block;
  margin-left: 8px;
  color: #dc2626;
  font-style: normal;
  font-weight: 800;
}
.lead-work-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}
.lead-work-status > div:first-child {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}
.lead-work-status .lead-task-actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
}
.lead-history-panel {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
}
.lead-history-panel .section-title {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}
.lead-history-panel .section-title h3 {
  font-size: 14px;
}
.follow-dashboard {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.follow-dashboard article {
  min-height: 86px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.follow-dashboard span,
.follow-dashboard em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}
.follow-dashboard strong {
  display: block;
  margin: 5px 0;
  color: #0f172a;
  font-size: 28px;
  line-height: 1;
}
.sales-stage-board {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.sales-stage-board article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 8px;
  min-height: 70px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  cursor: pointer;
}
.sales-stage-board article.active {
  border-color: #93c5fd;
  background: #eff6ff;
}
.sales-stage-board article.selected {
  border-color: #2563eb;
  background: #dbeafe;
  box-shadow: inset 0 0 0 1px #2563eb;
}
.sales-stage-board strong,
.sales-stage-board span,
.sales-stage-board em {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.sales-stage-board span,
.sales-stage-board em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}
.sales-stage-board b {
  min-width: 30px;
  align-self: start;
  justify-self: end;
  padding: 3px 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  text-align: center;
}
.sales-stage-board em {
  grid-column: 1 / -1;
}
.sales-follow-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(360px, .6fr);
  gap: 14px;
  align-items: start;
}
.sales-follow-grid .task-reminder-module,
.sales-follow-grid .follow-records {
  grid-column: 1 / -1;
}
.follow-action-panel {
  grid-column: 1 / -1;
}
.follow-action-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}
.follow-action-list article {
  display: grid;
  grid-template-columns: minmax(140px, .75fr) minmax(320px, 1.3fr) minmax(150px, .55fr) 130px 240px;
  gap: 8px;
  align-items: center;
  min-height: 66px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.follow-action-customer strong,
.follow-action-customer span,
.follow-action-content p,
.follow-action-meta span {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.follow-action-customer strong,
.follow-action-content b {
  color: var(--ink);
}
.follow-action-customer span,
.follow-action-content p,
.follow-action-meta span {
  color: var(--muted);
}
.follow-action-content {
  min-width: 0;
}
.follow-action-content p {
  margin: 4px 0 0;
}
.follow-action-content .follow-action-advice {
  color: #0f766e;
  font-size: 12px;
}
.follow-action-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.follow-action-tags {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.follow-action-buttons {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.follow-focus-panel {
  grid-column: 1 / -1;
}
.follow-customer-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}
.follow-customer-card {
  display: grid;
  grid-template-columns: minmax(280px, 1.3fr) minmax(220px, .8fr) 142px 236px;
  gap: 12px;
  align-items: center;
  min-height: 112px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.follow-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.follow-card-title strong {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 16px;
}
.follow-card-title span {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
}
.follow-card-main p {
  height: 38px;
  margin: 8px 0;
  overflow: hidden;
  color: #475569;
  line-height: 1.45;
}
.follow-card-next {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.follow-card-advice {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  margin-top: 6px;
  min-width: 0;
}
.follow-card-next span,
.follow-card-advice span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}
.follow-card-next strong,
.follow-card-advice strong {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.follow-card-advice strong {
  color: #0f766e;
  font-size: 12px;
}
.follow-card-meta {
  display: grid;
  gap: 5px;
  color: #475569;
  font-size: 13px;
}
.follow-card-meta span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.follow-card-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
.follow-card-actions {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.follow-card-actions .btn.small {
  width: 100%;
  padding: 0;
}
.sales-analysis-panel {
  overflow: auto;
}
.follow-analysis-table {
  width: 100%;
  min-width: 720px;
  table-layout: fixed;
}
.follow-analysis-table th,
.follow-analysis-table td {
  text-align: center;
}
.follow-analysis-table th:first-child,
.follow-analysis-table td:first-child {
  text-align: left;
}
.empty-follow {
  padding: 28px 14px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  color: var(--muted);
  text-align: center;
}
.stage-pipeline {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.stage-pipeline article {
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
}
.stage-pipeline article.active {
  border-color: #b9d0ff;
  background: #eef4ff;
}
.stage-pipeline strong,
.stage-pipeline span {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.stage-pipeline span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}
.follow-layout,
.follow-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.next-follow-panel,
.follow-records {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  overflow: hidden;
}
.module-label {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin: 12px 14px 0;
  padding: 0 14px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 14px;
  font-weight: 800;
}
.next-follow-panel .section-title,
.follow-records .section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.next-follow-panel h3,
.follow-records h3 {
  margin: 0;
  font-size: 16px;
}
.next-follow-panel .section-title span,
.follow-records .section-title span {
  color: var(--muted);
  font-size: 12px;
}
.task-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.task-table th:nth-child(1) { width: 17%; }
.task-table th:nth-child(2) { width: 86px; }
.task-table th:nth-child(3) { width: 17%; }
.task-table th:nth-child(4) { width: 18%; }
.task-table th:nth-child(5) { width: 110px; }
.task-table th:nth-child(6) { width: 86px; }
.task-table th:nth-child(7) { width: 92px; }
.task-table th:nth-child(8) { width: 286px; }
.task-table td {
  height: 64px;
  overflow: hidden;
  white-space: normal;
  vertical-align: middle;
}
.task-table th {
  vertical-align: middle;
}
.task-table .task-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 100%;
  gap: 6px;
  flex-wrap: nowrap;
  overflow: hidden;
}
.task-table .btn.small {
  width: 48px;
  padding: 0;
}
.task-reminder-module {
  padding: 10px 12px;
}
.reminder-module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.reminder-module-head h3 {
  margin: 3px 0 2px;
  font-size: 16px;
}
.reminder-module-head span {
  color: var(--muted);
  font-size: 13px;
}
.compact-label {
  width: max-content;
  margin-bottom: 0;
}
.reminder-module-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.task-action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}
.task-action-buttons .btn,
.task-action-buttons .btn.small {
  min-width: 92px;
  height: 36px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}
.reminder-count-pill {
  min-width: 68px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.reminder-count-pill strong {
  font-size: 20px;
  color: var(--primary);
  line-height: 1;
}
.task-reminder-module.is-expanded .reminder-builder {
  margin-top: 10px;
}
.task-reminder-module.is-collapsed .reminder-list {
  margin-top: 8px;
  padding: 10px 12px;
}
.reminder-builder.hidden {
  display: none;
}
.reminder-builder {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.field-label {
  align-self: end;
  width: max-content;
  min-width: 132px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: #eef7fb;
  color: #075569;
  font-weight: 700;
}
.reminder-builder textarea,
.reminder-builder input,
.reminder-builder select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.reminder-builder textarea {
  padding: 12px;
  resize: vertical;
}
.reminder-builder input,
.reminder-builder select {
  height: 42px;
  padding: 0 12px;
}
.reminder-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.reminder-row-four {
  grid-template-columns: 1.2fr .55fr .65fr .65fr;
}
.reminder-row-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.reminder-row label span {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}
.screenshot-drop {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px dashed #0284c7;
  border-radius: 7px;
  background: #f8fcff;
}
.screenshot-drop.dragging {
  border-color: #2563eb;
  background: #eff6ff;
}
.screenshot-drop:focus {
  border-color: #2563eb;
  outline: none;
}
.screenshot-drop input {
  padding: 8px;
}
.screenshot-drop p {
  margin: 0;
  color: var(--muted);
}
.task-attachment-drop {
  grid-column: 1 / -1;
  margin: 0;
  grid-template-columns: minmax(280px, .7fr) minmax(260px, 1fr);
  align-items: start;
}
.task-attachment-drop > strong {
  grid-column: 1 / -1;
}
.task-upload-control {
  display: grid;
  gap: 8px;
}
.task-attachment-live-preview {
  min-height: 86px;
}
.task-attachment-live-preview .muted {
  display: block;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.task-attachment-live-preview .task-preview-attachments {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
}
.task-attachment-live-preview figure {
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.task-attachment-live-preview .attachment-preview-media {
  position: relative;
  height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border-radius: 6px;
  overflow: hidden;
}
.task-attachment-live-preview img {
  width: 100%;
  height: 112px;
  object-fit: contain;
  display: block;
}
.task-attachment-live-preview figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  word-break: break-all;
}
.task-attachment-live-preview .attachment-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  word-break: break-all;
}
.attachment-remove-btn {
  flex: 0 0 auto;
  min-width: 44px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid #ffd6d2;
  border-radius: 6px;
  background: #fff6f5;
  color: var(--red);
  font-size: 12px;
}
.attachment-preview-media .attachment-remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(255, 246, 245, .96);
}
.full-width {
  width: 100%;
  justify-content: center;
}
.reminder-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 52px;
  margin-top: 2px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  gap: 8px;
}
.reminder-action-hint {
  margin-right: auto;
  color: var(--muted);
  font-size: 13px;
}
.reminder-action-buttons {
  display: flex;
  gap: 8px;
}
.reminder-list {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
}
.reminder-list article {
  display: grid;
  grid-template-columns: minmax(210px, .85fr) minmax(360px, 1.45fr) minmax(170px, .45fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.reminder-list article.is-due {
  border-color: #fecaca;
  background: #fffafa;
}
.reminder-title-block,
.reminder-content-block,
.reminder-time-block {
  min-width: 0;
}
.reminder-title-block span,
.reminder-content-block span,
.reminder-time-block span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}
.reminder-title-block strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}
.reminder-title-block small,
.reminder-content-block small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reminder-content-block p {
  margin: 0;
  color: var(--ink);
  white-space: pre-line;
  line-height: 1.45;
}
.reminder-time-block strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 14px;
}
.reminder-list article.is-due .reminder-time-block strong {
  color: #dc2626;
}
.block-line {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.follow-records article span {
  color: var(--muted);
  font-size: 12px;
}
.follow-records article {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}
.follow-records article:first-of-type {
  border-top: 0;
}
.follow-records article p {
  margin: 4px 0;
}
.follow-records {
  display: grid;
}
.follow-records article {
  min-height: 54px;
}
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, .65fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}
.settings-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
}
.settings-card .section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.settings-card h3 {
  margin: 0;
  font-size: 15px;
}
.settings-card .section-title span {
  color: var(--muted);
  font-size: 12px;
}
.settings-section-divider {
  height: 18px;
  margin: 10px 0 12px;
  border-top: 1px dashed var(--line);
}
.settings-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}
.account-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.account-list-table .account-col-name { width: 13%; }
.account-list-table .account-col-person { width: 17%; }
.account-list-table .account-col-role { width: 12%; }
.account-list-table .account-col-scope { width: 14%; }
.account-list-table .account-col-status { width: 170px; }
.account-list-table .account-col-login { width: 15%; }
.account-list-table .account-col-presence { width: 150px; }
.account-list-table .account-col-actions { width: 310px; }
.account-table th,
.account-table td {
  height: 52px;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.account-status-tags {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  overflow: visible;
  white-space: nowrap;
}
.presence-cell {
  display: grid;
  gap: 3px;
  justify-items: center;
  line-height: 1.2;
}
.presence-cell small {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.tag.muted-tag {
  background: #eef2f7;
  color: #64748b;
}
.subsection-title {
  margin: 18px 0 10px;
  font-size: 16px;
}
.legacy-template-preview {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  white-space: pre-wrap;
}
.account-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  max-width: none !important;
  overflow: visible !important;
  white-space: nowrap;
}
.account-actions .btn.small {
  flex: 0 0 58px;
  width: 58px;
  padding: 0;
}
.sales-summary article,
.task-summary article {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  background: #fff;
}
.sales-summary span,
.task-summary span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}
.sales-summary strong,
.task-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 26px;
}
.row-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.backup-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
}
.backup-panel h3 { margin: 0; font-size: 14px; }
.backup-panel .btn { justify-content: center; }
.module-backup-panel .import-card-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.backup-mode-actions .btn {
  min-width: 116px;
}
.backup-full-note {
  padding: 10px 12px;
  border: 1px dashed #b7cce8;
  border-radius: 7px;
  color: #365878;
  background: #f7fbff;
  font-size: 12px;
  line-height: 1.55;
}
.data-module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.data-module-option {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.data-module-option input { margin-top: 3px; }
.data-module-option strong {
  display: block;
  font-size: 13px;
}
.data-module-option small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.mini-list {
  display: grid;
  gap: 10px;
}
.mini-list p {
  margin: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  line-height: 1.6;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.form-grid > label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}
.form-grid > label input,
.form-grid > label select,
.form-grid > label textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}
.form-grid > label input,
.form-grid > label select {
  height: 34px;
  padding: 0 9px;
}
.form-grid > label textarea {
  min-height: 68px;
  padding: 8px 10px;
  line-height: 1.5;
  resize: vertical;
}
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.form-grid .span-4 { grid-column: 1 / -1; }
.customer-form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
}
.customer-form-grid .field {
  grid-column: span 1;
}
.customer-form-grid input,
.customer-form-grid select,
.customer-form-grid textarea {
  width: 100%;
}
.customer-invoice-card {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-column: 1 / -1;
  gap: 12px;
  margin-bottom: 8px;
  padding: 16px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: linear-gradient(135deg, #f8fbff 0%, #f1f7ff 100%);
}
.customer-invoice-card-head {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #dbeafe;
}
.customer-invoice-card-head div {
  display: grid;
  gap: 3px;
}
.customer-invoice-card-head strong {
  color: #0f2f5f;
  font-size: 15px;
}
.customer-invoice-card-head span:not(.tag) {
  color: #64748b;
  font-size: 12px;
}
.customer-invoice-card .field.wide {
  grid-column: span 2;
}
.customer-invoice-card .invoice-company-field {
  grid-column: 1 / 3;
}
.customer-invoice-card .invoice-address-field {
  grid-column: 3 / 5;
}
.customer-invoice-card .invoice-tax-field {
  grid-column: 1 / 3;
}
.customer-invoice-card .invoice-bank-field {
  grid-column: 3 / 4;
}
.customer-invoice-card .invoice-account-field {
  grid-column: 4 / 5;
}
.customer-invoice-card + .field.full {
  margin-top: 4px;
}
.lead-entry-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 4px;
}
.lead-entry-switch .btn { min-width: 112px; }
.lead-new-entry-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-column: 1 / -1;
  gap: 12px;
}
.lead-existing-customer-field small {
  display: block;
  margin-top: 6px;
}
.lead-new-entry-fields[hidden],
.lead-existing-customer-field[hidden],
[data-action="save-customer"][hidden] {
  display: none !important;
}
.customer-intro-field textarea {
  min-height: 120px;
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
}
.task-form-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: start;
}
.task-form-grid .field input,
.task-form-grid .field select {
  width: 100%;
  height: 34px;
}
.task-form-grid .field textarea {
  width: 100%;
  min-height: 128px;
  padding: 10px 12px;
  line-height: 1.55;
}
.task-form-grid .field.wide {
  grid-column: span 2;
}
.task-form-grid .field.full {
  grid-column: 1 / -1;
}
.task-next-plan-field textarea {
  min-height: 104px;
}
.task-follow-content-field textarea,
.task-next-plan-field textarea {
  resize: vertical;
}
.field { display: grid; gap: 6px; min-width: 0; }
.field label { color: #334155; font-size: 12px; font-weight: 700; }
.field.wide { grid-column: span 2; }
.field.full { grid-column: 1 / -1; }
.product-form-grid {
  align-items: start;
}
.product-form-grid .field {
  align-content: start;
}
.product-form-grid .product-photo-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(420px, 2fr);
  align-items: start;
  gap: 12px;
}
.product-form-grid .product-image-field {
  grid-template-rows: auto auto auto auto;
}
.product-form-grid .product-image-field input[type="file"] {
  height: 34px;
}
.product-form-grid .bank-image-preview {
  width: 100%;
  min-height: 104px;
  margin-top: 4px;
}
.product-form-grid .bank-image-preview img {
  width: 84px;
  height: 84px;
}
.product-form-section {
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}
.product-form-section strong {
  color: var(--ink);
  font-size: 14px;
}
.product-form-section span {
  color: var(--muted);
  font-size: 12px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; }
.toolbar-right { flex-wrap: wrap; justify-content: flex-end; }
.filter-bar {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) repeat(4, minmax(118px, 140px)) 74px;
  gap: 8px;
  margin-bottom: 10px;
}
.filter-bar select {
  height: 38px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 9px;
}
.customer-filter-bar {
  grid-template-columns: repeat(3, minmax(150px, 1fr)) repeat(4, minmax(105px, .68fr)) 74px;
  align-items: center;
}
.customer-filter-bar input,
.customer-filter-bar select,
.customer-filter-bar .btn {
  width: 100%;
}
.quote-filter-bar {
  grid-template-columns: minmax(260px, 1.2fr) repeat(2, minmax(150px, .8fr)) minmax(200px, 1fr) minmax(120px, .7fr) 74px;
}
.quote-list-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.dialog.quote-list-dialog {
  width: min(1540px, calc(100vw - 32px));
  max-height: 94vh;
}
.quote-batch-list-table th,
.quote-batch-list-table td {
  padding: 10px 8px;
  vertical-align: middle;
  overflow-wrap: anywhere;
}
.quote-batch-list-table th:nth-child(1) { width: 14%; }
.quote-batch-list-table th:nth-child(2) { width: 7%; }
.quote-batch-list-table th:nth-child(3) { width: 9%; }
.quote-batch-list-table th:nth-child(4) { width: 7%; }
.quote-batch-list-table th:nth-child(5) { width: 6%; }
.quote-batch-list-table th:nth-child(6) { width: 13%; }
.quote-batch-list-table th:nth-child(7) { width: 8%; }
.quote-batch-list-table th:nth-child(8) { width: 13%; }
.quote-batch-list-table th:nth-child(9) { width: 9%; }
.quote-batch-list-table th:nth-child(10) { width: 14%; }
.quote-batch-list-table td.action-cell {
  display: table-cell;
  white-space: nowrap;
}
.quote-batch-list-table td.action-cell .btn {
  padding-left: 7px;
  padding-right: 7px;
}
.quote-list-table .quote-product-photo {
  width: 76px;
  padding-left: 8px;
  padding-right: 8px;
  text-align: center;
}
.dialog.quote-editor-dialog {
  width: min(1880px, calc(100vw - 32px));
  max-height: 94vh;
}
.quote-editor-body {
  padding: 14px;
}
.quote-header-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}
.quote-products-wrap {
  overflow-x: hidden;
}
.quote-products {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.quote-products th:nth-child(1) { width: 4%; }
.quote-products th:nth-child(2) { width: 10%; }
.quote-products th:nth-child(3) { width: 10%; }
.quote-products th:nth-child(4) { width: 15%; }
.quote-products th:nth-child(5) { width: 10%; }
.quote-products th:nth-child(6) { width: 5%; }
.quote-products th:nth-child(7) { width: 5%; }
.quote-products th:nth-child(8) { width: 8%; }
.quote-products th:nth-child(9) { width: 10%; }
.quote-products th:nth-child(10) { width: 12%; }
.quote-products th:nth-child(11) { width: 11%; }
.quote-products th,
.quote-products td {
  padding-left: 6px;
  padding-right: 6px;
}
.quote-products .cell-input {
  min-width: 0;
}
.quote-products td {
  vertical-align: middle;
}
.quote-products tr.is-dragging {
  opacity: .45;
}
.quote-products tr.is-drag-over-before > td {
  border-top: 3px solid var(--primary);
}
.quote-products tr.is-drag-over-after > td {
  border-bottom: 3px solid var(--primary);
}
.quote-final-row {
  margin-top: 12px;
}
.wide-search {
  width: 100%;
}
.packing-filter-row {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(170px, 240px) minmax(170px, 240px) 66px;
  gap: 8px;
  align-items: end;
  margin-bottom: 8px;
}
.pi-management-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.customer-sales-analysis {
  display: grid;
  gap: 12px;
}
.customer-sales-controls {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(140px, 1fr) minmax(250px, 1.6fr) minmax(160px, 1fr) minmax(160px, 1fr) 88px;
  gap: 8px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.customer-sales-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.customer-sales-field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.customer-sales-field select,
.customer-sales-field input {
  width: 100%;
  height: 36px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}
.customer-sales-period-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}
.customer-sales-period-buttons .btn,
.customer-sales-query {
  height: 36px;
  padding: 0 10px;
  white-space: nowrap;
}
.customer-sales-range-note {
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--blue-soft);
  color: var(--muted);
  font-size: 12px;
}
.customer-sales-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.customer-sales-metric {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.customer-sales-metric span {
  color: var(--muted);
  font-size: 13px;
}
.customer-sales-metric strong {
  color: var(--ink);
  font-size: 24px;
}
.customer-sales-metric small {
  color: var(--muted);
  font-size: 12px;
}
.customer-sales-metric .up,
.customer-sales-change.up {
  color: #047857;
}
.customer-sales-metric .down,
.customer-sales-change.down,
.customer-sales-change.not-purchased {
  color: var(--danger);
}
.customer-sales-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr);
  gap: 12px;
  align-items: stretch;
}
.customer-sales-trend-panel,
.customer-sales-attention,
.customer-sales-orders,
.customer-sales-products {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.customer-sales-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.customer-sales-section-head h3,
.customer-sales-attention h3 {
  margin: 0;
  font-size: 16px;
}
.customer-sales-section-head > span {
  color: var(--muted);
  font-size: 12px;
}
.customer-sales-legend {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}
.customer-sales-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.customer-sales-legend i {
  display: inline-block;
  width: 18px;
  height: 3px;
  border-radius: 2px;
}
.customer-sales-legend i.current {
  background: var(--blue);
}
.customer-sales-legend i.previous {
  background: #94a3b8;
}
.customer-sales-trend-note {
  margin: -2px 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.customer-sales-chart {
  display: block;
  width: 100%;
  height: auto;
  min-height: 220px;
}
.customer-sales-grid-line {
  stroke: var(--line);
  stroke-width: 1;
}
.customer-sales-axis-label {
  fill: var(--muted);
  font-size: 11px;
}
.customer-sales-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.customer-sales-line.current {
  stroke: var(--blue);
  stroke-width: 3;
}
.customer-sales-line.previous {
  stroke: #94a3b8;
  stroke-width: 2;
  stroke-dasharray: 7 5;
}
.customer-sales-point {
  fill: #fff;
  stroke: var(--blue);
  stroke-width: 2;
}
.customer-sales-attention {
  display: grid;
  align-content: start;
  gap: 10px;
}
.customer-sales-reminder-list {
  display: grid;
  gap: 8px;
}
.customer-sales-reminder-list article {
  display: grid;
  gap: 4px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
}
.customer-sales-reminder-list article.attention,
.customer-sales-reminder-list article.important {
  border-color: #fbbf24;
  background: #fffbeb;
}
.customer-sales-reminder-list article.risk {
  border-color: #fca5a5;
  background: #fff1f2;
}
.customer-sales-reminder-list article.action {
  border-color: #bfdbfe;
  background: #eff6ff;
}
.customer-sales-reminder-list article span {
  color: var(--muted);
  font-size: 12px;
}
.customer-sales-reminder-list article strong {
  font-size: 13px;
  line-height: 1.5;
}
.customer-sales-reminder-list article small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}
.customer-sales-orders {
  display: grid;
  gap: 4px;
}
.customer-sales-orders table {
  min-width: 720px;
}
.customer-sales-products {
  display: grid;
  gap: 4px;
}
.customer-sales-products table {
  min-width: 1080px;
}
.customer-sales-change {
  display: inline-block;
  min-width: 88px;
  font-weight: 700;
}
.customer-sales-product-fact {
  min-width: 260px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.customer-sales-empty {
  padding: 36px 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}
@media (max-width: 1500px) {
  .customer-sales-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 1000px) {
  .customer-sales-metrics,
  .customer-sales-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .customer-sales-trend-panel,
  .customer-sales-orders,
  .customer-sales-products {
    grid-column: 1 / -1;
  }
}
@media (max-width: 700px) {
  .pi-management-tabs,
  .customer-sales-controls,
  .customer-sales-metrics,
  .customer-sales-layout {
    grid-template-columns: 1fr;
  }
  .pi-management-tabs {
    display: grid;
  }
  .customer-sales-trend-panel,
  .customer-sales-orders,
  .customer-sales-products {
    grid-column: auto;
  }
}
.pi-filter-row {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.pi-filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}
.packing-filter-row .filter-field {
  display: grid;
  gap: 4px;
}
.pi-filter-row .filter-field {
  display: grid;
  gap: 4px;
}
.packing-filter-row .filter-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.pi-filter-row .filter-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.packing-filter-row .search {
  width: 100%;
  height: 36px;
  padding: 0 10px;
}
.packing-filter-row .btn {
  height: 36px;
  padding: 0 10px;
}
.pi-filter-row .search,
.pi-filter-row select {
  width: 100%;
  height: 36px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}
.pi-filter-row .btn {
  width: 100%;
  height: 36px;
}
.pi-filter-clear {
  align-self: end;
}
@media (max-width: 1500px) {
  .pi-filter-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 900px) {
  .packing-filter-row {
    grid-template-columns: 1fr;
  }
  .pi-filter-grid {
    grid-template-columns: 1fr;
  }
}
.result-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.app table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
}
.customer-table { min-width: 1080px; }
.customer-table .col-code { width: 120px; }
.customer-table .col-company { width: 170px; }
.customer-table .col-country { width: 110px; }
.customer-table .col-contact { width: 150px; }
.customer-table .col-source { width: 105px; }
.customer-table .col-level { width: 70px; }
.customer-table .col-status { width: 105px; }
.customer-table .col-owner { width: 90px; }
.customer-table .col-next { width: 95px; }
.customer-table .col-actions { width: 165px; }
.customer-table th:nth-child(6),
.customer-table td:nth-child(6),
.customer-table th:nth-child(7),
.customer-table td:nth-child(7),
.customer-table th:nth-child(8),
.customer-table td:nth-child(8),
.customer-table th:nth-child(9),
.customer-table td:nth-child(9),
.customer-table th:nth-child(10),
.customer-table td:nth-child(10) {
  text-align: center;
}
.customer-table .customer-actions {
  justify-content: center;
  min-width: 0;
}
.customer-table .btn.small {
  padding: 0 7px;
}
.customer-table .col-actions { width: 215px; }
.task-edit-dialog,
.task-history-dialog {
  width: min(1320px, calc(100vw - 48px));
  max-width: min(1320px, calc(100vw - 48px));
}
#leadTaskHistory {
  width: 100%;
  overflow-x: auto;
}
.task-history-scroll {
  width: 100%;
  overflow-x: auto;
}
.task-history-table {
  width: min(100%, 1180px);
  min-width: 1180px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.task-history-table col.task-history-date { width: 110px; }
.task-history-table col.task-history-content { width: 250px; }
.task-history-table col.task-history-next { width: 250px; }
.task-history-table col.task-history-due { width: 110px; }
.task-history-table col.task-history-status { width: 90px; }
.task-history-table col.task-history-count { width: 80px; }
.task-history-table col.task-history-actions-col { width: 220px; }
.lead-history-table {
  min-width: 1180px;
  margin: 0;
}
.task-history-table th,
.task-history-table td {
  padding: 11px 8px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  line-height: 1.45;
  vertical-align: middle;
  white-space: normal;
  word-break: break-word;
  text-align: center;
}
.task-history-table th {
  background: var(--soft);
  font-weight: 700;
}
.task-history-table th:last-child,
.task-history-table td:last-child {
  border-right: 0;
  text-align: left;
  padding-left: 14px;
}
.task-history-table tbody tr:last-child td {
  border-bottom: 0;
}
.history-action-cell {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: nowrap;
  width: 100%;
  min-width: 0;
  white-space: nowrap;
}
.lead-history-table .history-action-cell {
  gap: 6px;
}
.lead-history-table .history-action-cell .btn.small {
  flex: 0 0 auto;
  min-width: 46px;
  padding: 0 6px;
}
.lead-history-table .history-action-cell .btn.danger {
  min-width: 72px;
}
.customer-task-history-wrap {
  width: 100%;
  overflow-x: auto;
}
.customer-task-history-table {
  width: min(100%, 1180px);
  min-width: 1180px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.customer-task-history-table col.customer-history-date { width: 110px; }
.customer-task-history-table col.customer-history-content { width: 250px; }
.customer-task-history-table col.customer-history-next { width: 250px; }
.customer-task-history-table col.customer-history-due { width: 110px; }
.customer-task-history-table col.customer-history-status { width: 90px; }
.customer-task-history-table col.customer-history-count { width: 80px; }
.customer-task-history-table col.customer-history-actions { width: 220px; }
.customer-task-history-table th,
.customer-task-history-table td {
  padding: 11px 8px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  line-height: 1.45;
  text-align: center;
  vertical-align: middle;
  white-space: normal;
  word-break: break-word;
}
.customer-task-history-table th {
  background: var(--soft);
  font-weight: 700;
}
.customer-task-history-table th:last-child,
.customer-task-history-table td:last-child {
  border-right: 0;
  text-align: left;
  padding-left: 14px;
}
.customer-task-history-table tbody tr:last-child td {
  border-bottom: 0;
}
.customer-task-history-table .history-action-cell {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: nowrap;
  width: 100%;
  min-width: 0;
  white-space: nowrap;
}
.customer-task-history-table .history-action-cell .btn.small {
  flex: 0 0 auto;
  min-width: 46px;
  padding: 0 6px;
}
.customer-task-history-table .history-action-cell .btn.danger {
  min-width: 72px;
}
.sales-table {
  min-width: 1180px;
  table-layout: fixed;
}
.sales-table .sales-col-name { width: 150px; }
.sales-table .sales-col-contact { width: 260px; }
.sales-table .sales-col-role { width: 160px; }
.sales-table .sales-col-count { width: 90px; }
.sales-table .sales-col-amount { width: 130px; }
.sales-table .sales-col-remark { width: 240px; }
.sales-table .sales-col-actions { width: 150px; }
.sales-table td {
  height: 56px;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.sales-table .sales-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow: visible;
}
.pi-list-table {
  width: 100%;
  min-width: 1160px;
  table-layout: fixed;
}
.pi-list-table .pi-col-no { width: 8.5%; }
.pi-list-table .pi-col-customer { width: 6%; }
.pi-list-table .pi-col-date { width: 5.5%; }
.pi-list-table .pi-col-owner { width: 5%; }
.pi-list-table .pi-col-status { width: 5%; }
.pi-list-table .pi-col-amount { width: 7%; }
.pi-list-table .pi-col-payment { width: 7%; }
.pi-list-table .pi-col-ship-qty { width: 4.5%; }
.pi-list-table .pi-col-ship-status { width: 6%; }
.pi-list-table .pi-col-latest-shipment { width: 8.5%; }
.pi-list-table .pi-col-remark { width: 6%; }
.pi-list-table .pi-col-actions { width: 21%; }
.pi-list-table th:last-child {
  background: var(--panel-2);
}
.pi-list-table .pi-actions {
  justify-content: center;
  flex-wrap: nowrap;
  overflow: visible;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  gap: 5px;
}
.pi-list-table .btn.small {
  flex: 0 0 auto;
  padding: 0 6px;
  height: 26px;
  font-size: 12px;
  border-radius: 5px;
}
.pi-list-table td {
  height: 44px;
  vertical-align: middle;
  padding: 6px 3px;
  text-align: center;
}
.pi-list-table th {
  text-align: center;
  padding: 8px 3px;
}
.pi-amount-cell {
  font-weight: 700;
  letter-spacing: 0;
  text-align: center;
}
.pi-payment-cell {
  line-height: 1.25;
  text-align: center;
}
.pi-payment-cell b {
  display: inline-block;
  margin-bottom: 1px;
}
.pi-payment-cell span {
  line-height: 1.15;
}
.pi-remark-cell {
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.readonly-cell {
  height: 34px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--ink);
}
.payment-record-table {
  min-width: 0;
  table-layout: fixed;
}
.payment-record-table th:nth-child(1) { width: 6%; }
.payment-record-table th:nth-child(2) { width: 12%; }
.payment-record-table th:nth-child(3),
.payment-record-table th:nth-child(4),
.payment-record-table th:nth-child(5) { width: 13%; }
.payment-record-table th:nth-child(6) { width: 12%; }
.payment-record-table th:nth-child(7) { width: 17%; }
.payment-record-table th:nth-child(8) { width: 14%; }
.payment-record-table td,
.payment-record-table th {
  padding: 7px 8px;
}
.payment-record-actions {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.payment-live-summary {
  gap: 18px;
  flex-wrap: wrap;
  height: auto;
  min-height: 36px;
  line-height: 1.5;
}
.payment-overpaid {
  color: #b45309;
  font-weight: 700;
}
.payment-proof-drop {
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
}
.payment-proof-drop.dragging {
  border-color: #2563eb;
  background: #eff6ff;
}
.payment-proof-drop p {
  margin: 0;
  color: var(--muted);
}
.payment-proof-preview {
  grid-column: 1 / -1;
}
.payment-proof-preview .task-preview-attachments {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 160px));
  justify-content: flex-start;
  gap: 10px;
}
.payment-proof-preview figure {
  max-width: none;
}
.payment-proof-preview img {
  width: 100%;
  height: 112px;
  object-fit: contain;
}
.payment-proof-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.payment-proof-meta span {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  padding: 10px;
}
.payment-proof-a4-page {
  box-sizing: border-box;
  width: 210mm;
  min-width: 210mm;
  max-width: 210mm;
  min-height: 297mm;
  padding: 14mm;
  background: #fff;
  border: 1px solid #d7dee8;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
  color: #111827;
  flex: 0 0 auto;
}
.payment-proof-a4-page h1 {
  margin: 0 0 18px;
  text-align: center;
  font-size: 24px;
  letter-spacing: 0;
}
.payment-proof-a4-info {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
  margin-bottom: 16px;
}
.payment-proof-a4-info col.payment-proof-label-col {
  width: 18%;
}
.payment-proof-a4-info col.payment-proof-value-col {
  width: 32%;
}
.payment-proof-a4-section {
  margin-top: 16px;
}
.payment-proof-a4-section h3 {
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #cbd5e1;
  font-size: 15px;
}
.payment-proof-a4-info th,
.payment-proof-a4-info td {
  position: static;
  height: auto;
  min-width: 0;
  white-space: normal;
  overflow: hidden;
  text-overflow: clip;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.payment-proof-a4-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9mm;
  align-items: start;
}
.payment-proof-a4-grid figure {
  box-sizing: border-box;
  margin: 0;
  padding: 3mm;
  border: 1px solid #cbd5e1;
  background: #fff;
  page-break-inside: avoid;
}
.payment-proof-a4-grid img {
  display: block;
  width: 100%;
  height: 82mm;
  object-fit: contain;
  background: #f8fafc;
}
.payment-proof-a4-grid figcaption {
  margin-top: 2.5mm;
  color: #64748b;
  font-size: 9pt;
  line-height: 1.35;
  word-break: break-word;
}
.payment-proof-file-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.8;
}
.packing-list-wrap {
  overflow-x: auto;
}
.packing-list-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.packing-list-table .packing-col-no { width: 170px; }
.packing-list-table .packing-col-pi { width: 170px; }
.packing-list-table .packing-col-customer { width: 150px; }
.packing-list-table .packing-col-date { width: 115px; }
.packing-list-table .packing-col-lines { width: 64px; }
.packing-list-table .packing-col-shipments { width: 78px; }
.packing-list-table .packing-col-progress { width: 88px; }
.packing-list-table .packing-col-actions { width: 330px; }
.packing-list-table th,
.packing-list-table td {
  height: 46px;
  padding: 7px 8px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.packing-list-table .packing-actions {
  min-width: 0;
  justify-content: flex-start;
  gap: 5px;
  overflow: visible;
}
.packing-list-table .btn.small {
  flex: 0 0 auto;
  height: 28px;
  padding: 0 7px;
}
.shipping-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.shipping-tab.active {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}
.shipping-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.shipping-flow div {
  display: grid;
  gap: 4px;
  min-height: 66px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.shipping-flow strong {
  color: var(--ink);
  font-size: 15px;
}
.shipping-flow span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.shipping-rule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.shipping-rule-grid div {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.shipping-rule-grid strong {
  color: var(--ink);
}
.shipping-rule-grid span {
  color: var(--muted);
  line-height: 1.35;
  font-size: 12px;
}
.merged-shipment-filter {
  margin: 12px 0;
}
.merged-pi-picker {
  display: grid;
  gap: 8px;
}
.merged-pi-picker-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 12px;
}
.merged-pi-picker-head span {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.merged-pi-options {
  min-height: 36px;
  max-height: 150px;
  overflow-y: auto;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.merged-pi-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 5px 7px;
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.merged-pi-options label:hover {
  background: #f8fafc;
}
.merged-pi-options input {
  flex: 0 0 auto;
}
.merged-shipment-hint {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px dashed #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e40af;
  font-weight: 700;
}
.merged-shipment-table tbody tr.merged-pi-group-start:not(:first-child) td {
  border-top: 12px solid #f1f5f9;
}
.merged-shipment-table tbody tr.merged-pi-group-start td {
  background: #f8fbff;
}
.merged-shipment-table tbody tr.merged-pi-group-start td:first-child {
  border-left: 4px solid var(--primary);
  font-weight: 800;
}
.shipping-section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin: 4px 0 12px;
}
.shipping-section-head h3 {
  margin: 0;
  font-size: 18px;
}
.shipping-section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.shipping-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.shipping-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 8px;
  align-items: end;
  margin-bottom: 12px;
}
.shipment-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 8px;
  align-items: end;
  margin-bottom: 12px;
}
.shipping-filter-grid .filter-field,
.shipment-filter-grid .filter-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.shipping-filter-grid .filter-field span,
.shipment-filter-grid .filter-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.shipping-filter-grid input,
.shipping-filter-grid select,
.shipment-filter-grid input,
.shipment-filter-grid select {
  width: 100%;
  min-width: 0;
  height: 40px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 40px;
  padding: 0 10px;
}
.shipping-filter-grid .btn,
.shipment-filter-grid .btn {
  width: 100%;
  height: 40px;
}
.shipping-status-table,
.shipment-record-table {
  width: 100%;
  min-width: 1360px;
  table-layout: fixed;
}
.shipping-status-table th,
.shipping-status-table td,
.shipment-record-table th,
.shipment-record-table td {
  height: 48px;
  padding: 7px 8px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.shipment-record-table td {
  height: 52px;
  min-height: 52px;
  vertical-align: middle;
}
.shipping-status-table .ship-status-pi { width: 155px; }
.shipping-status-table .ship-status-customer { width: 150px; }
.shipping-status-table .ship-status-owner { width: 110px; }
.shipping-status-table .ship-status-latest { width: 170px; }
.shipping-status-table .ship-status-total,
.shipping-status-table .ship-status-shipped,
.shipping-status-table .ship-status-remaining { width: 78px; }
.shipping-status-table .ship-status-state { width: 96px; }
.shipping-status-table .ship-status-actions { width: 330px; }
.shipping-status-table td.action-cell {
  display: table-cell;
  min-width: 0;
  vertical-align: middle;
}
.shipment-record-table .shipment-col-no { width: 150px; }
.shipment-record-table .shipment-col-date { width: 110px; }
.shipment-record-table .shipment-col-customer { width: 130px; }
.shipment-record-table .shipment-col-docs { width: 165px; }
.shipment-record-table .shipment-col-owner { width: 105px; }
.shipment-record-table .shipment-col-qty { width: 80px; }
.shipment-record-table .shipment-col-items { width: 300px; }
.shipment-record-table .shipment-col-packing { width: 120px; }
.shipment-record-table .shipment-col-logistics { width: 135px; }
.shipment-record-table .shipment-col-actions { width: 430px; }
.shipping-actions {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-wrap: nowrap;
  min-width: 0;
}
.shipping-actions .btn.small {
  flex: 0 0 auto;
  min-width: auto;
  height: 30px;
  padding: 0 7px;
}
.shipment-doc-links {
  font-weight: 700;
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shipment-items-cell {
  white-space: nowrap !important;
  line-height: 1.3;
  vertical-align: middle !important;
}
.shipment-item-summary,
.shipment-logistics-cell {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shipment-item-summary {
  font-weight: 600;
}
.shipment-item-summary-more {
  color: var(--muted);
  font-size: 12px;
}
.packing-status-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.packing-status-inline .one-line {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.shipment-actions-cell {
  vertical-align: middle !important;
}
.shipping-actions-row {
  justify-content: center;
}
.shipment-item-line {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 86px minmax(72px, .6fr);
  gap: 8px;
  align-items: center;
  padding: 3px 0;
}
.shipment-item-line + .shipment-item-line {
  border-top: 1px solid var(--line);
}
.shipment-item-line strong,
.shipment-item-line small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shipment-item-line span {
  min-width: 0;
  overflow: visible;
  white-space: nowrap;
}
.shipment-item-line small {
  color: var(--muted);
  font-size: 12px;
}
.shipment-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.shipment-detail-grid div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.shipment-detail-grid span {
  color: var(--muted);
  font-size: 12px;
}
.shipment-detail-grid strong {
  color: var(--ink);
  font-size: 14px;
}
@media (max-width: 1500px) {
  .shipping-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .shipping-flow { grid-template-columns: 1fr; }
  .shipping-rule-grid { grid-template-columns: 1fr; }
  .shipment-filter-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
th, td {
  height: 48px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  text-align: left;
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #425466;
  background: var(--panel-2);
  font-size: 12px;
}
td { background: #fff; }
tr:last-child td { border-bottom: 0; }
.center { text-align: center; }
.right { text-align: right; }
.clip {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.35;
}
.clip.one-line {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.box-spec-table {
  width: 100%;
  min-width: 1260px;
  table-layout: fixed;
}
.box-spec-table .box-col-name { width: 170px; }
.box-spec-table .box-col-color { width: 150px; }
.box-spec-table .box-col-qty { width: 100px; }
.box-spec-table .box-col-size { width: 155px; }
.box-spec-table .box-col-weight { width: 80px; }
.box-spec-table .box-col-keywords { width: 175px; }
.box-spec-table .box-col-remark { width: auto; }
.box-spec-table .box-col-actions { width: 220px; }
.box-spec-table td {
  height: 58px;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.box-spec-table .inline-cell {
  width: 100%;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  padding: 0 8px;
  outline: none;
}
.box-spec-table .inline-cell:hover,
.box-spec-table .inline-cell:focus {
  border-color: var(--line);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.08);
}
.box-spec-table .inline-cell.center {
  text-align: center;
}
.box-spec-table .readonly-cell {
  display: block;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.box-spec-table .readonly-cell.center {
  text-align: center;
}
.box-spec-table .box-action-cell {
  padding-left: 10px;
  padding-right: 10px;
  overflow: hidden;
  text-align: center;
}
.box-spec-table .box-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}
.box-spec-table td:nth-child(6) {
  max-width: 0;
  overflow: hidden;
}
.box-spec-table td:nth-child(7) {
  max-width: none;
  overflow: hidden;
}
.box-spec-table .btn.small {
  flex: 0 0 52px;
  width: 52px;
  padding: 0;
}
.box-spec-table th:last-child,
.box-spec-table td:last-child {
  text-align: center;
}
.template-table {
  width: 100%;
  min-width: 1120px;
  table-layout: fixed;
}
.template-table .tpl-col-name { width: 170px; }
.template-table .tpl-col-title { width: 210px; }
.template-table .tpl-col-company { width: 250px; }
.template-table .tpl-col-to { width: 90px; }
.template-table .tpl-col-bank { width: auto; }
.template-table .tpl-col-actions { width: 230px; }
.template-table td {
  height: 58px;
  max-width: 0;
  overflow: hidden;
  vertical-align: middle;
}
.template-table th:last-child,
.template-table td:last-child {
  max-width: none;
  overflow: visible;
  text-align: center;
}
.template-table .template-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  overflow: visible;
}
.template-table .btn.small {
  flex: 0 0 58px;
  width: 58px;
  padding: 0;
}
.group-manage-table {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
}
.product-group-add {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 10px;
  margin-bottom: 12px;
}
.group-manage-table .group-col-order { width: 72px; }
.group-manage-table .group-col-name { width: auto; }
.group-manage-table .group-col-status { width: 112px; }
.group-manage-table .group-col-count { width: 110px; }
.group-manage-table .group-col-action { width: 92px; }
.group-manage-table td {
  height: 52px;
}
.group-manage-table td,
.group-manage-table th {
  vertical-align: middle;
}
.group-manage-table .cell-input {
  display: block;
}
.product-group-drag-hint {
  margin: -4px 0 10px;
}
.draggable-group-row {
  cursor: grab;
  transition: background .12s ease, opacity .12s ease;
}
.draggable-group-row.is-disabled {
  background: #fff7f7;
}
.draggable-group-row:active {
  cursor: grabbing;
}
.draggable-group-row.dragging {
  opacity: .55;
  background: #eef5ff;
}
.draggable-group-row.drag-over-top {
  box-shadow: inset 0 3px 0 var(--blue);
}
.draggable-group-row.drag-over-bottom {
  box-shadow: inset 0 -3px 0 var(--blue);
}
.muted { color: var(--muted); }
.tag {
  display: inline-flex;
  justify-content: center;
  min-width: 52px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eaf7f1;
  color: var(--green);
  font-size: 12px;
}
.tag.warn { background: #fff5e8; color: var(--amber) !important; }
.tag.bad { background: #fff0ee; color: var(--red) !important; }

.pi-form {
  display: grid;
  gap: 14px;
}
.pi-step {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.pi-step-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.pi-step-head strong { font-size: 16px; }
.pi-step-head span { color: var(--muted); font-size: 12px; }
.pi-customer-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.pi-customer-grid .field.wide {
  grid-column: auto;
}
.history-import-bar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
}
.history-import-bar .field {
  width: min(420px, 100%);
}
.sub-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
}
.sub-panel strong,
.sub-panel span {
  display: block;
}
.sub-panel span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.pi-form .table-wrap {
  overflow-x: auto;
}
.pi-products {
  min-width: 1420px;
  table-layout: fixed;
}
.pi-products th:nth-child(1) { width: 72px; }
.pi-products th:nth-child(2) { width: 150px; }
.pi-products th:nth-child(3) { width: 180px; }
.pi-products th:nth-child(4) { width: 205px; }
.pi-products th:nth-child(5) { width: 150px; }
.pi-products th:nth-child(6) { width: 96px; }
.pi-products th:nth-child(7) { width: 78px; }
.pi-products th:nth-child(8) { width: 82px; }
.pi-products th:nth-child(9) { width: 138px; }
.pi-products th:nth-child(10) { width: 160px; }
.pi-products th:nth-child(11) { width: 112px; }
.pi-row-select-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.pi-row-drag-handle {
  display: inline-grid;
  width: 22px;
  height: 30px;
  place-items: center;
  color: #64748b;
  font-size: 17px;
  line-height: 1;
  cursor: grab;
  user-select: none;
  border-radius: 4px;
}
.pi-row-drag-handle:hover,
.pi-row-drag-handle:focus-visible {
  color: var(--primary);
  background: #eaf2ff;
  outline: none;
}
.pi-row-drag-handle:active {
  cursor: grabbing;
}
.pi-products tr.is-dragging {
  opacity: 0.45;
}
.pi-products tr.is-drag-over-before > td {
  border-top: 3px solid var(--primary);
}
.pi-products tr.is-drag-over-after > td {
  border-bottom: 3px solid var(--primary);
}
.cell-input {
  width: 100%;
  padding: 0 8px;
}
.product-group-input {
  text-overflow: ellipsis;
}
.pi-color-input {
  min-width: 92px;
}
.pi-row-actions {
  display: grid;
  grid-template-columns: repeat(2, 46px);
  justify-content: center;
  gap: 6px;
}
.pi-row-actions .btn.small {
  width: 46px;
  min-width: 46px;
  padding: 0;
}
.price-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  gap: 6px;
}
.price-group span {
  display: grid;
  place-items: center;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--panel-2);
  font-size: 12px;
}
.product-add-band {
  width: 100%;
  height: 52px;
  margin-bottom: 12px;
  border: 0;
  border-radius: 7px 7px 0 0;
  color: #fff;
  background: #147f91;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}
.product-select-strip {
  display: grid;
  grid-template-columns: 150px minmax(260px, 1fr) minmax(280px, 1.25fr) minmax(260px, 1fr);
  align-items: stretch;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
  width: 100%;
}
.product-select-label {
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: #0b6070;
  background: #edf6fa;
  font-weight: 700;
}
.product-select-strip input,
.product-select-strip select {
  height: 54px;
  min-width: 0;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  padding: 0 16px;
  font-size: 15px;
  background: #fff;
}
.product-catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.product-catalog-card {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 14px;
  position: relative;
  min-height: 160px;
  padding: 16px 92px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.product-catalog-card.is-disabled {
  background: #f7f8fa;
  border-color: #cbd3dc;
  opacity: .82;
}
.product-status-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
  vertical-align: 2px;
}
.product-status-badge.enabled {
  color: #137a50;
  background: #e7f7ef;
}
.product-status-badge.disabled {
  color: #9b2c2c;
  background: #fdeaea;
}
.product-catalog-photo .photo-box {
  width: 74px;
  height: 74px;
}
.product-catalog-photo .photo-box img {
  max-width: 68px;
  max-height: 68px;
}
.product-catalog-info {
  min-width: 0;
}
.product-catalog-info h3 {
  margin: 0 0 6px;
  color: #0b1f3a;
  font-size: 18px;
  line-height: 1.25;
}
.product-catalog-info h3 span {
  color: #d84f33;
  white-space: nowrap;
}
.product-catalog-info p {
  margin: 2px 0;
  color: var(--muted);
  line-height: 1.35;
}
.product-catalog-info .product-spec {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.product-catalog-actions {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 8px;
}
.empty {
  padding: 32px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: #fff;
}
.photo-box {
  display: grid;
  place-items: center;
  width: 58px;
  height: 42px;
  margin: 0 auto;
  border: 1px dashed #c8d2de;
  border-radius: 6px;
  color: var(--muted);
  background: #fbfcfd;
  font-size: 12px;
}
.photo-box img {
  max-width: 54px;
  max-height: 38px;
  object-fit: contain;
}
.summary-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 18px;
  padding: 12px 0 0;
  font-weight: 700;
}
.pi-final-row {
  padding-top: 14px;
}
.order-freight-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 4px 0;
}
.order-freight-check,
.order-freight-amount {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.order-freight-check input {
  width: 16px;
  height: 16px;
}
.order-freight-amount input {
  width: 150px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: right;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(15, 23, 42, .45);
}
.modal.hidden { display: none; }
.dialog {
  width: min(1180px, 96vw);
  max-height: 92vh;
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(0,0,0,.28);
}
.dialog.wide-dialog {
  width: min(2400px, calc(100vw - 12px));
}
.dialog.packing-editor-dialog {
  width: min(1680px, calc(100vw - 56px));
}
.dialog.shipment-dialog {
  width: min(1420px, calc(100vw - 96px));
}
#shipmentForm #shipmentForwarderAddress {
  min-height: 96px;
}
#shipmentForm #shipmentPackingRequirement {
  min-height: 86px;
}
.dialog-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.dialog-head h2 { margin: 0; font-size: 18px; }
.dialog-body { padding: 18px; }
.shipment-mode-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 0 14px;
}
.shipment-mode-row.hidden { display: none; }
.shipment-mode-row span:first-child {
  font-weight: 700;
  color: var(--text);
}
.shipment-edit-wrap {
  margin-top: 12px;
  border-radius: 9px;
  background: #fff;
  overflow-x: hidden;
}
.shipment-edit-table {
  min-width: 0;
  table-layout: fixed;
}
.shipment-edit-table .ship-edit-model { width: 15%; }
.shipment-edit-table .ship-edit-spec { width: 35%; }
.shipment-edit-table .ship-edit-color { width: 9%; }
.shipment-edit-table .ship-edit-num { width: 8%; }
.shipment-edit-table .ship-edit-input { width: 9%; }
.shipment-edit-table th {
  height: 38px;
  padding: 8px 9px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}
.shipment-edit-table td {
  height: 54px;
  padding: 8px 9px;
  vertical-align: middle;
  background: #fff;
}
.shipment-edit-table tbody tr + tr td {
  border-top: 1px solid #e8eef5;
}
.shipment-model-text {
  display: block;
  color: #16202a;
  line-height: 1.35;
}
.shipment-spec-text {
  display: -webkit-box;
  max-height: 58px;
  overflow: hidden;
  color: #475569;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.shipment-color-tag,
.shipment-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  max-width: 100%;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: #1f5fd1;
  font-weight: 700;
}
.shipment-color-tag {
  justify-content: flex-start;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shipment-number {
  background: #f1f5f9;
  color: #334155;
}
.shipment-number.shipped {
  background: #ecfdf3;
  color: #16845c;
}
.shipment-number.remaining {
  background: #fff7ed;
  color: #a86412;
}
.shipment-qty-input {
  width: 78px;
  height: 32px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
.shipment-qty-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 95, 209, .12);
}
.shipment-history-head {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.shipment-history-wrap {
  margin-top: 8px;
}
.shipment-history-table {
  table-layout: fixed;
}
.shipment-history-table .shipment-history-date { width: 120px; }
.shipment-history-table .shipment-history-no { width: 190px; }
.shipment-history-table .shipment-history-logistics { width: 260px; }
.shipment-history-table .shipment-history-qty { width: 110px; }
.shipment-history-table .shipment-history-items { width: auto; }
.shipment-history-table .shipment-history-remark { width: 300px; }
.shipment-history-table .shipment-history-actions { width: 110px; }
.shipment-history-logistics-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shipment-history-items-cell {
  white-space: normal;
}
.shipment-history-item-line {
  display: block;
  line-height: 1.45;
  word-break: break-word;
}
.shipment-history-item-line + .shipment-history-item-line {
  margin-top: 2px;
}
.shipment-history-row.shipment-history-editing td,
.shipment-history-row.shipment-history-saved td {
  background: #eff6ff;
}
.shipment-history-row.shipment-history-saved td:first-child {
  box-shadow: inset 4px 0 0 var(--blue);
}
.packing-editor-list {
  display: grid;
  gap: 12px;
}
.packing-requirement-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #cfe0f4;
  border-radius: 8px;
  background: #f8fbff;
}
.packing-requirement-panel label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}
.packing-requirement-panel textarea {
  width: 100%;
  min-height: 90px;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 9px 10px;
  resize: vertical;
  outline: none;
}
.packing-requirement-panel textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}
.packing-requirement-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.packing-requirement-summary {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.packing-requirement-summary span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eaf2ff;
  color: #1f5fd1;
  font-size: 12px;
  font-weight: 700;
}
.packing-preview-requirement {
  margin: 0 0 8px;
  padding: 7px 9px;
  border: 1px solid #94a3b8;
  background: #f8fafc;
  color: #111827;
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}
.packing-editor-line {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.packing-line-head {
  display: grid;
  grid-template-columns: 64px minmax(180px, 1fr) 160px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}
.packing-line-head label,
.packing-editor-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.packing-line-head strong {
  color: var(--ink);
  font-size: 16px;
}
.packing-line-no {
  color: var(--muted);
  font-weight: 800;
}
.packing-editor-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) repeat(5, minmax(110px, 1fr));
  gap: 12px;
  padding: 14px;
}
.packing-editor-grid .wide-field {
  grid-column: span 3;
}
.packing-editor-grid input,
.packing-editor-grid select,
.packing-line-head input {
  width: 100%;
  min-width: 0;
}
.packing-editor-grid .inline-cell,
.packing-line-head .inline-cell {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 0 10px;
  outline: none;
}
.packing-editor-grid .inline-cell:focus,
.packing-line-head .inline-cell:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}
.packing-editor-grid textarea {
  width: 100%;
  height: auto;
  min-height: 70px;
  padding: 8px 10px;
  resize: vertical;
}
.packing-editor-wrap {
  width: 100%;
  overflow-x: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.packing-editor-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
}
.packing-editor-table th,
.packing-editor-table td {
  border-bottom: 1px solid var(--line);
  padding: 7px 8px;
  vertical-align: top;
}
.packing-editor-table th {
  height: 38px;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 800;
  text-align: left;
  white-space: normal;
  line-height: 1.2;
}
.packing-editor-table td {
  height: 86px;
}
.packing-editor-table tr:last-child td {
  border-bottom: 0;
}
.packing-editor-table .center {
  text-align: center;
}
.packing-editor-table .strong,
.packing-editor-table .packing-model-cell {
  color: var(--ink);
  font-weight: 800;
}
.packing-editor-table .packing-model-cell {
  line-height: 1.25;
  white-space: normal;
  word-break: break-word;
}
.packing-editor-table .inline-cell {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  padding: 0 8px;
  outline: none;
  white-space: normal;
}
.packing-editor-table select.inline-cell {
  height: 40px;
  white-space: normal;
}
.packing-editor-table textarea.inline-cell {
  height: 76px;
  min-height: 76px;
  padding: 6px 8px;
  line-height: 1.28;
  resize: vertical;
  white-space: pre-wrap;
  word-break: break-word;
}
.packing-editor-table .inline-cell:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}
.packing-editor-table .empty-cell {
  height: 80px;
  color: var(--muted);
  text-align: center;
}
.packing-editor-table .col-no {
  width: 4.2%;
}
.packing-editor-table .col-model {
  width: 12%;
}
.packing-editor-table .col-qty {
  width: 6%;
}
.packing-editor-table .col-box {
  width: 21%;
}
.packing-editor-table .col-small {
  width: 6.5%;
}
.packing-editor-table .col-size {
  width: 9%;
}
.packing-editor-table .col-weight,
.packing-editor-table .col-volume {
  width: 7.2%;
}
.packing-editor-table .col-note {
  width: 14%;
}
@media (max-width: 1100px) {
  .packing-line-head {
    grid-template-columns: 56px minmax(0, 1fr);
  }
  .packing-line-head label {
    grid-column: 1 / -1;
  }
  .packing-editor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .packing-editor-grid .wide-field {
    grid-column: 1 / -1;
  }
}
@media (max-width: 640px) {
  .packing-editor-grid {
    grid-template-columns: 1fr;
  }
}
.print-preview-stage {
  padding: 18px;
  background: #eef2f7;
  overflow: auto;
}
.preview-zoom-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
}
.preview-zoom-toolbar .btn.small {
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
  line-height: 1;
}
.preview-zoom-value {
  min-width: 42px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.preview-zoom-shell {
  margin: 0 auto;
  position: relative;
}
.preview-zoom-shell .pi-preview {
  margin: 0;
}
.pi-preview {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 9mm;
  box-sizing: border-box;
  color: #111827;
  background: #fff;
}
.pi-a4-preview {
  border: 1px solid #cbd5e1;
  box-shadow: 0 18px 42px rgba(15, 23, 42, .22);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: 9pt;
}
.quote-preview-document {
  width: 210mm;
  min-height: 297mm;
  padding: 10mm;
  box-sizing: border-box;
  border: 1px solid #0f172a;
  box-shadow: 0 18px 42px rgba(15, 23, 42, .18);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: 9pt;
}
.quote-preview-sheet {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  border-spacing: 0;
  box-sizing: border-box;
}
.quote-preview-sheet > tbody > tr > td {
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid #475569;
  vertical-align: middle;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.quote-sheet-title > td,
.quote-sheet-meta > td,
.quote-sheet-products > td {
  padding: 0;
}
.quote-sheet-title-grid {
  display: grid;
  grid-template-columns: 26mm minmax(0, 1fr) 26mm;
  min-height: 23mm;
  align-items: center;
}
.quote-sheet-logo {
  display: grid;
  min-width: 0;
  min-height: 22mm;
  place-items: center;
  padding: 2mm;
}
.quote-sheet-logo img {
  display: block;
  width: 22mm;
  max-width: 100%;
  height: 12mm;
  object-fit: contain;
}
.quote-sheet-title-content {
  padding: 2mm 0;
  min-width: 0;
  text-align: center;
}
.quote-sheet-title-content p {
  margin: 0 0 2mm;
  font-size: 9.5pt;
}
.quote-sheet-title-content h1 {
  margin: 0;
  color: #0f172a;
  font-size: 21pt;
  letter-spacing: 2px;
}
.quote-preview-header-grid {
  display: grid;
  grid-template-columns: 18% 32% 18% 32%;
}
.quote-preview-meta-cell {
  min-width: 0;
  min-height: 11mm;
  box-sizing: border-box;
  padding: 2.5mm 3mm;
  border-right: 1px solid #475569;
  border-bottom: 1px solid #475569;
  color: #111827;
  font-weight: 700;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.quote-preview-meta-cell:nth-child(4n),
.quote-preview-meta-value--wide {
  border-right: 0;
}
.quote-preview-meta-label {
  background: #f3f4f6;
  color: #334155;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
  word-break: keep-all;
}
.quote-preview-meta-value--wide {
  grid-column: span 3;
}
.quote-preview-address {
  white-space: pre-wrap;
}
.quote-preview-sheet .quote-preview-edit-control {
  display: inline-block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1.5px solid #d97706;
  border-radius: 2px;
  background: #fffbeb;
  color: #0f172a;
  font: inherit;
  line-height: 1.35;
  padding: 1.2mm 1.6mm;
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(217, 119, 6, 0.14);
}
.quote-preview-sheet .quote-preview-editable-value.is-editing {
  display: block;
}
.quote-preview-sheet textarea.quote-preview-edit-control {
  display: block;
  min-height: 8mm;
  resize: vertical;
}
.quote-preview-sheet select.quote-preview-edit-control,
.quote-preview-sheet input.quote-preview-edit-control {
  min-height: 7mm;
}
.quote-preview-sheet input[type="number"].quote-preview-edit-control {
  width: 28mm;
  text-align: center;
}
.quote-sheet-section > td {
  padding: 2.6mm 3mm;
  font-size: 11pt;
  font-weight: 700;
}
.quote-preview-product-table {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  border-spacing: 0;
}
.quote-preview-product-table col.quote-product-col--sequence { width: 7%; }
.quote-preview-product-table col.quote-product-col--image { width: 8%; }
.quote-preview-product-table col.quote-product-col--internal { width: 22%; }
.quote-preview-product-table col.quote-product-col--customer { width: 16%; }
.quote-preview-product-table col.quote-product-col--spec { width: 27%; }
.quote-preview-product-table col.quote-product-col--moq { width: 6%; }
.quote-preview-product-table col.quote-product-col--quantity { width: 6%; }
.quote-preview-product-table col.quote-product-col--price { width: 8%; }
.quote-preview-product-table th,
.quote-preview-product-table td {
  min-width: 0;
  box-sizing: border-box;
  padding: 2.3mm 1.8mm;
  border-right: 1px solid #475569;
  border-bottom: 1px solid #475569;
  font-size: 7.4pt;
  line-height: 1.25;
  vertical-align: middle;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.quote-preview-product-table th:last-child,
.quote-preview-product-table td:last-child {
  border-right: 0;
}
.quote-preview-product-table thead th {
  background: #f1f5f9;
  color: #1e293b;
  text-align: center;
  font-weight: 700;
  white-space: nowrap;
  word-break: keep-all;
}
.quote-preview-product-row td {
  padding: 2.3mm 1.8mm;
  font-size: 7.4pt;
  line-height: 1.25;
}
.quote-preview-image {
  height: 15mm;
  padding: 1mm !important;
  text-align: center;
}
.quote-preview-image img {
  display: block;
  width: 100%;
  height: 13mm;
  object-fit: contain;
}
.quote-sheet-term > td {
  min-width: 0;
  min-height: 7mm;
  padding: 2.2mm 3mm;
  font-size: 8.5pt;
  line-height: 1.45;
}
.quote-preview-seller-row .quote-preview-seller-contact {
  padding: 2.4mm 3mm;
  text-align: right;
  font-size: 8.5pt;
  font-weight: 400;
  line-height: 1.5;
}
.quote-preview-seller-contact {
  margin: 0;
}
.quote-preview-seller-contact p { margin: 0; }
@media screen {
  .print-preview-stage {
    overflow: auto;
  }
  .print-preview-stage .pi-preview:not(.quote-preview-document) {
    width: 196mm;
    min-height: 297mm;
    padding: 6mm;
  }
  .print-preview-stage .quote-preview-document {
    width: 210mm;
    min-width: 210mm;
    max-width: 210mm;
    min-height: 297mm;
    padding: 10mm;
    overflow: hidden;
  }
  .print-preview-stage .quote-preview-sheet {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    table-layout: fixed;
  }
  .print-preview-stage .quote-preview-sheet th,
  .print-preview-stage .quote-preview-sheet td {
    min-width: 0;
  }
}
.pi-title { text-align: center; font-size: 19pt; font-weight: 800; margin: 0 0 5mm; }
.pi-subtitle { text-align: center; margin: -2px 0 8px; color: #475569; font-size: 13px; }
.pi-meta { font-size: 10pt; }
.pi-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.party {
  min-height: 116px;
  padding: 12px;
  border: 1px solid #9aa4b2;
}
.party h3 { margin: 0 0 8px; font-size: 14px; }
.party p { margin: 3px 0; font-size: 12px; }
.print-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
  border: 1px solid #9aa4b2;
}
.print-table th, .print-table td {
  border: 1px solid #9aa4b2;
  height: auto;
  padding: 3px 4px;
  font-size: 8.8pt;
  vertical-align: middle;
}
.print-table th {
  position: static;
  background: #f3f4f6;
  color: #111827;
  text-align: center;
  vertical-align: middle;
  font-weight: 800;
}
.legacy-meta {
  border: 1px solid #9aa4b2;
  border-bottom: 0;
  margin-bottom: 0;
}
.legacy-meta td {
  height: 8mm;
  padding: 3px 5px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
.legacy-party-table,
.legacy-pi-table {
  margin-bottom: 0;
}
.legacy-pi-table .pi-col-photo { width: 16mm; }
.legacy-pi-table .pi-col-desc-a,
.legacy-pi-table .pi-col-desc-b { width: 16mm; }
.legacy-pi-table .pi-col-spec-a,
.legacy-pi-table .pi-col-spec-b,
.legacy-pi-table .pi-col-spec-c { width: 16mm; }
.legacy-pi-table .pi-col-color { width: 12mm; }
.legacy-pi-table .pi-col-hs { width: 12mm; }
.legacy-pi-table .pi-col-qty { width: 16mm; }
.legacy-pi-table .pi-col-price { width: 17mm; }
.legacy-pi-table .pi-col-total { width: 18mm; }
.legacy-pi-table .pi-col-remark { width: 13mm; }
.legacy-party-table th,
.legacy-pi-table th {
  text-align: center;
  vertical-align: middle;
  font-weight: 800;
  line-height: 1.08;
  padding: 3px 2px;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
}
.legacy-pi-table .pi-th-qty,
.legacy-pi-table .pi-th-price,
.legacy-pi-table .pi-th-total {
  white-space: nowrap;
  font-size: 8.1pt;
}
.legacy-party-table td,
.legacy-pi-table td {
  height: 26px;
  line-height: 1.25;
  text-align: center;
  vertical-align: middle;
  word-break: break-word;
}
.legacy-pi-table td:nth-child(9),
.legacy-pi-table td:nth-child(10),
.legacy-pi-table td:nth-child(11) {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}
.legacy-party-table .red-text,
.legacy-pi-table .red-text {
  text-align: center;
}
.pi-output-root {
  padding: 6mm;
}
.pi-output-meta,
.pi-output-party,
.pi-output-table,
.pi-output-payment {
  width: 100%;
  table-layout: fixed;
}
.pi-output-party td {
  word-break: break-word;
  overflow-wrap: anywhere;
}
.pi-output-party td:first-child,
.pi-output-party td:nth-child(3) {
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
}
.pi-output-table {
  table-layout: fixed;
  border-collapse: collapse;
}
.pi-output-party,
.pi-output-table {
  table-layout: fixed;
}
.pi-doc-col-photo { width: 13%; }
.pi-doc-col-model { width: 15%; }
.pi-doc-col-specifications { width: 28%; }
.pi-doc-col-color { width: 14%; }
.pi-doc-col-qty { width: 7%; }
.pi-doc-col-price { width: 7%; }
.pi-doc-col-total { width: 7%; }
.pi-doc-col-remark { width: 9%; }
.pi-output-table th {
  height: 8mm;
  padding: 2px 2.5px;
  font-size: 7.2pt;
  line-height: 1.16;
  text-align: center;
  vertical-align: middle;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}
.pi-output-table td {
  min-height: 18mm;
  padding: 2.5px 2.5px;
  font-size: 7.1pt;
  line-height: 1.22;
  text-align: left;
  vertical-align: middle;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.pi-output-table .wrap-text {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.pi-output-table .right,
.pi-output-table td.right,
.pi-output-table th.right {
  text-align: right;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}
.pi-output-table .center,
.pi-output-table td.center,
.pi-output-table th.center {
  text-align: center;
}
.packing-output-root {
  padding: 6mm;
}
.packing-output-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  margin-top: 0;
}
.packing-output-table .packing-meta-row td {
  text-align: left;
  white-space: nowrap;
  font-size: 7.2pt;
}
.packing-output-table .packing-party-head th {
  background: var(--soft);
  font-weight: 800;
}
.packing-output-meta,
.packing-output-party,
.packing-output-table {
  width: 100%;
  table-layout: fixed;
}
.packing-output-table.packing-output-meta td,
.packing-output-table.packing-output-party td,
.packing-output-table.packing-output-party th {
  height: 9.4mm;
  padding: 2.5px 3px;
  font-size: 7.2pt;
  line-height: 1.14;
  text-align: center;
  vertical-align: middle;
  word-break: normal;
  overflow-wrap: anywhere;
}
.packing-output-table.packing-output-meta td {
  text-align: left;
  white-space: nowrap;
}
.packing-output-table.packing-output-party th {
  background: var(--soft);
  font-weight: 800;
}
.packing-output-table.packing-output-party .red-text {
  color: #e11d1d;
}
.packing-output-table th {
  height: 9mm;
  padding: 2px 1.8px;
  font-size: 6.2pt;
  line-height: 1.08;
  text-align: center;
  vertical-align: middle;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.packing-output-table td {
  min-height: 13.5mm;
  padding: 2px 1.8px;
  font-size: 6.1pt;
  line-height: 1.12;
  text-align: left;
  vertical-align: middle;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.packing-output-table td.center,
.packing-output-table th.center {
  text-align: center;
}
.packing-output-table td.right,
.packing-output-table th.right {
  text-align: right;
}

.packing-output-root .packing-output-table:not(.packing-output-meta):not(.packing-output-party) th {
  height: 8mm;
  padding: 1.8px 1.2px;
  font-size: 5.9pt;
  line-height: 1.08;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: normal;
}

.packing-output-root .packing-output-table:not(.packing-output-meta):not(.packing-output-party) td {
  padding: 2.2px 1.4px;
  font-size: 5.8pt;
  line-height: 1.14;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}

.packing-output-root .packing-cell-no,
.packing-output-root .packing-cell-color,
.packing-output-root .packing-cell-qty,
.packing-output-root .packing-cell-carton-size,
.packing-output-root .packing-cell-carton-qty,
.packing-output-root .packing-cell-cartons,
.packing-output-root .packing-cell-weight,
.packing-output-root .packing-cell-volume {
  text-align: center;
}

.packing-output-root .packing-cell-model {
  font-size: 5.7pt;
  line-height: 1.14;
}

.packing-output-root .packing-cell-spec {
  font-size: 5.4pt;
  line-height: 1.12;
}

.packing-output-root .packing-cell-carton-size {
  font-size: 5.6pt;
  line-height: 1.12;
}

.packing-output-root .packing-cell-rule,
.packing-output-root .packing-cell-advice {
  font-size: 5.1pt;
  line-height: 1.1;
  text-align: left;
  word-break: normal;
  overflow-wrap: anywhere;
}
.packing-output-table .packing-forwarder-row td {
  height: auto;
  min-height: 7mm;
  padding: 2.8mm 1.8mm;
  text-align: left;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.25;
}
.packing-sketch-section {
  margin-top: 4mm;
  page-break-inside: avoid;
}
.packing-sketch-title {
  margin-bottom: 2mm;
  font-size: 8pt;
  font-weight: 800;
  color: #111827;
}
.packing-sketch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.5mm;
}
.packing-sketch-card {
  display: grid;
  grid-template-columns: 28mm minmax(0, 1fr);
  gap: 3mm;
  min-height: 42mm;
  padding: 2.5mm;
  border: 1px solid #9aa4b2;
  background: #fff;
  page-break-inside: avoid;
}
.packing-box-3d {
  position: relative;
  width: 22mm;
  height: 28mm;
  margin: 4mm 0 0 2mm;
}
.packing-box-face {
  position: absolute;
  inset: 5mm 4mm 0 0;
  border: 1px solid #334155;
  background: linear-gradient(180deg, rgba(248, 250, 252, .82), rgba(226, 232, 240, .66));
  overflow: hidden;
}
.packing-box-top {
  position: absolute;
  left: 2.5mm;
  right: 1.5mm;
  top: 0;
  height: 5mm;
  border: 1px solid #334155;
  border-bottom: 0;
  background: #f1f5f9;
  transform: skewX(-32deg);
  transform-origin: bottom left;
}
.packing-box-side {
  position: absolute;
  top: 5mm;
  right: 0;
  bottom: 2.5mm;
  width: 4mm;
  border: 1px solid #334155;
  border-left: 0;
  background: #cbd5e1;
  transform: skewY(-28deg);
  transform-origin: top left;
}
.packing-box-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 1.8mm;
  border-top: 1px dashed rgba(15, 23, 42, .45);
  background: rgba(37, 99, 235, .06);
}
.packing-box-wireframe {
  position: absolute;
  left: 1.2mm;
  right: 1.2mm;
  bottom: 1.2mm;
  z-index: 1;
  display: grid;
  align-content: end;
  gap: .45mm;
  padding: .8mm;
  box-sizing: border-box;
  border: 1px dashed rgba(15, 23, 42, .35);
  background: rgba(255, 255, 255, .28);
}
.packing-product-cell {
  display: block;
  aspect-ratio: 1.25 / .82;
  min-height: 1.5mm;
  border: .35mm solid #2563eb;
  box-shadow: inset 0 0 0 .25mm rgba(255, 255, 255, .86), 0 .25mm .45mm rgba(15, 23, 42, .18);
  transform: skewX(-7deg);
}
.packing-box-empty,
.packing-box-used {
  position: absolute;
  left: 1mm;
  right: 1mm;
  z-index: 2;
  text-align: center;
  font-size: 5.4pt;
  font-weight: 800;
  color: #0f172a;
}
.packing-box-empty { top: 2mm; }
.packing-box-used { bottom: 2mm; color: #fff; text-shadow: 0 1px 1px rgba(15, 23, 42, .6); }
.packing-sketch-info {
  min-width: 0;
  font-size: 5.7pt;
  line-height: 1.28;
}
.packing-sketch-head {
  display: flex;
  justify-content: space-between;
  gap: 2mm;
  margin-bottom: 1.2mm;
  font-size: 6pt;
}
.packing-sketch-head span,
.packing-sketch-meta span {
  color: #475569;
}
.packing-sketch-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1mm;
  margin-bottom: 1.5mm;
}
.packing-sketch-items {
  display: grid;
  gap: .8mm;
  margin-bottom: 1.5mm;
}
.packing-sketch-item {
  display: grid;
  grid-template-columns: 2.4mm minmax(0, .9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: 1mm;
}
.packing-sketch-more {
  color: #475569;
  font-size: 5.3pt;
}
.packing-sketch-dot {
  width: 2mm;
  height: 2mm;
  border-radius: 50%;
}
.packing-sketch-steps {
  margin: 0;
  padding-left: 3.2mm;
}
.packing-sketch-steps li {
  margin: .4mm 0;
}
.pi-output-photo-cell {
  padding: 0;
  text-align: center;
  vertical-align: middle;
}
.pi-output-photo {
  display: grid;
  place-items: center;
  width: 19mm;
  height: 17mm;
  margin: 0 auto;
  overflow: hidden;
  color: #64748b;
  font-size: 6.4pt;
  line-height: 1.1;
  text-align: center;
  background: #fff;
}
.pi-output-photo img {
  display: block;
  max-width: 18mm;
  max-height: 16mm;
  width: auto;
  height: auto;
  object-fit: contain;
}
.pi-output-photo-empty,
.pi-output-photo-name {
  border: 1px dashed #cbd5e1;
  padding: 1mm;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.red-text { color: #dc2626; }
.legacy-terms {
  margin-top: 6mm;
  padding: 5mm;
  border: 1px solid #9aa4b2;
  background: #fff;
  font-size: 9pt;
  line-height: 1.36;
}
.pi-output-payment {
  margin-top: 5mm;
}
.pi-output-payment th,
.pi-output-payment td {
  font-size: 8.4pt;
  line-height: 1.3;
  vertical-align: middle;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.pi-bank-image {
  margin-top: 3mm;
  text-align: left;
}
.pi-bank-image img {
  display: block;
  width: 95mm;
  max-width: 100%;
  height: auto;
  min-width: 95mm;
  object-fit: contain;
  background: #fff;
}
.legacy-terms-title {
  margin-bottom: 2mm;
  font-weight: 800;
  font-size: 10.5pt;
}
.legacy-terms-label {
  margin-top: 2px;
  font-weight: 800;
}
.legacy-terms-text {
  white-space: normal;
}
.bank-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}
.bank-box section {
  border: 1px solid #9aa4b2;
  padding: 10px;
  font-size: 12px;
  line-height: 1.55;
}

.auth-mode .sidebar {
  opacity: .98;
}

.login-shell {
  min-height: calc(100vh - 132px);
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(17, 24, 39, .12);
  padding: 28px;
}

.login-brand {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #123f67;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 14px;
}

.login-card h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.login-card p,
.login-hint {
  color: var(--muted);
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

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

.login-form input {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
}

.login-error {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  border-radius: 6px;
  padding: 9px 10px;
  font-size: 13px;
}

.login-hint {
  margin-top: 14px;
  font-size: 12px;
}

.block-line {
  display: block;
  margin-top: 4px;
}

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

.permission-readonly-grid article,
.permission-matrix section {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  padding: 12px;
}

.permission-readonly-grid strong,
.permission-matrix strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
}

.permission-readonly-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.permission-matrix label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 7px 0;
  color: var(--ink);
  font-size: 13px;
}

.permission-matrix input {
  width: 15px;
  height: 15px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  transform: translateY(80px);
  opacity: 0;
  padding: 12px 14px;
  border-radius: 7px;
  color: #fff;
  background: #15202b;
  transition: .18s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }

.preview-dialog {
  width: min(98vw, 1280px);
}

.contract-preview-dialog {
  width: min(1280px, 96vw);
  height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.contract-preview-content {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.contract-preview-stage {
  flex: 1;
  min-height: 0;
  padding: 0;
  padding-bottom: 24px;
  background: #e5e7eb;
}

.internal-order-note-dialog {
  width: min(760px, calc(100vw - 44px));
}

.internal-order-note-panel {
  display: flex;
  flex: 0 0 390px;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border-left: 1px solid var(--line);
  background: #f8fafc;
  overflow: auto;
}

.internal-order-note-panel.hidden {
  display: none;
}

.internal-order-note-dialog .internal-order-note-panel {
  width: 100%;
  padding: 0;
  border-left: 0;
  background: #fff;
}

.internal-order-note-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.internal-order-note-head h3 {
  margin: 0;
  font-size: 17px;
}

.internal-order-note-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.internal-order-note-warning,
.internal-order-note-ready {
  padding: 9px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.5;
}

.internal-order-note-warning {
  border: 1px solid #f2c36b;
  color: #8a4b08;
  background: #fff8e6;
}

.internal-order-note-ready {
  border: 1px solid #a7d9c4;
  color: #126447;
  background: #ecfdf5;
}

.internal-order-note-text {
  width: 100%;
  min-height: 430px;
  flex: 1;
  padding: 13px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  outline: none;
  color: #172033;
  background: #fff;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.75;
  resize: vertical;
}

.internal-order-note-text:focus {
  border-color: #6ea2e8;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.internal-order-note-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.contract-pdf-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 74vh;
  border: 0;
  background: #fff;
}

.contract-preview-loading,
.contract-preview-error {
  min-height: 260px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.contract-preview-error {
  color: var(--danger);
}

.domestic-contract-sheet {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 9mm;
  box-sizing: border-box;
  overflow: hidden;
  color: #111;
  background: #fff;
  border: 0;
  box-shadow: 0 18px 42px rgba(15, 23, 42, .22);
  font-family: "SimSun", "Microsoft YaHei", sans-serif;
  font-size: 9pt;
  line-height: 1.35;
}

.domestic-contract-sheet > table {
  width: 100%;
}

.domestic-contract-header {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.domestic-contract-header td {
  height: 14mm;
  padding: 0;
  border: 1px solid #111;
  position: relative;
  vertical-align: middle;
}

.domestic-contract-logo {
  position: absolute;
  top: 50%;
  left: 5mm;
  width: 20mm;
  height: 10mm;
  margin: 0;
  object-fit: contain;
  transform: translateY(-50%);
}

.domestic-contract-logo-placeholder {
  position: absolute;
  top: 50%;
  left: 5mm;
  width: 20mm;
  height: 10mm;
  margin: 0;
  transform: translateY(-50%);
}

.domestic-contract-title-content {
  width: 100%;
}

.domestic-contract-title-cell h1 {
  margin: 0;
  padding: 5px 8px;
  border: 0;
  font-size: 20pt;
  line-height: 1.2;
  text-align: center;
}

.domestic-contract-block {
  width: 100%;
  table-layout: fixed;
}

.domestic-contract-block td {
  padding: 5px 7px;
  border: 1px solid #111;
  border-bottom: 0;
  text-align: left;
}

.domestic-contract-block.domestic-contract-preamble td,
.domestic-contract-block.domestic-contract-section-title td {
  font-weight: 700;
}

.domestic-contract-table {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 8pt;
}

.domestic-contract-table th,
.domestic-contract-table td {
  min-width: 0;
  height: auto;
  padding: 4px 3px;
  border: 1px solid #111;
  vertical-align: middle;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

.domestic-contract-table th {
  position: static;
  top: auto;
  z-index: auto;
}

.domestic-contract-products th,
.domestic-contract-products td {
  text-align: center;
}

.contract-col-index { width: 5%; }
.contract-col-internal-model { width: 14%; }
.contract-col-image { width: 8%; }
.contract-col-model { width: 14%; }
.contract-col-spec { width: 16%; }
.contract-col-brand { width: 6%; }
.contract-col-quantity { width: 7%; }
.contract-col-delivery-date { width: 9%; }
.contract-col-price { width: 7%; }
.contract-col-total { width: 7%; }
.contract-col-remark { width: 7%; }

.domestic-contract-products td:nth-child(4),
.domestic-contract-products td:nth-child(5) {
  text-align: left;
}

.domestic-contract-product-image {
  display: block;
  max-width: 100%;
  max-height: 48px;
  margin: 0 auto;
  object-fit: contain;
}

.contract-center { text-align: center; }
.contract-right { text-align: right; }
.contract-tax-note { color: #e11d48; }
.domestic-contract-invoice { white-space: normal; line-height: 1.55; }
.domestic-contract-parties tr:last-child td {
  border-bottom: 1px solid #111;
}

.contract-template-editor-dialog {
  display: flex;
  flex-direction: column;
  width: min(1180px, calc(100vw - 28px));
  height: calc(100vh - 28px);
  max-height: calc(100vh - 28px);
  overflow: hidden;
}

.contract-template-editor-body {
  flex: 1;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.contract-template-editor-form {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.contract-template-editor-toolbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: #fff;
  border-bottom: 1px solid #d9e1ea;
}

.contract-template-editor-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
}

.contract-template-name input {
  width: 230px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.contract-template-default input {
  width: 16px;
  height: 16px;
}

.contract-template-editor-hint {
  flex: 1;
  min-width: 220px;
  color: var(--muted);
  font-size: 12px;
}

.contract-template-editor-stage {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  background: #eef2f6;
}

.contract-template-edit-sheet {
  overflow: visible;
}

.contract-template-inline-input,
.contract-template-inline-textarea {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  border: 1px solid #e4b84a;
  border-radius: 3px;
  padding: 3px 5px;
  background: #fff8d8;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  line-height: inherit;
}

.contract-template-inline-input {
  min-height: 28px;
}

.contract-template-inline-textarea {
  display: block;
  min-height: 34px;
  resize: none;
  overflow: hidden;
}

.contract-template-inline-input:focus,
.contract-template-inline-textarea:focus {
  outline: 2px solid #2a69d1;
  outline-offset: 0;
  border-color: #2a69d1;
  background: #fff;
}

.contract-template-edit-sheet .domestic-contract-title-cell .contract-template-inline-input {
  min-height: 44px;
  text-align: center;
}

.contract-template-edit-sheet .contract-center .contract-template-inline-input {
  text-align: center;
}

.contract-template-readonly {
  display: block;
  min-height: 28px;
  padding: 3px 5px;
  color: #687386;
  background: #f3f5f7;
}

.contract-template-readonly small {
  display: block;
  margin-top: 2px;
  color: #8b95a5;
  font-size: 9px;
  line-height: 1.2;
}

.contract-template-sample-row td {
  color: #687386;
  background: #f3f5f7;
}

.contract-template-image-placeholder {
  display: grid;
  place-items: center;
  min-height: 42px;
  color: #8b95a5;
  font-size: 9px;
}

.contract-template-compact-label {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  margin: 3px 0;
  color: #5f6b7a;
  font-size: 9px;
}

.contract-template-payment-editor-row > td {
  padding: 8px;
}

.contract-template-payment-accounts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.contract-template-account-card {
  --account-accent: #2563eb;
  --account-soft: #eff6ff;
  overflow: hidden;
  border: 1px solid #93b4ea;
  border-radius: 8px;
  background: #fff;
}

.public-account-card {
  --account-accent: #2563eb;
  --account-soft: #eff6ff;
}

.private-account-card {
  --account-accent: #d97706;
  --account-soft: #fff7ed;
  border-color: #f0bd78;
}

.contract-template-account-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: var(--account-soft);
  border-bottom: 1px solid #dbe5f0;
}

.contract-template-account-badge {
  padding: 3px 8px;
  border-radius: 999px;
  color: #fff;
  background: var(--account-accent);
  font-weight: 700;
}

.contract-template-account-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}

.contract-template-account-fields label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.contract-template-account-fields label > span {
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.contract-template-account-full {
  grid-column: 1 / -1;
}

.contract-template-account-number {
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .06em;
}

@media (max-width: 760px) {
  .contract-template-account-fields {
    grid-template-columns: 1fr;
  }

  .contract-template-account-full {
    grid-column: auto;
  }
}

@media screen {
  .contract-preview-stage .domestic-contract-sheet,
  .contract-template-editor-stage .domestic-contract-sheet {
    width: 196mm;
    min-width: 196mm;
    min-height: 277mm;
    padding: 6mm;
  }
}

@media screen and (max-width: 1100px) {
  .contract-preview-dialog {
    width: calc(100vw - 12px);
    height: calc(100vh - 12px);
  }

  .contract-preview-dialog .dialog-head {
    position: static;
    flex-direction: column;
    align-items: stretch;
  }

  .contract-preview-dialog .toolbar-right {
    width: 100%;
    justify-content: flex-start;
  }
}

@media screen and (max-width: 900px) {
  .contract-preview-content {
    display: grid;
    grid-template-rows: minmax(420px, 1fr) auto;
    overflow: auto;
  }

  .contract-preview-stage {
    min-height: 420px;
  }

  .contract-preview-content .internal-order-note-panel {
    width: 100%;
    max-height: none;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .internal-order-note-text {
    min-height: 320px;
  }
}

.task-preview-stage {
  max-height: calc(100vh - 110px);
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px;
  background: #e8edf3;
}

.a4-task-page,
.payment-proof-a4-page {
  box-sizing: border-box;
  width: 210mm;
  min-width: 210mm;
  max-width: 210mm;
  min-height: 297mm;
  padding: 14mm;
  background: #fff;
  border: 1px solid #d7dee8;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
  color: #111827;
  flex: 0 0 auto;
  overflow: hidden;
}

.a4-task-page *,
.payment-proof-a4-page * {
  box-sizing: border-box;
  max-width: 100%;
}

.a4-task-page h1 {
  margin: 0 0 18px;
  text-align: center;
  font-size: 24px;
  letter-spacing: 0;
}

.a4-task-info {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #94a3b8;
  margin-bottom: 16px;
  overflow: hidden;
  empty-cells: show;
}

.a4-task-info col.label-col {
  width: 22%;
}

.a4-task-info col.value-col {
  width: 28%;
}

.a4-task-info th,
.a4-task-info td {
  position: static;
  border: 0;
  border-right: 1px solid #94a3b8;
  border-bottom: 1px solid #94a3b8;
  height: auto;
  min-width: 0;
  padding: 8px 10px;
  line-height: 1.5;
  vertical-align: top;
  white-space: normal;
  overflow: hidden;
  text-overflow: clip;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.a4-task-info th {
  background: #f3f6fa;
  font-weight: 700;
}

.a4-task-info tr:last-child th,
.a4-task-info tr:last-child td {
  border-bottom: 0;
}

.a4-task-info th:last-child,
.a4-task-info td:last-child {
  border-right: 0;
}

.a4-task-section {
  margin-top: 16px;
}

.a4-task-section h3 {
  margin: 0 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #cbd5e1;
  font-size: 15px;
}

.a4-task-text {
  box-sizing: border-box;
  width: 100%;
  min-height: 0;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  background: #fff;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.a4-task-text.plan {
  min-height: 0;
}

.a4-task-record-table {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #94a3b8;
  overflow: hidden;
  empty-cells: show;
}

.a4-task-record-table th,
.a4-task-record-table td {
  position: static;
  border: 0;
  border-right: 1px solid #94a3b8;
  border-bottom: 1px solid #94a3b8;
  height: auto;
  min-width: 0;
  padding: 8px 9px;
  line-height: 1.55;
  vertical-align: top;
  white-space: normal;
  overflow: hidden;
  text-overflow: clip;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.a4-task-record-table th {
  background: #f3f6fa;
  text-align: center;
  font-weight: 700;
}

.a4-task-record-table tr:last-child td {
  border-bottom: 0;
}

.a4-task-record-table th:last-child,
.a4-task-record-table td:last-child {
  border-right: 0;
}

.a4-task-record-table .record-date {
  width: 12%;
}

.a4-task-record-table .record-stage {
  width: 11%;
}

.a4-task-record-table .record-content {
  width: 30%;
}

.a4-task-record-table .record-next {
  width: 28%;
}

.a4-task-record-table .record-due {
  width: 11%;
}

.a4-task-record-table .record-status {
  width: 8%;
}

.a4-attach-names {
  margin-top: 6px;
  color: #64748b;
  font-size: 12px;
}

.a4-task-page .task-preview-attachments figure {
  width: 58mm;
  border-radius: 4px;
}

.a4-task-page .task-preview-attachments img {
  max-height: 88mm;
}

.task-preview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.task-preview-grid article,
.task-preview-record {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.task-preview-grid span,
.task-preview-grid em {
  display: block;
  color: var(--muted);
  font-style: normal;
  line-height: 1.6;
}

.task-preview-grid strong {
  display: block;
  margin: 4px 0;
}

.task-preview-section {
  margin-top: 14px;
}

.task-preview-section h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.task-preview-content {
  min-height: 52px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
  white-space: pre-wrap;
  line-height: 1.65;
}

.task-preview-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
}

.task-preview-attachments figure {
  width: 180px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.task-preview-attachments img {
  display: block;
  width: 100%;
  max-height: 230px;
  object-fit: contain;
  background: #f8fafc;
  border-radius: 6px;
}

.task-preview-attachments figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--text);
}

.task-preview-records {
  display: grid;
  gap: 10px;
}

.task-preview-record-head {
  display: grid;
  grid-template-columns: 70px repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

.task-preview-record-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 10px;
}

.task-preview-record-body p {
  margin: 4px 0;
  white-space: pre-wrap;
  line-height: 1.6;
}

.task-preview-record-attachments {
  margin-top: 10px;
}

@media print {
  @page {
    size: A4;
    margin: 0;
  }
  body { background: #fff; }
  .app, .dialog-head { display: none; }
  .modal { position: static; display: block; padding: 0; background: #fff; }
  .dialog { width: auto; max-height: none; box-shadow: none; }
  .contract-preview-content { display: block; }
  .internal-order-note-panel { display: none !important; }
  .dialog-body,
  .print-preview-stage {
    padding: 0;
    background: #fff;
    overflow: visible;
  }
  .preview-zoom-shell {
    width: auto !important;
    height: auto !important;
  }
  .pi-preview {
    width: 210mm;
    min-height: 297mm;
    max-width: none;
    margin: 0;
    padding: 6mm;
    border: 0;
    box-shadow: none;
    transform: none !important;
  }
  .pi-preview.quote-preview-document {
    width: 210mm;
    min-height: 297mm;
    padding: 10mm;
  }
  .pi-output-root {
    padding: 6mm;
  }
  .pi-output-table th,
  .pi-output-table td {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .pi-output-table td {
    min-height: 18mm;
  }
  .packing-output-table th,
  .packing-output-table td {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .packing-output-root .packing-sketch-section {
    display: none !important;
  }
.packing-output-table .packing-export-hide {
  visibility: hidden !important;
}

  .pi-output-photo,
  .pi-output-photo img {
    break-inside: avoid;
  }
}

@media (max-width: 1366px) {
  .app { grid-template-columns: 156px minmax(0, 1fr); }
  .sidebar { padding: 12px 8px; }
  .brand { gap: 7px; }
  .brand-mark { flex-basis: 40px; width: 40px; height: 34px; font-size: 11px; }
  .brand-copy strong { font-size: 13px; }
  .nav button { height: 36px; padding: 0 9px; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pi-customer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .history-import-bar { grid-template-columns: minmax(240px, 1fr) auto auto; }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .import-grid { grid-template-columns: 1fr; }
  .data-module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-bar { grid-template-columns: minmax(260px, 1fr) repeat(4, minmax(108px, 132px)) 68px; }
  .customer-filter-bar { grid-template-columns: repeat(3, minmax(135px, 1fr)) repeat(4, minmax(96px, .68fr)) 68px; }
  .product-select-strip { grid-template-columns: 130px minmax(190px, 1fr) minmax(220px, 1.15fr) minmax(190px, 1fr); }
  .product-catalog-grid { grid-template-columns: 1fr; }
  .pi-list-table {
    min-width: 1280px;
  }
  .pi-list-table td,
  .pi-list-table th {
    padding-left: 9px;
    padding-right: 9px;
    font-size: 13px;
  }
  .pi-list-table .btn.small {
    height: 28px;
    padding: 0 6px;
    font-size: 12px;
  }
  .shipment-record-table {
    min-width: 1420px;
  }
  .shipment-record-table .shipment-col-items { width: 250px; }
  .shipment-record-table .shipment-col-actions { width: 360px; }
}

@media (min-width: 1281px) and (max-width: 1750px) {
  .lead-task-filter:not(.customer-task-filter) {
    grid-template-columns: repeat(6, minmax(0, 1fr)) 64px;
  }
}

@media (max-width: 1600px) {
  .pi-list-table {
    min-width: 1420px;
  }
  .pi-list-table .pi-col-no { width: 8%; }
  .pi-list-table .pi-col-payment { width: 7.5%; }
  .pi-list-table .pi-col-latest-shipment { width: 8%; }
  .pi-list-table .pi-col-remark { width: 5.5%; }
  .pi-list-table .pi-col-actions { width: 22%; }
}

@media (max-width: 1500px) {
  .follow-dashboard {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .sales-stage-board {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .follow-action-list article {
    grid-template-columns: minmax(130px, .7fr) minmax(280px, 1.15fr) minmax(140px, .55fr) 120px 230px;
  }
  .follow-customer-card {
    grid-template-columns: minmax(260px, 1fr) minmax(200px, .7fr) 130px 220px;
  }
  .lead-work-card {
    grid-template-columns: 140px minmax(190px, .7fr) minmax(320px, 1.25fr) minmax(230px, .85fr);
  }
}

@media (max-width: 1280px) {
  .pi-list-table {
    min-width: 1180px;
  }
  .pi-list-table td,
  .pi-list-table th {
    padding-left: 7px;
    padding-right: 7px;
    font-size: 12px;
  }
  .pi-payment-cell {
    line-height: 1.2;
  }
  .shipment-record-table {
    min-width: 1320px;
  }
  .shipment-record-table .shipment-col-actions { width: 320px; }
  .task-toolbar {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .lead-task-filter:not(.customer-task-filter) {
    grid-template-columns: repeat(3, minmax(0, 1fr)) 64px;
  }
  .task-preview-grid,
  .task-preview-record-body {
    grid-template-columns: minmax(0, 1fr);
  }
  .task-preview-record-head {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .task-preview-stage {
    padding: 12px;
  }
  .a4-task-page {
    width: 100%;
    min-height: auto;
    padding: 16px;
  }
  .lead-work-card {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }
  .lead-work-status,
  .lead-work-status > div:first-child,
  .lead-work-status .lead-task-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .follow-action-list article {
    grid-template-columns: minmax(0, 1fr) 150px 170px;
  }
  .follow-action-content {
    grid-column: 1 / -1;
    order: 4;
  }
  .follow-action-buttons {
    grid-column: 1 / -1;
  }
  .follow-customer-card {
    grid-template-columns: minmax(0, 1fr) 170px;
  }
  .follow-card-meta,
  .follow-card-status,
  .follow-card-actions {
    grid-column: 1 / -1;
  }
  .follow-card-actions {
    grid-template-columns: repeat(5, minmax(58px, 1fr));
  }
}






















