/* ============================================================
   海陆联运费用报价单 · 样式
   结构：hero 品牌区 + 填写指引 + 三张卡片（询价 / 船司报价矩阵 / 条款）+ 固定提交栏
   风格：深海军蓝 + 青绿强调色，金融/物流单据质感
   ============================================================ */

:root {
  --navy-950: #071b30;
  --navy-900: #0b2540;
  --navy-800: #10345a;
  --navy-700: #17456f;
  --teal-700: #0b6b64;
  --teal-600: #0f766e;
  --teal-500: #12968b;
  --teal-050: #e6f6f4;
  --blue-600: #1d63c9;
  --blue-050: #eaf2fd;
  --amber-600: #b45309;
  --amber-050: #fdf3e3;
  --ink-900: #10233a;
  --ink-700: #33475c;
  --ink-500: #61758b;
  --ink-400: #8a9bb0;
  --line: #e2e9f1;
  --line-strong: #cfdae7;
  --bg: #eef2f7;
  --card: #ffffff;
  --danger: #d64545;
  --danger-bg: #fdeeee;
  --shadow-sm: 0 1px 2px rgba(13, 38, 64, .05), 0 4px 14px rgba(13, 38, 64, .05);
  --shadow-md: 0 10px 30px rgba(13, 38, 64, .10);
  --shadow-lg: 0 22px 60px rgba(9, 28, 48, .14);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font: "Inter", "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  /* 页面主容器宽度：宽屏自动撑开，给多方案矩阵留出横向空间 */
  --shell: clamp(1120px, 78vw, 2400px);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink-900);
  background:
    radial-gradient(1100px 420px at 8% -200px, rgba(29, 99, 201, .16), transparent 68%),
    radial-gradient(900px 380px at 96% -180px, rgba(18, 150, 139, .15), transparent 64%),
    linear-gradient(180deg, #eef3f9 0%, #f4f7fb 46%, #eef2f7 100%);
  padding-bottom: calc(104px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}

/* ====================== 顶部品牌区 ====================== */
.hero {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(126deg, var(--navy-950) 0%, var(--navy-900) 46%, #123c63 100%);
  color: #fff;
  padding: 30px 0 66px;
}

/* 细网格纹理，增强单据质感 */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, .9), transparent 78%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, .9), transparent 78%);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  width: 620px; height: 620px;
  right: -220px; top: -320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(18, 150, 139, .40), transparent 62%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.brand-mark {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #6fe3d6;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16);
}

.brand-mark svg { width: 26px; height: 26px; }

.brand-text { display: flex; flex-direction: column; gap: 2px; margin-right: auto; }
.brand-name { font-size: 14px; font-weight: 600; letter-spacing: .02em; color: #eaf3fb; }
.brand-en { font-size: 10.5px; letter-spacing: .20em; color: rgba(255, 255, 255, .55); font-weight: 600; }

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(25px, 3.6vw, 36px);
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1.22;
}

