/* BajaKita — gaya aplikasi mobile
   Bahasa visual: gambar kerja baja. Penampang diarsir seperti potongan pada
   gambar teknik, garis ukur biru, dan kuning cat penanda ujung batang untuk
   menandai pilihan aktif. Tata letak dirancang untuk layar ponsel lebih dulu. */

@font-face {
  font-family: 'Archivo';
  src: url('fonts/archivo-wdth.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --bg: #F2F4F5;
  --surface: #FFFFFF;
  --ink: #18232B;
  --muted: #56636B;
  --line: #D3D9DD;
  --line-soft: #E6EAEC;
  --steel: #DCE2E6;
  --mark: #F4C20D;
  --sel: #FFF7D6;
  --dim: #1F5F99;
  --hatch: rgba(24, 35, 43, .55);
  --danger: #A23B1E;
  --bar-bg: rgba(242, 244, 245, .92);

  --cond: 78%;
  --r-panel: 12px;
  --r-ctl: 8px;
  --sat: max(env(safe-area-inset-top, 0px), var(--safe-area-inset-top, 0px));
  --sab: max(env(safe-area-inset-bottom, 0px), var(--safe-area-inset-bottom, 0px));
  --adh: 0px; /* tinggi banner iklan (Android), diisi app.js */
  --tabbar-h: 64px;
  --maxw: 600px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12181C;
    --surface: #1A2228;
    --ink: #E6EBEE;
    --muted: #9AA7AF;
    --line: #34414A;
    --line-soft: #26313A;
    --steel: #3A4750;
    --sel: #2C2915;
    --dim: #82B6E8;
    --hatch: rgba(230, 235, 238, .5);
    --danger: #F08A6C;
    --bar-bg: rgba(18, 24, 28, .92);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.defs { position: absolute; width: 0; height: 0; }
.hatch-line { stroke: var(--hatch); stroke-width: 1; }
.ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.glyph { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }

/* ---------- kerangka aplikasi ---------- */
.app { max-width: var(--maxw); margin: 0 auto; min-height: 100dvh; position: relative; }
@media (min-width: 640px) {
  body { background: var(--line-soft); }
  .app { background: var(--bg); box-shadow: 0 0 0 1px var(--line); }
}
.view { padding-bottom: calc(var(--tabbar-h) + var(--sab) + var(--adh) + 16px); }
.content { padding: 12px 16px 8px; }

.bar {
  position: sticky; top: 0; z-index: 10;
  padding: calc(var(--sat) + 8px) 16px 10px;
  background: var(--bar-bg);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.bar-row { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.brand { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 750; font-stretch: var(--cond); letter-spacing: .005em; }
.brand-mark { width: 28px; height: 28px; padding: 3px; background: #18232B; fill: var(--mark); border-radius: 6px; }
.title { margin: 0; font-size: 26px; line-height: 1.1; font-weight: 720; font-stretch: 72%; }

.sort { margin-left: auto; position: relative; display: flex; align-items: center; height: 40px; padding: 0 10px 0 8px; gap: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 14px; }
.sort .ic { width: 18px; height: 18px; }
.sort select { appearance: none; -webkit-appearance: none; border: 0; background: none; padding: 0 2px; height: 100%; font-size: 14px; color: var(--ink); outline: none; }
.sort:focus-within { border-color: var(--ink); }

.searchbar { position: relative; margin-top: 8px; }
.searchbar svg { position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.searchbar input {
  width: 100%; height: 50px; padding: 0 48px 0 44px;
  font-size: 17px; background: var(--surface);
  border: 2px solid var(--ink); border-radius: var(--r-ctl); outline: none;
  -webkit-appearance: none; appearance: none;
}
.searchbar input::placeholder { color: var(--muted); opacity: .85; }
.searchbar input:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--mark) 55%, transparent); }
.searchbar input::-webkit-search-cancel-button { display: none; }
.clear { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; font-size: 24px; line-height: 1; color: var(--muted); }

.chips { display: flex; gap: 8px; margin: 10px -16px 0; padding: 0 16px 2px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; scroll-snap-align: start;
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 14px 0 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  font-size: 15px;
}
.chip svg { width: 20px; height: 20px; }
.chip .n { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip[aria-pressed="true"] .n { color: inherit; opacity: .7; }
.chip[data-n="0"]:not([aria-pressed="true"]) { opacity: .45; }

/* ---------- daftar ---------- */
.count { margin: 2px 2px 10px; font-size: 14px; color: var(--muted); }
.count b { color: var(--ink); font-weight: 650; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; }
.row {
  width: 100%; min-height: 68px; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto;
  gap: 2px 12px; align-items: center; padding: 12px 10px 12px 14px; text-align: left;
  background: none; border: 0; border-top: 1px solid var(--line-soft);
}
.row:first-child { border-top: 0; }
.row:active { background: var(--sel); }
.row .g { grid-row: 1 / span 2; color: var(--muted); display: grid; place-items: center; }
.row .g svg { width: 28px; height: 28px; }
.row .sz { grid-column: 2; font-stretch: var(--cond); font-weight: 650; font-size: 19px; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .nm { grid-column: 2; grid-row: 2; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .nm .gr { color: var(--ink); opacity: .75; }
.row .w { grid-column: 3; grid-row: 1 / span 2; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.25; }
.row .w small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.row .chev { grid-column: 4; grid-row: 1 / span 2; width: 18px; height: 18px; color: var(--muted); }
mark { background: color-mix(in srgb, var(--mark) 45%, transparent); color: inherit; border-radius: 2px; }

.empty { padding: 32px 20px; text-align: center; }
.empty p { margin: 0 0 14px; color: var(--muted); }
.empty .tries { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.empty .tries button { height: 36px; padding: 0 14px; border: 1px solid var(--line); background: var(--bg); border-radius: 999px; font-size: 14px; }
.empty .reset { height: 44px; padding: 0 18px; border: 1px solid var(--ink); background: none; border-radius: var(--r-ctl); }

.sample-note { display: flex; align-items: center; gap: 10px; margin: 14px 2px 0; font-size: 13.5px; color: var(--muted); }
.flag { width: 14px; height: 14px; flex: none; background: repeating-linear-gradient(-45deg, var(--mark) 0 4px, #18232B 4px 8px); border-radius: 2px; }

/* ---------- halaman detail ---------- */
.page {
  position: fixed; inset: 0; z-index: 30; margin: 0 auto; max-width: var(--maxw);
  background: var(--bg); overflow-y: auto; overscroll-behavior: contain;
  padding-bottom: calc(var(--sab) + var(--adh) + 24px);
  animation: page-in .26s cubic-bezier(.2, .8, .2, 1);
}
.page.leaving { animation: page-out .2s ease-in forwards; }
@keyframes page-in { from { transform: translateX(28%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes page-out { to { transform: translateX(28%); opacity: 0; } }
.bar-detail { padding-left: 6px; border-bottom-color: transparent; box-shadow: inset 0 -4px 0 var(--mark); }
.back { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; border-radius: 50%; }
.back:active { background: var(--line-soft); }
.bar-title { margin: 0; font-size: 17px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.detail .kind { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.detail h2 { margin: 4px 0 0; font-size: 18px; font-weight: 650; line-height: 1.3; }
.detail .big {
  margin: 6px 0 0; font-size: 46px; line-height: 1; font-weight: 720;
  font-stretch: 66%; letter-spacing: -.005em; font-variant-numeric: tabular-nums;
}
.detail .big .mm { font-size: 20px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.drawing { margin: 14px -8px 4px; padding: 14px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.draw { display: block; width: 100%; height: auto; max-height: 300px; }
.draw .sec { fill: url(#hatch); stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; }
.draw .void { fill: var(--surface); stroke: var(--ink); stroke-width: 1.6; }
.draw .solid { fill: var(--steel); stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; }
.draw .thin { fill: none; stroke: var(--ink); stroke-width: 1; }
.draw .axis { stroke: var(--muted); stroke-width: .8; stroke-dasharray: 10 3 2 3; fill: none; }
.draw .dim line, .draw .dim path { stroke: var(--dim); stroke-width: 1; fill: none; }
.draw .dim .tick { stroke-width: 1.6; }
.draw .dim circle { fill: var(--dim); stroke: none; }
.draw text { fill: var(--dim); font-family: 'Archivo', system-ui, sans-serif; font-size: 13px; font-stretch: var(--cond); font-weight: 600; font-variant-numeric: tabular-nums; }

.wt { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 2px; border-bottom: 1px solid var(--line); }
.wt span { color: var(--muted); font-size: 15px; }
.wt strong { font-size: 28px; font-weight: 700; font-stretch: var(--cond); font-variant-numeric: tabular-nums; }
.wt strong small { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 3px; }

.need { margin-top: 16px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.need h3 { margin: 0 0 10px; font-size: 16px; font-weight: 650; }
.need-out { margin: 12px 0 0; font-size: 15px; }
.need-out b { font-size: 22px; font-stretch: var(--cond); font-variant-numeric: tabular-nums; }
.presets { display: flex; gap: 8px; margin-top: 10px; }
.presets button { height: 36px; padding: 0 14px; font-size: 14px; border: 1px solid var(--line); background: var(--bg); border-radius: 999px; }
.presets button[aria-pressed="true"] { border-color: var(--ink); font-weight: 650; box-shadow: inset 0 -3px 0 var(--mark); }

.specs { margin: 18px 2px 0; display: grid; grid-template-columns: auto 1fr; gap: 0 16px; font-size: 15px; }
.specs dt { color: var(--muted); padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.specs dd { margin: 0; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
.specs dt:last-of-type, .specs dd:last-of-type { border-bottom: 0; }
.unverified { display: flex; gap: 10px; align-items: start; margin: 14px 2px 0; font-size: 13.5px; color: var(--muted); }
.unverified .flag { margin-top: 3px; }

/* ---------- isian ---------- */
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fields:has(> label:nth-child(3)) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fields label { display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; font-size: 14px; color: var(--muted); }
.fields label .u { font-size: 13px; opacity: .8; }
.fields input {
  width: 100%; height: 48px; padding: 0 12px; font-size: 18px; font-variant-numeric: tabular-nums;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-ctl); outline: none;
}
.fields input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mark) 55%, transparent); }
.fields input[aria-invalid="true"] { border-color: var(--danger); }

/* ---------- kalkulator ---------- */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.shapes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.shape {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 72px; padding: 8px 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl);
  font-size: 14px; line-height: 1.2; text-align: center;
}
.shape svg { width: 28px; height: 28px; }
.shape[aria-pressed="true"] { background: var(--sel); border-color: var(--ink); box-shadow: inset 0 -4px 0 var(--mark); font-weight: 650; }
.calc-out { margin: 14px 0 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 6px 14px 14px; }
.calc-draw .draw { max-height: 200px; margin: 6px auto 0; }
.calc-nums { margin: 4px 0 0; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.calc-nums div { padding: 10px 0 0; }
.calc-nums div:nth-child(2) { padding-left: 14px; border-left: 1px solid var(--line); }
.calc-nums .total { grid-column: 1 / -1; margin-top: 10px; border-top: 1px solid var(--line); }
.calc-nums dt { font-size: 13px; color: var(--muted); }
.calc-nums dd { margin: 2px 0 0; font-size: 24px; font-weight: 700; font-stretch: var(--cond); font-variant-numeric: tabular-nums; line-height: 1.15; }
.calc-nums dd small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.calc-nums .total dd { font-size: 34px; }
.calc-msg { margin: 10px 0 0; font-size: 13.5px; color: var(--muted); }
.calc-msg.err { color: var(--danger); }
.fields-run { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.calc-foot { margin: 16px 2px 0; font-size: 13.5px; color: var(--muted); }

/* ---------- info ---------- */
.prose p { margin: 4px 0 14px; max-width: 62ch; }
.facts { margin: 8px 0 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.facts div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 14px; border-top: 1px solid var(--line-soft); }
.facts div:first-child { border-top: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-weight: 600; }
.partner { margin-top: 16px; padding: 16px; border: 1px dashed var(--line); border-radius: var(--r-panel); color: var(--muted); font-size: 14px; }
.small { font-size: 13px; color: var(--muted); }

/* ---------- navigasi bawah ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: var(--adh); z-index: 20; margin: 0 auto; max-width: var(--maxw);
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + var(--sab)); padding-bottom: var(--sab);
  background: var(--bar-bg); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; background: none; color: var(--muted); font-size: 12.5px; }
.tab[aria-current="page"] { color: var(--ink); font-weight: 650; }
.tab[aria-current="page"]::before { content: ''; position: absolute; top: 0; left: 50%; width: 36px; height: 4px; margin-left: -18px; background: var(--mark); border-radius: 0 0 3px 3px; }
.tab .ic { width: 24px; height: 24px; }



/* ---------- filter bahan (segmented) ---------- */
.seg { display: flex; gap: 0; margin-top: 10px; padding: 3px; background: var(--line-soft); border-radius: 10px; }
.seg button {
  flex: 1; min-height: 36px; padding: 0 6px; border: 0; background: none; border-radius: 8px;
  font-size: 14px; color: var(--muted); white-space: nowrap;
}
.seg button .n { font-size: 12px; opacity: .8; font-variant-numeric: tabular-nums; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 650; box-shadow: 0 1px 0 var(--line), inset 0 -3px 0 var(--mark); }
.seg-calc { margin: 0 0 12px; }
.seg-calc + .seg-calc { margin-top: -4px; }

/* ---------- daftar katalog ---------- */
.sec-h { position: sticky; top: 0; z-index: 1; padding: 8px 14px; background: var(--line-soft); font-size: 13px; font-weight: 650; color: var(--muted); border-top: 1px solid var(--line); }
.sec-h:first-child { border-top: 0; }
.sec-h span { font-weight: 400; margin-left: 4px; font-variant-numeric: tabular-nums; }
.sec-h + .row { border-top: 0; }
.more { height: 1px; }
.fav-dot { display: inline-block; width: 8px; height: 8px; margin-left: 8px; vertical-align: middle; border-radius: 50%; background: var(--mark); }

/* ---------- tombol ---------- */
.icon-btn { flex: none; width: 44px; height: 44px; display: grid; place-items: center; margin-left: auto; border: 0; background: none; border-radius: 50%; color: var(--ink); }
.icon-btn:active { background: var(--line-soft); }
.star[aria-pressed="true"] .ic { fill: var(--mark); stroke: #8a6a00; }
.btn { min-height: 48px; padding: 0 18px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--r-ctl); font-size: 16px; font-weight: 600; }
.btn:active { background: var(--line-soft); }
.btn-primary { background: var(--mark); border-color: var(--mark); color: #18232B; }
.btn-primary:active { background: #E0B000; }
.btn:disabled { opacity: .45; }
.btn-block { display: block; width: 100%; margin-top: 12px; }
.link { padding: 0; border: 0; background: none; font-weight: 650; text-align: left; text-decoration: underline; text-decoration-color: var(--mark); text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* ---------- detail tambahan ---------- */
.mat-tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 600; vertical-align: 2px; background: var(--line-soft); color: var(--muted); }
.mat-tag[data-mat="ss"] { background: color-mix(in srgb, var(--dim) 14%, transparent); color: var(--dim); }
.mat-tag[data-mat="al"] { background: color-mix(in srgb, #8a6a00 14%, transparent); color: var(--ink); }
.mat-tag[data-mat="cu"] { background: color-mix(in srgb, #b4532a 16%, transparent); color: var(--ink); }
.mat-tag[data-mat="brass"] { background: color-mix(in srgb, #b08a1e 18%, transparent); color: var(--ink); }
.mat-tag[data-mat="bronze"] { background: color-mix(in srgb, #8c5a2b 16%, transparent); color: var(--ink); }
.detail .full { margin: 4px 0 0; color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.sibs { margin-top: 14px; }
.sibs h3, .pairs h3 { margin: 0 0 8px; font-size: 15px; font-weight: 650; }
.sib-row { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
.sib-row::-webkit-scrollbar { display: none; }
.sib-row button { flex: none; height: 36px; padding: 0 12px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; font-size: 14px; font-stretch: var(--cond); font-weight: 600; font-variant-numeric: tabular-nums; }
.pairs { margin-top: 16px; }
.wrench { margin: 0 0 8px; font-size: 15px; }
.pair { width: 100%; display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; margin-top: 6px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl); font-size: 15px; }
.pair .g svg { width: 24px; height: 24px; color: var(--muted); }
.pair .w { font-variant-numeric: tabular-nums; font-weight: 600; }
.pair .w small { font-weight: 400; color: var(--muted); }
.about { margin-top: 20px; }
.about h3, .tech-h { margin: 0 0 8px; font-size: 16px; font-weight: 650; }
.tech-h { margin-top: 20px; }
.about h4 { margin: 12px 0 4px; font-size: 14px; font-weight: 650; color: var(--muted); }
.about .desc { margin: 0; font-size: 15px; line-height: 1.5; }
.about .apps { margin: 0; padding-left: 20px; font-size: 15px; line-height: 1.6; }
.profile { float: right; width: 42%; max-width: 190px; margin: 0 0 8px 12px; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.about::after { content: ''; display: block; clear: both; }
.draw.iso { max-height: 150px; }
.iso path, .iso circle { stroke: var(--ink); stroke-width: 1.2; stroke-linejoin: round; }
.iso .front { fill: var(--steel); }
.iso .top { fill: color-mix(in srgb, var(--steel) 45%, var(--surface)); }
.iso .side { fill: color-mix(in srgb, var(--steel) 75%, var(--ink)); }
.iso .inner { fill: color-mix(in srgb, var(--steel) 40%, var(--ink)); }
.iso .hl { stroke: var(--surface); stroke-width: 3; opacity: .6; fill: none; }
.iso .rib { stroke-width: 1.6; fill: none; }
.specs .gx { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); }
.props-note { margin: 8px 2px 0; font-size: 13px; color: var(--muted); }

/* ---------- daftar kebutuhan ---------- */
.proj input { width: 100%; height: 48px; padding: 0 14px; font-size: 17px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl); outline: none; color: var(--ink); }
.proj input:focus { border-color: var(--ink); }
#items { margin-top: 12px; }
.item { padding: 12px 12px 10px; margin-bottom: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.item-top { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: start; }
.item-top .g { color: var(--muted); padding-top: 2px; }
.item-top .g svg { width: 26px; height: 26px; }
.item-t { min-width: 0; font-size: 16px; font-stretch: var(--cond); }
.item-t .link { font-size: 18px; font-stretch: var(--cond); }
.item-t small { display: block; font-stretch: 100%; font-size: 13.5px; color: var(--muted); }
.item-top .icon-btn { width: 36px; height: 36px; margin: -4px -4px 0 0; color: var(--muted); }
.fields-item { margin-top: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fields-item label { font-size: 12.5px; }
.fields-item input { height: 44px; font-size: 16px; padding: 0 10px; }
.ref-price { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; margin: 10px 2px 0; font-size: 14px; }
.ref-price small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.ref-price b { font-variant-numeric: tabular-nums; }
.ref-price .link { flex: none; padding: 2px 0; }
.item-out { display: flex; justify-content: space-between; margin: 10px 2px 0; font-variant-numeric: tabular-nums; }
.item-out .kg { font-weight: 700; font-size: 18px; font-stretch: var(--cond); }
.item-out .cost { color: var(--muted); }
.summary dl { margin: 6px 0 0; padding: 4px 14px; background: var(--ink); color: var(--bg); border-radius: var(--r-panel); }
.summary dl div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid rgba(255, 255, 255, .12); font-variant-numeric: tabular-nums; }
.summary dl div:first-child { border-top: 0; }
.summary dt { opacity: .75; }
.summary dd { margin: 0; font-weight: 600; }
.summary .sum-main dd { font-size: 26px; font-weight: 750; font-stretch: var(--cond); line-height: 1.1; }
.summary .sum-main dd small { font-size: 15px; font-weight: 500; opacity: .75; }
.summary .small { margin: 8px 2px 0; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }

/* ---------- badge & toast ---------- */
.tab .badge { position: absolute; top: 6px; left: 50%; margin-left: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--mark); color: #18232B; font-size: 11px; font-weight: 750; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.toast {
  position: fixed; z-index: 50; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--sab) + var(--adh) + 12px); width: min(560px, calc(100% - 24px));
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px;
  background: #18232B; color: #F2F4F5; border-radius: 10px; font-size: 15px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
  animation: toast-in .2s ease-out;
}
.toast span { flex: 1; }
.toast button { min-height: 36px; padding: 0 12px; border: 0; border-radius: 6px; background: none; color: var(--mark); font-weight: 700; }
@keyframes toast-in { from { transform: translate(-50%, 10px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .page, .page.leaving, .toast { animation: none; }
}

.page-open .toast { bottom: calc(var(--sab) + var(--adh) + 16px); }
.sib-row button[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.sib-row { scroll-behavior: auto; }

/* ---------- region & pengaturan ---------- */
.region-pill { margin-left: auto; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 700; letter-spacing: .04em; color: var(--muted); }
.region-pill + .sort { margin-left: 8px; }
.set-h { margin: 22px 0 6px; font-size: 18px; font-weight: 700; font-stretch: var(--cond); }
.set-h:first-child { margin-top: 4px; }
.opts { display: grid; gap: 8px; margin-top: 8px; }
.opts-2 { grid-template-columns: 1fr 1fr; }
.opts button {
  display: grid; grid-template-columns: 40px 1fr; gap: 0 10px; align-items: center; min-height: 52px; padding: 8px 12px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl); font-size: 15px;
}
.opts-2 button { display: block; min-height: 48px; }
.opts button .code { grid-row: 1 / span 2; display: grid; place-items: center; height: 32px; border-radius: 6px; background: var(--line-soft); font-size: 12px; font-weight: 750; letter-spacing: .04em; color: var(--muted); }
.opts button .nm { font-weight: 600; }
.opts button .n { font-size: 12.5px; color: var(--muted); }
.opts button[aria-checked="true"] { border-color: var(--ink); background: var(--sel); box-shadow: inset 4px 0 0 var(--mark); }
.opts button[aria-checked="true"] .code { background: var(--ink); color: var(--bg); }
#opt-units, #opt-scope { margin-top: 8px; }
:lang(ja) body, :lang(zh-Hans) body, html:lang(ja), html:lang(zh-Hans) { font-family: 'Archivo', 'Noto Sans CJK JP', 'Noto Sans CJK SC', 'Hiragino Sans', 'PingFang SC', system-ui, sans-serif; }

/* ---------- tab Alat ---------- */
.tools { margin-top: 8px; }
.cmp-btn + .star { margin-left: 0; }
.cmp-btn[aria-pressed="true"] .ic { fill: var(--mark); stroke: #8a6a00; }
.tool-hint { margin: 14px 2px; color: var(--muted); font-size: 15px; }
.tool-sub { margin: 16px 2px 8px; font-weight: 650; }
.tool-h { margin: 18px 0 8px; font-size: 16px; font-weight: 650; }
.cmp-search { display: block; margin-top: 0; }
.cmp-search input { border-width: 1px; height: 48px; }
.cmp-sug { margin-top: 4px; }
.cmp-sug .pair[aria-pressed="true"] { opacity: .5; }
.cmp-wrap { margin: 14px -16px 8px; padding: 0 16px; overflow-x: auto; }
.cmp-t { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.cmp-t th, .cmp-t td { padding: 8px 10px; border-top: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
.cmp-t thead th { border-top: 0; position: relative; min-width: 118px; padding-top: 10px; }
.cmp-t thead th .link { display: block; margin-top: 4px; font-size: 16px; font-stretch: var(--cond); }
.cmp-t thead th small { display: block; color: var(--muted); font-weight: 400; font-size: 12.5px; }
.cmp-t tbody th { position: sticky; left: 0; z-index: 1; width: 96px; min-width: 96px; max-width: 112px; background: var(--surface); color: var(--muted); font-weight: 400; font-size: 12.5px; line-height: 1.3; box-shadow: 1px 0 0 var(--line-soft); }
.cmp-t thead th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 0; }
.cmp-t td.best { font-weight: 700; background: var(--sel); box-shadow: inset 0 -3px 0 var(--mark); }
.cmp-draw .draw { max-height: 56px; width: calc(100% - 24px); }
.cmp-draw .draw text, .cmp-draw .draw .dim { display: none; }
.cmp-del { position: absolute; top: 2px; right: 0; width: 32px; height: 32px; color: var(--muted); }
.cmp-del .ic { width: 18px; height: 18px; }

.sel { width: 100%; height: 48px; padding: 0 10px; font-size: 16px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-ctl); }
.sel-wrap { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; font-size: 14px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; margin: 14px 2px 0; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); }
#beam .calc-out { margin: 0 0 14px; padding: 4px 10px; }
#beam .calc-draw .draw { max-height: 130px; }
.beam-row { width: 100%; display: grid; gap: 4px; margin-top: 8px; padding: 12px 14px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl); }
.beam-row.fail { border-style: dashed; }
.beam-row .b-top { display: flex; align-items: baseline; gap: 8px; }
.beam-row .b-top b { font-size: 18px; font-stretch: var(--cond); font-variant-numeric: tabular-nums; }
.beam-row .b-top .w { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; }
.beam-row .b-top small, .beam-row .b-kind, .beam-row .b-n { color: var(--muted); font-size: 13px; }
.beam-row .tag { font-style: normal; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--mark); color: #18232B; }
.meter { display: block; height: 6px; border-radius: 3px; background: var(--line-soft); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--ink); }
.beam-row.fail .meter span { background: var(--danger); }
.b-u { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.b-u .gov { font-weight: 700; }

.cut-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; align-items: end; margin-top: 8px; }
.cut-row .icon-btn { margin: 0 0 2px; color: var(--muted); }
.cut-nums { margin: 14px 0 0; padding: 0 14px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); border-top: 1px solid var(--line); }
.cut-nums div:nth-child(3) { border-top: 1px solid var(--line); margin-top: 10px; }
.cut-nums div:nth-child(4) { border-top: 1px solid var(--line); margin-top: 10px; padding-left: 14px; border-left: 1px solid var(--line); }
.cut-pat { margin-bottom: 12px; }
.cut-pat p { margin: 0 0 4px; font-variant-numeric: tabular-nums; }
.cut-bar { display: block; width: 100%; height: auto; }
.cut-bar .solid { fill: var(--steel); stroke: var(--ink); stroke-width: 1; }
.cut-bar .sec { fill: url(#hatch); stroke: var(--ink); stroke-width: 1; }
.cut-bar text { fill: var(--ink); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; font-family: 'Archivo', system-ui, sans-serif; }

.eq-card { margin-top: 14px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.eq-card h3 { margin: 0; font-size: 16px; font-weight: 650; }
.eq-card > .small { margin: 2px 0 8px; }
.eq-t { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.eq-t th { text-align: left; font-weight: 400; color: var(--muted); font-size: 12.5px; padding: 4px 6px; }
.eq-t td { padding: 7px 6px; border-top: 1px solid var(--line-soft); }
.eq-t th:nth-child(n+3), .eq-t td:nth-child(n+3) { text-align: right; white-space: nowrap; }
.eq-t tr.here td { background: var(--sel); }
.eq-t tr.here td:first-child { box-shadow: inset 3px 0 0 var(--mark); }
.eq-t tr.hit td { font-weight: 700; }
.seg-wrap { flex-wrap: wrap; margin: 0 0 8px; }
.seg-wrap button { flex: 1 1 30%; }
.ga-t tr.hit td { background: var(--sel); box-shadow: none; }
.ga-t tr.hit td:first-child { box-shadow: inset 3px 0 0 var(--mark); }
.eq-u { margin: 6px 0 0; }
.eq-link { font-weight: 500; text-align: left; }

/* ---------- daftar: ekspor ---------- */
.btn-file { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-file .ic { width: 20px; height: 20px; }

/* ---------- beberapa daftar, link & QR ---------- */
.proj-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.proj-sel { flex: 1; min-width: 0; }
.proj-row .icon-btn { flex: none; border: 1px solid var(--line); border-radius: var(--r-ctl); width: 48px; height: 48px; }
#link-btn { margin-top: 10px; }
.link-panel { margin-top: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl); }
.link-panel .qr { display: block; width: min(240px, 70vw); height: auto; margin: 0 auto 10px; border-radius: 6px; }
.link-panel input, .import-row input { width: 100%; min-width: 0; height: 44px; padding: 0 12px; font-size: 14px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-ctl); }
.import { margin-top: 14px; }
.import summary { cursor: pointer; padding: 8px 2px; font-weight: 600; }
.import-row { display: flex; gap: 8px; }
.import-row .btn { flex: none; }

/* ---------- besi beton ---------- */
.sel-first { margin: 0 0 4px; }
.rc-row { margin-top: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl); }
.rc-row p { margin: 2px 0 0; }
.rc-row .b-top { display: flex; justify-content: space-between; gap: 10px; font-size: 16px; }
.rc-row .b-top .w { font-weight: 650; font-variant-numeric: tabular-nums; }
#rc-to-list { margin-top: 14px; }
#col .calc-draw .draw { max-height: 190px; }

/* ---------- cek ukuran, kamus, panduan ---------- */
.cek-item { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; margin-top: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl); }
.cek-item small { display: block; color: var(--muted); font-size: 13px; }
.cek-item .w { font-weight: 650; font-variant-numeric: tabular-nums; }
.cek-res { margin-top: 14px; padding: 14px 16px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface); }
.cek-res.ok { border-color: var(--ok, #2e7d32); box-shadow: inset 4px 0 0 var(--ok, #2e7d32); }
.cek-res.low, .cek-res.high { border-color: var(--danger); box-shadow: inset 4px 0 0 var(--danger); }
.cek-pct { margin: 0; font-size: 34px; font-weight: 700; font-stretch: var(--cond); font-variant-numeric: tabular-nums; }
.cek-v { margin: 2px 0 0; font-weight: 600; }
.cek-specs { margin-top: 10px; }
.tips { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14.5px; }
.tips li { margin: 4px 0; }
.tol-link { display: block; margin-top: 4px; }
.term { padding: 12px 2px; border-bottom: 1px solid var(--line); }
.term h3 { margin: 0 0 4px; font-size: 17px; }
.term h3 small { font-weight: 500; color: var(--muted); font-size: 13px; }
.term p { margin: 0 0 6px; }
.guide { margin-top: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 0 14px; }
.guide summary { cursor: pointer; padding: 14px 0; display: grid; gap: 2px; }
.guide summary small { color: var(--muted); font-size: 13.5px; }
.guide-item { padding: 10px 0; border-top: 1px solid var(--line); }
.guide-item h4 { margin: 0 0 4px; font-size: 16px; }
.guide-item p { margin: 0 0 6px; }
.guide-item dl { margin: 0 0 6px; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 14.5px; }
.guide-item dt { color: var(--muted); }
.guide-item dd { margin: 0; }
.guide-tip { margin: 0; padding: 10px 0 14px; border-top: 1px dashed var(--line); font-size: 14.5px; color: var(--muted); }

/* satuan cepat di tab Alat */
.units-pill { flex: none; letter-spacing: 0; font-variant-numeric: tabular-nums; }

/* rencana potong: banyak panjang stok */
.cut-sum { margin: 10px 2px 12px; font-size: 15px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.cut-L { font-weight: 650; }
.cut-L.have { color: var(--muted); }

/* hitung balik di detail */
.need-mode { margin: 6px 0 10px; }

/* riwayat & favorit */
.hist-list { list-style: none; margin: 8px 0 12px; padding: 0; border-top: 1px solid var(--line); }
.hist-row { display: flex; align-items: center; gap: 2px; border-bottom: 1px solid var(--line); }
.hist-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 10px 2px; border: 0; background: none; text-align: left; color: var(--ink); font: inherit; }
.hist-open .glyph, .hist-open svg { flex: none; width: 28px; height: 28px; }
.hist-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hist-txt b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-txt span { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.hist-open time { flex: none; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.hist-row .icon-btn { margin: 0; color: var(--muted); }
.hist-star[aria-pressed="true"] .ic { fill: var(--mark); stroke: #8a6a00; }
.hist-mats { flex-wrap: wrap; }
