:root {
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f8f9fb; --text: #0f1729; --muted: #667085; --faint: #98a2b3;
  --line: #e6e8ec; --line-strong: #d0d5dd;
  --accent: #3b5bdb; --accent-soft: #edf1ff; --accent-text: #2f4ac0;
  --good: #12805c; --good-soft: #e7f6ef; --bad: #c4320a; --bad-soft: #fdeee9; --warn: #a15c07; --warn-soft: #fef4e2;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 4px 16px rgba(16, 24, 40, .08);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117; --surface: #161b22; --surface-2: #1c222b; --text: #e6edf3; --muted: #8b949e; --faint: #6e7681;
    --line: #262c36; --line-strong: #30363d;
    --accent: #6d8dff; --accent-soft: #1d2747; --accent-text: #a5b8ff;
    --good: #4cc38a; --good-soft: #12301f; --bad: #ff8a65; --bad-soft: #3a1d14; --warn: #f0b952; --warn-soft: #362812;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 6px 20px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 13px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1200px; margin: 0 auto; padding: 0 20px; height: 60px; display: flex; align-items: center; gap: 28px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), #7048e8);
  display: grid; place-items: center; color: #fff; font: 800 15px/1 system-ui, sans-serif; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 7px 12px; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: 14px; white-space: nowrap; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.on { background: var(--accent-soft); color: var(--accent-text); }
.status { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); flex: none; }
.status.bad { color: var(--bad); } .status.bad .dot { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }

main { max-width: 1200px; margin: 0 auto; padding: 28px 20px 80px; }

/* ---------- headings ---------- */
.page-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
h1 { font-size: 28px; line-height: 1.2; letter-spacing: -.02em; margin: 0; font-weight: 700; }
.sub { color: var(--muted); margin: 6px 0 0; }
h2 { font-size: 17px; margin: 0; font-weight: 650; letter-spacing: -.01em; }

/* ---------- controls ---------- */
.search { position: relative; width: min(380px, 100%); }
.search input { width: 100%; height: 42px; padding: 0 44px 0 40px; border-radius: 11px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font: inherit; box-shadow: var(--shadow); outline: none; transition: border-color .15s, box-shadow .15s; }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search svg { position: absolute; left: 13px; top: 12px; color: var(--faint); }
.search kbd { position: absolute; right: 10px; top: 10px; font: 12px/20px inherit; padding: 0 6px; border-radius: 6px;
  border: 1px solid var(--line); color: var(--faint); background: var(--surface-2); }

.segmented { display: inline-flex; padding: 4px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; max-width: 100%; overflow-x: auto; }
.segmented button { border: 0; background: none; padding: 7px 14px; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 550; font-size: 14px; white-space: nowrap; }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segmented .n { color: var(--faint); font-weight: 500; margin-left: 4px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; cursor: pointer; user-select: none; }
.toggle input { appearance: none; width: 34px; height: 20px; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked { background: var(--accent); } .toggle input:checked::after { transform: translateX(14px); }

.btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font-weight: 550; font-size: 14px; cursor: pointer; box-shadow: var(--shadow); }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 550;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip.bad, .chip.up { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.good, .chip.down { background: var(--good-soft); color: var(--good); border-color: transparent; }

/* ---------- product list ---------- */
.family { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden; }
.family-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px 10px; }
.family-head h2 { font-size: 16px; }
.vrow { display: grid; grid-template-columns: minmax(0, 1fr) 120px 140px 180px 16px; align-items: center; gap: 18px;
  padding: 12px 18px; border-top: 1px solid var(--line); transition: background .12s; }