.hero-sub {
  margin: 0;
  max-width: 760px;
  font-size: 13.5px;
  line-height: 1.75;
  color: rgba(255, 255, 255, .76);
}
.hero-sub b { color: #ffd7a1; }

.hero-facts {
  list-style: none;
  margin: 22px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-facts li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 15px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .13);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.hero-facts b { font-size: 14px; color: #fff; font-weight: 700; }
.hero-facts span { font-size: 12px; color: rgba(255, 255, 255, .62); }

/* ====================== 填写指引 ====================== */
.guide {
  max-width: var(--shell);
  margin: -38px auto 0;
  padding: 0 24px;
  position: relative;
  z-index: 3;
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.guide-item {
  flex: 1 1 0;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 15px 17px;
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.guide-no {
  flex: none;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--teal-700);
  background: var(--teal-050);
  border-radius: 8px;
  padding: 5px 7px;
  line-height: 1;
}

.guide-item b { display: block; font-size: 13.5px; color: var(--ink-900); margin-bottom: 3px; }
.guide-item p { margin: 0; font-size: 12px; line-height: 1.55; color: var(--ink-500); }

.guide-arrow {
  flex: none;
  align-self: center;
  width: 18px; height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #c3d2e2, #9fb4ca);
  position: relative;
}
.guide-arrow::after {
  content: "";
  position: absolute;
  right: -1px; top: -3px;
  width: 7px; height: 7px;
  border-top: 2px solid #9fb4ca;
  border-right: 2px solid #9fb4ca;
  transform: rotate(45deg);
  border-radius: 1px;
}

/* ====================== 专属链接：复用上周报价 ====================== */
.reuse {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: linear-gradient(120deg, #f1fbf9, #eff4ff);
  border: 1px solid #cfe3e0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.reuse[hidden] { display: none; }

.reuse-main { display: flex; align-items: center; gap: 14px; min-width: 0; }

.reuse-badge {
  flex: none;
  align-self: flex-start;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #0b6b64;
  background: #dcf3ef;
  border: 1px solid #bfe5df;
  border-radius: 8px;
  line-height: 1;
}

.reuse-text { min-width: 0; }
.reuse-text b {
  display: block;
  font-size: 14px;
  color: var(--ink-900);
  margin-bottom: 3px;
}
.reuse-text p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-500);
}

.reuse-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.reuse-note {
  font-size: 12px;
  color: var(--ink-400);
  font-variant-numeric: tabular-nums;
}

.btn-reuse {
  flex: none;
  border: 1px solid #b6dfd8;
  background: linear-gradient(135deg, var(--teal-500), var(--teal-700));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 118, 110, .20);
  transition: all .15s;
  white-space: nowrap;
}
.btn-reuse:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-1px); }
.btn-reuse:disabled {
  cursor: default;
  color: var(--ink-400);
  background: #f2f5f8;
  border-color: var(--line-strong);
  box-shadow: none;
}

/* ====================== 页面与卡片 ====================== */
.page {
  max-width: var(--shell);
  margin: 16px auto 0;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  z-index: 2;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px 24px 24px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--line);
}

.card-title { display: flex; align-items: flex-start; gap: 12px; }

.step {
  flex: none;
  width: 30px; height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
  color: #fff;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--teal-500), var(--navy-700));
  box-shadow: 0 4px 10px rgba(18, 150, 139, .22);
}

.card h2 { margin: 0; font-size: 17.5px; font-weight: 700; color: var(--ink-900); line-height: 1.3; }

.card-desc {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--ink-500);
  line-height: 1.5;
}

.card-legend {
  font-size: 12px;
  color: var(--ink-500);
  background: #f7fafd;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  white-space: nowrap;
}

.req-mark, .star { color: var(--danger); font-weight: 800; }

.rule-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 12px;
  color: var(--ink-500);
}
.rule-legend li { display: inline-flex; align-items: center; gap: 6px; }

.rule-dot {
  width: 16px; height: 16px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  border: 1px dashed var(--line-strong);
  color: var(--ink-400);
  background: #f8fafc;
}
.rule-dot.zero { border: 1px solid #b9cde2; color: var(--navy-700); background: #fff; }
.rule-dot.plan { border: 1px solid #b9cde2; color: var(--teal-700); background: var(--teal-050); font-size: 12px; }

/* ====================== 表单字段 ====================== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
  gap: 16px 18px;
}

/* 询价要素分区 */
.form-grid.section-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.section-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-section + .field-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 11px;
}

.section-head h3 {
  position: relative;
  margin: 0;
  padding-left: 12px;
  font-size: 13px;
  font-weight: 750;
  color: var(--navy-800);
  letter-spacing: .02em;
}

.section-head h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 14px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--teal-500), var(--navy-700));
}

.section-head span { font-size: 11.5px; color: var(--ink-400); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.span-2 { grid-column: span 2; }

.field label {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-700);
  display: flex;
  align-items: center;
  gap: 5px;
  letter-spacing: .01em;
}

.field label .coin {
  font-size: 10px;
  font-weight: 800;
  border-radius: 5px;
  padding: 1.5px 5px;
  letter-spacing: .05em;
}

.coin.rmb { color: var(--blue-600); background: var(--blue-050); }
.coin.usd { color: var(--teal-700); background: var(--teal-050); }
.coin.peso { color: var(--amber-600); background: var(--amber-050); }

