:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --ink: #1b2430;
  --muted: #66788a;
  --line: #d7e1ee;
  --brand: #0b6cff;
  --brand-2: #00a86b;
  --warn: #f5a524;
  --danger: #e5484d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at 20% 10%, #e9f1ff 0%, var(--bg) 40%), var(--bg);
  color: var(--ink);
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.auth-card {
  width: min(460px, 96vw);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
}

.auth-card h2 {
  margin: 0 0 8px;
}

.auth-form {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.auth-submit {
  width: 100%;
}

.auth-loading-panel {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.auth-loading-panel h2 {
  margin: 16px 0 6px;
}

.auth-loading-panel p {
  margin: 0;
}

.auth-loading-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid #dbeafe;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: auth-loading-spin 0.8s linear infinite;
}

@keyframes auth-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.auth-message {
  margin-top: 10px;
}

.auth-message.warn {
  color: #8f5a00;
}

.auth-message.ok {
  color: #0b6b41;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  background: linear-gradient(180deg, #152238 0%, #0e1727 100%);
  color: #dce9ff;
  padding: 20px;
}

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

.brand p {
  margin: 6px 0 18px;
  color: #98b3d9;
  font-size: 13px;
}

.nav-btn {
  width: 100%;
  margin-bottom: 10px;
  border: 1px solid #314968;
  background: #182842;
  color: #dce9ff;
  padding: 10px 12px;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  transition: 0.2s;
}

.nav-btn.active,
.nav-btn:hover {
  background: #0b6cff;
  border-color: #0b6cff;
  color: #fff;
}

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

.topbar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

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

.topbar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.role-box {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.environment-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid #f0b429;
  border-radius: 999px;
  padding: 4px 10px;
  color: #7a4b00;
  background: #fff7df;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.auth-card .environment-badge {
  width: fit-content;
  margin: 0 auto 10px;
}

.backend-status {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  background: #f7fbff;
  color: #3b5874;
  font-size: 12px;
}

.backend-status.ok {
  background: #eaf8f0;
  border-color: #bde5cb;
  color: #0b6b41;
}

.backend-status.warn {
  background: #fff7e8;
  border-color: #ffe1ac;
  color: #8f5a00;
}

.backend-status.loading {
  background: #eef5ff;
  border-color: #cadfff;
  color: #204b85;
}

.current-user {
  color: #1f3b57;
  font-size: 13px;
}

.sync-notice {
  margin-top: 10px;
  border: 1px solid #b9d4ff;
  background: #eef5ff;
  color: #183b66;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.sync-notice b {
  display: block;
  font-size: 14px;
}

.sync-notice span {
  display: block;
  color: #516a87;
  font-size: 12px;
  margin-top: 2px;
}

.role-box select,
input,
textarea,
button {
  font: inherit;
}

select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
  line-height: 1.4;
}

select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 34px;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, transparent 50%, #355271 50%),
    linear-gradient(135deg, #355271 50%, transparent 50%),
    linear-gradient(to right, #d7e1ee, #d7e1ee);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 13px) calc(50% - 3px),
    calc(100% - 2.4rem) 50%;
  background-size:
    6px 6px,
    6px 6px,
    1px 60%;
  background-repeat: no-repeat;
}

select::-ms-expand {
  display: none;
}

select:disabled {
  background-color: #f5f7fb;
  color: #7f8fa1;
}

.view {
  margin-top: 14px;
}

.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(14, 23, 39, 0.45);
  display: grid;
  place-items: center;
  z-index: 1000;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(520px, 96vw);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

.app-confirm-card {
  width: min(680px, 96vw);
}

.app-confirm-message {
  color: #26384c;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 10px;
}

.app-confirm-detail {
  max-height: min(360px, 52vh);
  overflow: auto;
  border: 1px solid #dfe8f4;
  border-radius: 10px;
  padding: 10px 12px;
  background: #f7faff;
  color: #18324f;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.app-confirm-actions {
  justify-content: flex-end;
  margin-top: 12px;
}

.app-confirm-card textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

.card h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

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

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

.policy-block h4 {
  margin: 0 0 8px;
  font-size: 15px;
  color: #1f3b57;
}

.policy-block p {
  margin: 6px 0;
  color: #2d4055;
  line-height: 1.7;
}

.policy-list {
  margin: 8px 0 8px 20px;
  padding: 0;
  color: #2d4055;
  line-height: 1.7;
}

.grid-2,
.grid-3 {
  display: grid;
  gap: 10px;
}

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

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

.analysis-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 10px;
  align-items: end;
}

.analysis-filter-note {
  margin-top: 10px;
}

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

.section-head h3,
.section-head p {
  margin-top: 0;
}

.analysis-section-heading {
  margin: 18px 0 10px;
  font-size: 16px;
}

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

.analysis-kpi {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 12px;
  min-height: 104px;
}

.analysis-kpi.blue {
  border-color: #c9dcff;
  background: #f5f9ff;
}

.analysis-kpi.green {
  border-color: #bfe8d6;
  background: #f3fbf7;
}