.vrow:hover { background: var(--surface-2); }
.vrow:hover .chev { color: var(--accent); transform: translateX(2px); }
.vname { font-weight: 550; min-width: 0; overflow-wrap: anywhere; }
.vflags { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.spark { color: var(--accent); }
.spark svg { width: 120px; height: 34px; display: block; }
.vdelta { text-align: right; }
.vcost { text-align: right; font-size: 20px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kop { color: var(--faint); font-weight: 500; font-size: .68em; }
.chev { color: var(--faint); transition: transform .15s, color .15s; }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }

/* ---------- product page ---------- */
.crumbs { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.crumbs a:hover { color: var(--text); }
.title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.title-row h1 { overflow-wrap: anywhere; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 16px; margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.label { color: var(--muted); font-size: 13px; font-weight: 500; }
.hero-cost { font-size: 42px; font-weight: 750; letter-spacing: -.03em; line-height: 1.1; margin: 8px 0 14px; font-variant-numeric: tabular-nums; }
.hero-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-note { color: var(--faint); font-size: 13px; margin: 14px 0 0; }
.hero-chart svg { width: 100%; height: 120px; display: block; color: var(--accent); overflow: visible; }
.axis { display: flex; justify-content: space-between; color: var(--faint); font-size: 12px; margin-top: 8px; gap: 8px; }
.card-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 12px; }

.bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-2); gap: 2px; margin: 2px 0 16px; }
.bar span { display: block; height: 100%; min-width: 2px; }
.legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px 28px; }
.legend div { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 44px; gap: 10px; align-items: center; font-size: 14px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.legend .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend .sm { font-variant-numeric: tabular-nums; font-weight: 550; }
.legend .pc { color: var(--faint); font-size: 13px; text-align: right; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 28px 0 0; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs .n { color: var(--faint); font-weight: 500; margin-left: 4px; }
.tabpane { padding-top: 16px; }

/* tree table */
.tablecard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.tree-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.linkbtn { border: 0; background: none; color: var(--accent-text); cursor: pointer; font-weight: 550; font-size: 14px; padding: 4px 8px; border-radius: 6px; }
.linkbtn:hover { background: var(--accent-soft); }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { background: var(--surface-2); text-align: left; font-weight: 600; color: var(--muted); font-size: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th.r, td.r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.node td { font-weight: 600; }
tr.node { cursor: pointer; }
tr.node:hover td { background: var(--surface-2); }
tr.part.missing td { background: var(--bad-soft); }
.cell { display: flex; align-items: center; gap: 4px; min-width: 280px; }
.tog { width: 22px; height: 22px; display: inline-grid; place-items: center; border-radius: 6px; color: var(--faint); transition: transform .15s; flex: none; }
tr.node[aria-expanded="true"] .tog { transform: rotate(90deg); color: var(--accent); }
.bullet { width: 22px; flex: none; display: inline-grid; place-items: center; }
.bullet::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--line-strong); }
.unit { color: var(--faint); font-size: 12px; margin-left: 2px; }
.bought { display: flex; gap: 8px; align-items: center; justify-content: flex-end; white-space: nowrap; }
tfoot td { font-weight: 700; font-size: 15px; background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 0; }

/* history list */
.changes { display: flex; flex-direction: column; gap: 10px; }
.change { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 14px 18px; }
.change-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.change-head .when { color: var(--muted); font-size: 14px; min-width: 88px; }
.change-head .fromto { color: var(--faint); font-size: 13px; margin-left: auto; font-variant-numeric: tabular-nums; }
.why { margin: 10px 0 0; padding: 10px 0 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 14px; border-top: 1px dashed var(--line); }
.why li { display: grid; grid-template-columns: minmax(0, 1fr) auto 110px; gap: 14px; align-items: center; }
.why .p { color: var(--muted); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.why .e { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.up { color: var(--bad); } .down { color: var(--good); }
.note { color: var(--faint); font-size: 13px; margin: 12px 0 0; }

/* issues */
.issues-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.issue-list { list-style: none; margin: 0; padding: 0; }
.issue-list li { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; }
.issue-list .nm { font-weight: 550; }
.issue-list .where { color: var(--faint); font-size: 13px; margin-top: 2px; }
.section-head { padding: 16px 18px 12px; }
.section-head .t { display: flex; align-items: center; gap: 10px; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* login */
.login-page { display: grid; place-items: center; min-height: 100vh;
  background: radial-gradient(1000px 500px at 15% -10%, var(--accent-soft), transparent), var(--bg); }
.login { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 32px;
  width: min(380px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 12px; }
.login .logo { margin-bottom: 12px; }
.login label { color: var(--muted); font-size: 13px; font-weight: 500; }
.login input { height: 44px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 11px; font: inherit; background: var(--surface); color: var(--text); outline: none; }
.login input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.login .btn { height: 44px; justify-content: center; margin-top: 4px; }
.login .err { color: var(--bad); margin: 0; font-size: 13px; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .issues-grid { grid-template-columns: 1fr; }
  .vrow { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .vrow .spark, .vrow .chev { display: none; }
  .vrow .vdelta { grid-column: 1; grid-row: 2; text-align: left; }
  .vrow .vcost { grid-column: 2; grid-row: 1 / span 2; }
}
@media (max-width: 640px) {
  .topbar-in { gap: 12px; padding: 0 16px; }
  .status .txt { display: none; }
  .logo .name { display: none; }
  .nav a { padding: 7px 9px; }
  main { padding: 20px 16px 60px; }
  h1 { font-size: 23px; }
  .hero-cost { font-size: 34px; }
  .search { width: 100%; }
  .search kbd { display: none; }
  .why li { grid-template-columns: minmax(0, 1fr) auto; }
  .why .p { grid-column: 1 / -1; grid-row: 2; }
}
.segmented { scrollbar-width: none; } .segmented::-webkit-scrollbar { display: none; }

.notice { background: var(--warn-soft); color: var(--warn); border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-size: 14px; }
.notice ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- order builder ---------- */
.order-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.order-setup { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.input, .select { height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; font: inherit; background: var(--surface);
  color: var(--text); outline: none; min-width: 0; width: 100%; }
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.order-saved .select { width: min(320px, 100%); }
.order-add { width: 100%; }
.suggest { position: absolute; z-index: 30; left: 0; right: 0; top: 46px; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden; max-height: 380px; overflow-y: auto; }
.suggest button { display: flex; justify-content: space-between; gap: 12px; width: 100%; text-align: left; border: 0; background: none;
  padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--line); }
.suggest button:hover { background: var(--accent-soft); }
.order-table td { vertical-align: middle; }
.oname { font-weight: 550; }
.ometa { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.linkbtn.small { font-size: 13px; padding: 2px 6px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; background: var(--surface); }
.stepper button { width: 30px; height: 32px; border: 0; background: var(--surface-2); cursor: pointer; font-size: 16px; color: var(--muted); }
.stepper button:hover { color: var(--text); background: var(--line); }
.stepper input { width: 56px; height: 32px; border: 0; text-align: center; font: inherit; background: none; color: var(--text); -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.stepper.big button { width: 38px; height: 38px; } .stepper.big input { height: 38px; width: 64px; font-weight: 600; }
.iconbtn { border: 0; background: none; color: var(--faint); cursor: pointer; width: 30px; height: 30px; border-radius: 8px; }
.iconbtn:hover { background: var(--bad-soft); color: var(--bad); }
.strong { font-weight: 600; }
.order-sum { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 14px; }
.order-sum .hero-cost { margin: 0; font-size: 32px; }
.sets { display: flex; justify-content: space-between; align-items: center; }
.grand { display: flex; justify-content: space-between; align-items: baseline; padding-top: 14px; border-top: 1px solid var(--line); }
.grand strong { font-size: 26px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.order-actions { display: flex; flex-direction: column; gap: 8px; }
.order-actions .btn { justify-content: center; }
.removed { margin-top: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.removed summary { cursor: pointer; color: var(--muted); font-weight: 550; }
.removed ul { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; }
.removed li { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
@media (max-width: 960px) { .order-grid { grid-template-columns: 1fr; } .order-sum { position: static; } }
@media (max-width: 640px) { .order-setup { grid-template-columns: 1fr; } }
.order-table td:first-child { min-width: 240px; }
.ometa .linkbtn { padding-left: 0; }

.plink { color: inherit; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.plink:hover { color: var(--accent-text); text-decoration-color: currentColor; }
.issue-list li > a { display: block; flex: 1; }

.costing { margin-bottom: 16px; }
.costing td { font-size: 15px; }
.total-cell { font-weight: 750; font-size: 17px !important; color: var(--accent-text); }
.vtotal { font-size: 12px; font-weight: 600; color: var(--accent-text); letter-spacing: 0; }

/* ---------- photos ---------- */
.vrow { grid-template-columns: 64px minmax(0, 1fr) 120px 140px 180px 16px; }
.vthumb { width: 64px; height: 48px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #fff;
  padding: 0; cursor: zoom-in; display: block; }
.vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vthumb.empty { cursor: default; background: repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 6px, var(--bg) 6px, var(--bg) 12px); }
.tthumb { width: 30px; height: 30px; flex: none; border-radius: 7px; overflow: hidden; border: 1px solid var(--line); padding: 0;
  background: #fff; cursor: zoom-in; margin-right: 6px; transition: transform .15s, box-shadow .15s; }
.tthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tthumb:hover { transform: scale(1.12); box-shadow: var(--shadow-lg); }
.hero.with-photo { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1.1fr); }
.photo-card { padding: 10px; }
.gallery-main { display: block; width: 100%; aspect-ratio: 4 / 3; border: 0; padding: 0; border-radius: 10px; overflow: hidden; background: #fff; cursor: zoom-in; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; display: block; }
.gallery-strip { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; scrollbar-width: none; }
.gallery-strip button { flex: none; width: 52px; height: 40px; border-radius: 8px; overflow: hidden; border: 2px solid transparent; padding: 0;
  background: #fff; cursor: pointer; opacity: .75; }
.gallery-strip button.on, .gallery-strip button:hover { border-color: var(--accent); opacity: 1; }
.gallery-strip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-strip .more { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 13px; }
.oline { display: flex; gap: 10px; align-items: flex-start; }
.oline .tthumb { width: 40px; height: 40px; }
.lb { position: fixed; inset: 0; z-index: 100; background: rgba(10, 12, 16, .88); backdrop-filter: blur(6px);
  display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: center; }
.lb[hidden] { display: none; }
.lb figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 0; }
.lb img { max-width: 100%; max-height: 82vh; border-radius: 12px; background: #fff; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.lb figcaption { color: #e6e8ec; font-size: 14px; text-align: center; }
.lb-nav, .lb-x { border: 0; background: rgba(255, 255, 255, .1); color: #fff; width: 48px; height: 48px; border-radius: 50%; cursor: pointer;
  font-size: 28px; line-height: 1; justify-self: center; }
.lb-nav:hover, .lb-x:hover { background: rgba(255, 255, 255, .22); }
.lb-nav[hidden] { visibility: hidden; display: block; }
.lb-x { position: absolute; top: 16px; right: 16px; font-size: 18px; }
@media (max-width: 1100px) { .hero.with-photo { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .hero.with-photo .photo-card { grid-column: 1 / -1; } }
@media (max-width: 860px) {
  .vrow { grid-template-columns: 56px minmax(0, 1fr) auto; }
  .vrow .vthumb { grid-row: 1 / span 2; width: 56px; height: 44px; }
  .vrow .vdelta { grid-column: 2; grid-row: 2; }
  .vrow .vcost { grid-column: 3; grid-row: 1 / span 2; }
  .hero.with-photo { grid-template-columns: 1fr; }
}
@media (max-width: 640px) { .lb { grid-template-columns: 40px minmax(0, 1fr) 40px; } .lb-nav { width: 36px; height: 36px; font-size: 22px; } }
[hidden] { display: none !important; }
@media (max-width: 1100px) { .hero.with-photo .gallery-main { aspect-ratio: 16 / 9; max-height: 420px; } }
.gallery-main { max-height: 460px; }

/* ---------- order: cost line ---------- */
.costline { color: var(--muted); font-size: 13px; margin-top: -6px; }
.small-toggle { font-size: 13px; }

/* ---------- gallery manager ---------- */
.gal-grid { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; align-items: start; }
.gal-list { position: sticky; top: 76px; }
.gal-scroll { max-height: calc(100vh - 220px); overflow-y: auto; padding-bottom: 8px; }
.gal-gtitle { padding: 12px 14px 6px; font-size: 12px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; }
.gal-item { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; text-align: left;
  border: 0; background: none; padding: 7px 14px; cursor: pointer; font-size: 13px; }
.gal-item:hover { background: var(--surface-2); }
.gal-item.on { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.gal-item img, .gal-item .noimg { width: 40px; height: 32px; border-radius: 6px; object-fit: cover; background: #fff; border: 1px solid var(--line); display: block; }
.gal-item .noimg { background: repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 5px, var(--bg) 5px, var(--bg) 10px); }
.gal-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gal-editor { min-height: 420px; }
.gal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px; border: 2px dashed var(--line-strong); border-radius: 14px;
  background: var(--surface-2); cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop span { color: var(--muted); font-size: 13px; }
.drop .progress { color: var(--accent-text); font-weight: 600; }
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-top: 16px; }
.ph-card { position: relative; margin: 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #fff; aspect-ratio: 4 / 3; }
.ph-card.cover { border: 2px solid var(--accent); }
.ph-card img { width: 100%; height: 100%; object-fit: contain; display: block; cursor: zoom-in; }
.cover-tag { position: absolute; left: 8px; top: 8px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.ph-tools { position: absolute; right: 6px; bottom: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.ph-card:hover .ph-tools { opacity: 1; }
.ph-tools button { width: 30px; height: 30px; border-radius: 8px; border: 0; background: rgba(15, 23, 41, .75); color: #fff; cursor: pointer; font-size: 15px; }
.ph-tools button.del:hover { background: #c4320a; }
@media (hover: none) { .ph-tools { opacity: 1; } }
@media (max-width: 860px) { .gal-grid { grid-template-columns: 1fr; } .gal-list { position: static; } .gal-scroll { max-height: 320px; } }

.offer-setup { margin-top: 16px; }
.offer-setup summary { cursor: pointer; }
.offer-fields { display: grid; grid-template-columns: 1fr 160px; gap: 12px; margin-top: 14px; }
.offer-fields .wide { grid-column: 1 / -1; }
.input.area { height: auto; padding: 10px 12px; resize: vertical; font: inherit; line-height: 1.4; }
@media (max-width: 640px) { .offer-fields { grid-template-columns: 1fr; } }

/* ---------- constructor ---------- */
.center-box { display: grid; place-items: center; padding: 40px 0; }
.login.inline { box-shadow: var(--shadow); }
.linkbtn.danger { color: var(--bad); } .linkbtn.danger:hover { background: var(--bad-soft); }
.b-head { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.b-head .wide { grid-column: 1 / -1; }
.big-input { height: 46px; font-size: 17px; font-weight: 600; }
.b-line { display: grid; grid-template-columns: minmax(0, 1fr) auto 130px 32px; gap: 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); }
.b-line.sub { padding-left: 40px; background: var(--surface-2); }
.b-line.ro { grid-template-columns: minmax(0, 1fr) 70px 130px 32px; }
.b-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.b-name { min-width: 0; font-weight: 550; overflow-wrap: anywhere; }
.b-tog { width: 24px; height: 24px; flex: none; border: 0; background: none; color: var(--faint); cursor: pointer; border-radius: 6px; font-size: 18px; transition: transform .15s; }
.b-tog[aria-expanded="true"] { transform: rotate(90deg); color: var(--accent); }
.b-tog.none { cursor: default; }
.b-cost { line-height: 1.25; }
.b-kids { border-left: 3px solid var(--accent-soft); margin-left: 26px; }
.b-kidbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 14px 8px 40px; background: var(--surface-2); border-top: 1px solid var(--line); flex-wrap: wrap; }
.search.mini { width: 240px; display: inline-block; vertical-align: middle; }
.search.mini input { height: 32px; padding-left: 32px; font-size: 13px; box-shadow: none; }
.search.mini svg { top: 9px; left: 10px; }
.tthumb.ph-empty { display: inline-block; background: var(--surface-2); cursor: default; }
.nn-card { margin-top: 16px; border: 2px dashed var(--accent); }
.sub-lines .b-line.sub { padding-left: 14px; }
.small-grand { padding-top: 8px; font-size: 14px; } .small-grand strong { font-size: 16px !important; }
@media (max-width: 860px) { .b-head { grid-template-columns: 1fr; } .b-line { grid-template-columns: minmax(0, 1fr) auto; } .b-line .b-cost { grid-column: 1; } }
