/* Simple engineering tools: line sizing calculator, P&ID and PFD drawing */
.st-head { padding-top: 4px; padding-bottom: 0; }
.st-head h1 { margin: 4px 0 2px; }
.st-head p { margin: 0 0 10px; color: var(--muted); }

/* ---------- line sizing ---------- */
.ls { background: var(--panel); border: 1px solid var(--grid-line); border-radius: 10px; padding: 18px; display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 22px; }
.ls-form { display: grid; gap: 12px; align-content: start; }
.ls-f { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
.ls-f > span:first-child { font-weight: 600; }
.ls select, .ls input { font: 500 15px var(--f-sans); color: var(--paper); background: var(--bg-deep); border: 1px solid #2C4C6C; border-radius: 6px; padding: 9px 10px; width: 100%; min-width: 0; }
.ls input[type="number"] { font-family: var(--f-mono); }
.ls select:focus-visible, .ls input:focus-visible { outline: 2px solid var(--brass); outline-offset: 1px; }
.ls-in { display: flex; gap: 8px; align-items: center; }
.ls-in b { font-weight: 500; color: var(--muted); min-width: 52px; font-size: 13px; }
.ls:not(.is-gas) .ls-pr, .ls:not(.is-userliq) .ls-solv, .ls:not(.is-userliq) .ls-liqprop { display: none; }
.ls-more summary { cursor: pointer; color: var(--brass); font-size: 13px; padding: 2px 0; }
.ls-moregrid { display: grid; gap: 10px; margin-top: 10px; }
.ls-out { min-width: 0; }
.ls-answer { border-left: 4px solid var(--brass); background: var(--bg-deep); border-radius: 0 8px 8px 0; padding: 16px 18px; display: grid; grid-template-columns: auto 1fr; gap: 10px 28px; align-items: center; }
.ls-answer.bad { border-left-color: var(--rust); }
.ls-big span { display: block; color: var(--muted); font-size: 13px; }
.ls-big strong { display: block; font: 700 46px/1.05 var(--f-display); color: var(--brass); letter-spacing: .01em; }
.ls-big em { font-style: normal; color: var(--paper); font-size: 13px; }
.ls-kv { margin: 0; display: grid; gap: 8px; }
.ls-kv div { display: grid; grid-template-columns: 150px 1fr; gap: 0 10px; }
.ls-kv dt { color: var(--muted); font-size: 13px; }
.ls-kv dd { margin: 0; font: 600 15px var(--f-mono); }
.ls-kv small { grid-column: 2; color: var(--muted-dim, #42586C); color: #7F95AB; font-size: 12px; }
.ls-why { color: #B9C8D6; font-size: 13.5px; margin: 12px 2px; max-width: 70ch; }
.ls-empty { color: var(--muted); padding: 18px; }
.ls-tab { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ls-tab th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--grid-line); }
.ls-tab td { padding: 6px 8px; border-bottom: 1px solid #1A2E44; font-family: var(--f-mono); }
.ls-tab td:last-child { font-family: var(--f-sans); color: var(--muted); }
.ls-tab tr.pick td { color: var(--brass); background: #1A2C40; } .ls-tab tr.pick td:last-child { color: var(--brass); font-weight: 600; }
.ls-tab small { color: var(--muted); }
@media (max-width: 760px) { .ls { grid-template-columns: 1fr; padding: 14px; } .ls-answer { grid-template-columns: 1fr; } .ls-kv div { grid-template-columns: 130px 1fr; } }

/* ---------- drawing sheet (P&ID / PFD) ---------- */
.sd { --sd-line: #24405E; border: 1px solid var(--sd-line); border-radius: 10px; overflow: hidden; background: #0A141F; display: grid; grid-template-columns: 200px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: calc(100vh - 140px); min-height: 520px; color: var(--paper); font: 400 14px/1.4 var(--f-sans); }
.sd *, .sd *::before, .sd *::after { box-sizing: border-box; }
.sd button, .sd input, .sd select { font: inherit; color: var(--paper); }
.sd button { background: var(--panel-raised); border: 1px solid #2C4C6C; border-radius: 6px; padding: 7px 12px; cursor: pointer; white-space: nowrap; }
.sd button:hover { border-color: var(--brass); }
.sd button:focus-visible, .sd input:focus-visible, .sd select:focus-visible { outline: 2px solid var(--brass); outline-offset: 1px; }
.sd button[aria-pressed="true"] { background: var(--brass); color: #0B1622; border-color: var(--brass); font-weight: 700; }
.sd input, .sd select { background: var(--bg-deep); border: 1px solid #2C4C6C; border-radius: 5px; padding: 6px 8px; width: 100%; min-width: 0; }
.sd-bar { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; padding: 8px 10px; background: var(--panel); border-bottom: 1px solid var(--sd-line); flex-wrap: wrap; }
.sd-bar .sp { flex: 1; }
.sd-bar .sd-name { max-width: 240px; font-weight: 600; background: transparent; border-color: transparent; }
.sd-bar .sd-name:hover, .sd-bar .sd-name:focus { border-color: #2C4C6C; }
.sd-pal { background: var(--panel); border-right: 1px solid var(--sd-line); overflow-y: auto; padding: 8px; }
.sd-pal input[type="search"] { margin-bottom: 8px; }
.sd-pal details { margin-bottom: 4px; }
.sd-pal details[hidden] { display: none; }
.sd-pal summary { cursor: pointer; font: 700 12.5px var(--f-sans); color: var(--muted); padding: 5px 2px; }
.sd-pal .g { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding-bottom: 6px; }
.sd-pal .s { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 2px; background: var(--bg-deep); border-color: #1F3650; white-space: normal; text-align: center; }
.sd-pal .s[hidden] { display: none; }
.sd-pal .s img { width: 44px; height: 33px; }
.sd-pal .s span { font-size: 10.5px; line-height: 1.2; color: #C9D6E2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sd-pal .s[aria-pressed="true"] { background: #1D3550; border-color: var(--brass); color: var(--paper); font-weight: 400; }
.sd-wrap { position: relative; min-width: 0; min-height: 0; touch-action: none; }
.sd-wrap > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: default; }
.sd-wrap.placing > canvas, .sd-wrap.connecting > canvas { cursor: crosshair; }
.sd-wrap.panning > canvas { cursor: grabbing; }
.sd-hint { position: absolute; left: 12px; bottom: 10px; right: 120px; pointer-events: none; color: #B9C8D6; font-size: 13px; text-shadow: 0 1px 2px #000; }
.sd-zoom { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 4px; }
.sd-zoom button { padding: 4px 10px; }
.sd-msg { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); background: var(--brass); color: #0B1622; padding: 6px 12px; border-radius: 6px; font-weight: 600; font-size: 13px; display: none; z-index: 3; max-width: calc(100% - 20px); text-align: center; }
.sd-msg.on { display: block; }
.sd-card { position: absolute; right: 10px; top: 10px; width: 270px; background: #102133f2; border: 1px solid #2C4C6C; border-radius: 10px; padding: 12px; z-index: 2; box-shadow: 0 10px 30px rgba(0,0,0,.45); display: grid; gap: 8px; }
.sd-card[hidden] { display: none; }
.sd-card h3 { margin: 0; font: 700 14px var(--f-sans); color: var(--brass); padding-right: 28px; }
.sd-card label { display: grid; gap: 3px; font-size: 12.5px; color: var(--muted); }
.sd-card .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sd-card .x { position: absolute; right: 8px; top: 8px; padding: 1px 8px; }
.sd-card a { color: var(--brass); font-size: 13px; }
.sd-card .del { justify-self: start; color: #FF9C8C; }
.sd-start { position: absolute; inset: 0; z-index: 4; background: rgba(10,20,31,.94); overflow-y: auto; padding: 22px; }
.sd-start[hidden] { display: none; }
.sd-start h2 { margin: 0 0 4px; font: 700 20px var(--f-sans); }
.sd-start p { margin: 0 0 14px; color: var(--muted); }
.sd-start .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; max-width: 1100px; }
.sd-start .tpl { display: flex; flex-direction: column; gap: 6px; text-align: left; white-space: normal; padding: 8px; background: var(--bg-deep); }
.sd-start .tpl canvas { width: 100%; height: auto; border-radius: 6px; border: 1px solid #1F3650; }
.sd-start .tpl b { font-size: 14px; }
.sd-start .blank { justify-content: center; align-items: center; min-height: 150px; border-style: dashed; font-weight: 600; }
.sd-mob { display: none; }
@media (max-width: 800px) {
  .sd { grid-template-columns: minmax(0, 1fr); height: 80vh; }
  .sd-pal { display: none; position: absolute; z-index: 5; left: 0; top: 0; bottom: 0; width: 210px; }
  .sd.pal-open .sd-pal { display: block; }
  .sd { position: relative; }
  .sd-mob { display: inline-block; }
  .sd-card { left: 10px; right: 10px; width: auto; top: auto; bottom: 10px; }
}
