/* HBDTECH Official Theme Styling for PLC Solution & Quote Tool
   Consistent with HBDTECH website layout, color scheme (#005ca1 Blue & #f26520 Orange), and typography */

:root {
  --blue: #005ca1;
  --blue-hover: #004c85;
  --blue-light: #eef6fc;
  --orange: #f26520;
  --orange-hover: #d95314;
  --orange-light: #fff7ed;
  --line: #e2e8f0;

  --brand: #005ca1;
  --brand-hover: #004c85;
  --brand-light: #eef6fc;
  --emerald: #059669;
  --emerald-hover: #047857;
  --amber: #d97706;
  --purple: #7c3aed;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
}

/* Scoped Workspace Container */
.plc-quote-workspace, .plc-quote-workspace * {
  box-sizing: border-box;
}

.plc-quote-workspace {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--slate-800);
  line-height: 1.5;
  font-size: 14px;
}

.plc-quote-workspace .wrap {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 10px 0 30px;
}

/* Top Tool Profile Header Card */
.tool-profile {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  padding: 22px 26px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0, 92, 161, 0.04);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.profile-info {
  flex: 1;
  min-width: 280px;
}

.profile-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--blue);
  background: var(--blue-light);
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.profile-info h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--slate-900);
  margin: 0 0 6px;
  line-height: 1.3;
}

.profile-info p {
  font-size: 13.5px;
  color: var(--slate-600);
  line-height: 1.6;
  margin: 0;
}

.profile-lang {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-lang .lang-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-600);
}

.profile-lang select.lang-select {
  border: 1.5px solid var(--blue);
  border-radius: 6px;
  background-color: #fff;
  padding: 6px 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--blue);
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
}

.profile-lang select.lang-select:hover {
  background-color: var(--blue-light);
}

/* Primary CTA Button - HBDTECH Signature Orange */
.btn-primary {
  background-color: var(--orange) !important;
  border-color: var(--orange) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(242, 101, 32, 0.25) !important;
  font-weight: 700 !important;
  transition: all 0.2s ease !important;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--orange-hover) !important;
  border-color: var(--orange-hover) !important;
  box-shadow: 0 4px 14px rgba(242, 101, 32, 0.35) !important;
  transform: translateY(-1px);
}

.btn-primary:disabled {
  background-color: var(--slate-300) !important;
  border-color: var(--slate-300) !important;
  box-shadow: none !important;
  transform: none !important;
}

/* Add Button */
.btn-add {
  color: var(--blue) !important;
  background: var(--blue-light) !important;
  border: 1px dashed var(--blue) !important;
  transition: all 0.15s ease;
}

.btn-add:hover {
  background: #dbeafe !important;
  color: var(--blue-hover) !important;
}

/* Delivery Mode Active Card */
.delivery-card.active {
  border-color: var(--blue) !important;
  background: #f0f7fd !important;
  box-shadow: 0 4px 14px rgba(0, 92, 161, 0.12) !important;
}

.delivery-card.active .delivery-badge {
  background: var(--blue) !important;
  color: #fff !important;
}

/* Points Total Highlight */
.pb-total {
  color: var(--blue) !important;
}

/* Quote Card Highlights */
.quote-card {
  border: 2px solid var(--blue) !important;
}

.quote-card .q-badge {
  background: var(--blue-light) !important;
  color: var(--blue) !important;
}

.quote-card .q-amount {
  color: var(--orange) !important;
}

/* Tag Badges Hover */
.tag:hover {
  border-color: var(--blue) !important;
  color: var(--blue) !important;
  background: var(--blue-light) !important;
}

/* Input Focus States */
input[type="text"]:focus, input[type="tel"]:focus, input[type="password"]:focus, textarea:focus, select:focus {
  border-color: var(--blue) !important;
  box-shadow: 0 0 0 3px rgba(0, 92, 161, 0.15) !important;
}

