: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); }
.userbox { margin-left: auto; display: flex; align-items: center; gap: 10px; color: #425062; font-weight: 600; font-size: 13px; }
.userbox .role { background: #eef1f6; border-radius: 20px; padding: 3px 10px; font-size: 11.5px; color: #5b6675; }
.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); }
.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; }
.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); }
.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:first-child { font-weight: 800; color: var(--blue-dark); border-bottom: 1px solid var(--line); padding: 10px 14px; font-size: 13px; }
.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; min-height: 1123px; margin: 0 auto; background: #fff; box-shadow: 0 6px 30px rgba(0,0,0,.18);
  padding: 32px 48px 30px; position: relative; color: #1a222e; font-size: 13.5px;
  display: flex; flex-direction: column;
}
.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; page-break-inside: avoid; break-inside: avoid; }
.sheet .q-imgs img { width: 293px; height: 293px; object-fit: contain; border: 1px solid #e3e8ef; border-radius: 8px; background: #fff; page-break-inside: avoid; break-inside: avoid; }
.q-spacer { flex: 1; min-height: 12px; }
.sheet .q-total { page-break-inside: avoid; break-inside: avoid; }
.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); }
.sheet .q-total .words { font-size: 11px; color: #4a5568; text-transform: uppercase; letter-spacing: .4px; margin-top: 2px; }
.sheet .q-foot { margin-top: 10px; border-top: 1px solid #dfe5ec; padding-top: 8px; color: #687382; font-size: 11px; display: flex; justify-content: space-between; page-break-inside: avoid; break-inside: avoid; }
.q-actions { max-width: 794px; margin: 0 auto 16px; display: flex; gap: 10px; justify-content: flex-end; }

@media print {
  @page { size: A4 portrait; margin: 0; }
  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 {
    width: 210mm; height: 297mm; margin: 0; box-shadow: none;
    padding: 6mm 12mm 8mm; position: relative; overflow: hidden;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
    display: flex; flex-direction: column;
  }
  .sheet .q-head { padding-bottom: 4px; }
  .sheet .co .name { font-size: 12px; }
  .sheet .co .addr { font-size: 9px; }
  .sheet .q-title .t { font-size: 17px; }
  .sheet .q-title .meta { font-size: 9px; }
  .sheet .q-model { margin: 6px 0 4px; }
  .sheet .q-model .m { font-size: 14px; }
  .sheet th { padding: 2px 6px; font-size: 11px; }
  .sheet td { padding: 1.5px 6px; font-size: 11.5px; }
  .sheet td.t { width: 140px; }
  .sheet .q-imgs { margin: 4px 0 2px; gap: 8mm; page-break-inside: avoid; break-inside: avoid; }
  .sheet .q-imgs img { width: 48mm; height: 48mm; page-break-inside: avoid; break-inside: avoid; }
  .q-spacer { flex: 1; min-height: 2px; }
  .sheet .q-total { margin-top: 2px; page-break-inside: avoid; break-inside: avoid; }
  .sheet .q-total .usd { font-size: 14px; }
  .sheet .q-total .words { font-size: 8.5px; }
  .sheet .q-foot { position: static; left: auto; right: auto; bottom: auto; margin-top: 3mm; font-size: 9px; page-break-inside: avoid; break-inside: avoid; }
}
.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; }
}