.field .hint {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-400);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
  padding: 0 13px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink-900);
  transition: border-color .15s, box-shadow .15s, background .15s;
  appearance: none;
  -webkit-appearance: none;
}

input::placeholder { color: #a7b6c7; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2361758b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
  cursor: pointer;
  text-overflow: ellipsis;
}

input:hover, select:hover { border-color: #b9cadd; background: #fff; }

input:focus, select:focus {
  outline: none;
  border-color: var(--teal-500);
  background: #fff;
  box-shadow: 0 0 0 3.5px rgba(18, 150, 139, .13);
}

input[readonly] {
  background: repeating-linear-gradient(135deg, #f4f7fa, #f4f7fa 8px, #eef2f7 8px, #eef2f7 16px);
  color: var(--ink-500);
  cursor: default;
  border-color: var(--line);
}

input.invalid, select.invalid {
  border-color: var(--danger);
  background: var(--danger-bg);
  box-shadow: 0 0 0 3.5px rgba(214, 69, 69, .11);
}

input[type="date"] { min-height: 42px; }
input[type="time"] { min-height: 42px; }

/* 星期 / 星期区间 / 星期+时间 组合控件 */
.combo { display: flex; align-items: center; gap: 6px; }
.combo > select, .combo > input[type="time"] { flex: 1 1 0; min-width: 0; }
.combo-sep { flex: none; font-size: 12px; color: var(--ink-400); }
input[type="date"]::-webkit-calendar-picker-indicator { opacity: .5; cursor: pointer; }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* 数字框内置单位（如 柜/周）：仅作提示，不参与输入，数值仍是纯数字 */
.unit-wrap { position: relative; display: block; }
.unit-wrap > input { padding-right: 64px; }
.unit-suffix {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--ink-400);
  pointer-events: none;
}

/* ====================== 船公司卡片 ====================== */
.row-list { display: flex; flex-direction: column; gap: 18px; }

.carrier {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: #fff;
  overflow: hidden;
  animation: rowIn .22s ease;
}

@keyframes rowIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.carrier-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 16px;
  padding: 13px 16px 14px;
  background: linear-gradient(90deg, #f2f7fc, #f9fcfe 62%, #f4f9f9);
  border-bottom: 1px solid var(--line);
}

.carrier-id { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }

.carrier-no {
  flex: none;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--navy-700), var(--navy-900));
  border-radius: 7px;
  padding: 4px 9px;
  letter-spacing: .02em;
}

.carrier-note { font-size: 11.5px; color: var(--ink-400); }

.carrier-side { display: flex; align-items: center; gap: 10px; justify-self: end; }
.carrier-total-label { font-size: 11.5px; color: var(--ink-500); }
.carrier-total { font-size: 15px; font-weight: 800; color: var(--navy-800); font-variant-numeric: tabular-nums; }