/* ---------- 统一卡片体系 ---------- */
.card {
  background-color: #fff;
  border-radius: 16px;
  border: 1px solid var(--slate-200);
  padding: 20px 20px 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}

@media (min-width: 640px) {
  .card {
    padding: 24px 28px;
  }
}

/* 步骤头部 */
.step-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.step-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--slate-900);
  line-height: 1.3;
}

.no {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.no-blue { background-color: var(--brand); }
.no-emerald { background-color: var(--emerald); }
.no-amber { background-color: var(--amber); }
.no-purple { background-color: var(--purple); }
.no-slate { background-color: var(--slate-600); }
.no-ai { background: linear-gradient(135deg, var(--purple), var(--brand)); font-size: 15px; }

.tip {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--slate-500);
  line-height: 1.45;
}

/* 子分组 */
.signal-group {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}

.signal-group:last-child {
  margin-bottom: 0;
}

.sub-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.sub-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--slate-800);
}

.sub-hint {
  font-size: 12px;
  color: var(--slate-500);
  font-weight: normal;
}

/* ---------- 字段表单 ---------- */
.field {
  margin-bottom: 14px;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 6px;
}

.field label em {
  color: #ef4444;
  font-style: normal;
  margin-left: 2px;
}

.field input[type="text"],
.field input[type="tel"],
.field input[type="email"],
.field input[type="number"],
.field textarea,
#logic,
.ai-card textarea,
.ai-card input {
  width: 100%;
  border: 1px solid var(--slate-300);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--slate-900);
  transition: all 0.15s ease;
}

.field textarea, #logic, .ai-card textarea {
  resize: vertical;
  line-height: 1.5;
}

.field input::placeholder,
.field textarea::placeholder,
#logic::placeholder,
.ai-card textarea::placeholder,
.ai-card input::placeholder {
  color: var(--slate-400);
}

.field input:focus,
.field textarea:focus,
#logic:focus,
.ai-card textarea:focus,
.ai-card input:focus,
.row input:focus,
.row select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.12);
}

.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 480px) {
  .two {
    grid-template-columns: 1fr;
  }
}

/* ---------- 动态行 ---------- */
.rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  padding: 8px 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.chip {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  border-radius: 6px;
  padding: 4px 8px;
  letter-spacing: 0.5px;
}

.chip-DI { background: var(--emerald); }
.chip-AI { background: var(--brand); }
.chip-DO { background: var(--amber); }
.chip-AO { background: var(--purple); }

.row input,
.row select {
  flex: 1 1 140px;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--slate-300);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--slate-900);
}

.row select {
  flex: 1 1 160px;
}

.del {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  background: #fff;
  color: var(--slate-400);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.del:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #ef4444;
}

/* 统一添加行按钮 */
.btn-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 38px;
  margin-top: 10px;
  border: 1.5px dashed var(--slate-300);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-600);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-add:hover {
  border-color: var(--brand);
  background: var(--brand-light);
  color: var(--brand);
}

/* ---------- 统一按钮规范 ---------- */
.submit-wrap {
  margin-top: 24px;
}

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(26, 86, 219, 0.25);
  transition: all 0.15s ease;
}

.btn-primary:hover {
  background: var(--brand-hover);
  box-shadow: 0 4px 12px rgba(26, 86, 219, 0.35);
}

.btn-primary:active {
  transform: scale(0.99);
}

.btn-block {
  width: 100%;
  padding: 14px 20px;
}

.btn-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--slate-300);
  border-radius: 14px;
  background: #fff;
  color: var(--slate-700);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-ghost:hover {
  background: var(--slate-50);
  border-color: var(--slate-400);
}

.msg {
  min-height: 20px;
  font-size: 13px;
  color: #ef4444;
  text-align: center;
  margin: 10px 0 0;
  font-weight: 500;
}