.analysis-kpi.orange {
  border-color: #ffe0aa;
  background: #fff9ef;
}

.analysis-kpi.gray {
  background: #f8fafc;
}

.analysis-kpi-label {
  color: var(--muted);
  font-size: 12px;
}

.analysis-kpi-value {
  margin-top: 8px;
  color: #172235;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.2;
}

.analysis-kpi-hint {
  margin-top: 8px;
  color: #5c7085;
  font-size: 12px;
  line-height: 1.4;
}

.analysis-profile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

.analysis-profile h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.analysis-profile-head {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid #e0e8f2;
  border-radius: 10px;
  background: #f8fbff;
  font-size: 13px;
}

.analysis-profile-section {
  margin-top: 12px;
  font-size: 13px;
}

.analysis-profile-section ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #2d4055;
  line-height: 1.7;
}

.analysis-table {
  min-width: 980px;
}

.analysis-detail-table {
  min-width: 1380px;
}

.analysis-audit-editor-row td {
  background: #f8fbff;
}

.analysis-audit-editor {
  position: sticky;
  left: 0;
  max-width: 1100px;
  padding: 10px;
}

.edit-pricing-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(320px, 2fr);
  gap: 10px;
  align-items: start;
}

.edit-tiered-quantity-field {
  margin-top: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field.hidden {
  display: none;
}

.field label {
  font-size: 13px;
  color: #3a4a5c;
}

.field-label-with-help {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.best-example-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  text-decoration: underline dotted;
  cursor: help;
}

.best-example-help:hover,
.best-example-help:focus-visible {
  color: #355271;
  outline: none;
}

.best-example-popover {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 20;
  display: none;
  width: min(360px, 82vw);
  padding: 10px 12px;
  border: 1px solid #c7d6e8;
  border-radius: 8px;
  background: #fff;
  color: #26384c;
  box-shadow: 0 10px 26px rgba(31, 59, 87, 0.18);
  font-size: 12px;
  line-height: 1.55;
  text-decoration: none;
}

.best-example-popover b,
.best-example-popover span {
  display: block;
}

.best-example-popover b {
  margin-top: 6px;
  color: #1b2430;
}

.best-example-popover b:first-child {
  margin-top: 0;
}

.best-example-help:hover .best-example-popover,
.best-example-help:focus-visible .best-example-popover {
  display: block;
}

.crm-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}

.crm-section-title {
  margin-bottom: 10px;
  color: #1f3b57;
  font-size: 14px;
  font-weight: 700;
}

.edit-impact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 14px;
  color: #3a4a5c;
  font-size: 13px;
}

.field-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}

.field-badge.warn {
  background: #fff4d6;
  color: #8f5a00;
}

.crm-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 14px;
  margin-top: 10px;
  color: #3a4a5c;
  font-size: 13px;
}

.decision-record-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.decision-record-header h3 {
  margin-bottom: 4px;
}

.decision-record-latest {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #dfe8f4;
  border-radius: 10px;
  background: #f7faff;
  color: #26384c;
  font-size: 13px;
  line-height: 1.6;
}

.decision-record-form {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #dfe8f4;
  border-radius: 10px;
  background: #fbfdff;
}

.decision-record-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 12px;
  margin-top: 6px;
  color: #3a4a5c;
  font-size: 12px;
  line-height: 1.55;
}

.decision-record-table {
  min-width: 980px;
}

.crm-kpi-grid {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  margin: 10px 0 0;
}

.crm-kpi-grid .analysis-kpi {
  min-height: 72px;
  padding: 10px 12px;
}

.crm-order-summary-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.crm-order-summary-grid .analysis-kpi {
  min-width: 0;
  min-height: 132px;
}

.crm-order-summary-grid .analysis-kpi-value {
  font-size: clamp(18px, 2vw, 21px);
  overflow-wrap: anywhere;
}

.crm-workbench-grid {
  align-items: start;
  grid-template-columns: minmax(520px, 1.15fr) minmax(420px, 0.85fr);
}

.crm-config-card {
  margin-top: 12px;
}

.crm-config-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  gap: 16px;
  margin-top: 12px;
}

.crm-config-section-head {
  margin-bottom: 8px;
}

.crm-config-section-head h3 {
  margin: 0;
}

.crm-config-table {
  min-width: 0;
}

.crm-config-name-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.crm-config-name-cell span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.crm-config-row {
  cursor: pointer;
}

.crm-config-row:hover td {
  background: #f8fbff;
}

.crm-lead-table {
  min-width: 1040px;
  table-layout: fixed;
}

.crm-lead-table th:first-child,
.crm-lead-table td:first-child {
  width: 72px;
}

.crm-lead-table th:nth-child(2),
.crm-lead-table td:nth-child(2) {
  width: 190px;
}

.crm-lead-table th:nth-child(3),
.crm-lead-table td:nth-child(3),
.crm-lead-table th:nth-child(4),
.crm-lead-table td:nth-child(4) {
  width: 88px;
}