.btn-del {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-500);
  font-family: inherit;
  font-size: 12.5px;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: all .15s;
}
.btn-del:hover { color: var(--danger); background: var(--danger-bg); border-color: #f3cfcf; }

/* 折叠 / 展开明细按钮 */
.btn-collapse {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--navy-700);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 650;
  padding: 5px 11px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.btn-collapse:hover { border-color: var(--teal-500); color: var(--teal-700); background: var(--teal-050); }

/* 卡片折叠：仅隐藏矩阵数据行，保留表头（方案 / 路线 / 合计）作为紧凑总览 */
.carrier.collapsed .matrix tbody { display: none; }
.carrier.collapsed .matrix-wrap { padding-bottom: 2px; }

.carrier-grid {
  grid-column: 1 / -1;
  display: grid;
  /* 船司卡片头仅剩船公司/航线两项（ETD/ETA 已下沉到方案列） */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.mini-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.mini-field label {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--ink-500);
  display: flex;
  align-items: center;
  gap: 4px;
}

.mini-field input, .mini-field select { height: 38px; font-size: 13.5px; background: #fff; }

/* ====================== 港口方案矩阵 ====================== */
.matrix-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.matrix {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.matrix th, .matrix td { padding: 0; border-bottom: 1px solid #eef3f8; }
.matrix thead th { background: #f7fafd; }

/* 左侧项目列：横向滚动时固定在左侧（左右留出与卡片一致的内边距，不贴边线）*/
.m-label {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 208px;
  min-width: 208px;
  max-width: 208px;
  text-align: left;
  vertical-align: middle;
  background: #fff;
  box-shadow: 1px 0 0 var(--line);
}

/* 必须比 .matrix th 优先级高，否则内边距会被归零、文字贴住边框线 */
.matrix th.m-label { padding: 8px 16px; }

.m-label span { display: block; font-size: 12.5px; font-weight: 650; color: var(--ink-700); }

.m-label em {
  /* 费用说明允许折成最多两行：像「必填（无费用填 0）」这类括注放在一行会被省略号裁掉 */
  display: -webkit-box;
  margin-top: 2px;
  font-style: normal;
  font-size: 11px;
  line-height: 1.45;
  color: var(--ink-400);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
}

.matrix th.m-corner { padding: 9px 16px; text-align: center; }
.m-corner span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink-500);
  font-size: 12px;
  font-weight: 700;
}
.m-corner em { display: block; text-align: center; font-size: 10.5px; }

/* 方案列（横向一个启运港 / 柜型对应一列）：内容居中，同步按钮定位到右下角 */
.m-plan {
  position: relative;
  min-width: 168px;
  padding: 9px 10px 30px;
  text-align: center;
  vertical-align: top;
  border-left: 1px solid var(--line);
}

.plan-head { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }

.plan-no {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--teal-700);
  background: var(--teal-050);
  border-radius: 6px;
  padding: 3px 7px;
}

.plan-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-400);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.plan-del:hover { color: var(--danger); background: var(--danger-bg); }

/* 同步前面方案的下拉（第二个方案起显示）：小尺寸，定位到方案格右下角 */
.plan-sync {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: auto;
  min-width: 0;
  height: 22px;
  padding: 0 18px 0 7px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink-500);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 9 6'%3E%3Cpath d='M1 1l3.5 3.5L8 1' fill='none' stroke='%2361758b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 5px center;
  background-size: 8px 5px;
}
.plan-sync:hover { border-color: var(--teal-500); color: var(--teal-700); background-color: var(--teal-050); }
.plan-sync:focus { outline: none; border-color: var(--teal-500); box-shadow: 0 0 0 2px rgba(18, 150, 139, .15); }

/* 船司卡片头部的同步下拉：复用 .plan-sync 样式，改为行内流式排列 */
.carrier-sync {
  position: static;
  height: 28px;
  padding: 0 20px 0 9px;
  font-size: 12px;
  background-position: right 6px center;
}

