/* PS Engineering — Generator Size Calculator (one page) */
:root {
  --bg: #F7F5F1;
  --ink: #15161A;
  --ink-soft: #6A6C74;
  --red: #E0263C;
  --blue: #1E5FC2;
  --line: #E5E2DA;
  --green: #1FAF55;
  --amber: #F59E0B;
  --card: #FFFFFF;
  --font: 'Space Grotesk', 'Noto Sans Bengali', sans-serif;
  --mono: 'IBM Plex Mono', monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
button { font-family: var(--font); }
img { max-width: 100%; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 64px);
  background: rgba(247, 245, 241, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1.5px solid var(--line);
}
.nav-logo { height: 44px; display: block; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.lang-toggle {
  display: flex; border: 2px solid var(--ink); border-radius: 10px;
  overflow: hidden; font-size: 13px; font-weight: 700; cursor: pointer;
}
.lang-toggle button {
  padding: 8px 14px; border: none; background: transparent;
  font-size: 13px; font-weight: 700; cursor: pointer; color: var(--ink);
  min-height: 36px;
}
.lang-toggle button.on { background: var(--ink); color: #fff; }
.btn-wa {
  padding: 11px 20px; border-radius: 10px; border: none;
  background: var(--green); color: #fff; font-size: 14px; font-weight: 700;
  cursor: pointer; text-decoration: none; display: inline-block;
}
.btn-wa:hover { filter: brightness(1.07); }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: clamp(40px, 7vh, 80px) 16px 0; }
.hero h1 {
  font-size: clamp(38px, 6.4vw, 76px);
  font-weight: 700; letter-spacing: -0.03em; line-height: 1.04; margin: 0;
}
.hero-sub { font-size: clamp(16px, 2vw, 20px); color: var(--ink-soft); margin: 18px auto 0; max-width: 560px; text-wrap: pretty; }
.hero-sub strong { color: var(--ink); }

.demo { width: min(740px, 100%); margin: clamp(32px, 5vh, 56px) auto 0; padding: 0 16px; position: relative; }
.demo-row { display: flex; gap: clamp(10px, 2vw, 28px); justify-content: center; }
.demo-tile {
  position: relative; background: #fff; border: 2px solid var(--line); border-radius: 16px;
  padding: clamp(12px, 1.6vw, 20px) 6px clamp(10px, 1.4vw, 14px);
  text-align: center; flex: 1; max-width: 124px;
  animation: tilePop 9s cubic-bezier(.2,.8,.3,1) infinite;
  animation-delay: var(--d);
}
.demo-tile .nm { font-size: clamp(11px, 1.3vw, 14.5px); font-weight: 700; margin-top: 8px; }
.demo-badge {
  position: absolute; top: -10px; right: -10px; width: 28px; height: 28px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 14px; font-weight: 700;
  display: grid; place-items: center; box-shadow: 0 3px 8px rgba(224,38,60,.35);
  opacity: 0; animation: badgePop 9s cubic-bezier(.2,.8,.3,1) infinite; animation-delay: var(--d);
}
@keyframes tilePop {
  0%, 8% { border-color: var(--line); transform: scale(1); box-shadow: 0 2px 8px rgba(21,22,26,.05); }
  10% { transform: scale(.94); }
  12%, 70% { border-color: var(--blue); transform: scale(1); box-shadow: 0 10px 24px rgba(30,95,194,.18); }
  80%, 100% { border-color: var(--line); box-shadow: 0 2px 8px rgba(21,22,26,.05); }
}
@keyframes badgePop {
  0%, 9% { opacity: 0; transform: scale(.4); }
  13%, 70% { opacity: 1; transform: scale(1); }
  80%, 100% { opacity: 0; transform: scale(.4); }
}
.demo-cursor { position: absolute; left: 42px; top: 104px; pointer-events: none; z-index: 3; animation: handMove 9s cubic-bezier(.2,.8,.3,1) infinite; }
.demo-cursor span {
  display: block; width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--ink); background: rgba(255,255,255,.7);
  box-shadow: 0 4px 10px rgba(21,22,26,.25);
}
@keyframes handMove {
  0%, 6% { transform: translate(0,0); opacity: 1; }
  10% { transform: translate(0,6px); } 12% { transform: translate(0,0); }
  22% { transform: translate(152px,0); } 24% { transform: translate(152px,6px); } 26% { transform: translate(152px,0); }
  34% { transform: translate(304px,0); } 36% { transform: translate(304px,6px); } 38% { transform: translate(304px,0); }
  46% { transform: translate(456px,0); } 48% { transform: translate(456px,6px); } 50% { transform: translate(456px,0); }
  58% { transform: translate(608px,0); } 60% { transform: translate(608px,6px); } 62% { transform: translate(608px,0); }
  75%, 88% { transform: translate(608px,40px); opacity: 0; }
  92%, 100% { transform: translate(0,0); opacity: 1; }
}
.demo-bar { margin-top: 36px; display: flex; align-items: center; gap: 14px; }
.demo-track { flex: 1; height: 20px; border-radius: 999px; border: 2.5px solid var(--ink); overflow: hidden; background: #fff; }
.demo-fill { height: 100%; width: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--blue), var(--red)); animation: fillGrow 9s cubic-bezier(.3,.7,.2,1) infinite; transform-origin: left; }
@keyframes fillGrow {
  0%, 6% { transform: scaleX(0.06); }
  14% { transform: scaleX(0.2); } 26% { transform: scaleX(0.34); } 38% { transform: scaleX(0.52); }
  50% { transform: scaleX(0.71); } 62%, 88% { transform: scaleX(0.86); }
  96%, 100% { transform: scaleX(0.06); }
}
.demo-kva { font-size: clamp(16px, 2vw, 22px); font-weight: 700; flex-shrink: 0; }