.crm-lead-table th:nth-child(5),
.crm-lead-table td:nth-child(5) {
  width: 120px;
}

.crm-lead-table th:nth-child(6),
.crm-lead-table td:nth-child(6) {
  width: 96px;
}

.crm-lead-table th:nth-child(7),
.crm-lead-table td:nth-child(7) {
  width: 190px;
}

.crm-lead-table th:nth-child(8),
.crm-lead-table td:nth-child(8) {
  width: 190px;
}

.crm-lead-table th:nth-child(9),
.crm-lead-table td:nth-child(9) {
  width: 150px;
}

.crm-lead-id-button {
  min-width: 52px;
  padding-left: 8px;
  padding-right: 8px;
}

.crm-lead-cell-ellipsis {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-lead-contact-cell {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.crm-lead-table .selected-row td {
  background: #f4f9ff;
}

.crm-lead-row {
  cursor: pointer;
}

.crm-lead-row:hover td {
  background: #f8fbff;
}

.crm-source-status-row {
  gap: 8px;
  flex-wrap: wrap;
}

.market-insight-hero {
  border-top: 4px solid #2563eb;
}

.market-candidate-card {
  border-top: 4px solid #059669;
}

.market-email-weekly-card {
  border-top: 4px solid #7c3aed;
}

.market-email-weekly-card .decision-record-header select {
  min-width: 130px;
}

.market-email-weekly-kpis {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  margin-top: 14px;
}

.market-email-trend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(34px, 1fr));
  align-items: end;
  gap: 8px;
  min-height: 190px;
  margin-top: 18px;
  padding: 16px 12px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: linear-gradient(180deg, #faf7ff 0%, #fff 100%);
  overflow-x: auto;
}

.market-email-trend-item {
  display: grid;
  grid-template-rows: 22px 120px 20px;
  gap: 4px;
  min-width: 0;
  text-align: center;
}

.market-email-trend-value,
.market-email-trend-label {
  overflow: hidden;
  color: #64748b;
  font-size: 11px;
  white-space: nowrap;
}

.market-email-trend-track {
  position: relative;
  overflow: hidden;
  border-radius: 6px 6px 2px 2px;
  background: #f1f5f9;
}

.market-email-trend-track span {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #8b5cf6, #6d28d9);
}

.market-email-weekly-note {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-top: 10px;
  color: #64748b;
  font-size: 12px;
  flex-wrap: wrap;
}

.market-email-weekly-details {
  margin-top: 12px;
  padding: 0;
}

.mes-order-id-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.mes-order-id-input-row .btn {
  white-space: nowrap;
}

.mes-info-mount {
  margin-top: 12px;
}

.mes-lookup-hint {
  padding: 10px 12px;
  border: 1px dashed #bfdbfe;
  border-radius: 10px;
  background: #f8fbff;
}

.mes-info-card {
  margin-top: 10px;
  padding: 16px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fbff 0%, #fff 100%);
}

.mes-info-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.mes-info-card-head > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mes-info-card h4 {
  margin: 0;
  color: #173b63;
}

.mes-info-summary {
  padding: 12px;
  border-radius: 10px;
  background: #eef6ff;
}

.mes-info-block {
  margin-top: 14px;
}

.mes-remark-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.mes-remark-item {
  padding: 10px 12px;
  border-left: 3px solid #60a5fa;
  border-radius: 6px;
  background: #fff;
}

.mes-remark-item p {
  margin: 4px 0 0;
  color: #334155;
  white-space: pre-wrap;
}

.mes-parts-table {
  min-width: 980px;
  margin-top: 8px;
}

.mes-parts-table th:first-child {
  min-width: 190px;
}

.market-candidate-kpis {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.market-candidate-filter {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(6, minmax(128px, auto)) auto;
  gap: 10px;
  margin: 14px 0;
}

.market-candidate-list {
  display: grid;
  gap: 12px;
}

.market-candidate-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  border: 1px solid #d9e5df;
  border-radius: 12px;
  background: #fbfefc;
}

.market-decision-hero {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  background: linear-gradient(135deg, #ecfdf5 0%, #f8fffc 100%);
}

.market-decision-hero-title {
  display: flex;
  align-items: center;
  gap: 9px;
}

.market-decision-hero > p {
  margin: 10px 0 12px;
  color: #184c3a;
  font-size: 15px;
  font-weight: 600;
}

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

.market-decision-grid > div {
  padding: 10px 11px;
  border: 1px solid #d6eee4;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.86);
}

.market-decision-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.market-decision-grid b {
  color: #263f37;
  font-size: 13px;
  line-height: 1.55;
}

.market-promotion-decision {
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid #dbeafe;
  border-radius: 9px;
  background: #f8fbff;
}

.market-promotion-decision .market-candidate-heading {
  margin-top: 8px;
}

.market-next-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid #fed7aa;
  border-radius: 9px;
  background: #fffaf3;
}

.market-next-action > div:first-child > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.market-next-action .market-candidate-actions {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border: 0;
}

.market-result-pending {
  border-color: #fed7aa !important;
  background: #fffaf3 !important;
}

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

.market-score-detail-grid > div {
  padding: 11px 12px;
  border: 1px solid #dbe4ec;
  border-radius: 9px;
  background: #fff;
}

.market-score-detail-grid ul,
.market-score-rule-detail ul {
  margin: 7px 0 0;
  padding-left: 20px;
  line-height: 1.6;
}

.market-score-table th,
.market-score-table td {
  padding: 7px 8px;
}

.market-score-rule-detail {
  margin-top: 10px;
  color: var(--muted);
}

.market-candidate-heading,
.market-candidate-signals,
.market-evidence-refs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.market-candidate-main h4 {
  margin: 8px 0 4px;
  font-size: 16px;
}

.market-candidate-main p {
  margin: 10px 0;
  line-height: 1.65;
}

.market-candidate-summary {
  padding: 10px 12px;
  border-left: 3px solid #059669;
  background: #f0fdf4;
  color: #234538;
}

.market-candidate-brief {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.market-candidate-brief > div {
  padding: 11px 12px;
  border: 1px solid #dbe4ec;
  border-radius: 9px;
  background: #fff;
}

.market-candidate-brief p {
  margin: 5px 0 0;
  color: #42566d;
  font-size: 13px;
}

.market-candidate-value {
  padding: 11px 12px;
  border-radius: 9px;
  background: #f8fafc;
}

.market-candidate-promotion {
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid #fed7aa;
  border-radius: 9px;
  background: #fffaf3;
}

.market-candidate-promotion ul {
  margin: 7px 0 0;
  padding-left: 20px;
  line-height: 1.6;
}

.market-candidate-acquisition {
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 9px;
  background: #f8fbff;
}

.market-candidate-acquisition .market-candidate-heading {
  margin-top: 8px;
}

.market-candidate-acquisition ul {
  margin: 7px 0 0;
  padding-left: 20px;
  line-height: 1.6;
}

.market-promotion-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 9px;
  background: #fff7ed;
}

.market-candidate-value ul {
  margin: 6px 0 0;
  padding-left: 20px;
  line-height: 1.65;
}

.market-candidate-customer-value,
.market-candidate-missing {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 12px;
}

.market-candidate-actions {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #d9e5df;
}

.market-candidate-history {
  margin: 10px 0 0;
  padding-left: 20px;
  line-height: 1.65;
}

.market-candidate-action-modal .modal-card {
  width: min(640px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.market-material-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 7px;
}

.market-material-checklist label {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 8px 9px;
  border: 1px solid #dbe4ec;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 13px;
}

.market-material-checklist input {
  width: auto;
  margin-top: 2px;
}

.market-candidate-customer-value {
  background: #eff6ff;
  color: #294e7a;
}

.market-candidate-customer-value span {
  margin-left: 6px;
  color: var(--muted);
}

.market-candidate-missing {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  background: #fff7ed;
  color: #9a4b0b;
}

.market-candidate-score {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-content: start;
  gap: 2px 8px;
  padding: 10px;
  border-radius: 10px;
  background: #ecfdf5;
  text-align: center;
}

.market-candidate-score b {
  color: #047857;
  font-size: 22px;
}

.market-candidate-score span {
  color: var(--muted);
  font-size: 11px;
}

.market-candidate-evidence {
  grid-column: 1 / -1;
  border-top: 1px solid #d9e5df;
  padding-top: 10px;
}

.market-candidate-evidence summary {
  color: #126344;
  font-weight: 600;
  cursor: pointer;
}

.market-candidate-evidence-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.2fr);
  gap: 16px;
  margin: 12px 0;
}

