/* Legend workflow (web/legend.js). Tag colours: keep in step with PALETTE in web/legend-core.js. */
.legend-buttons { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 4px 0; }
.legend-buttons[hidden] { display: none; } /* display: flex would otherwise show a hidden row */
.legend-small { font-size: 12px; }
.legend-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.legend-table td, .legend-table th { text-align: left; padding: 2px 4px; border-bottom: 1px solid #eee; vertical-align: top; }
#legend-table tbody tr, #sheets-table tbody tr { cursor: pointer; }
#legend-table tr.selected, #sheets-table tr.current { background: #e6f0ff; }
#legend-table tr.needs-look { background: #fff4f4; }
#legend-table tr.selected.needs-look { background: #ffe3e3; }
.legend-symbol { width: 56px; height: 36px; border: 1px solid #ddd; background: #fff; display: block; }
.legend-flag { color: #b00020; font-weight: bold; }
.legend-note { color: #7a5200; }
.legend-looks-right { margin-top: 2px; }
.legend-find-all { margin-top: 2px; width: 58px; padding: 1px 0; font-size: 11px; }
#legend-pick { max-width: 100%; }
/* Electrical sheets in the page list (a full bid set mixes every trade). */
.pages button.electrical { background: #fff3d6; border: 1px solid #c98200; }
#legend-hand-btn.primary { font-weight: bold; border: 2px solid #1a56c4; }
.legend-editor { border: 1px solid #ccd; padding: 6px; margin: 6px 0; background: #fafbff; }
.legend-editor label { display: block; margin-top: 4px; font-size: 13px; }
.legend-editor input[type=text] { width: 100%; }
.legend-editor select { max-width: 160px; }
#legend-engineer { width: 100%; }
#legend-library { margin-top: 8px; }
/* The legend step's Whole set part: a lighter line, still in its step. */
#setscan-body { border-top: 1px dashed #c9cdd4; margin-top: 12px; }
#setscan-body h3 { font-size: 14px; margin: 10px 0 4px; }
#setscan-progress { width: 100%; }
#sheets-table td.ok, .legend-table td.ok { color: #1b6e20; }
.counts-table td.num, .counts-table th:not(:first-child) { text-align: right; }
.counts-table td.strong { font-weight: bold; }
.counts-table tfoot td { border-top: 2px solid #ccc; font-weight: bold; }
.counts-table { font-size: 12px; }
.tag-tools { margin: 4px 0; font-size: 13px; }
.tag-tools select { max-width: 100%; }
.tag-key { margin-top: 4px; font-size: 12px; line-height: 1.8; }
#viewport.mode-legendbox { cursor: crosshair; }
.tag-chip { display: inline-block; padding: 0 4px; border-radius: 3px; font-size: 11px; font-weight: bold;
  line-height: 15px; min-width: 16px; text-align: center; }
.tag-c0 { background: #1f5fbf; color: #ffffff; }
.tag-c1 { background: #c62828; color: #ffffff; }
.tag-c2 { background: #6a3d9a; color: #ffffff; }
.tag-c3 { background: #8c564b; color: #ffffff; }
.tag-c4 { background: #00838f; color: #ffffff; }
.tag-c5 { background: #9e9d24; color: #111111; }
.tag-c6 { background: #d81b60; color: #ffffff; }
.tag-c7 { background: #283593; color: #ffffff; }
.tag-c8 { background: #ef6c00; color: #111111; }
.tag-c9 { background: #37474f; color: #ffffff; }
#legend-details summary { cursor: pointer; font-size: 13px; margin: 4px 0; }
/* Show legend: the whole legend, cut from its page, in a column beside the
   drawing so it never covers it. Its width is dragged at the left edge; the
   picture fits that width, or is zoomed and scrolled to read. */
/* Top right of the toolbar however it wraps; the toolbar keeps room for it. */
#toolbar { position: relative; }
#toolbar:has(#legend-show-btn:not([hidden])) { padding-right: 124px; }
#legend-show-btn { position: absolute; top: 5px; right: 8px; }
#legend-show-btn[aria-expanded=true] { font-weight: bold; }
#legend-side { position: relative; width: 40%; min-width: 280px; max-width: calc(100% - 240px); flex: none;
  display: flex; flex-direction: column;
  padding: 8px 12px; border-left: 1px solid #ccc; background: #fff; }
#legend-side[hidden] { display: none; }
.legend-side-grip { position: absolute; left: -4px; top: 0; bottom: 0; width: 8px; cursor: col-resize; z-index: 3;
  touch-action: none; }
.legend-side-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; justify-content: space-between; }
.legend-side-head h2 { font-size: 14px; margin: 4px 0; }
#legend-side-zoom { min-width: 3.5em; text-align: center; display: inline-block; }
#legend-side-from { margin: 2px 0 6px; }
#legend-side-view { flex: 1; min-height: 0; overflow: auto; border: 1px solid #ddd; background: #fff; }
#legend-side-canvas { display: block; }
#legend-side-canvas[hidden] { display: none; }
/* Over the legend picture: the one symbol under the pointer lights up green
   (#legend-side-hover) and is clicked to find all of it; a symbol's count shows
   on it once found. Dragging on the picture boxes a symbol that doesn't light up. */
#legend-side-sheet { position: relative; display: inline-block; vertical-align: top; }
#legend-side-marks { position: absolute; inset: 0; cursor: crosshair; touch-action: none; }
#legend-side-marks.pointing { cursor: pointer; }
.legend-side-mark { position: absolute; padding: 0; margin: 0; border: 2px solid transparent; border-radius: 3px;
  background: transparent; pointer-events: none; }
.legend-side-mark:focus-visible { border-color: #15803d; background: rgba(21, 128, 61, .15); outline: none; }
.legend-side-mark.finding { border-color: #15803d; border-style: dashed; }
#legend-side-hover { position: absolute; border: 2px solid #15803d; border-radius: 4px; background: rgba(21, 128, 61, .2);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .85); pointer-events: none; }
#legend-side-hover[hidden] { display: none; }
.legend-side-count { position: absolute; right: 0; top: 0; transform: translate(60%, -60%); padding: 1px 6px;
  font-size: 11px; font-weight: 700; line-height: 15px; white-space: nowrap; color: #fff; background: #15803d;
  border-radius: 8px; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); pointer-events: none; }
.legend-side-drag { position: absolute; border: 2px dashed #15803d; background: rgba(21, 128, 61, .12);
  pointer-events: none; }
#legend-side-hint { margin: 6px 0 0; }
#legend-region-btn.primary { font-weight: bold; border: 2px solid #1a56c4; }