.hero-ctas { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: clamp(32px, 5vh, 52px); padding: 0 16px; }
.btn-big {
  padding: 18px 36px; border-radius: 12px; font-size: clamp(16px, 1.6vw, 19px); font-weight: 700;
  cursor: pointer; border: 2.5px solid var(--ink); min-height: 56px;
  transition: transform .15s cubic-bezier(.2,.8,.3,1), box-shadow .15s;
  text-decoration: none; display: inline-flex; align-items: center; color: var(--ink); background: #fff;
}
.btn-big.primary { background: var(--red); color: #fff; box-shadow: 5px 5px 0 var(--ink); }
.btn-big:hover { transform: translate(-2px,-2px); }
.btn-big.primary:hover { box-shadow: 7px 7px 0 var(--ink); }
.hero-note { font-size: 13.5px; color: var(--ink-soft); margin-top: 18px; padding: 0 16px; }

/* ---------- Calculator ---------- */
.calc { padding: clamp(56px, 9vh, 100px) clamp(16px, 4vw, 64px) 40px; max-width: 1440px; margin: 0 auto; }
.calc-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.step-chip {
  display: inline-block; font-family: var(--mono); font-size: 11.5px; letter-spacing: .16em;
  background: var(--ink); color: #fff; padding: 6px 12px; border-radius: 4px; margin-bottom: 12px;
}
.calc-head h2 { font-size: clamp(28px, 3.6vw, 44px); font-weight: 700; letter-spacing: -0.025em; margin: 0; }
.calc-head .hint { font-size: 14px; color: var(--ink-soft); }
.btn-reset {
  padding: 9px 16px; border-radius: 999px; border: 1.5px solid var(--line);
  background: #fff; font-size: 13px; font-weight: 600; color: var(--ink-soft); cursor: pointer;
}
.btn-reset:hover { border-color: var(--ink); color: var(--ink); }

.calc-body { display: grid; grid-template-columns: 1fr 430px; gap: 36px; align-items: start; }
.tile-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }

.tile {
  position: relative; background: #fff; border-radius: 16px; cursor: pointer;
  border: 2px solid var(--line); box-shadow: 0 2px 8px rgba(21,22,26,.05);
  padding: 18px 12px 14px; text-align: center; user-select: none;
  transition: border-color .15s, box-shadow .2s, transform .12s;
}
.tile:hover { transform: translateY(-3px); }
.tile:active { transform: scale(.97); }
.tile.on { border-color: var(--blue); box-shadow: 0 8px 22px rgba(30,95,194,.16); }
.tile-qty {
  position: absolute; top: -10px; right: -10px; min-width: 28px; height: 28px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 14.5px; font-weight: 700;
  display: grid; place-items: center; padding: 0 7px; box-shadow: 0 3px 8px rgba(224,38,60,.35);
  animation: qtyIn .25s cubic-bezier(.2,.8,.3,1);
}
@keyframes qtyIn { from { transform: scale(.5); } }
.tile-icon { display: grid; place-items: center; height: 50px; color: var(--ink); }
.tile.on .tile-icon { color: var(--blue); }
.tile-name { font-size: 15px; font-weight: 700; margin-top: 8px; }
.tile-sub { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; min-height: 15px; }
.tile-meta { font-size: 11px; color: var(--ink-soft); margin-top: 10px; font-family: var(--mono); }
.size-chips { display: flex; gap: 5px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.size-chips button {
  padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; cursor: pointer;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink-soft); min-height: 26px;
  white-space: nowrap; font-family: var(--font);
}
.size-chips button.on { border-color: var(--blue); background: var(--blue); color: #fff; }
.tile-steps { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.tile-steps button {
  width: 38px; height: 38px; border-radius: 10px; font-size: 18px; font-weight: 700; cursor: pointer;
}
.tile-steps .minus { border: 2px solid var(--line); background: #fff; color: var(--ink); }
.tile-steps .plus { border: none; background: var(--blue); color: #fff; }
.tile-steps button:hover { filter: brightness(1.07); }

/* ---------- Result panel ---------- */
.panel {
  background: #fff; border-radius: 20px; border: 2px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink); padding: 26px; position: sticky; top: 92px;
}
.panel-label { font-family: var(--mono); font-size: 11.5px; letter-spacing: .14em; color: var(--ink-soft); margin-bottom: 14px; }
.panel-main { display: flex; gap: 20px; align-items: stretch; }
.battery {
  width: 62px; border-radius: 12px; border: 2.5px solid var(--ink); position: relative;
  overflow: hidden; background: #F3F1EB; height: 200px; flex-shrink: 0;
}
.battery-fill {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(180deg, var(--red), var(--blue));
  transition: height .6s cubic-bezier(.3,.7,.2,1);
}
.battery-mark { position: absolute; left: 0; right: 0; height: 2px; background: rgba(255,255,255,.6); }
.battery-bolt { position: absolute; inset: 0; display: grid; place-items: center; color: var(--line); }
.battery-bolt.live { color: #fff; animation: boltPulse 1.6s ease-in-out infinite; }
@keyframes boltPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(.88); opacity: .8; } }
.panel-empty { font-size: 16.5px; line-height: 1.55; color: var(--ink-soft); padding-top: 6px; }
.panel-empty strong { color: var(--ink); }
.kva-big { font-size: clamp(48px, 5vw, 62px); font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.kva-big .unit { font-size: 25px; color: var(--ink-soft); font-weight: 600; }
.kva-text { font-size: 15.5px; line-height: 1.5; margin-top: 10px; }
.kva-text .soft { color: var(--ink-soft); }
.level-chip {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 12px;
  background: #F3F1EB; border-radius: 999px; padding: 7px 14px; font-size: 13.5px; font-weight: 700;
}
.level-chip svg { color: var(--blue); }
.level-track { display: flex; gap: 5px; margin-top: 20px; }
.level-track div { flex: 1; height: 9px; border-radius: 999px; background: #ECE9E1; transition: background .3s; }
.level-track div.past { background: var(--blue); }
.level-track div.now { background: var(--red); }
.level-names { display: flex; justify-content: space-between; font-size: 10px; font-family: var(--mono); color: var(--ink-soft); margin-top: 6px; }
.surge-note {
  margin-top: 16px; background: #FFF7E8; border: 1.5px solid var(--amber); border-radius: 12px;
  padding: 12px 16px; font-size: 13.5px; line-height: 1.5;
  animation: noteIn .35s cubic-bezier(.2,.8,.3,1) both;
}
@keyframes noteIn { from { opacity: 0; transform: translateY(8px); } }
.panel-ctas { display: grid; gap: 10px; margin-top: 20px; }
.btn-panel-wa {
  padding: 16px 0; border-radius: 12px; border: none; background: var(--green); color: #fff;
  font-size: 15.5px; font-weight: 700; cursor: pointer; text-align: center; text-decoration: none; display: block;
}
.btn-panel-wa:hover { filter: brightness(1.06); }
.btn-panel-wa.off { background: #D8D5CC; pointer-events: none; }
.btn-copy {
  padding: 12px 0; border-radius: 12px; border: 1.5px solid var(--line); background: #fff;
  font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer;
}
.btn-copy:hover { border-color: var(--ink); }
.btn-copy:disabled { color: var(--ink-soft); cursor: default; }
.panel-foot { text-align: center; font-size: 11.5px; color: var(--ink-soft); }

/* mobile fixed result bar */
.mobile-bar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: #fff; border-top: 2px solid var(--ink); padding: 10px 16px;
  box-shadow: 0 -8px 28px rgba(21,22,26,.14);
  align-items: center; gap: 12px; justify-content: space-between;
}
.mobile-bar .num { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.mobile-bar .num span { font-size: 14px; color: var(--ink-soft); }
.mobile-bar .lvl { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
.mobile-bar a {
  padding: 13px 18px; border-radius: 10px; background: var(--green); color: #fff;
  font-size: 14px; font-weight: 700; text-decoration: none; white-space: nowrap;
}

/* ---------- Sections ---------- */
.section { padding: clamp(56px, 9vh, 100px) clamp(16px, 4vw, 64px); max-width: 1240px; margin: 0 auto; }
.section h2 { font-size: clamp(26px, 3.4vw, 40px); font-weight: 700; letter-spacing: -0.025em; margin: 0 0 8px; text-align: center; }
.section .lead { text-align: center; color: var(--ink-soft); font-size: 16px; margin: 0 0 36px; }
.edu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.edu-card { background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 26px 24px; }
.edu-card.bad { border-color: #F3C2C9; }
.edu-card.good { border-color: var(--green); box-shadow: 0 8px 24px rgba(31,175,85,.12); }
.edu-emoji { font-size: 15px; font-weight: 700; display: inline-block; padding: 6px 12px; border-radius: 999px; margin-bottom: 14px; }
.edu-card.bad .edu-emoji { background: #FDEDEF; color: var(--red); }
.edu-card.good .edu-emoji { background: #E8F8EE; color: var(--green); }
.edu-card h3 { font-size: 19px; margin: 0 0 8px; }
.edu-card p { font-size: 14.5px; line-height: 1.6; color: var(--ink-soft); margin: 0; text-wrap: pretty; }

.trust-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.trust-card { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 22px 20px; text-align: center; }
.trust-card .big { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; color: var(--blue); }
.trust-card .big.alt { color: var(--red); }
.trust-card .sm { font-size: 13.5px; color: var(--ink-soft); margin-top: 6px; line-height: 1.45; }

/* ---------- Lead ---------- */
.lead-card {
  background: #fff; border: 2px solid var(--ink); border-radius: 20px; box-shadow: 6px 6px 0 var(--ink);
  padding: clamp(24px, 4vw, 40px); max-width: 640px; margin: 0 auto;
}
.lead-card h2 { text-align: left; }
.lead-card .sub { color: var(--ink-soft); font-size: 14.5px; margin: 6px 0 24px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 14px 16px; border-radius: 12px; border: 2px solid var(--line);
  font-family: var(--font); font-size: 15.5px; background: var(--bg); color: var(--ink); min-height: 50px;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--blue); background: #fff; }
.lead-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.btn-lead {
  width: 100%; padding: 17px 0; border-radius: 12px; border: none; background: var(--green); color: #fff;
  font-size: 16px; font-weight: 700; cursor: pointer; margin-top: 6px;
}
.btn-lead:hover { filter: brightness(1.06); }
.lead-foot { font-size: 12px; color: var(--ink-soft); text-align: center; margin-top: 12px; }

/* ---------- Footer ---------- */
.footer { border-top: 2px solid var(--ink); background: #fff; padding: 36px clamp(16px, 4vw, 64px) 110px; }
.footer-in { max-width: 1240px; margin: 0 auto; display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: center; }
.footer .fcol { font-size: 13.5px; color: var(--ink-soft); line-height: 1.7; }
.footer .fcol strong { color: var(--ink); }
.footer-disc { max-width: 1240px; margin: 22px auto 0; font-size: 12px; color: var(--ink-soft); border-top: 1.5px solid var(--line); padding-top: 16px; line-height: 1.6; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .calc-body { grid-template-columns: 1fr; }
  .panel { position: static; }
  .tile-grid { grid-template-columns: repeat(3, 1fr); }
  .trust-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .demo-cursor { display: none; }
  .mobile-bar.show { display: flex; }
}
@media (max-width: 700px) {
  .edu-grid { grid-template-columns: 1fr; }
  .lead-row { grid-template-columns: 1fr; }
  .tile-grid { gap: 12px; }
  .tile { padding: 12px 6px 10px; }
  .tile-name { font-size: 12.5px; }
  .tile-icon { height: 40px; }
  .tile-icon svg { width: 36px; height: 36px; }
  .nav-logo { height: 36px; }
}
@media (max-width: 480px) {
  .trust-grid { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .demo-tile, .demo-badge, .demo-cursor, .demo-fill, .battery-bolt.live { animation: none !important; }
}

/* ---------- Added: fast text entry + calculation detail ---------- */
.quick-entry {
  background: #fff;
  border: 2px dashed var(--line);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: minmax(190px, .75fr) 1.25fr;
  gap: 14px;
  align-items: center;
}
.quick-entry label { font-weight: 700; font-size: 15px; display: block; margin-bottom: 4px; }
.quick-entry p { margin: 0; color: var(--ink-soft); font-size: 12.5px; line-height: 1.45; }
.quick-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.quick-row input {
  min-height: 46px;
  border-radius: 12px;
  border: 2px solid var(--line);
  padding: 0 14px;
  font-family: var(--font);
  font-size: 14.5px;
  background: var(--bg);
  color: var(--ink);
}
.quick-row input:focus { outline: none; border-color: var(--blue); background: #fff; }
.quick-row button {
  border: none;
  border-radius: 12px;
  padding: 0 18px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.quick-msg { grid-column: 1 / -1; font-size: 12.5px; color: var(--ink-soft); }
.start-wrap { margin-top: 8px; }
.start-label { font-size: 10px; font-family: var(--mono); color: var(--ink-soft); letter-spacing: .08em; margin-bottom: 5px; }
.start-chips { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.start-chips button {
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
}
.start-chips button.on { border-color: var(--red); background: var(--red); color: #fff; }
.calc-detail {
  margin-top: 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #FAF9F5;
  display: grid;
  gap: 7px;
}
.calc-detail-title { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.calc-detail div:not(.calc-detail-title) { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.calc-detail span { color: var(--ink-soft); }
.calc-detail strong { color: var(--ink); }
.calc-detail p { margin: 4px 0 0; color: var(--ink-soft); font-size: 11.5px; line-height: 1.45; }
@media (max-width: 700px) {
  .quick-entry { grid-template-columns: 1fr; }
  .quick-row { grid-template-columns: 1fr; }
  .quick-row button { min-height: 44px; }
}

/* ---------- Added: custom load entry ---------- */
.custom-load-box {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: 0 10px 26px rgba(21,22,26,.04);
}
.custom-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.custom-eyebrow {
  display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px;
  background: #EEF4FF; color: var(--blue); font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: .08em; margin-bottom: 7px;
}
.custom-head h3 { margin: 0 0 4px; font-size: 20px; letter-spacing: -0.02em; }
.custom-head p { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.45; max-width: 760px; }
.custom-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 82px 110px minmax(150px, .7fr) auto;
  gap: 10px;
  align-items: end;
}
.custom-field label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 5px; }
.custom-field input, .custom-field select {
  width: 100%; min-height: 44px; border-radius: 12px; border: 2px solid var(--line);
  background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; padding: 0 12px;
}
.custom-field input:focus, .custom-field select:focus { outline: none; border-color: var(--blue); background: #fff; }
.custom-add {
  min-height: 44px; border: none; border-radius: 12px; background: var(--ink); color: #fff;
  font-weight: 700; padding: 0 18px; cursor: pointer; white-space: nowrap;
}
.custom-add:hover { filter: brightness(1.08); }
.custom-msg { margin-top: 10px; font-size: 12.5px; color: var(--ink-soft); }
.custom-list { display: grid; gap: 8px; margin-top: 12px; }
.custom-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; background: #FAF9F5;
}
.custom-item strong { display: block; font-size: 13.5px; }
.custom-item span { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.custom-actions { display: flex; gap: 6px; align-items: center; }
.custom-actions button {
  min-width: 32px; height: 32px; border-radius: 9px; border: 1.5px solid var(--line); background: #fff;
  color: var(--ink); font-weight: 800; cursor: pointer;
}
.custom-actions button:hover { border-color: var(--blue); }
.custom-actions .danger { min-width: auto; padding: 0 10px; color: var(--red); font-size: 12px; }
@media (max-width: 900px) {
  .custom-form { grid-template-columns: 1fr 1fr; }
  .custom-field.name, .custom-field.mode, .custom-add { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .custom-form { grid-template-columns: 1fr; }
  .custom-item { align-items: flex-start; flex-direction: column; }
}

/* ---------- Deep finalized UI fixes: clean square cards + emoji custom loads ---------- */
.tile-grid { align-items: stretch; }
.tile {
  min-height: 176px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 10px 58px;
  overflow: visible;
}
.tile-icon { height: 48px; flex: 0 0 auto; }
.tile-name, .tile-sub, .tile-meta { max-width: 100%; overflow-wrap: anywhere; }
.tile-meta { min-height: 18px; }
.tile-steps {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  margin-top: 0;
}
.tile-steps button { flex: 1; height: 36px; }

.load-options-panel {
  margin-top: 18px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 10px 26px rgba(21,22,26,.04);
}
.load-options-head h3 { margin: 0 0 4px; font-size: 18px; letter-spacing: -0.02em; }
.load-options-head p { margin: 0 0 12px; color: var(--ink-soft); font-size: 12.5px; }
.load-options-list { display: grid; gap: 10px; }
.load-option-row {
  display: grid;
  grid-template-columns: minmax(170px, .9fr) 1fr 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #FAF9F5;
}
.load-option-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.load-option-icon {
  width: 42px; height: 42px; border-radius: 12px; background: #fff; border: 1.5px solid var(--line);
  display: grid; place-items: center; flex: 0 0 auto; color: var(--blue);
}
.load-option-title strong { display: block; font-size: 13.5px; }
.load-option-title span { display: block; font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }
.option-block label { display: block; font-size: 11px; font-weight: 800; color: var(--ink-soft); margin-bottom: 6px; }
.option-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.option-chips button {
  border: 1.5px solid var(--line); background: #fff; color: var(--ink-soft); border-radius: 999px;
  padding: 6px 9px; font-size: 11px; font-weight: 800; cursor: pointer; white-space: nowrap;
}
.option-chips button.on { background: var(--blue); color: #fff; border-color: var(--blue); }

.preset-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 4px 2px 12px;
  margin: 0 0 8px;
  scrollbar-width: thin;
}
.preset-pill {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-items: center;
  min-width: 150px;
  max-width: 210px;
  text-align: left;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 10px 12px;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(21,22,26,.03);
}
.preset-pill:hover { border-color: var(--blue); transform: translateY(-1px); }
.preset-pill span { grid-row: 1 / span 2; font-size: 24px; line-height: 1; }
.preset-pill b { font-size: 12.5px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preset-pill small { font-family: var(--mono); font-size: 10.5px; color: var(--ink-soft); margin-top: 3px; }
.custom-name-wrap { position: relative; }
.custom-name-wrap input { padding-left: 42px; }
.custom-emoji {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; display: grid; place-items: center; font-size: 18px; z-index: 2;
}
.custom-note { margin-top: 8px; font-size: 11.5px; color: var(--ink-soft); line-height: 1.45; }
.custom-item-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.custom-item-emoji {
  width: 38px; height: 38px; border-radius: 12px; background: #fff; border: 1.5px solid var(--line);
  display: grid; place-items: center; font-size: 20px; flex: 0 0 auto;
}

@media (max-width: 980px) {
  .load-option-row { grid-template-columns: 1fr; align-items: start; }
}
@media (max-width: 680px) {
  .tile-grid { grid-template-columns: repeat(2, 1fr); }
  .tile { min-height: 150px; padding: 14px 8px 54px; }
  .tile-icon { height: 40px; }
  .tile-icon svg { width: 34px; height: 34px; }
  .preset-pill { min-width: 138px; }
}
@media (max-width: 420px) {
  .tile { min-height: 142px; }
  .tile-name { font-size: 12px; }
  .tile-sub { font-size: 10.5px; }
  .tile-meta { font-size: 10px; }
}

/* ---------- UI polish: non-clustered custom loads + consistent line icons ---------- */
.custom-load-box {
  padding: 20px;
  border-radius: 22px;
  margin-bottom: 24px;
}
.custom-head.compact { margin-bottom: 14px; }
.custom-head.compact h3 { font-size: 22px; }
.custom-head.compact p { max-width: 900px; }
.custom-form {
  grid-template-columns: minmax(240px, 1fr) 78px 118px minmax(180px, .72fr) 112px;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: #FAF9F5;
}
.custom-field input, .custom-field select { background: #fff; }
.custom-add { min-height: 46px; border-radius: 13px; }
.custom-msg { margin: 10px 2px 0; font-weight: 700; }
.custom-note { margin: 8px 2px 0; }
.custom-preset-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 18px 2px 10px;
}
.custom-preset-head strong { display: block; font-size: 13.5px; }
.custom-preset-head span { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-soft); }
.preset-more {
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.preset-more:hover { border-color: var(--blue); color: var(--blue); }
.preset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.preset-grid .preset-pill {
  min-width: 0;
  max-width: none;
  width: 100%;
  min-height: 62px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 15px;
  background: #fff;
}
.preset-grid .preset-icon {
  grid-row: 1 / span 2;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #EEF4FF;
  color: var(--blue);
  font-size: inherit;
}
.preset-grid .preset-pill b {
  font-size: 12.5px;
  line-height: 1.15;
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.preset-grid .preset-pill small {
  font-size: 10.5px;
  line-height: 1.2;
}
.custom-emoji {
  color: var(--blue);
  background: #EEF4FF;
  border-radius: 8px;
}
.custom-item-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #fff;
  border: 1.5px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--blue);
  flex: 0 0 auto;
}

/* Keep main load cards closer to square and easier to scan */
.tile {
  min-height: 154px;
  padding: 16px 10px 52px;
}
.tile-icon { height: 42px; }
.tile-icon svg { width: 38px; height: 38px; }
.tile-name { margin-top: 6px; }
.tile-meta { margin-top: 7px; min-height: 16px; }
.tile-steps {
  left: 10px;
  right: 10px;
  bottom: 9px;
}
.tile-steps button { height: 34px; }

@media (max-width: 1180px) {
  .custom-form { grid-template-columns: minmax(220px, 1fr) 78px 118px; }
  .custom-field.mode, .custom-add { grid-column: span 1; }
  .preset-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .custom-form { grid-template-columns: 1fr 1fr; }
  .custom-field.name, .custom-field.mode, .custom-add { grid-column: 1 / -1; }
  .preset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .custom-load-box { padding: 16px; }
  .custom-form { grid-template-columns: 1fr; }
  .custom-preset-head { align-items: flex-start; flex-direction: column; }
  .preset-grid { grid-template-columns: 1fr; }
  .tile { min-height: 140px; padding: 13px 8px 50px; }
}

/* ---------- Final deep-polish: options back inside square cards, no tall rectangle panel ---------- */
.load-options-panel { display: none !important; }
.tile-grid {
  align-items: stretch;
  grid-auto-rows: 1fr;
}
.tile {
  aspect-ratio: 1 / 1;
  min-height: 188px;
  max-height: 245px;
  padding: 15px 10px 50px;
  justify-content: flex-start;
  overflow: hidden;
}
.tile.with-options {
  padding-bottom: 112px;
}
.tile-icon {
  width: 50px;
  height: 50px;
  margin: 0 auto;
  border-radius: 14px;
  border: 1.5px solid transparent;
  color: var(--ink);
  background: transparent;
}
.tile.on .tile-icon {
  color: var(--blue);
  background: #EEF4FF;
  border-color: rgba(30,95,194,.18);
}
.tile-name {
  font-size: 14px;
  line-height: 1.15;
  margin-top: 7px;
}
.tile-sub {
  font-size: 11px;
  line-height: 1.15;
  min-height: 13px;
}
.tile-meta {
  font-size: 10.5px;
  margin-top: 6px;
  min-height: 14px;
}
.tile-config {
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 49px;
  display: grid;
  gap: 5px;
  text-align: left;
}
.tile-chip-line {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 5px;
  align-items: center;
}
.tile-chip-line > span {
  font-size: 9px;
  font-weight: 800;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .02em;
}
.tile-chip-scroll {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  padding-bottom: 1px;
}
.tile-chip-scroll::-webkit-scrollbar { display: none; }
.tile-chip-scroll button {
  flex: 0 0 auto;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  font-family: var(--font);
  font-size: 9.5px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.tile-chip-scroll button.on {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.tile-chip-scroll button:focus-visible,
.tile-steps button:focus-visible,
.preset-pill:focus-visible,
.custom-add:focus-visible,
.preset-more:focus-visible {
  outline: 3px solid rgba(30,95,194,.22);
  outline-offset: 2px;
}
.tile-steps {
  left: 9px;
  right: 9px;
  bottom: 9px;
  gap: 7px;
}
.tile-steps button {
  height: 33px;
  border-radius: 10px;
}

/* Keep every electrical object icon visually from the same family. */
.preset-grid .preset-icon,
.custom-emoji,
.custom-item-icon {
  background: #fff;
  color: var(--ink);
  border: 1.5px solid var(--line);
}
.preset-grid .preset-pill:hover .preset-icon,
.custom-name-wrap:focus-within .custom-emoji,
.custom-item:hover .custom-item-icon {
  color: var(--blue);
  border-color: rgba(30,95,194,.35);
  background: #EEF4FF;
}
.preset-grid .preset-pill svg,
.custom-emoji svg,
.custom-item-icon svg,
.tile-icon svg {
  display: block;
  stroke-width: 2.8;
}
.preset-grid .preset-pill small {
  color: var(--ink-soft);
  font-family: var(--mono);
}

/* The custom-load block is calmer: form first, then a compact optional preset grid. */
.custom-load-box {
  padding: 20px 22px;
}
.custom-head.compact h3 {
  font-size: 21px;
}
.custom-head.compact p {
  font-size: 12.8px;
  max-width: 760px;
}
.custom-form {
  margin-top: 8px;
}
.custom-preset-head {
  margin-top: 16px;
}
.preset-grid .preset-pill {
  min-height: 66px;
}

@media (max-width: 1180px) {
  .tile {
    min-height: 176px;
  }
  .tile.with-options {
    padding-bottom: 106px;
  }
  .tile-config { bottom: 47px; }
  .tile-chip-line { grid-template-columns: 31px minmax(0, 1fr); }
  .tile-chip-line > span { font-size: 8.5px; }
  .tile-chip-scroll button { font-size: 9px; padding: 0 7px; height: 23px; }
}
@media (max-width: 680px) {
  .tile {
    min-height: 156px;
    padding: 12px 8px 48px;
  }
  .tile.with-options {
    min-height: 172px;
    padding-bottom: 96px;
  }
  .tile-icon { width: 42px; height: 42px; }
  .tile-name { font-size: 12.4px; }
  .tile-sub { font-size: 10px; }
  .tile-meta { font-size: 9.5px; }
  .tile-config { left: 7px; right: 7px; bottom: 45px; gap: 4px; }
  .tile-chip-line { grid-template-columns: 1fr; gap: 2px; }
  .tile-chip-line > span { display: none; }
  .tile-chip-scroll button { height: 22px; font-size: 8.5px; padding: 0 6px; }
}
@media (max-width: 420px) {
  .tile {
    min-height: 148px;
  }
  .tile.with-options {
    min-height: 168px;
  }
}

/* ---------- Emergency QA repair: no overflow inside selected cards ---------- */
.tile-grid {
  align-items: stretch;
}
.tile {
  overflow: hidden !important;
}
.tile-icon,
.preset-grid .preset-icon,
.custom-emoji,
.custom-item-icon {
  color: var(--blue) !important;
  background: #EEF4FF !important;
  border: 1.5px solid rgba(30,95,194,.18) !important;
}
.tile.on .tile-icon {
  color: var(--blue) !important;
  background: #EEF4FF !important;
  border-color: rgba(30,95,194,.25) !important;
}
.tile.with-options {
  padding: 13px 10px 51px !important;
}
.tile.with-options .tile-icon {
  width: 46px !important;
  height: 46px !important;
  border-radius: 14px;
}
.tile.with-options .tile-icon svg {
  width: 38px;
  height: 38px;
}
.tile.with-options .tile-name {
  font-size: 13.5px !important;
  line-height: 1.08 !important;
  margin-top: 5px !important;
}
.tile.with-options .tile-sub {
  font-size: 10.2px !important;
  line-height: 1.05 !important;
  min-height: 11px !important;
  margin-top: 2px !important;
}
.tile.with-options .tile-meta {
  font-size: 9.8px !important;
  line-height: 1 !important;
  margin-top: 4px !important;
  min-height: 10px !important;
}
.tile-config-fixed {
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 48px;
  display: grid !important;
  grid-template-columns: 1fr;
  gap: 5px;
  height: auto;
  text-align: left;
}
.tile-mini-select {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  margin: 0;
}
.tile-mini-select > span {
  font-size: 8.3px;
  line-height: 1;
  font-weight: 900;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tile-mini-select select {
  width: 100%;
  min-width: 0;
  height: 25px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 800;
  padding: 0 24px 0 9px;
  cursor: pointer;
  outline: none;
}
.tile-mini-select select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(30,95,194,.12);
}
.tile-steps {
  position: absolute !important;
  left: 9px !important;
  right: 9px !important;
  bottom: 9px !important;
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 7px !important;
  margin: 0 !important;
}
.tile-steps button {
  width: 100% !important;
  height: 32px !important;
  min-width: 0 !important;
}
.tile-chip-line,
.tile-chip-scroll {
  max-width: 100%;
}
@media (max-width: 1180px) {
  .tile.with-options { padding-bottom: 50px !important; }
  .tile-config-fixed { bottom: 47px; gap: 4px; }
  .tile-mini-select { grid-template-columns: 30px minmax(0,1fr); }
  .tile-mini-select > span { font-size: 7.8px; }
  .tile-mini-select select { height: 24px; font-size: 9.2px; padding-left: 7px; }
}
@media (max-width: 680px) {
  .tile.with-options { min-height: 178px !important; padding-bottom: 48px !important; }
  .tile.with-options .tile-icon { width: 40px !important; height: 40px !important; }
  .tile.with-options .tile-icon svg { width: 33px; height: 33px; }
  .tile-config-fixed { left: 7px; right: 7px; bottom: 45px; }
  .tile-mini-select { grid-template-columns: 1fr; gap: 2px; }
  .tile-mini-select > span { display: none; }
  .tile-mini-select select { height: 23px; font-size: 8.8px; }
}

/* ---------- Final UX repair: visible qty badges, instant custom add, black/white icons ---------- */
.tile {
  overflow: visible !important;
}
.tile-qty {
  top: 8px !important;
  right: 8px !important;
  min-width: 26px !important;
  height: 26px !important;
  z-index: 5 !important;
  border: 2px solid #fff !important;
  color: #fff !important;
  font-size: 13px !important;
  line-height: 1 !important;
}

/* Return all electrical object shapes to the original black/white line style. */
.tile-icon,
.tile.on .tile-icon,
.preset-grid .preset-icon,
.preset-grid .preset-pill:hover .preset-icon,
.custom-emoji,
.custom-name-wrap:focus-within .custom-emoji,
.custom-item-icon,
.custom-item:hover .custom-item-icon,
.load-option-icon,
.demo-tile svg {
  color: var(--ink) !important;
  background: transparent !important;
  border-color: transparent !important;
}
.tile-icon {
  border: 0 !important;
  box-shadow: none !important;
}
.preset-grid .preset-icon,
.custom-emoji,
.custom-item-icon {
  background: #fff !important;
  border: 1.5px solid var(--line) !important;
}
.tile-icon svg,
.preset-grid .preset-icon svg,
.custom-emoji svg,
.custom-item-icon svg {
  stroke: currentColor !important;
}

/* Custom load: no add button. Preset click adds immediately; manual entry uses Enter. */
.custom-form {
  grid-template-columns: minmax(180px, 1fr) 82px 110px minmax(150px, .7fr) minmax(190px, .55fr) !important;
}
.custom-enter-hint {
  min-height: 44px;
  border-radius: 12px;
  border: 1.5px dashed var(--line);
  background: #FAF9F5;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 12px;
  font-size: 11.5px;
  line-height: 1.25;
  font-weight: 650;
}
.preset-grid .preset-pill {
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.preset-grid .preset-pill:active {
  transform: scale(.98);
}

/* Keep option selects readable without hiding counts. */
.tile.with-options {
  min-height: 188px !important;
}
.tile-config-fixed {
  z-index: 3;
}
.tile-steps {
  z-index: 4;
}
.tile-mini-select select {
  font-size: 10.2px !important;
  text-overflow: ellipsis;
}

@media (max-width: 900px) {
  .custom-form { grid-template-columns: 1fr 1fr !important; }
  .custom-field.name, .custom-field.mode, .custom-enter-hint { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .custom-form { grid-template-columns: 1fr !important; }
  .custom-enter-hint { grid-column: auto; }
  .tile-qty { top: 6px !important; right: 6px !important; }
}