.market-candidate-evidence-grid p,
.market-candidate-evidence-grid ul {
  margin: 6px 0;
  line-height: 1.65;
}

.market-collapsible-card > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  list-style-position: inside;
}

.market-collapsible-card[open] > summary {
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.market-collapsible-content {
  padding-top: 2px;
}

.market-evidence-ref {
  padding: 4px 7px;
  border-radius: 6px;
  background: #eef2f7;
  color: #44566c;
  font-size: 11px;
}

.market-project-preview-card {
  border-top: 4px solid #7c3aed;
}

.market-project-kpis {
  grid-template-columns: repeat(6, minmax(130px, 1fr));
}

.market-project-note {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid #ddd6fe;
  border-radius: 9px;
  background: #f7f5ff;
  color: #55468a;
  font-size: 12px;
  line-height: 1.6;
}

.market-project-table {
  min-width: 1320px;
}

.market-project-table th:nth-child(1) { width: 190px; }
.market-project-table th:nth-child(2) { width: 390px; }
.market-project-table th:nth-child(3) { width: 130px; }
.market-project-table th:nth-child(4) { width: 130px; }
.market-project-table th:nth-child(5) { width: 110px; }
.market-project-table th:nth-child(6) { width: 230px; }
.market-project-table th:nth-child(7) { width: 120px; }

.market-project-excerpt {
  display: -webkit-box;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.market-sales-customer-card {
  border-top: 4px solid #0f766e;
}

.market-sales-owner-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 12px;
  margin-bottom: 4px;
}

.market-sales-owner {
  flex: 0 0 auto;
  min-width: 170px;
  border: 1px solid #d7e1ee;
  border-radius: 10px;
  background: #f8fafc;
  color: #29445f;
  padding: 9px 12px;
  text-align: left;
  cursor: pointer;
}

.market-sales-owner span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.market-sales-owner.active {
  border-color: #0f766e;
  background: #e8f7f3;
  color: #0f5f59;
  box-shadow: inset 0 0 0 1px #0f766e;
}

.market-sales-kpis {
  grid-template-columns: repeat(6, minmax(130px, 1fr));
}

.market-sales-kpis .analysis-kpi.warning {
  background: #fff8e8;
}

.market-sales-kpis .analysis-kpi.danger {
  background: #fff1f1;
}

.market-sales-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 190px 160px auto;
  gap: 10px;
  align-items: center;
  margin: 14px 0 10px;
}

