/* Flange joint, EN 1591-1: on top of calc.css (layout and parts shared with flange/) */
main.fl .tabs { grid-template-columns: repeat(4, 1fr); }
main.fl .stage-bar { justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
main.fl .stage-bar .hist { margin-left: auto; }
.fl-types button { white-space: nowrap; }
#view { display: block; width: 100%; height: auto; user-select: none; touch-action: none; }
#view .hit { fill: transparent; stroke: none; }
#view .handle { cursor: grab; }
#view .handle.hx { cursor: ew-resize; }
#view .handle .knob { fill: var(--surface); stroke: var(--sel); stroke-width: 1.8; }
#view .handle:hover .knob, #view .handle:focus .knob { fill: var(--sel); }
#view.dragging .handle { cursor: grabbing; }

/* parts */
.fl-sec { fill: url(#enHatch); stroke: var(--steel-850); stroke-width: 1.1; stroke-linejoin: round; }
.fl-ghost { fill: none; stroke: var(--steel-500); stroke-width: .9; stroke-dasharray: 4 3; pointer-events: none; }
.fl-gasket { fill: var(--x-2f8f9d, #2f8f9d); fill-opacity: .55; stroke: var(--x-1f6f7a, #1f6f7a); stroke-width: .8; }
.fl-stud { fill: var(--steel-100); stroke: var(--steel-700); stroke-width: .9; }
.fl-nut { fill: var(--steel-300); stroke: var(--steel-850); stroke-width: .9; }
.fl-edge { stroke: var(--steel-850); stroke-width: 1; }
.fl-break { stroke: var(--steel-850); stroke-width: 1; stroke-dasharray: 3 2; }
.fl-ctr { stroke: var(--steel-550); stroke-width: .8; stroke-dasharray: 10 3 2 3; fill: none; pointer-events: none; }
.fl-ext { fill: none; stroke: var(--steel-400); stroke-width: .8; pointer-events: none; }
.fl-dim { fill: none; stroke: var(--steel-550); stroke-width: .9; pointer-events: none; }
.fl-dimh { fill: var(--steel-550); }
.fl-load line, .fl-load path.sh { stroke: var(--load); stroke-width: 1.8; fill: none; }
.fl-load path.hd { fill: var(--load); stroke: none; }
.fl-load.fl-p line { stroke: var(--moment); } .fl-load.fl-p path.hd { fill: var(--moment); }
.fl-load.fl-g line { stroke: var(--x-1f6f7a, #1f6f7a); } .fl-load.fl-g path.hd { fill: var(--x-1f6f7a, #1f6f7a); }
.fl-name { font-size: 12.5px; font-weight: 600; fill: var(--text); }
.fl-role { font-size: 11px; fill: var(--text-3); }
.fl-nm { cursor: text; }
.fl-nm:hover .fl-name, .fl-nm:focus .fl-name { fill: var(--sel); }
.fl-nm:focus { outline: none; }

/* pills */
#view .pill rect { fill: var(--surface); stroke: var(--steel-300); }
#view .pill text { font-size: 11.5px; font-weight: 500; fill: var(--text-2); font-variant-numeric: tabular-nums; }
#view .pill.dimv rect { stroke: var(--steel-200); }
#view .pill.load rect { stroke: color-mix(in srgb, var(--load) 35%, transparent); } #view .pill.load text { fill: var(--load); font-weight: 600; }
#view .pill.desig rect { stroke: color-mix(in srgb, var(--sel) 45%, transparent); } #view .pill.desig text { fill: var(--x-1e4fbf, #1e4fbf); font-weight: 600; }
#view .pill.desig { cursor: pointer; }
#view .pill.editable { cursor: text; }
#view .pill.gas rect { stroke: color-mix(in srgb, var(--x-1f6f7a, #1f6f7a) 40%, transparent); } #view .pill.gas text { fill: var(--x-1f6f7a, #1f6f7a); }
#view .pill.press rect { stroke: color-mix(in srgb, var(--moment) 40%, transparent); } #view .pill.press text { fill: var(--moment); font-weight: 600; }
#view .pill.editable:hover rect, #view .pill.editable:focus rect { stroke: var(--sel); stroke-width: 1.4; }
#view .pill.editable:focus, #view .pill.desig:focus { outline: none; }

/* editors in the drawing */
.stage { position: relative; }
.fl-edit { position: absolute; transform: translate(-50%, -50%); z-index: 5; display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1.5px solid var(--sel); border-radius: 9px; padding: 2px 8px 2px 4px; box-shadow: 0 6px 18px rgba(20, 22, 28, .14); }
.fl-edit input { width: 82px; border: 0; outline: none; font: inherit; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; padding: 3px 2px; }
.fl-edit-name input { width: 180px; text-align: center; }
.fl-edit span { font-size: 11.5px; color: var(--text-3); }

/* live strip */
.fl-live { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; min-height: 38px; align-items: center; }
.fl-live b { font-weight: 500; color: var(--text-3); margin-right: 5px; }
.fl-live i { font-style: normal; color: var(--text-3); }

/* panel */
.fl-seg { margin-bottom: 6px; }
.fl-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 6px; }
.fl-chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 2px 9px; font-size: 12px; color: var(--text-2); cursor: pointer; font-variant-numeric: tabular-nums; }
.fl-chip:hover { border-color: var(--line-2); }
.fl-chip.on { border-color: var(--text); color: var(--text); font-weight: 500; }
.fl-forms { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-bottom: 6px; }
.fl-form { display: grid; justify-items: center; gap: 2px; padding: 5px 6px 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; font-size: 12px; color: var(--text-2); }
.fl-form:hover { border-color: var(--line-2); }
.fl-form.on { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); color: var(--text); }
.fl-lab { font-size: 12px; color: var(--text-3); margin: 8px 0 4px; }
#panel input.bad { color: var(--bad); }
#panel .num:has(input.bad) input { border-color: var(--bad); }
#panel select { max-width: 100%; }
#panel .f.sel.wide { grid-template-columns: minmax(0, 1fr); }
#panel .f.sel.wide select { width: 100%; }

/* summary */
.fl-say { margin-top: 6px; font-size: 12.5px; color: var(--text-2); line-height: 1.4; max-width: 34ch; }
.fl-des { font-weight: 600; color: var(--x-1e4fbf, #1e4fbf); }

/* charts and the disc's data */
.fl-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
#view .handle.hy { cursor: ns-resize; } #view .handle.hx { cursor: ew-resize; }
#tchart .tdrag { cursor: ew-resize; }
#tchart { touch-action: none; user-select: none; }
.fl-check { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--text-2); margin: 6px 0 2px; line-height: 1.4; }
.fl-check input { margin-top: 2px; }
.fl-dims { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 6px 28px; }
.fl-dims table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.fl-dims th { font-weight: 500; font-size: 11.5px; color: var(--text-3); text-align: left; padding: 5px 8px 5px 0; border-bottom: 1px solid var(--line); }
.fl-dims td { padding: 5px 8px 5px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.fl-dims td.v { text-align: right; white-space: nowrap; font-weight: 500; }
.fl-dims td.t { color: var(--text-3); text-align: right; }
.fl-dims h3 { font-size: 12.5px; font-weight: 600; margin: 4px 0 6px; }
.fl-steppers { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin: 2px 0 8px; }
.fl-step { display: grid; gap: 4px; }
.fl-step .lab { font-size: 12px; color: var(--text-3); }
.fl-step .ctl { display: flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.fl-step .ctl button { width: 34px; height: 30px; border: 0; background: var(--surface-2); cursor: pointer; font-size: 15px; color: var(--text-2); }
.fl-step .ctl button:hover { background: var(--fill-1); }
.fl-step .ctl span { flex: 1; text-align: center; font-variant-numeric: tabular-nums; font-weight: 500; font-size: 13px; }
.fl-icon { display: block; margin: 0 auto; }
.fl-forms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; margin-bottom: 6px; }
.fl-form { display: grid; justify-items: center; gap: 2px; padding: 6px 6px 5px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; font-size: 12px; color: var(--text-2); }
.fl-form:hover { border-color: var(--line-2); }
.fl-form.on { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); color: var(--text); }
.fl-view button { white-space: nowrap; }

@media (max-width: 1100px) { .fl-two { grid-template-columns: minmax(0, 1fr); } }
#panel.fade-b { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent); }
#panel.fade-t { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 28px); mask-image: linear-gradient(to bottom, transparent, #000 28px); }
#panel.fade-t.fade-b { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 28px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to bottom, transparent, #000 28px, #000 calc(100% - 32px), transparent); }
#checks td.note { white-space: normal; min-width: 200px; line-height: 1.4; }
.fl-tag { display: inline-flex; align-items: center; line-height: 1; font-size: 10.5px; color: var(--text-3); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; margin-left: 4px; white-space: nowrap; vertical-align: 1px; }
@media (max-width: 760px) { .fl-dims td.v, .fl-dims td.t { white-space: normal; } }
@media print { .fl-edit { display: none !important; } }

/* EN 1591-1 additions */
.fl-sec.b { fill: url(#enHatch2); }
.fl-brk { fill: none; stroke: var(--steel-850); stroke-width: 1; }
.en-groove { fill: var(--surface); stroke: var(--steel-850); stroke-width: .9; }
.en-gasket-e { fill: var(--x-1f6f7a, #1f6f7a); fill-opacity: .55; stroke: none; pointer-events: none; }
.en-rot path { fill: none; stroke: var(--moment); stroke-width: 1; stroke-dasharray: 4 3; opacity: .7; pointer-events: none; }
#view .pill.rot rect { stroke: color-mix(in srgb, var(--moment) 35%, transparent); } #view .pill.rot text { fill: var(--moment); }
main.en .stage-bar .en-cond { flex-wrap: wrap; }
main.en .stage-bar .en-cond button { white-space: nowrap; }
.en-flag { color: var(--warn-ink); }
.en-tab { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.en-tab th { font-weight: 500; font-size: 11.5px; color: var(--text-3); text-align: right; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.en-tab td { text-align: right; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.en-tab th.l, .en-tab td.l { text-align: left; }
.en-tab tr.sel td { background: var(--bg); }
.en-tab .ms { display: inline-flex; align-items: center; line-height: 1; }
.en-lbtn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12px; color: var(--text-2); cursor: pointer; line-height: 1; }
.en-lbtn[aria-pressed="true"] { border-color: var(--text); color: var(--text); font-weight: 500; }
#wchart { touch-action: none; user-select: none; }
#wchart .tdrag { cursor: ew-resize; }
.steps .src { color: var(--text-3); font-size: 11.5px; margin-left: auto; padding-right: 8px; white-space: nowrap; }
@media (max-width: 760px) {
  .en-tab { font-size: 12px; }
  #conds thead { display: none; }
  #conds tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  #conds td { border: 0; padding: 1px 0; text-align: left; white-space: normal; }
  #conds td.l { grid-column: 1 / -1; font-weight: 600; }
  #conds td:not(.l)::before { color: var(--text-3); font-size: 11px; display: block; }
  #conds td:nth-child(2)::before { content: "P"; } #conds td:nth-child(3)::before { content: "T"; } #conds td:nth-child(4)::before { content: "FB"; } #conds td:nth-child(5)::before { content: "FG"; }
  #conds td:nth-child(6)::before { content: "FQ"; } #conds td:nth-child(7)::before { content: "FR"; } #conds td:nth-child(8)::before { content: "ΔU"; } #conds td:nth-child(9)::before { content: "Gasket Q"; } #conds td:nth-child(10)::before { content: "ΘF"; }
  #levels th:nth-child(2), #levels td:nth-child(2), #levels th:nth-child(3), #levels td:nth-child(3) { display: none; }
  .steps .src { display: none; }
}

/* theme-auto:start · generated by scripts/theme/hexmap.py: dark values (the rule of scripts/theme/colour.py) for
   colours that are not tokens, written as var(--x-rrggbb, #rrggbb): light is the fallback, unchanged */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --x-1e4fbf: #749ff5; --x-1f6f7a: #72adb6; --x-2f8f9d: #7ac1cd; --x-6e7177: #85827f; --x-8a5cb8: #c09bea;
    --x-cfd5db: #373b3f;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-1e4fbf: #749ff5; --x-1f6f7a: #72adb6; --x-2f8f9d: #7ac1cd; --x-6e7177: #85827f; --x-8a5cb8: #c09bea;
    --x-cfd5db: #373b3f;
  }
}
/* theme-auto:end */
