:root {
  --blue: #2b5aa0;
  --blue-dark: #1d4178;
  --red: #d92b2b;
  --ink: #1c2430;
  --muted: #68738280;
  --line: #e3e8ef;
  --bg: #f4f6f9;
  --card: #ffffff;
  --ok: #188a52;
  --warn: #b7791f;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 16px rgba(16,24,40,.06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Manrope', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}
h1, h2, h3, .display { font-family: 'Space Grotesk', 'Manrope', sans-serif; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
a { color: var(--blue); }

/* ---------- auth ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; gap: 48px;
  background: #060b16;
  padding: 40px 6vw; position: relative; overflow: hidden;
}
.auth-wrap::before {
  content: ''; position: absolute; inset: -48px;
  background: url('assets/login-bg.png') center / cover no-repeat;
  filter: blur(11px) brightness(.5) saturate(1.05);
  transform: scale(1.06);
}
.auth-wrap::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(3,7,16,.78) 0%, rgba(3,7,16,.42) 48%, rgba(3,7,16,.6) 100%);
}
.auth-card, .auth-hero, .auth-foot { position: relative; z-index: 1; }
.auth-card {
  width: 420px; flex: 0 0 420px; max-width: 100%; background: var(--card); border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,.45); padding: 36px 34px; animation: rise .45s ease both;
}
.auth-hero { flex: 1; max-width: 640px; margin-left: auto; color: #fff; animation: rise .6s .1s ease both; }
.auth-hero .ah-eyebrow {
  font-size: 13px; letter-spacing: .35em; color: #a5c6f2; font-weight: 700; margin-bottom: 18px;
  text-shadow: 0 1px 8px rgba(0,0,0,.6); animation: rise .5s .15s ease both;
}
.auth-hero .ah-title {
  font-size: 44px; font-weight: 800; line-height: 1.2; color: #fff;
  text-shadow: 0 2px 14px rgba(0,0,0,.65);
  font-family: 'Manrope', 'Microsoft YaHei', sans-serif; animation: rise .5s .3s ease both;
}
.auth-hero .ah-title .red { color: #ff4d4d; }
.auth-hero .ah-bar { width: 34px; height: 4px; background: #ff4d4d; margin: 20px 0 22px; animation: rise .5s .45s ease both; }
.auth-hero .ah-zh {
  font-size: 22px; line-height: 1.6; color: #ffffff; font-weight: 700; margin-bottom: 18px;
  text-shadow: 0 1px 10px rgba(0,0,0,.7); animation: rise .5s .6s ease both;
}
.auth-hero .ah-type {
  font-size: 15.5px; line-height: 1.75; color: #cfdcf0; min-height: 82px; white-space: pre-line;
  text-shadow: 0 1px 8px rgba(0,0,0,.7);
}
.auth-hero .ah-type::after { content: '▍'; color: #7ea6e0; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.auth-hero .ah-feats { display: flex; gap: 44px; margin-top: 34px; animation: rise .5s .8s ease both; }
.auth-hero .ah-feat { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.auth-hero .ah-ico {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  color: #6fa5ea; border: 1px solid rgba(111,165,234,.45); border-radius: 10px;
  box-shadow: 0 0 14px rgba(43,90,160,.35) inset;
}
.auth-hero .ah-ico svg { width: 24px; height: 24px; }
.auth-hero .ah-feat b { font-size: 14.5px; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.auth-hero .ah-feat i { font-style: normal; font-size: 12px; color: #b9c9e2; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.rem-row { margin: 2px 0 14px; }
.rem-row label { display: flex; align-items: center; gap: 7px; font-size: 13px; color: #5b6675; cursor: pointer; }
.rem-row input { width: 15px; height: 15px; accent-color: var(--blue); cursor: pointer; }
.auth-foot {
  position: absolute; right: 22px; bottom: 14px; font-size: 11.5px; color: #7d8ba0;
}
.auth-foot a { color: inherit; text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; color: #a9bcd6; }
@media (max-width: 980px) {
  .auth-wrap { flex-direction: column; align-items: center; gap: 28px; padding: 32px 20px 56px; }
  .auth-hero { margin-left: 0; order: -1; max-width: 520px; }
  .auth-hero .ah-title { font-size: 30px; }
  .auth-hero .ah-zh { font-size: 17px; }
  .auth-card { flex: 0 0 auto; width: 100%; max-width: 440px; }
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.auth-logo { display: flex; justify-content: center; margin-bottom: 8px; }
.auth-logo img { height: 54px; }
.auth-card h1 { text-align: center; font-size: 20px; margin: 10px 0 4px; letter-spacing: .2px; }
.auth-sub { text-align: center; color: #687382; margin-bottom: 22px; font-size: 13px; }
.auth-tabs { display: flex; background: #eef1f6; border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.auth-tabs button {
  flex: 1; border: 0; background: transparent; padding: 9px 0; border-radius: 8px;
  font-weight: 600; color: #5b6675; font-size: 13.5px;
}
.auth-tabs button.on { background: #fff; color: var(--blue); box-shadow: 0 1px 4px rgba(16,24,40,.12); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: #42506242; color: #425062; margin-bottom: 6px; }
.field input, .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px;
  outline: none; transition: border .15s, box-shadow .15s; background: #fff;
}
.field input:focus, .field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(43,90,160,.12); }
.btn {
  border: 0; border-radius: 9px; padding: 10px 18px; font-weight: 700; font-size: 13.5px;
  background: var(--blue); color: #fff; transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: #eef1f6; color: #3c4859; }
.btn.danger { background: var(--red); }
.btn.small { padding: 6px 12px; font-size: 12.5px; border-radius: 7px; }
.btn.wide { width: 100%; padding: 12px 0; }
.msg { border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-bottom: 12px; }
.msg.err { background: #fdecec; color: #b3261e; }
.msg.ok { background: #e8f6ee; color: var(--ok); }

/* ---------- app shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 20px;
  background: #fff; border-bottom: 1px solid var(--line); padding: 0 22px; height: 58px;
}
.topbar .logo img { height: 30px; display: block; }
.tabs { display: flex; gap: 4px; height: 100%; }
.tabs button {
  border: 0; background: transparent; padding: 0 16px; font-weight: 700; color: #5b6675;
  border-bottom: 2.5px solid transparent; font-size: 13.5px;
}
.tabs button.on { color: var(--blue); border-bottom-color: var(--blue); }
/* Generate PI nav button */
.tabs button.nav-pi {
  color: #059669; border: 1.5px solid #059669; border-radius: 8px; margin: 10px 4px;
  padding: 0 14px; font-size: 12.5px; line-height: 1;
}
.tabs button.nav-pi:hover { background: #f0fdf7; }
/* Global Express link */
.tabs a.nav-express {
  display: flex; align-items: center; padding: 0 14px; font-weight: 700; font-size: 12.5px;
  color: #7c3aed; border: 1.5px solid #7c3aed; border-radius: 8px; margin: 10px 4px;
  text-decoration: none; line-height: 1;
}
.tabs a.nav-express:hover { background: #f5f3ff; }

/* ── Avatar dropdown ── */
.av-wrap { margin-left: auto; position: relative; display: flex; align-items: center; }
.av-btn {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  padding: 5px 10px; border-radius: 10px; transition: background .15s;
}
.av-btn:hover { background: #f1f5fb; }
.av-initials {
  width: 36px; height: 36px; border-radius: 50%; background: var(--blue);
  color: #fff; font-weight: 800; font-size: 15px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.av-img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.av-name { font-weight: 600; font-size: 13px; color: #425062; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role { background: #eef1f6; border-radius: 20px; padding: 3px 10px; font-size: 11.5px; color: #5b6675; }
.user-menu {
  display: none; position: absolute; top: calc(100% + 6px); right: 0;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 32px rgba(16,24,40,.12); min-width: 180px; z-index: 200; overflow: hidden;
  animation: rise .2s ease;
}
.user-menu.open { display: block; }
.user-menu-item {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 11px 16px; font-size: 13.5px; font-weight: 600; color: #334052; cursor: pointer;
}
.user-menu-item:hover { background: #f1f5fb; }
.user-menu-item.danger { color: var(--red); }
.user-menu-item.danger:hover { background: #fdecec; }

.content { max-width: 1280px; margin: 0 auto; padding: 24px 22px 60px; }

/* ---------- builder ---------- */
.rate-banner {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(90deg, rgba(43,90,160,.10), rgba(43,90,160,.03));
  border: 1px solid rgba(43,90,160,.25); border-radius: 10px;
  padding: 9px 16px; margin-bottom: 16px;
  font-size: 13px; color: var(--blue-dark); font-weight: 700;
}
.rate-banner .rb-ico { color: var(--blue); display: flex; flex-shrink: 0; }
.rate-banner .rb-ico svg { width: 16px; height: 16px; }
.rate-banner .rb-label { color: #5b6675; font-weight: 700; letter-spacing: .3px; }
.rate-banner .rb-val { margin-left: auto; font-family: 'Space Grotesk', 'Manrope', sans-serif; font-weight: 700; color: var(--blue); font-size: 14px; }
.builder { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: stretch; }
.builder .panel { display: flex; flex-direction: column; min-height: 0; }
.builder > .panel:first-child { min-height: 480px; }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel .p-head { padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.search { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.search input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; outline: none; }
.search input:focus { border-color: var(--blue); }
.plist { flex: 1; overflow: auto; padding: 8px; }
.pgroup { padding: 10px 10px 5px; font-size: 15px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; font-family: 'Space Grotesk', 'Manrope', sans-serif; }
.pgroup.cat-pos { color: var(--blue); }
.pgroup.cat-per { color: var(--red); }
.cat-tabs { display: flex; gap: 6px; padding: 10px 12px 0; }
.cat-tabs button {
  flex: 1; border: 1px solid var(--line); background: #f5f7fa; border-radius: 8px;
  padding: 8px 4px; font-size: 11.5px; font-weight: 800; letter-spacing: .6px;
  text-transform: uppercase; color: #5b6675; font-family: 'Space Grotesk', 'Manrope', sans-serif;
}
.cat-tabs button.on { background: rgba(43,90,160,.12); border-color: rgba(43,90,160,.4); color: var(--blue); }
.price-edit { width: 120px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-weight: 800; text-align: right; font-size: 15px; color: var(--blue); outline: none; }
.price-edit:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(43,90,160,.12); }
.pitem {
  padding: 8px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; color: #33405252; color: #334052;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.pitem:hover { background: #f1f5fb; }
.pitem.on { background: rgba(43,90,160,.10); color: var(--blue); }
.pitem .cat { font-size: 10.5px; font-weight: 700; color: #98a2b3; background: #f1f4f8; padding: 2px 8px; border-radius: 20px; }
.pitem-imgs { display: flex; gap: 3px; flex-shrink: 0; }
.pitem-img { width: 28px; height: 28px; object-fit: contain; border-radius: 4px; border: 1px solid var(--line); background: #f5f7fa; flex-shrink: 0; display: block; }
.pitem-img-ph { background: #eef1f6; }

.config { padding: 18px 20px 24px; }
.config h2 { font-size: 19px; margin-bottom: 2px; }
.config .sub { color: #687382; font-size: 12.5px; margin-bottom: 16px; }
.spec-table { width: 100%; border-collapse: collapse; }
.spec-table th {
  text-align: left; font-size: 11px; letter-spacing: .6px; text-transform: uppercase; color: #8a94a3;
  padding: 8px 10px; border-bottom: 2px solid var(--line);
}
.spec-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.spec-table tr:last-child td { border-bottom: 0; }
.spec-table .t { font-weight: 700; color: #33405252; color: #334052; width: 200px; }
/* v84: per-row highlight toggle (★) — marked rows are emphasized in the quotation */
.spec-table .hl-btn {
  background: none; border: none; cursor: pointer; padding: 0 7px 0 0; font-size: 13px;
  color: #c3cad6; line-height: 1; vertical-align: 1px;
}
.spec-table .hl-btn:hover { color: #f0a000; }
.spec-table .hl-btn.on { color: #f0a000; }
.spec-table tr.row-hl td { background: #fff7cc; }
.spec-table tr.row-hl td.t { color: #7a5b00; }
.spec-table select {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; outline: none;
}
.spec-table select:focus { border-color: var(--blue); }
/* Fixed per-product values (Weight / Dimensions) — read-only, admin-only editing */
.fixed-spec {
  display: inline-flex; align-items: center; gap: 7px;
  font-weight: 700; font-size: 13px; color: #1a222e;
  padding: 6px 10px; border: 1px dashed #c6cfdb; border-radius: 8px; background: #f7f9fc;
}
.fixed-spec::before { content: '🔒'; font-size: 11px; opacity: .55; }
.price { font-variant-numeric: tabular-nums; font-weight: 700; color: #22304252; color: #223042; text-align: right; white-space: nowrap; }
.price.dim { color: #98a2b3; font-weight: 600; }
.totalbar {
  margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: linear-gradient(90deg, rgba(43,90,160,.08), rgba(43,90,160,.02)); border: 1px solid rgba(43,90,160,.25);
  border-radius: 10px; padding: 12px 16px;
}
.totalbar .t-label { font-weight: 800; color: var(--blue-dark); }
.totalbar .t-usd { font-family: 'Space Grotesk'; font-size: 22px; font-weight: 700; color: var(--blue); }
.totalbar .t-cny { color: #687382; font-weight: 600; }
.actions { display: flex; gap: 10px; margin-top: 18px; }

/* ---------- admin ---------- */
.admin { display: grid; grid-template-columns: 210px 1fr; gap: 20px; align-items: start; }
.admin-nav { padding: 10px; }
.admin-nav button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent; border-radius: 8px;
  padding: 10px 14px; font-weight: 700; color: #42506242; color: #425062; margin-bottom: 2px; font-size: 13.5px;
}
.admin-nav button.on { background: rgba(43,90,160,.10); color: var(--blue); }
.admin-body { padding: 20px; }
.admin-body h2 { font-size: 17px; margin-bottom: 14px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--line); color: #8a94a3; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl tr:hover td { background: #f8fafc; }
.badge { display: inline-block; border-radius: 20px; padding: 2px 10px; font-size: 11px; font-weight: 700; }
.badge.pending { background: #fdf3e0; color: var(--warn); }
.badge.active { background: #e8f6ee; color: var(--ok); }
.badge.disabled { background: #fdecec; color: #b3261e; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; outline: none; }
.spacer { flex: 1; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(15,23,36,.45); display: flex; align-items: center; justify-content: center; z-index: 100; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.25); width: 560px; max-width: calc(100vw - 40px); max-height: 86vh; overflow: auto; padding: 24px; animation: rise .25s ease; }
.modal h3 { margin-bottom: 14px; font-size: 16px; }
.modal .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checklist { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.checklist label { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-weight: 600; }
.checklist label:hover { background: #f1f5fb; }
.checklist .grp { padding: 6px 8px 2px; font-size: 11px; font-weight: 800; color: #8a94a3; text-transform: uppercase; }

/* ---------- accessories 2-pane ---------- */
.acc-layout { display: grid; grid-template-columns: 210px 1fr; gap: 0; height: calc(100vh - 180px); overflow: hidden; }
.acc-types { border-right: 1px solid var(--line); overflow-y: auto; background: var(--card); border-radius: var(--radius) 0 0 var(--radius); }
.acc-type-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: 12.5px; color: #334052; gap: 6px; }
.acc-type-item.head { font-weight: 800; color: var(--blue-dark); border-bottom: 1px solid var(--line); padding: 10px 14px; font-size: 13px; }
.acc-pi-legend { display: flex; align-items: center; gap: 8px; padding: 8px 14px; font-size: 10.5px; font-weight: 800; color: #8a94a3; text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.pi-cb { width: 15px; height: 15px; accent-color: var(--blue); cursor: pointer; flex-shrink: 0; }
.acc-pi-legend .pi-cb { cursor: default; }
.acc-type-item.on { background: rgba(43,90,160,.12); color: var(--blue); }
.acc-type-item:hover:not(.on) { background: #f5f7fa; }
.acc-type-item.dim { color: #b0b8c4; }
.acc-type-count { font-size: 11px; font-weight: 700; color: #b0b8c4; background: #f1f4f8; border-radius: 20px; padding: 1px 7px; min-width: 20px; text-align: center; }
.acc-type-item.on .acc-type-count { background: rgba(43,90,160,.15); color: var(--blue); }
.acc-right { display: flex; flex-direction: column; padding: 16px; overflow: hidden; background: var(--card); border-radius: 0 var(--radius) var(--radius) 0; }
.acc-top-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; flex-shrink: 0; }
.acc-rate { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: #334052; }
.acc-rate input { border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; font-size: 13px; font-weight: 700; }
.acc-tbl-wrap { flex: 1; min-height: 0; overflow-y: auto; }
.acc-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.acc-tbl th { position: sticky; top: 0; text-align: left; padding: 6px 8px; border-bottom: 2px solid var(--line); color: #8a94a3; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; background: #fafbfc; z-index: 1; }
.acc-tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.acc-tbl tr:hover td { background: #f8fafc; cursor: pointer; }
.acc-tbl tr.sel td { background: rgba(43,90,160,.07); }
.acc-pagination { display: flex; align-items: center; gap: 6px; padding: 10px 0 0; font-size: 12.5px; color: #5b6675; flex-shrink: 0; border-top: 1px solid var(--line); margin-top: 8px; }

/* ---------- quotation sheet ---------- */
.qwrap { background: #e8ebf0; padding: 28px 12px; }
.sheet {
  width: 794px; height: 1123px; /* A4 at 96dpi — fixed height on screen too */
  margin: 0 auto; background: #fff; box-shadow: 0 6px 30px rgba(0,0,0,.18);
  padding: 32px 48px 0; color: #1a222e; font-size: 13.5px;
  position: relative; overflow: hidden; display: block;
}
.sheet .q-head { display: flex; gap: 18px; align-items: flex-start; border-bottom: 3px solid var(--blue); padding-bottom: 14px; }
.sheet .q-head img.logo { height: 44px; }
.sheet .co { flex: 1; }
.sheet .co .name { font-family: 'Space Grotesk'; font-size: 16.5px; font-weight: 700; color: var(--blue-dark); letter-spacing: .3px; }
.sheet .co .addr { color: #4a5568; margin-top: 3px; line-height: 1.45; }
.sheet .q-title { text-align: right; }
.sheet .q-title .t { font-family: 'Space Grotesk'; font-size: 25px; font-weight: 700; color: var(--red); letter-spacing: 2px; }
.sheet .q-title .meta { color: #4a5568; margin-top: 6px; line-height: 1.5; }
.sheet .q-model { margin: 14px 0 10px; display: flex; justify-content: space-between; align-items: baseline; }
.sheet .q-model .m { font-size: 16px; font-weight: 800; font-family: 'Space Grotesk'; color: #16233a; }
.sheet .q-model .m span { color: var(--blue); }
.sheet table { width: 100%; border-collapse: collapse; }
.sheet th { background: var(--blue); color: #fff; padding: 6px 8px; text-align: left; font-size: 11.5px; letter-spacing: .6px; text-transform: uppercase; }
.sheet td { border-bottom: 1px solid #dfe5ec; padding: 5px 8px; vertical-align: top; }
.sheet td.t { font-weight: 700; width: 170px; color: #24344d; }
.sheet .q-imgs { display: flex; gap: 18px; margin: 14px 0 10px; }
.sheet .q-imgs img { width: 220px; height: 220px; object-fit: contain; border: 1px solid #e3e8ef; border-radius: 8px; background: #fff; }
.q-spacer { display: none; }
.sheet .q-total { display: flex; justify-content: flex-end; margin-top: 10px; }
.sheet .q-total .box { border: 2px solid var(--blue); border-radius: 8px; padding: 8px 18px; text-align: right; }
.sheet .q-total .usd { font-family: 'Space Grotesk'; font-size: 20px; font-weight: 700; color: var(--blue); display: flex; align-items: baseline; gap: 10px; }
.sheet .q-total .orig-price { font-size: 13px; font-weight: 600; color: #98a2b3; text-decoration: line-through; }
.sheet .q-total .words { font-size: 11px; color: #4a5568; text-transform: uppercase; letter-spacing: .4px; margin-top: 2px; }
/* WHY CHOOSE + footer pinned to bottom of the fixed-height sheet */
.q-creds-wrap {
  position: absolute; left: 48px; right: 48px; bottom: 24px;
}
.q-creds { }
.q-creds-header { display: flex; align-items: center; gap: 5px; font-size: 9.5px; font-weight: 800; color: var(--blue); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 4px; }
.q-creds-header svg { width: 11px; height: 11px; color: #f0a000; flex-shrink: 0; }
.q-creds-list { padding-left: 14px; margin: 0; }
.q-creds-list li { font-size: 8.5px; color: #4a5568; line-height: 1.55; }
.q-bottom-row { margin-top: 8px; border-top: 1px solid #dfe5ec; padding-top: 6px; display: flex; justify-content: flex-end; }
.q-foot-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; color: #687382; font-size: 11px; text-align: right; }
.q-actions { max-width: 794px; margin: 0 auto 16px; display: flex; gap: 10px; justify-content: flex-end; }

@media print {
  /* Give the page a real bottom margin so footer stays on page 1 */
  @page { size: A4 portrait; margin: 6mm 12mm 10mm 12mm; }
  html, body { height: auto; margin: 0; padding: 0; background: #fff !important; }
  #app { display: none !important; }
  #modal-root { position: static; display: block; }
  .modal-back { position: static !important; inset: auto !important; background: none !important; padding: 0 !important; display: block !important; max-height: none !important; overflow: visible !important; }
  .qwrap { background: #fff !important; padding: 0 !important; max-height: none !important; overflow: visible !important; width: auto !important; display: block !important; }
  .q-actions { display: none !important; }
  /* Sheet: auto height, no overflow tricks — content must fit naturally */
  .sheet {
    width: auto; margin: 0; box-shadow: none; padding: 0;
    position: static; display: block;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  /* ── Header ── */
  .sheet .q-head { padding-bottom: 3px; border-bottom-width: 2px; gap: 10px; }
  .sheet .q-head img.logo { height: 26px; }
  .sheet .co .name { font-size: 9px; }
  .sheet .co .addr { font-size: 6.5px; margin-top: 0; line-height: 1.25; }
  .sheet .q-title .t { font-size: 12px; }
  .sheet .q-title .meta { font-size: 6.5px; margin-top: 1px; line-height: 1.3; }
  /* ── Model title ── */
  .sheet .q-model { margin: 2px 0 1px; }
  .sheet .q-model .m { font-size: 10px; }
  .sheet .q-model div[style] { font-size: 6.5px !important; }
  /* ── Spec table: ultra-compact ── */
  .sheet th { padding: 1px 4px; font-size: 8px; }
  .sheet td { padding: 0.5px 4px; font-size: 8.5px; line-height: 1.2; }
  .sheet td.t { width: 100px; font-size: 8.5px; }
  /* ── Images: side by side, small ── */
  .sheet .q-imgs { margin: 2px 0 1px; gap: 4mm; }
  .sheet .q-imgs img { width: 33mm; height: 33mm; }
  .q-spacer { display: none !important; }
  /* ── Price total ── */
  .sheet .q-total { margin-top: 2px; }
  .sheet .q-total .box { padding: 2px 8px; }
  .sheet .q-total .usd { font-size: 11px; }
  .sheet .q-total .orig-price { font-size: 8.5px; }
  .sheet .q-total .words { font-size: 6.5px; margin-top: 0; }
  /* ── WHY CHOOSE + footer: normal flow after price ── */
  .q-creds-wrap { margin-top: 3px; }
  .q-creds-header { font-size: 6.5px; margin-bottom: 1px; }
  .q-creds-list { padding-left: 9px; }
  .q-creds-list li { font-size: 5.5px; line-height: 1.3; }
  .q-bottom-row {
    margin-top: 3px;
    border-top: 1px solid #dfe5ec; padding-top: 2px;
    display: flex; justify-content: flex-end;
  }
  .q-foot-right { font-size: 7px; gap: 1px; }
}
.auth-icp { margin-top: 18px; text-align: center; font-size: 11.5px; color: #8a94a3; }
.auth-icp a { color: inherit; text-decoration: none; }
.auth-icp a:hover { text-decoration: underline; }
.site-icp { text-align: center; padding: 10px 0 14px; font-size: 11.5px; color: #8a94a3; }
.site-icp a { color: inherit; text-decoration: none; }
.site-icp a:hover { text-decoration: underline; }

@media print {
  .site-icp, .auth-icp { display: none; }
}
@media (max-width: 900px) {
  .builder { grid-template-columns: 1fr; }
  .admin { grid-template-columns: 1fr; }
  .sheet { width: 100%; min-height: auto; padding: 24px; }
}

/* ============ PI (PROFORMA INVOICE) ============ */
/* Full-screen 2-column modal */
.modal-back.pi-modal { align-items: flex-start; overflow-y: auto; padding: 0; }
.pi-wrap {
  position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); z-index: 200; overflow: hidden;
}
.pi-top-bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: var(--blue-dark);
  color: #fff; flex-shrink: 0; box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.pi-top-title { font-family: 'Space Grotesk','Manrope',sans-serif; font-size: 16px; font-weight: 800; flex: 1; letter-spacing: .5px; }
.pi-body { display: grid; grid-template-columns: 420px 1fr; flex: 1; overflow: hidden; }
.pi-edit-col { overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; border-right: 1px solid var(--line); }
.pi-preview-col { overflow-y: auto; padding: 16px; background: #e8ebf0; }
.pi-section { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.pi-sec-title { font-size: 13px; font-weight: 800; color: var(--blue-dark); margin-bottom: 12px; letter-spacing: .3px; }
.pi-hdr-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pi-field label { display: block; font-size: 11px; font-weight: 700; color: #8a94a3; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }
.pi-field input, .pi-field select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; font-family: inherit; background: #fff; outline: none; box-sizing: border-box; }
.pi-field input:focus, .pi-field select:focus { border-color: var(--blue); }
/* Buyer dropdown */
.buyer-drop { display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 50; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 220px; overflow-y: auto; }
.buyer-drop-row { padding: 10px 14px; cursor: pointer; font-size: 13px; font-weight: 600; }
.buyer-drop-row:hover { background: #f1f5fb; }
/* Items edit table */
.pi-item-edit-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.pi-item-edit-tbl th { background: var(--blue); color: #fff; padding: 6px 8px; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.pi-item-edit-tbl td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.pi-desc-cell { max-width: 0; }
.pi-item-name-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pi-iname { font-weight: 700; font-size: 13px; color: var(--blue); cursor: pointer; }
.pi-iname:hover { text-decoration: underline; }
.pi-hs-tag { font-size: 11px; color: #687382; background: #f1f4f8; border-radius: 4px; padding: 1px 6px; }
.pi-ispec { font-size: 11px; color: #4a5568; margin-top: 3px; line-height: 1.5; }
/* Item search popup */
.pi-item-popup-back { position: absolute; inset: 0; background: rgba(15,23,36,.5); z-index: 300; display: flex; align-items: center; justify-content: center; }
.pi-item-popup { background: #fff; border-radius: 14px; width: 620px; max-width: calc(100vw - 40px); max-height: calc(100vh - 60px); overflow-y: auto; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.pi-item-config { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
/* ── PI sheet (print-ready preview) ── */
.pi-sheet { background:#fff; border-radius:var(--radius); box-shadow:0 6px 30px rgba(0,0,0,.12); padding:28px 36px; max-width:794px; margin:0 auto; }
/* Wrapper inside sheet */
.pi2-wrap { font-size:12px; color:#1a222e; font-family:'Manrope','Segoe UI',Arial,sans-serif; line-height:1.45; }

/* ① Header */
.pi2-hdr { margin-bottom:14px; }
.pi2-title { font-family:'Space Grotesk','Manrope',sans-serif; font-size:22px; font-weight:900; color:var(--blue-dark); letter-spacing:2.5px; text-align:center; padding-bottom:8px; border-bottom:3px solid var(--blue-dark); margin-bottom:12px; }
.pi2-meta { width:100%; border-collapse:collapse; font-size:11.5px; }
.pi2-meta td { padding:4px 8px; }
.pi2-mk { color:#687382; font-weight:700; width:130px; white-space:nowrap; }
.pi2-mv { font-weight:700; color:#1a222e; padding-right:20px; }

/* ② Parties */
.pi2-parties { display:grid; grid-template-columns:1fr 1fr; gap:0; border:1px solid var(--blue-dark); border-bottom:0; margin-bottom:0; }
.pi2-party { padding:10px 14px; }
.pi2-seller { border-left:1px solid var(--blue-dark); }
.pi2-plbl { font-size:10px; font-weight:900; text-transform:uppercase; letter-spacing:.8px; padding:3px 8px; display:inline-block; margin-bottom:6px; color:#fff; }
.pi2-buyer-lbl { background:var(--blue-dark); }
.pi2-seller-lbl { background:#059669; }
.pi2-pname { font-weight:800; font-size:13px; color:var(--blue-dark); margin-bottom:4px; }
.pi2-pdetail { font-size:11px; color:#4a5568; line-height:1.6; }

/* ③ Shipping/Ref sub-row */
.pi2-subrow { display:grid; grid-template-columns:1fr 1fr; gap:0; border:1px solid var(--blue-dark); border-top:1px solid rgba(43,90,160,.3); margin-bottom:14px; }
.pi2-subbox { padding:8px 14px; font-size:11px; }
.pi2-subbox:not(:first-child) { border-left:1px solid var(--blue-dark); }
.pi2-sublbl { display:block; font-size:9.5px; font-weight:900; text-transform:uppercase; letter-spacing:.6px; color:#8a94a3; margin-bottom:3px; }

/* ④ Items table */
.pi2-tbl { width:100%; border-collapse:collapse; margin-bottom:0; }
.pi2-thead { background:var(--blue-dark); }
.pi2-th { color:#fff; padding:7px 10px; font-size:10.5px; font-weight:800; text-transform:uppercase; letter-spacing:.5px; text-align:left; }
.pir td { border-bottom:1px solid #dfe5ec; padding:8px 10px; vertical-align:top; }
.pir:nth-child(even) td { background:#f8fafc; }
.pi-no { text-align:center; color:#8a94a3; font-size:11.5px; width:30px; }
.pi-desc { }
.pi-iname2 { font-weight:800; font-size:13px; color:#16233a; }
.pi-hs2 { font-weight:400; font-size:11.5px; color:#687382; }
.pi-ispec2 { font-size:11px; color:#4a5568; margin-top:3px; line-height:1.55; }
.pi-num2 { text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap; }

/* ⑤ Totals */
.pi2-totals { border-top:2px solid var(--blue-dark); margin-bottom:14px; }
.pi2-tot-tbl { width:100%; border-collapse:collapse; }
.pi2-tot-lbl { padding:5px 10px; font-size:12px; font-weight:600; color:#4a5568; text-align:right; width:70%; }
.pi2-tot-val { padding:5px 10px; font-size:12px; font-weight:700; color:#1a222e; text-align:right; width:30%; border-left:2px solid var(--blue-dark); }
.pi2-grand-row .pi2-grand-lbl { font-size:14px; font-weight:900; color:#fff; background:var(--blue-dark); padding:8px 10px; text-align:right; text-transform:uppercase; letter-spacing:.8px; }
.pi2-grand-row .pi2-grand-val { font-size:14px; font-weight:900; color:#fff; background:var(--blue-dark); padding:8px 10px; text-align:right; }

/* ⑥ Bank */
.pi2-bank { border:1px solid var(--blue-dark); margin-bottom:12px; page-break-inside:avoid; break-inside:avoid; }
.pi2-bank-title { background:var(--blue-dark); color:#fff; font-size:10px; font-weight:900; text-transform:uppercase; letter-spacing:.8px; padding:5px 10px; }
.pi2-bank-tbl { width:100%; border-collapse:collapse; font-size:11px; }
.pi-bk { padding:4px 10px; font-weight:700; color:#4a5568; white-space:nowrap; width:160px; border-bottom:1px solid #dfe5ec; }
.pi-bv { padding:4px 10px; font-weight:700; color:#1a222e; border-bottom:1px solid #dfe5ec; border-left:1px solid #dfe5ec; }

/* ⑦ Footer: declaration + signature */
.pi2-footer { display:flex; justify-content:space-between; align-items:flex-end; gap:20px; margin-top:12px; page-break-inside:avoid; break-inside:avoid; }
.pi2-decl { font-size:10px; color:#687382; line-height:1.6; flex:1; }
.pi2-sign { text-align:right; flex-shrink:0; }
.pi2-sign-label { font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.5px; color:#4a5568; margin-bottom:48px; white-space:nowrap; }
.pi2-sign-line { border-bottom:1.5px solid #8a94a3; width:200px; margin-left:auto; }

/* ── Print rules ── */
@media print {
  /* Use @page margin for ALL pages — this creates consistent top/bottom margins
     on every page including continuations, solving the "content at top of page 2" issue */
  @page { size: A4 portrait; margin: 10mm 14mm; }

  .pi-wrap { position:static !important; overflow:visible !important; }
  .pi-top-bar, .pi-edit-col { display:none !important; }
  .pi-body { display:block !important; }
  .pi-preview-col { overflow:visible !important; padding:0 !important; background:#fff !important; }
  .pi-sheet {
    /* No extra padding needed — @page margin handles all 4 sides on every page */
    width:auto !important; max-width:none; margin:0; padding:0; box-shadow:none; border-radius:0;
    -webkit-print-color-adjust:exact !important; print-color-adjust:exact !important;
  }
  .pi-sheet * { -webkit-print-color-adjust:exact !important; print-color-adjust:exact !important; }
  tr { page-break-inside:avoid; break-inside:avoid; }
}

/* ---------- v91: bilingual labels ---------- */
.bi { display: inline-flex; flex-direction: column; align-items: flex-start; justify-content: center; line-height: 1.2; gap: 1px; text-align: left; }
.bi.inline { flex-direction: row; align-items: baseline; gap: 7px; }
.bi-en { font-size: inherit; font-weight: inherit; color: inherit; }
.bi-zh { font-size: 10px; font-weight: 600; opacity: .66; letter-spacing: .2px; font-family: "PingFang SC","Microsoft YaHei","Noto Sans SC",sans-serif; }
.tabs button .bi-zh { font-size: 10px; }
.tabs .nav-pi .bi-zh, .tabs .nav-express .bi-zh { font-size: 10px; opacity: .8; }
.admin-nav button .bi-zh { font-size: 10.5px; }
.cat-tabs button .bi-zh { font-size: 9.5px; }
.rb-src { font-size: 10.5px; font-weight: 600; color: #8a94a3; margin-left: 8px; letter-spacing: .2px; }

/* v91 small-screen safety: wrap/scroll instead of clipping bilingual bars */
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.q-actions { flex-wrap: wrap; row-gap: 8px; }
.pi-top-bar > div { flex-wrap: wrap; row-gap: 6px; }

/* ---------- v107: searchable option combo ---------- */
/* Colour carries the state: amber = nothing chosen yet (still needs a decision),
   teal = settled. The search field inside the panel is blue so it is obviously
   the thing to type into. */
.opt-combo {
  display: flex; align-items: center; gap: 8px; width: 100%;
  min-height: 36px; padding: 5px 10px 5px 12px;
  font-family: inherit; font-size: 13px; font-weight: 700; text-align: left;
  border: 1.5px solid #cbd5e1; border-radius: 9px; background: #fff; color: var(--ink);
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.opt-combo:hover { box-shadow: 0 1px 6px rgba(16,24,40,.12); }
.opt-combo:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(43,90,160,.22); }
.opt-combo-val { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt-combo-price {
  flex: 0 0 auto; font-size: 11px; font-weight: 800; color: #2b5aa0;
  background: #eef3fb; border-radius: 4px; padding: 1px 7px; white-space: nowrap;
}
.opt-combo-caret { flex: 0 0 auto; font-size: 11px; opacity: .75; }
.opt-combo.is-empty { border-color: #f0b429; background: #fffaef; color: #8a5a00; }
.opt-combo.is-set { border-color: #2f9e6f; background: #f2fbf7; color: #14603f; }
.opt-combo.is-disabled, .opt-combo[disabled] {
  border-color: var(--line); background: #f7f8fa; color: #98a2b3; cursor: not-allowed;
}
.opt-combo.is-disabled:hover, .opt-combo[disabled]:hover { box-shadow: none; }

.opt-combo-pop {
  position: fixed; z-index: 9999; display: none; overflow: hidden;
  flex-direction: column;
  background: #fff; border: 1.5px solid #cbd5e1; border-radius: 11px;
  box-shadow: 0 12px 34px rgba(16,24,40,.18);
}
.opt-combo-pop.open { display: flex; }
.opt-combo-search {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 7px; padding: 7px 9px;
  background: #eef3fb; border-bottom: 1px solid #dbe4f0;
}
.opt-combo-mag { font-size: 12px; flex: 0 0 auto; }
.opt-combo-input {
  flex: 1 1 auto; min-width: 0; padding: 6px 9px; font-family: inherit; font-size: 13px;
  border: 1.5px solid #b9c9e3; border-radius: 7px; background: #fff; color: var(--ink);
}
.opt-combo-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(43,90,160,.16); }
.opt-combo-clear {
  flex: 0 0 auto; border: none; background: transparent; color: #687382;
  font-size: 13px; line-height: 1; padding: 3px 5px; border-radius: 6px;
}
.opt-combo-clear:hover { background: #dbe4f0; color: var(--ink); }
.opt-combo-count { flex: 0 0 auto; font-size: 10.5px; font-weight: 800; color: #4a5568; white-space: nowrap; }
/* The list is the only scrolling part: the search row stays pinned and the panel
   never exceeds the max-height computed on open. overscroll-behavior stops a
   wheel gesture inside the list from chaining out to the page once the list has
   reached its end — that chained page scroll used to close the panel. */
.opt-combo-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.opt-combo-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 11px;
  font-size: 13px; cursor: pointer; border-bottom: 1px solid #f1f4f8;
}
.opt-combo-item:last-child { border-bottom: none; }
.opt-combo-item-name { flex: 1 1 auto; }
.opt-combo-item.is-active { background: #e8f0fb; }
.opt-combo-item.is-sel { font-weight: 800; }
.opt-combo-item.is-sel::before { content: '\2713'; color: #2f9e6f; font-weight: 900; }
.opt-combo-item mark { background: #ffe9a8; color: inherit; border-radius: 3px; padding: 0 1px; }
.opt-combo-emptyres { padding: 14px 11px; text-align: center; font-size: 12.5px; color: #8a94a3; }