/* ---------- ✨ AI 一句话生成 ---------- */
.ai-card {
  border-color: #ddd6fe;
  background: linear-gradient(180deg, #faf5ff 0%, #fff 45%);
}

.ai-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.ai-card .btn-primary {
  padding: 10px 20px;
  font-size: 14px;
  border-radius: 12px;
}

.ai-card .btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ai-btn-ghost {
  padding: 10px 16px;
  font-size: 14px;
  border-radius: 12px;
}

.ai-btn-ghost:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ai-msg {
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-500);
  min-height: 20px;
}

.ai-msg.ok { color: var(--emerald); }
.ai-msg.err { color: #ef4444; }

.ai-qa {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 14px;
  margin-top: 14px;
}

.ai-qa-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--slate-800);
  margin-bottom: 8px;
}

.ai-q-list {
  margin: 0 0 12px;
  padding-left: 20px;
}

.ai-q-list li {
  font-size: 14px;
  color: var(--slate-700);
  line-height: 1.6;
  margin-bottom: 4px;
}

.ai-qa textarea {
  font-size: 14px;
}

.ai-login-tip {
  margin: 0 0 10px;
  font-size: 13.5px;
  color: var(--slate-600);
}

.ai-login-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ai-login-form input {
  height: 42px;
  font-size: 15px;
}

@media (max-width: 480px) {
  .ai-login-form {
    grid-template-columns: 1fr;
  }
}

/* ---------- 提交完成卡片 ---------- */
.okCard {
  text-align: center;
  padding: 36px 20px;
}

.ok-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #dcfce7;
  color: var(--emerald);
  font-size: 32px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ok-title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 800;
  color: var(--slate-900);
}

.rid {
  margin: 0;
  font-size: 14px;
  font-family: monospace;
  color: var(--slate-500);
  font-weight: 600;
}

.sync {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--emerald);
  font-weight: 600;
}

.contact-box {
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-radius: 12px;
  padding: 16px;
  margin: 20px 0;
}

.contact-label {
  margin: 0 0 8px;
  font-size: 13px;
  color: #92400e;
  font-weight: 500;
}

.tel {
  display: inline-block;
  font-size: 20px;
  font-weight: 800;
  color: #b45309;
  text-decoration: none;
  letter-spacing: 0.5px;
}

.pdfTip {
  margin: 12px 0 16px;
  font-size: 12px;
  color: var(--slate-500);
}

/* ---------- 要求快捷标签 ---------- */
.tagbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.tag {
  border: 1px dashed var(--slate-300);
  background: #fff;
  color: var(--slate-600);
  font-size: 12.5px;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.tag:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-light);
}

/* ---------- 行内数量 ---------- */
.row input.qty {
  flex: 0 0 64px;
  width: 64px;
  text-align: center;
  padding: 0 4px;
  font-weight: 600;
}

/* ---------- 点数汇总 ---------- */
.points-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 4px 0 16px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--slate-200);
  font-size: 13.5px;
  color: var(--slate-600);
}

.points-bar.has-points {
  border-color: #bfdbfe;
  background: var(--brand-light);
}

.pb-title {
  font-weight: 700;
  color: var(--slate-700);
}

.pb-item b {
  font-size: 15px;
  color: var(--slate-900);
}

.pb-di b { color: var(--emerald); }
.pb-ai b { color: var(--brand); }
.pb-do b { color: var(--amber); }
.pb-ao b { color: var(--purple); }

.pb-total {
  margin-left: auto;
  font-weight: 700;
  color: var(--brand);
}

.pb-total b {
  font-size: 18px;
}

.pb-empty {
  color: var(--slate-400);
}

/* ---------- 交付模式卡片 ---------- */
.no-indigo { background-color: #4f46e5; }

.delivery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 640px) {
  .delivery-grid { grid-template-columns: 1fr; }
}

.delivery-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1.5px solid var(--slate-200);
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s;
}

.delivery-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.delivery-card:hover {
  border-color: #a5b4fc;
}