.plan-route {
  margin-top: 6px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 750;
  color: var(--ink-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plan-meta {
  margin-top: 1px;
  text-align: center;
  font-size: 11px;
  color: var(--ink-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plan-head-total {
  margin-top: 6px;
  text-align: center;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--navy-800);
  font-variant-numeric: tabular-nums;
}

/* 数据行（加宽左右内边距，让列间彩色留白更宽；悬停不再抹平列底色） */
.m-row td { padding: 6px 12px; vertical-align: middle; }
.m-row:hover .m-label { background-color: #fbfdff; }

/* 方案列分界：相邻列交替淡蓝/稍深底色 + 每列左侧明显竖向分隔线，多方案并排时一眼区分不易看混 */
/* 必须写在 .matrix th 之后并提高优先级（.matrix th 的 padding:0 会把它归零，
   导致底部的“同步”下拉盖住各列合计）*/
.matrix thead th.m-plan { padding: 9px 10px 30px; border-left: 2px solid #b9cde0; }
.matrix thead th.m-plan:nth-child(even) { background: #eaf3fd; }
.matrix thead th.m-plan:nth-child(odd) { background: #d3e5f6; }
.matrix tbody tr.m-row td { border-left: 2px solid #b9cde0; }
.matrix tbody tr.m-row td:nth-child(even) { background: #f6fbff; }
.matrix tbody tr.m-row td:nth-child(odd) { background: #dcebf9; }
.matrix tbody tr.m-group th { border-left: 2px solid #b9cde0; }
/* 总计行保持深色渐变，仅用半透明分隔线与上方列对齐 */
.matrix tbody tr.m-total td { border-left: 2px solid rgba(255, 255, 255, .30); }

input.m-input, select.m-input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 9px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink-900);
  transition: border-color .15s, box-shadow .15s;
}

input.m-input:hover, select.m-input:hover { border-color: #c3d2e2; background: #fff; }

input.m-input:focus, select.m-input:focus {
  outline: none;
  border-color: var(--teal-500);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(18, 150, 139, .12);
}

input.m-input.invalid, select.m-input.invalid {
  border-color: var(--danger);
  background: var(--danger-bg);
  box-shadow: 0 0 0 3px rgba(214, 69, 69, .10);
}

select.m-input {
  padding-right: 28px;
  background-position: right 9px center;
  background-size: 10px 7px;
}

input[type="date"].m-input { min-height: 34px; }
input[type="number"].m-input::placeholder { color: #c3cfdb; }

/* 多选控件（目的地等）：按钮 + 挂到 body 上的复选框菜单（避免被矩阵滚动容器裁剪） */
.ms { position: relative; }
.ms-btn {
  position: relative;
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 26px 0 9px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink-900);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.ms-btn::after {
  content: '▾';
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--ink-400);
}
.ms-btn:hover { border-color: #c3d2e2; }
.ms-btn:focus { outline: none; border-color: var(--teal-500); box-shadow: 0 0 0 3px rgba(18, 150, 139, .12); }
.ms-btn.open { border-color: var(--teal-500); box-shadow: 0 0 0 3px rgba(18, 150, 139, .12); }
.ms-ph { color: #c3cfdb; }
.ms.invalid .ms-btn { border-color: var(--danger); background: var(--danger-bg); box-shadow: 0 0 0 3px rgba(214, 69, 69, .10); }

.ms-menu {
  position: fixed;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  max-height: 340px;
  overflow-y: auto;
  /* 菜单滚到顶/底时不要把滚动续给页面：否则页面一滚，菜单就被收起 */
  overscroll-behavior: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(16, 38, 68, .16);
}
.ms-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--ink-900);
  cursor: pointer;
}
.ms-item:hover { background: var(--teal-050); }
.ms-item input { width: 15px; height: 15px; accent-color: var(--teal-500); cursor: pointer; }
.ms-clear {
  margin-top: 4px;
  padding: 6px 9px;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  font-family: inherit;
  font-size: 12px;
  color: var(--ink-400);
  text-align: left;
  cursor: pointer;
}
.ms-clear:hover { color: var(--danger); }

/* 多选手填新增（如船公司不在预设列表里）：吸在菜单底部，滚动时始终可点到 */
.ms-add {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 6px;
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.ms-add input {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink-900);
}
.ms-add input:focus { outline: none; border-color: var(--teal-500); box-shadow: 0 0 0 3px rgba(18, 150, 139, .12); }
.ms-add button {
  height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: 7px;
  background: var(--teal-500);
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}
.ms-add button:hover { filter: brightness(.94); }

/* 分组小标题的折叠按钮：只隐藏该组数据行，标题始终可见 */
.m-group th .grp-toggle {
  float: right;
  margin: -2px 0 0 10px;
  padding: 2px 8px;
  border: 1px solid rgba(23, 60, 105, .18);
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  font-family: inherit;
  font-size: 11px;
  color: inherit;
  cursor: pointer;
}
.m-group th .grp-toggle:hover { background: #fff; border-color: rgba(23, 60, 105, .34); }
.matrix tr.grp-hidden { display: none; }

/* 分组行 */
.m-group th {
  padding: 8px 16px;
  text-align: left;
  background: #f3f8fc;
  border-top: 1px solid var(--line);
  font-size: 12px;
  font-weight: 750;
  color: var(--navy-800);
  letter-spacing: .02em;
}

.m-group th .group-icon {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 7px;
  vertical-align: -5px;
  background: #e8f0f8;
  color: var(--navy-700);
}
.m-group th .group-icon svg { width: 13px; height: 13px; }
.m-group th .coin { margin-left: 8px; }

.m-group th em {
  margin-left: 10px;
  font-style: normal;
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-400);
}

.m-group[data-kind="rmb"] th { background: #eef4fd; color: #1b4f9c; }
.m-group[data-kind="usd"] th { background: #ebf7f5; color: var(--teal-700); }
.m-group[data-kind="peso"] th { background: #fdf6e9; color: var(--amber-600); }
.m-group[data-kind="service"] th { background: #f2f5f9; color: var(--ink-700); }

/* 分组标题行拆成：左侧标题列（sticky，带折叠按钮）+ 每个方案一格小计，
   折叠后标题行仍可见，所以该组金额始终看得到 */
.m-group th.mg {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
}
.m-group th.mg .mg-main {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.m-group th.mg .mg-main .group-icon { margin-right: 0; flex: none; }
.m-group th.mg .mg-main b {
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.m-group th.mg .grp-toggle { float: none; margin: 0; flex: none; }

.m-group td.g-sum {
  padding: 7px 12px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
  color: var(--ink-500);
}
.matrix tbody tr.m-group td.g-sum { border-left: 1px solid rgba(23, 60, 105, .10); }
.m-group[data-kind="base"] td.g-sum { background: #f3f8fc; }
.m-group[data-kind="rmb"] td.g-sum { background: #eef4fd; color: #1b4f9c; }
.m-group[data-kind="usd"] td.g-sum { background: #ebf7f5; color: var(--teal-700); }
.m-group[data-kind="peso"] td.g-sum { background: #fdf6e9; color: var(--amber-600); }
.m-group[data-kind="service"] td.g-sum { background: #f2f5f9; }

/* 总计行（按方案横向展示） */
.m-total th.m-label {
  padding: 10px 16px;
  background: var(--navy-900);
  color: #d7f5f1;
  font-weight: 700;
  box-shadow: none;
}
.m-total th.m-label span { color: #d7f5f1; font-weight: 700; }
.m-total th.m-label em { color: rgba(215, 245, 241, .62); }

.m-total td {
  padding: 9px 10px;
  border-left: 1px solid rgba(255, 255, 255, .12);
  background: linear-gradient(120deg, var(--navy-900), #123f66 68%, #0e4a55);
}

.plan-total {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
  text-shadow: 0 2px 10px rgba(111, 227, 214, .24);
}

/* 卡片底部：添加方案 */
.carrier-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 11px 16px;
  background: #fafcfe;
  border-top: 1px solid var(--line);
}

.plan-add {
  height: 38px;
  padding: 0 16px;
  border: 1.5px dashed #b3c9e0;
  border-radius: 9px;
  background: #fff;
  color: var(--navy-700);
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: all .16s;
}
.plan-add:hover { border-color: var(--teal-500); color: var(--teal-700); background: var(--teal-050); }

.foot-hint { font-size: 11.5px; color: var(--ink-400); }

/* 添加船公司按钮 */
.btn-add {
  margin-top: 16px;
  width: 100%;
  height: 48px;
  border: 1.5px dashed #b3c9e0;
  border-radius: var(--radius-md);
  background: #f7fafd;
  color: var(--navy-700);
  font-family: inherit;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all .16s;
}
.btn-add:hover { border-color: var(--teal-500); color: var(--teal-700); background: var(--teal-050); }
.btn-add-icon { font-size: 17px; line-height: 1; }

/* ====================== 条款 ====================== */
.notes-card { background: linear-gradient(180deg, #fff, #fbfcfe); }

.notes {
  margin: 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  color: var(--ink-700);
  font-size: 13px;
  line-height: 1.72;
}
.notes li::marker { color: var(--teal-500); font-weight: 800; }

/* ====================== 底部提交栏 ====================== */
.submit-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px max(24px, calc((100vw - var(--shell)) / 2 + 24px));
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px rgba(13, 38, 64, .08);
}

.submit-summary { display: flex; flex-direction: column; gap: 2px; }
.sum-line { font-size: 12px; color: var(--ink-500); }
.sum-line b { color: var(--ink-900); font-variant-numeric: tabular-nums; }
.sum-line .dot { margin: 0 6px; color: #c3cfdb; }
#req-progress { color: var(--amber-600); }
#req-progress.done { color: var(--teal-600); }

.sum-total { display: flex; align-items: baseline; gap: 8px; }
.sum-label { font-size: 12px; color: var(--ink-500); }
#grand-total {
  font-size: 22px;
  font-weight: 800;
  color: var(--navy-900);
  letter-spacing: .01em;
}
.sum-unit { font-size: 11px; font-weight: 700; color: var(--ink-400); letter-spacing: .08em; }

.btn-submit {
  height: 48px;
  min-width: 178px;
  padding: 0 32px;
  border: none;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--teal-500), var(--teal-700) 70%, var(--navy-800));
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 750;
  letter-spacing: .08em;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(15, 118, 110, .28);
  transition: transform .12s, box-shadow .12s, opacity .15s;
}
.btn-submit:hover { transform: translateY(-1px); box-shadow: 0 13px 28px rgba(15, 118, 110, .36); }
.btn-submit:active { transform: translateY(0); }
.btn-submit:disabled { opacity: .62; cursor: not-allowed; transform: none; box-shadow: none; }

/* ====================== Toast ====================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 112px;
  transform: translateX(-50%) translateY(8px);
  z-index: 60;
  max-width: min(580px, calc(100vw - 48px));
  background: #14273b;
  color: #eef5fb;
  font-size: 13.5px;
  line-height: 1.6;
  padding: 12px 18px;
  border-radius: 11px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: #7f1d1d; }

/* ====================== 成功弹窗 ====================== */
.mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(8, 22, 37, .52);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.mask[hidden] { display: none; }

.dialog {
  width: min(450px, 100%);
  background: #fff;
  border-radius: 22px;
  padding: 30px 28px 24px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: dialogIn .24s cubic-bezier(.2, .9, .3, 1.2);
}

@keyframes dialogIn {
  from { opacity: 0; transform: scale(.94) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.dialog-check svg { width: 58px; height: 58px; }
.dialog-check circle { stroke: var(--teal-500); stroke-width: 2.6; }
.dialog-check path {
  stroke: var(--teal-500); stroke-width: 3.4;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 40; stroke-dashoffset: 40;
  animation: checkDraw .45s .12s ease forwards;
}

@keyframes checkDraw { to { stroke-dashoffset: 0; } }

.dialog h3 { margin: 12px 0 6px; font-size: 19px; color: var(--ink-900); }
.dialog-sub { margin: 0 0 16px; font-size: 13px; color: var(--ink-500); line-height: 1.6; }

.dialog-info {
  text-align: left;
  background: #f7fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 15px;
  font-size: 12.5px;
  color: var(--ink-700);
  line-height: 1.95;
  display: flex;
  flex-direction: column;
}
.dialog-info b { color: var(--ink-900); font-variant-numeric: tabular-nums; }

.dialog-actions { display: flex; gap: 10px; margin-top: 20px; }
.dialog-actions button {
  flex: 1;
  height: 43px;
  border-radius: 11px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  transition: all .15s;
}

.btn-ghost { border: 1px solid var(--line-strong); background: #fff; color: var(--ink-700); }
.btn-ghost:hover { border-color: #b9cadd; background: #f7fafc; }

.btn-primary {
  border: none;
  background: linear-gradient(135deg, var(--teal-500), var(--teal-700));
  color: #fff;
  box-shadow: 0 8px 18px rgba(15, 118, 110, .24);
}
.btn-primary:hover { filter: brightness(1.05); }

/* ====================== 加载失败 ====================== */
.load-error {
  max-width: 520px;
  margin: 18vh auto 0;
  padding: 0 24px;
  text-align: center;
  font-family: var(--font);
}
.load-error h2 { font-size: 18px; color: var(--ink-900); margin-bottom: 8px; }
.load-error p { font-size: 13px; color: var(--ink-500); line-height: 1.7; }

/* ====================== 响应式 ====================== */
@media (max-width: 900px) {
  .guide { flex-direction: column; gap: 10px; }
  .guide-arrow { display: none; }
  .form-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
  .form-grid.section-cols-2,
  .form-grid.section-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .carrier-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .m-label { width: 172px; min-width: 172px; max-width: 172px; }
}

@media (max-width: 640px) {
  body { font-size: 13.5px; padding-bottom: calc(132px + env(safe-area-inset-bottom)); }

  .hero { padding: 24px 0 56px; }
  .hero-inner { padding: 0 16px; }
  .hero-facts li { padding: 8px 12px; }
  .hero-facts b { font-size: 13px; }
  .brand { margin-bottom: 18px; }

  .guide { padding: 0 12px; margin-top: -34px; }
  .guide-item { padding: 13px 14px; }

  /* 专属通道：窄屏下按钮换行铺满，避免和说明文字挤成一行 */
  .reuse { padding: 12px 14px; gap: 10px; }
  .reuse-main { gap: 10px; }
  .reuse-text b { font-size: 13.5px; }
  .reuse-text p { font-size: 12px; }
  .reuse-actions { width: 100%; justify-content: space-between; }
  .btn-reuse { flex: 1 1 100%; text-align: center; padding: 11px 14px; }

  .page { padding: 0 12px; margin-top: 12px; gap: 13px; }
  .card { padding: 17px 14px 18px; border-radius: 16px; }
  .card-head { margin-bottom: 14px; padding-bottom: 12px; gap: 10px; }
  .card h2 { font-size: 16.5px; }
  .step { width: 28px; height: 28px; }

  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
  .field.span-2 { grid-column: span 2; }

  input[type="text"], input[type="number"], input[type="date"], input[type="time"], select {
    height: 46px;
    font-size: 16px; /* 防止 iOS 聚焦自动放大 */
  }

  .field .hint { font-size: 11px; }
  .field-section + .field-section { margin-top: 15px; padding-top: 13px; }
  .section-head { margin-bottom: 9px; gap: 6px; }
  .section-head span { display: none; }

  .carrier { border-radius: 12px; }
  .carrier-head { padding: 12px 12px 13px; gap: 9px 12px; }
  .carrier-note { display: none; }
  .carrier-total-label { display: none; }
  .carrier-grid { gap: 9px 10px; }
  .mini-field input, .mini-field select { height: 42px; font-size: 15px; }

  .m-label { width: 128px; min-width: 128px; max-width: 128px; }
  .matrix th.m-label { padding: 6px 10px; }
  .m-label span { font-size: 12px; }
  .m-label em { display: none; }
  .m-corner em { display: none; }
  .m-plan { min-width: 152px; }
  .matrix thead th.m-plan { padding: 8px 8px 30px; }
  .plan-sync { height: 24px; font-size: 11px; }
  .m-row td { padding: 3px 6px; }
  input.m-input, select.m-input { height: 40px; font-size: 15px; }
  .carrier-foot { padding: 10px 12px; gap: 10px; }
  .foot-hint { display: none; }
  .plan-add { height: 40px; flex: 1 1 auto; }

  .submit-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 9px;
    padding: 10px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
  .submit-summary { flex-direction: column; align-items: center; gap: 1px; }
  .sum-line { text-align: center; }
  .sum-total { justify-content: center; }
  #grand-total { font-size: 20px; }
  .btn-submit { width: 100%; height: 48px; }
  .toast { bottom: 158px; }
}

@media (max-width: 400px) {
  .form-grid,
  .form-grid.section-cols-2,
  .form-grid.section-cols-3 {
    grid-template-columns: minmax(0, 1fr);
  }
  .field.span-2 { grid-column: span 1; }
  .carrier-grid { grid-template-columns: minmax(0, 1fr); }
}

@media print {
  .submit-bar, .btn-add, .btn-del, .plan-add, .plan-del, .guide,
  .hero::before, .hero::after { display: none !important; }
  body { background: #fff; padding-bottom: 0; }
  .card, .carrier { box-shadow: none; }
  .matrix-wrap { overflow: visible; }
  .m-total td { background: #f2f6fa; }
  .plan-total { color: var(--ink-900); text-shadow: none; }
}