.market-current-sort {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: #355271;
  font-size: 12px;
}

.market-table-sort {
  display: grid;
  gap: 5px;
  min-width: 125px;
}

.market-table-sort > span {
  font-weight: 700;
}

.market-table-sort select {
  width: 100%;
  min-height: 28px;
  padding: 3px 24px 3px 7px;
  border-color: #c9d7e5;
  background-color: #fff;
  color: #365b7d;
  font-size: 11px;
}

.market-cooperation-rule {
  margin-bottom: 12px;
  border: 1px solid #cfe4df;
  border-radius: 9px;
  background: #f1faf8;
  color: #315d58;
  padding: 9px 11px;
  font-size: 12px;
  line-height: 1.55;
}

.market-sales-customer-table {
  min-width: 1180px;
}

.market-sales-customer-table th:nth-child(1) {
  width: 220px;
}

.market-sales-customer-table th:nth-child(2) {
  width: 150px;
}

.market-sales-customer-table th:nth-child(n + 3) {
  width: 140px;
}

.market-money-primary {
  margin-top: 2px;
  color: #365b7d;
  font-size: 16px;
}

.market-insight-kpis {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
}

.market-source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.market-source-card {
  padding: 14px;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: #f8fafc;
  line-height: 1.65;
}

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

.market-source-error {
  margin-top: 4px;
  color: #b45309;
  font-size: 12px;
}

.market-sync-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.market-sync-summary .muted {
  margin-left: auto;
}

.market-insight-filter {
  display: grid;
  grid-template-columns: minmax(260px, 520px) auto;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
}

.market-customer-table {
  min-width: 1360px;
}

.market-customer-table th:nth-child(1) {
  width: 90px;
}

.market-customer-table th:nth-child(2) {
  width: 180px;
}

.market-customer-table th:nth-child(3) {
  width: 230px;
}

.market-customer-table th:nth-child(4),
.market-customer-table th:nth-child(5) {
  width: 110px;
}

.market-customer-table th:nth-child(n + 6) {
  width: 120px;
}

.market-account-mapping {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 330px;
}

.market-account-mapping select {
  min-width: 230px;
}

.crm-ai-analysis .crm-section {
  margin-top: 8px;
}

.crm-ai-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.crm-ai-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.crm-ai-card summary {
  display: grid;
  gap: 6px;
  min-height: 94px;
  padding: 12px;
  cursor: pointer;
  list-style: none;
}

.crm-ai-card summary::-webkit-details-marker {
  display: none;
}

.crm-ai-card summary span {
  color: #355271;
  font-weight: 700;
}

.crm-ai-card summary b {
  font-size: 20px;
  line-height: 1.35;
}

.crm-ai-card[open] summary {
  border-bottom: 1px solid var(--line);
  background: #f4f9ff;
}

.crm-ai-card-body {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
}

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

.crm-evidence-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #f8fbff;
}