.delivery-card.is-active {
  border-color: #4f46e5;
  background: #eef2ff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.dc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.dc-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--slate-900);
}

.dc-badge {
  font-size: 10.5px;
  font-weight: 700;
  color: #4f46e5;
  background: #e0e7ff;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

.dc-desc {
  font-size: 12.5px;
  color: var(--slate-600);
  line-height: 1.5;
}

.dc-list {
  font-size: 11.5px;
  color: var(--slate-500);
  line-height: 1.5;
}

/* ---------- 完成页：报价卡与操作 ---------- */
.ok-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.ok-actions .btn-primary,
.ok-actions .btn-ghost {
  padding: 13px 20px;
  text-decoration: none;
}

.quote-card {
  text-align: left;
  margin: 18px 0 4px;
  border: 1px solid #bfdbfe;
  background: linear-gradient(180deg, #f8fbff 0%, #fff 60%);
  border-radius: 14px;
  padding: 16px 18px;
}

.q-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.q-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--slate-600);
  letter-spacing: 0.3px;
}

.q-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-light);
  border-radius: 999px;
  padding: 3px 10px;
}

.q-amount {
  font-size: 34px;
  font-weight: 900;
  color: var(--brand);
  line-height: 1.2;
  margin: 4px 0 2px;
  letter-spacing: -0.5px;
}

.q-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 12.5px;
  color: var(--slate-500);
}

.q-warn {
  margin: 10px 0 0;
  padding: 8px 10px;
  font-size: 12.5px;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-radius: 8px;
}

.q-lines {
  margin-top: 12px;
  border-top: 1px dashed var(--slate-200);
  padding-top: 8px;
}

.q-line {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--slate-600);
  padding: 4px 0;
}

.q-line b {
  color: var(--slate-800);
}

.q-config {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.q-config-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--slate-500);
  margin-right: 2px;
}

.q-chip {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--slate-700);
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  padding: 3px 8px;
}

.q-note {
  margin: 12px 0 0;
  font-size: 11.5px;
  color: var(--slate-400);
  line-height: 1.5;
}

.q-offline {
  margin: 0;
  font-size: 13px;
  color: #92400e;
}

.proposal-box {
  margin-top: 14px;
  padding: 14px;
  border: 1px dashed var(--slate-300);
  border-radius: 12px;
  background: var(--slate-50);
  text-align: left;
}

.proposal-box .tip {
  margin: 0 0 10px;
}

.proposal-row {
  display: flex;
  gap: 8px;
}

.proposal-row input {
  flex: 1;
  min-width: 0;
  height: 42px;
  border: 1px solid var(--slate-300);
  border-radius: 10px;
  padding: 0 12px;
  font-size: 15px;
  font-family: inherit;
}

.proposal-row .btn-primary {
  padding: 0 18px;
  font-size: 14px;
  border-radius: 10px;
  white-space: nowrap;
}

/* 手机端行布局：有类型选择的分两行（名称 / 类型+数量+删除），无类型的一行放下 */
@media (max-width: 560px) {
  .row {
    flex-wrap: wrap;
    gap: 6px;
  }

  .row input.name {
    flex: 1 1 100%;
    order: 1;
  }

  /* 有类型下拉的行：徽标与名称同一行，第二行放类型/数量/删除 */
  .row:not(.row--no-type) input.name {
    flex: 1 1 calc(100% - 56px);
  }

  .row select {
    flex: 1 1 120px;
    order: 2;
  }

  .row input.qty {
    flex: 0 0 52px;
    width: 52px;
    order: 3;
  }

  .row .del {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    order: 4;
  }

  .row.row--no-type input.name {
    flex: 1 1 90px;
  }

  .row.row--no-type input.qty { order: 2; }
  .row.row--no-type .del { order: 3; }
}

/* 打印支持 */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .wrap { max-width: 100%; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

