/* LED profile builder - IGM store. RTL, mobile first. */
:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #17212b;
  --muted: #5d6b79;
  --line: #d9e0e7;
  --brand: #0b5cab;
  --brand-ink: #ffffff;
  --brand-soft: #e7f0fa;
  --ok: #1a7f4b;
  --warn: #8a5a00;
  --warn-bg: #fff6df;
  --bad: #b3261e;
  --bad-bg: #fdecea;
  --radius: 12px;
  --feed: #d81e3a;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "Heebo", "Arial Hebrew", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
#app { max-width: 880px; margin: 0 auto; padding: 16px 12px 120px; }
.loading { padding: 60px 0; text-align: center; color: var(--muted); }
h1, h2, h3, p { margin: 0; }
.top { padding: 8px 4px 12px; }
.brand { font-weight: 700; color: var(--brand); letter-spacing: .02em; }
.title { font-size: 1.6rem; line-height: 1.25; margin-top: 2px; }
.subtitle { color: var(--muted); margin-top: 6px; max-width: 60ch; }
.banner { background: var(--warn-bg); color: var(--warn); border: 1px solid #f0d28a; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; font-weight: 600; }
.toast { background: var(--brand-soft); color: var(--brand); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; font-weight: 600; }
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab { flex: 1; padding: 10px 12px; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tab.is-on { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.main { display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.card.center { text-align: center; align-items: center; }
.card-title { font-size: 1.15rem; }
.muted { color: var(--muted); font-size: .92rem; }
.grid { display: grid; grid-template-columns: 1fr; gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-weight: 600; font-size: .95rem; }
.field-help { color: var(--muted); font-size: .86rem; }
.static { padding: 9px 12px; background: var(--bg); border-radius: 8px; width: fit-content; max-width: 100%; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; color: inherit; background: #fff; min-height: 44px; }
.input:focus-visible, .choice:focus-visible, .btn:focus-visible, .tab:focus-visible, .fam-card:focus-visible, .link:focus-visible, .step-btn:focus-visible { outline: 3px solid #8cbcf0; outline-offset: 1px; }
.input.is-bad { border-color: var(--bad); background: var(--bad-bg); }
select.input { appearance: auto; }
textarea.input { resize: vertical; min-height: 64px; }
.num { position: relative; display: flex; align-items: center; }
.num .input { direction: ltr; text-align: right; padding-left: 48px; padding-right: 12px; }
.num-suffix { position: absolute; left: 12px; color: var(--muted); font-size: .85rem; pointer-events: none; }
.choices { display: flex; gap: 8px; }
.choices-wrap, .choices-shape, .choices-icon { flex-wrap: wrap; }
.choice { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; color: inherit; cursor: pointer; text-align: center; }
.choice.is-on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; box-shadow: inset 0 0 0 1px var(--brand); }
.choices-shape .choice { flex-direction: column; gap: 2px; min-width: 92px; padding: 8px 10px; }
.shape-icon { width: 46px; height: 44px; fill: none; stroke: currentColor; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.choices-icon .choice { width: 48px; padding: 6px; }
.orient-icon { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.swatch { width: 20px; height: 20px; border-radius: 50%; border: 1px solid #aab4bf; flex: none; }
.sw-white { background: #fff; }
.sw-black { background: #1b1b1b; }
.sw-nickel { background: linear-gradient(135deg, #d9d9d9, #9a9a9a); }
.sw-ral { background: conic-gradient(#e53935, #fdd835, #43a047, #1e88e5, #8e24aa, #e53935); }
.led::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 1px solid #aab4bf; flex: none; }
.k24::before { background: #ffd98a; } .k27::before { background: #ffe6ad; } .k30::before { background: #fff0cf; }
.k40::before { background: #f4f8ff; } .k60::before { background: #dfeaff; }
.k-rgb::before { background: conic-gradient(#ef4444, #eab308, #22c55e, #3b82f6, #a855f7, #ef4444); }
.k-red::before { background: #ef4444; } .k-blue::before { background: #3b82f6; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--brand); }
.check-confirm { font-weight: 600; }
.addon { display: flex; flex-direction: column; gap: 10px; }
.addon-qty { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-inline-start: 30px; }
.addon-body { display: grid; grid-template-columns: 1fr; gap: 12px; padding-inline-start: 30px; }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.step-btn { width: 44px; height: 44px; border: 1px solid var(--line); background: #fff; border-radius: 8px; font-size: 1.3rem; cursor: pointer; color: inherit; }
.step-input { width: 76px; text-align: center; direction: ltr; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:disabled { background: #a9b6c3; cursor: not-allowed; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); width: fit-content; }
.btn-block { width: 100%; }
.link { background: none; border: 0; padding: 4px 2px; font: inherit; color: var(--brand); cursor: pointer; text-decoration: underline; }
.link-danger { color: var(--bad); }
.actions { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.msg { padding: 8px 12px; border-radius: 8px; font-size: .93rem; }
.msg-bad { background: var(--bad-bg); color: var(--bad); }
.msg-warn { background: var(--warn-bg); color: var(--warn); }
.msg-info { background: var(--brand-soft); color: var(--brand); }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--bg); color: var(--muted); font-size: .8rem; }
.tag-ok { background: #e3f4ea; color: var(--ok); }

/* model picker */
.filter { overflow-x: auto; }
.group-title { font-size: 1rem; margin: 6px 0 8px; color: var(--muted); }
.fam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.fam-card { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; font: inherit; color: inherit; cursor: pointer; text-align: start; }
.fam-card:hover { border-color: var(--brand); }
.fam-photo { height: 74px; display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 8px; overflow: hidden; }
.fam-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.fam-name { font-weight: 700; }
.fam-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.chosen { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.chosen-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chosen-photo { width: 120px; height: 64px; display: flex; align-items: center; justify-content: center; flex: none; }
.chosen-name { font-size: 1.2rem; font-weight: 700; }
.chosen-side { display: flex; align-items: center; gap: 12px; }
.section-img { height: 64px; max-width: 120px; object-fit: contain; }

/* dimensions + sketch */
.dims-wrap { display: grid; grid-template-columns: 1fr; gap: 16px; }
.dims-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.dims { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dims-1 { grid-template-columns: minmax(0, 220px); }
.dim { display: flex; flex-direction: column; gap: 4px; }
.dim-label { font-size: .88rem; font-weight: 600; color: var(--muted); }
.angles summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.sketch-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sketch-box { border: 1px dashed var(--line); border-radius: var(--radius); background: #fbfcfd; min-height: 200px; display: flex; align-items: center; justify-content: center; padding: 8px; }
.sketch { width: 100%; max-width: 380px; height: 240px; }
.sketch-small { width: 100%; height: 96px; }
.sketch-small .sk-line { stroke-width: 7; }
.sk-line { stroke: #22303d; stroke-width: 5; stroke-linecap: round; fill: none; }
.sk-missing { stroke: #b6c1cc; stroke-dasharray: 6 7; }
.sk-label { font-size: 15px; font-weight: 700; fill: var(--brand); }
.sk-feed { fill: var(--feed); stroke: #fff; stroke-width: 2; }
.sk-feed-n { font-size: 9px; font-weight: 700; fill: #fff; }
.total { font-weight: 600; }
.feeds { display: flex; flex-direction: column; gap: 12px; }
.feed-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.feed-head { display: flex; justify-content: space-between; align-items: center; }
.switch-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* price bar */
.pricebar { position: fixed; inset-inline: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(20, 30, 40, .08); z-index: 10; }
.pricebar-in { max-width: 880px; margin: 0 auto; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.price { min-width: 0; }
.price-label { font-size: .8rem; color: var(--muted); }
.price-value { font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.price-vat { font-size: .8rem; font-weight: 500; color: var(--muted); margin-inline-start: 6px; }
.price-note { font-weight: 600; font-size: .95rem; }
.price-bad { color: var(--bad); }
.price-sub { font-size: .82rem; color: var(--muted); }
.pricebar-actions { display: flex; gap: 8px; flex: none; }

/* cart */
.item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.item:first-of-type { padding-top: 0; }
.item-sketch { flex: none; width: 100px; display: flex; align-items: flex-start; justify-content: center; }
.item-sketch .sketch { height: 150px; }
.item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.item-title { font-weight: 700; }
.item-lines { margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: .92rem; }
.item-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.item-price { font-weight: 800; }
.item-actions { display: flex; gap: 12px; margin-inline-start: auto; }
.radio { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.radio.is-on { border-color: var(--brand); background: var(--brand-soft); }
.radio input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
.radio-main { flex: 1; display: flex; flex-direction: column; }
.radio-title { font-weight: 700; }
.radio-price { font-weight: 700; flex: none; }
.totals { display: flex; flex-direction: column; gap: 6px; }
.totals.is-loading { opacity: .55; }
.row { display: flex; justify-content: space-between; gap: 12px; }
.row-total { font-size: 1.2rem; font-weight: 800; border-top: 1px solid var(--line); padding-top: 8px; }
.row-total small { font-size: .75rem; font-weight: 500; color: var(--muted); }
.order-box { display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; padding: 12px 0; }
.order-num { font-size: 1.2rem; font-weight: 800; }
.order-ok { font-weight: 700; color: var(--ok); }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--brand); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

@media (min-width: 720px) {
  #app { padding: 24px 16px 120px; }
  .grid { grid-template-columns: 1fr 1fr; }
  .field-wide { grid-column: 1 / -1; }
  .dims-wrap { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dims-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dims-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .addon-body { grid-template-columns: 1fr 1fr 1fr; }
  .item-sketch { width: 150px; }
  .item-review .item-sketch { width: 260px; }
  .item-review .item-sketch .sketch { height: 190px; }
}
@media (max-width: 420px) {
  .pricebar-in { flex-direction: column; align-items: stretch; }
  .pricebar-actions .btn { flex: 1; }
  .item { flex-direction: column; }
  .item-sketch { width: 100%; }
}
[hidden] { display: none !important; }