.crm-evidence-meta {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

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

.crm-communication-table {
  min-width: 720px;
}

.crm-lead-form-card textarea {
  min-height: 72px;
}

.crm-stage-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.crm-stage-option {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: #1b2430;
  text-align: left;
  cursor: pointer;
}

.crm-stage-option span,
.crm-stage-option small {
  display: block;
}

.crm-stage-option span {
  font-weight: 700;
}

.crm-stage-option small {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.4;
}

.crm-stage-option:hover,
.crm-stage-option.active {
  border-color: var(--brand);
  background: #eef5ff;
}

.crm-stage-option.active span {
  color: #084fc4;
}

.crm-progress {
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  gap: 0;
  overflow-x: auto;
  padding: 14px 2px 4px;
}

.crm-progress-step {
  position: relative;
  min-width: 110px;
  display: grid;
  justify-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.crm-progress-step::before,
.crm-progress-step::after {
  content: "";
  position: absolute;
  top: 14px;
  width: 50%;
  height: 2px;
  background: #d7e1ee;
}

.crm-progress-step::before {
  left: 0;
}

.crm-progress-step::after {
  right: 0;
}

.crm-progress-step:first-child::before,
.crm-progress-step:last-child::after {
  display: none;
}

.crm-progress-step.done::before,
.crm-progress-step.done::after,
.crm-progress-step.current::before {
  background: var(--brand);
}

.crm-progress-dot {
  position: relative;
  z-index: 1;
  width: 30px;
  height: 30px;
  border: 2px solid #c9d8ea;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.crm-progress-step.done .crm-progress-dot,
.crm-progress-step.current .crm-progress-dot {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.crm-progress-step.current .crm-progress-label {
  color: #084fc4;
  font-weight: 700;
}

.crm-progress-step.done .crm-progress-label {
  color: #355271;
}

.crm-progress-label {
  white-space: nowrap;
}

.crm-note-preview-list {
  display: grid;
  gap: 4px;
  border: 1px solid #dfe8f4;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.crm-note-preview-item {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border-bottom: 1px solid #edf2f8;
}

.crm-note-preview-item:last-child {
  border-bottom: none;
}

.crm-note-preview-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.crm-note-preview-text {
  color: #26384c;
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.crm-note-preview-attachment {
  border: 1px solid #d7e1ee;
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.material-editor-panel .field label,
.material-browser-card .field label,
.material-toolbar .field label {
  font-size: 12px;
}

.material-editor-panel input,
.material-editor-panel select,
.material-editor-panel textarea,
.material-browser-card input,
.material-browser-card select,
.material-toolbar input,
.material-toolbar select {
  font-size: 13px;
}

textarea {
  min-height: 60px;
  resize: vertical;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
}

a.btn {
  text-decoration: none;
  display: inline-block;
}

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

.btn.secondary {
  background: #eef3fb;
  border-color: var(--line);
  color: #18324f;
}

.btn.success {
  background: var(--brand-2);
  color: #fff;
}

.btn.warn {
  background: var(--warn);
  color: #fff;
}

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  box-shadow: none;
}

.btn.quote-selection-blocked:disabled {
  background: #eef1f5;
  border-color: #d5dde7;
  color: #657487;
  opacity: 1;
}

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

.file-list {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 8px;
  background: #f9fbff;
}

.upload-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upload-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.upload-item-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.upload-thumb-link {
  display: inline-flex;
  align-items: center;
}

.upload-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.upload-video-thumb {
  width: 96px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #000;
}

.attachment-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.attachment-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: #fff;
  text-decoration: none;
  color: inherit;
}

.attachment-image-card {
  width: 100%;
  cursor: zoom-in;
  text-align: left;
  font: inherit;
}

.attachment-image-card:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 20px rgba(43, 108, 176, 0.14);
}

.attachment-image {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.attachment-video-card {
  gap: 8px;
}

.attachment-video {
  width: 100%;
  height: 110px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #000;
  object-fit: cover;
}

.attachment-name {
  font-size: 12px;
  color: #355271;
  word-break: break-all;
}

.image-preview-card {
  width: min(1100px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 12px;
  box-shadow: 0 24px 80px rgba(14, 23, 39, 0.28);
}

.image-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.image-preview-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  color: var(--text);
}

.image-preview-body {
  display: grid;
  place-items: center;
  min-height: 220px;
  overflow: auto;
  border-radius: 10px;
  background: #f5f8fc;
}

.image-preview-body img {
  display: block;
  max-width: 100%;
  max-height: calc(92vh - 92px);
  object-fit: contain;
}

.btn-compact {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
}

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

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

.quantity-tier-editor-wrap {
  max-width: 100%;
}

.quantity-tier-editor-table {
  min-width: 980px;
  table-layout: fixed;
}

.quantity-tier-editor-table th:nth-child(1),
.quantity-tier-editor-table td:nth-child(1) {
  width: 74px;
  text-align: center;
}

.quantity-tier-editor-table th:nth-child(2),
.quantity-tier-editor-table td:nth-child(2) {
  width: 160px;
}

.quantity-tier-editor-table th:nth-child(3),
.quantity-tier-editor-table td:nth-child(3) {
  width: 120px;
}

.quantity-tier-editor-table th:nth-child(4),
.quantity-tier-editor-table td:nth-child(4) {
  width: 240px;
}

.quantity-tier-editor-table th:nth-child(5),
.quantity-tier-editor-table td:nth-child(5) {
  width: 94px;
  text-align: center;
}

.quantity-tier-editor-table th:nth-child(6),
.quantity-tier-editor-table td:nth-child(6) {
  width: 180px;
}

.quantity-tier-editor-table th:nth-child(7),
.quantity-tier-editor-table td:nth-child(7) {
  width: 110px;
}

.quantity-tier-editor-table input:not([type="radio"]):not([type="checkbox"]) {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 6px 10px;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 8px;
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

.table th {
  color: #3b5874;
  background: #f7fbff;
}

.tier-quote-table {
  min-width: 760px;
}

.tier-quote-table th,
.tier-quote-table td {
  padding: 5px 6px;
  vertical-align: middle;
  font-size: 12px;
}

.tier-quote-table .tier-quote-input {
  min-width: 72px;
  width: 100%;
  padding: 5px 6px;
  border-radius: 8px;
  font-size: 12px;
}

.tier-quote-table .tier-quote-reason-input {
  min-width: 108px;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.tag.blue {
  background: #dceaff;
  color: #12457f;
}

.tag.green {
  background: #d8f7ea;
  color: #0c6642;
}

.tag.orange {
  background: #fff1d6;
  color: #995d00;
}

.tag.red {
  background: #fff0f0;
  color: #b4232c;
}

.tag.gray {
  background: #edf1f7;
  color: #556577;
}

.inquiry-actions-cell {
  min-width: 150px;
}

.inquiry-list-meta {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.inquiry-action-stack {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.inquiry-more-filters {
  margin-bottom: 10px;
  border: 1px solid #dfe8f4;
  border-radius: 8px;
  padding: 8px 10px;
  background: #f9fbff;
}

.inquiry-more-filters summary {
  cursor: pointer;
  color: #18324f;
  font-weight: 700;
}

.table-action-inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

.table-action-select {
  min-width: 86px;
  max-width: 120px;
  padding: 6px 28px 6px 10px;
  font-size: 12px;
}

.table td.follow-up-cell-due {
  background: #ffe8e8;
  color: #8b1d1d;
  font-weight: 600;
  box-shadow: inset 3px 0 0 #d73939;
}

.table-pager {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

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

.notice {
  padding: 10px;
  border-radius: 10px;
  background: #eef5ff;
  border: 1px solid #cadfff;
  color: #204b85;
  font-size: 13px;
}

.notice.warn {
  background: #fff7e8;
  border-color: #ffe1ac;
  color: #8f5a00;
}

.material-toolbar-card {
  padding: 10px 12px;
}

.material-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.material-toolbar-title {
  min-width: 0;
}

.material-toolbar-title h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.material-toolbar-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.material-toolbar-stats span {
  padding: 4px 8px;
  border-radius: 999px;
  background: #f3f7fc;
  border: 1px solid var(--line);
  color: #486079;
  font-size: 11px;
}

.material-toolbar-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.material-inline-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.material-inline-filters select,
.material-inline-filters input {
  min-width: 150px;
  min-height: 36px;
}

.material-hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.material-workbench {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.material-browser-card {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 110px);
  overflow: auto;
}

.material-browser-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.material-editor-panel {
  min-width: 0;
}

.material-list {
  display: grid;
  gap: 6px;
}

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

.material-category-group {
  border-top: 1px solid #dbe6f3;
  padding-top: 8px;
}

.material-category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.material-category-header h3 {
  margin: 0;
  font-size: 13px;
}

.material-category-header span {
  color: var(--muted);
  font-size: 11px;
}

.material-list-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
}

.material-list-item.active,
.material-list-item:hover {
  border-color: #86b7ff;
  background: #f0f6ff;
}

.material-list-item small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  line-height: 1.35;
  font-size: 11px;
}

.material-nested-card p {
  margin: 6px 0 0;
  color: #486079;
  font-size: 12px;
  line-height: 1.55;
}

.material-detail-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.material-detail-header h3 {
  margin-bottom: 2px;
  font-size: 18px;
}

.material-detail-header .row-actions {
  align-items: center;
}

.material-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  line-height: 1;
  font-size: 11px;
  font-weight: 600;
  flex: 0 0 auto;
}

.material-detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 10px;
}

.material-score-grid {
  display: grid;
  gap: 8px;
}

.material-score-grid.compact {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.material-score-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px;
  display: grid;
  gap: 6px;
  font-size: 12px;
}

.material-score-card span {
  color: #3a4a5c;
}

.material-score-card-input {
  display: flex;
  align-items: center;
  gap: 6px;
}

.material-score-card input {
  min-height: 32px;
  padding: 4px 8px;
  font-size: 12px;
}

.material-nested-card {
  margin: 0;
  background: #fbfdff;
}

.material-tag-block {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.material-checkbox-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.material-checkbox-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: #f8fbff;
  color: #355271;
  font-size: 11px;
  cursor: pointer;
}

.material-checkbox-tag.active {
  border-color: #86b7ff;
  background: #e8f2ff;
  color: #12457f;
}

.material-checkbox-tag input {
  width: auto;
  margin: 0;
}

.material-form-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  margin-top: 10px;
  background: #fbfdff;
}

.material-form-section.compact {
  padding: 8px 10px;
}

.material-section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 8px;
  cursor: default;
}

details .material-section-title {
  margin-bottom: 0;
  cursor: pointer;
  list-style: none;
}

details .material-section-title::-webkit-details-marker {
  display: none;
}

.material-section-title h3 {
  margin: 0;
  font-size: 13px;
}

.material-section-title p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  max-width: 720px;
}

.material-section-body {
  margin-top: 8px;
}

.material-section-arrow {
  width: 10px;
  height: 10px;
  border-right: 2px solid #6c829c;
  border-bottom: 2px solid #6c829c;
  transform: rotate(45deg);
  margin-top: 6px;
  transition: transform 0.16s ease;
  flex: 0 0 auto;
}

details[open] .material-section-arrow {
  transform: rotate(225deg);
}

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

.material-media-card {
  min-height: 104px;
  border: 1px dashed #b8cbe2;
  border-radius: 12px;
  padding: 10px;
  background:
    linear-gradient(135deg, rgba(11, 108, 255, 0.06), rgba(0, 168, 107, 0.05)),
    #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.material-media-card span,
.material-media-card small {
  color: var(--muted);
  font-size: 11px;
}

.material-media-card b {
  color: #18324f;
  word-break: break-word;
}

.material-upload-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

.material-upload-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.material-upload-head b {
  display: block;
  font-size: 13px;
  color: #18324f;
}

.material-upload-head small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.disabled-like {
  pointer-events: none;
  opacity: 0.6;
}

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

@media (max-width: 1360px) {
  .material-computed-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.material-range-inputs,
.material-dimension-inputs {
  display: grid;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.material-range-inputs {
  grid-template-columns: 1fr auto 1fr;
}

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

.material-range-inputs input,
.material-dimension-inputs input {
  min-width: 0;
}

.material-range-inputs span {
  color: var(--muted);
  font-size: 11px;
}

.score-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

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

.status-reason-trigger {
  margin-left: 6px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline dotted;
  cursor: help;
  padding: 0;
}

.status-reason-trigger:hover,
.status-reason-trigger:focus-visible {
  color: #355271;
  outline: none;
}

.dual-quote-rule-card {
  border: 1px solid #cbd7e5;
  border-left: 4px solid #2f6fa7;
  border-radius: 6px;
  background: #f7fafc;
  padding: 12px;
}

.dual-quote-rule-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.dual-quote-config-card > summary {
  cursor: pointer;
  user-select: none;
}

.dual-quote-config-card[open] > summary {
  margin-bottom: 8px;
}

.post-dual-quote-notice {
  border-left: 4px solid #b85c1e;
}

.reason-tooltip {
  position: fixed;
  z-index: 3000;
  background: #182842;
  color: #eaf2ff;
  border: 1px solid #314968;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.55;
  box-shadow: 0 10px 28px rgba(10, 20, 35, 0.35);
  pointer-events: none;
  white-space: normal;
}

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

  .sidebar {
    padding: 12px;
  }

  .main {
    padding: 12px;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .analysis-filters,
  .analysis-kpi-grid,
  .analysis-profile-head {
    grid-template-columns: 1fr;
  }

  .crm-kpi-grid,
  .crm-workbench-grid,
  .crm-config-grid {
    grid-template-columns: 1fr;
  }

  .edit-pricing-grid {
    grid-template-columns: 1fr;
  }

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

  .decision-record-header {
    flex-direction: column;
  }

  .decision-record-detail-grid {
    grid-template-columns: 1fr;
  }

  .edit-impact-grid {
    grid-template-columns: 1fr;
  }

  .crm-note-preview-item {
    grid-template-columns: 1fr;
    gap: 3px;
    align-items: start;
  }

  .crm-note-preview-attachment {
    justify-self: start;
  }

  .material-toolbar,
  .material-toolbar-actions {
    align-items: stretch;
  }

  .material-inline-filters {
    justify-content: flex-start;
  }

  .material-workbench {
    grid-template-columns: 1fr;
  }

  .material-browser-card {
    position: static;
    max-height: none;
  }

  .material-score-grid.compact,
  .material-computed-grid,
  .material-media-grid {
    grid-template-columns: 1fr;
  }

  .score-row {
    grid-template-columns: 1fr;
  }
}
.dual-quote-progress-card {
  border: 1px solid #cbd7e5;
  border-left: 4px solid #2f6fa7;
  border-radius: 8px;
  background: #f7fafc;
  padding: 12px;
}

.dual-quote-progress-table td,
.dual-quote-progress-table th {
  vertical-align: middle;
}

@media (max-width: 900px) {
  .market-insight-kpis,
  .market-source-grid,
  .market-sales-kpis,
  .market-project-kpis,
  .market-candidate-kpis {
    grid-template-columns: 1fr;
  }

  .market-insight-filter,
  .market-sales-toolbar,
  .market-candidate-filter,
  .market-candidate-evidence-grid {
    grid-template-columns: 1fr;
  }

  .market-candidate-item {
    grid-template-columns: 1fr;
  }

  .market-candidate-brief {
    grid-template-columns: 1fr;
  }

  .market-decision-grid,
  .market-score-detail-grid {
    grid-template-columns: 1fr;
  }

  .market-next-action {
    align-items: flex-start;
    flex-direction: column;
  }

  .market-material-checklist {
    grid-template-columns: 1fr;
  }

  .market-candidate-score,
  .market-candidate-evidence {
    grid-column: 1;
  }

  .market-sync-summary .muted {
    width: 100%;
    margin-left: 0;
  }
}
