/* Whiteboard: list page, editor chrome (rail, panels, properties, board strip, zoom), canvas overlay, color panel.
   The canvas uses the board's own background color in both themes; the chrome follows the app theme tokens. */
/* Whiteboard canvas overlay tokens (the board keeps its own background in both themes). */
:root { --wb-sel: #2563eb; --wb-sel-hover: #1d4ed8; --wb-sel-soft: rgba(37, 99, 235, .08); --wb-sel-faint: rgba(37, 99, 235, .05); --wb-muted: #8b929c; --wb-adj: #facc15; --wb-adj-line: #854d0e; --wb-guide: #e11d48; }

/* ---------- list page ---------- */
.wb-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 12px; }
.wb-tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; }
.wb-tile:hover, .wb-tile:focus-visible { border-color: var(--line-strong); box-shadow: var(--shadow); outline: none; }
.wb-thumb { height: 150px; background: var(--dg-paper) center / contain no-repeat; border-bottom: 1px solid var(--line); }
.wb-thumb.empty { display: flex; align-items: center; justify-content: center; color: var(--text-3); font-size: 12px; background: var(--canvas-bg); }
.wb-tname { display: flex; align-items: center; gap: 6px; padding: 8px 10px 0; font-weight: 600; }
.wb-tname span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-tmenu { font-size: 18px; }
.wb-tmeta { padding: 2px 10px 10px; }

/* ---------- editor layout ---------- */
.wb-page { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); }

.wb-body { flex: 1; min-height: 0; display: flex; }
.wb-rail { width: 46px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; }
.wb-tool { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--text-2); padding: 0; }
.wb-tool:hover { background: var(--line-2); color: var(--text); }
.wb-tool.on { background: var(--accent-2); border-color: var(--accent); color: var(--accent); }
.wb-tool:focus-visible { outline: 2px solid var(--focus); }
.wb-railsep { width: 26px; height: 1px; background: var(--line); margin: 5px 0; flex: none; }
.wb-ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.wb-left { width: 270px; flex: none; display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--line); min-height: 0; }
.wb-lhead { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 4px; }
.wb-lbody { flex: 1; overflow-y: auto; padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.wb-center { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.wb-canvashost { flex: 1; position: relative; min-height: 0; }
.wb-props { width: 262px; flex: none; overflow-y: auto; background: var(--panel); border-left: 1px solid var(--line); padding: 6px 12px 24px; font-size: 13px; }

/* ---------- canvas ---------- */
.wb-canvas { position: absolute; inset: 0; overflow: hidden; outline: none; background: var(--dg-paper); user-select: none; -webkit-user-select: none; touch-action: none; }
/* The board edge follows the theme; keyboard focus shows a soft ring instead of a bright frame (dark theme). */
.wb-canvashost { box-shadow: 0 0 0 1px var(--border); }
.wb-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--focus-halo); }
.wb-svg, .wb-over { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
.wb-svg text { user-select: none; -webkit-user-select: none; }
.wb-over { pointer-events: none; }
.wb-over .wb-h { pointer-events: all; }
.wb-canvas.panning, .wb-canvas.panning * { cursor: grab !important; }
.wb-canvas.grabbing, .wb-canvas.grabbing * { cursor: grabbing !important; }
.wb-canvas.sampling, .wb-canvas.sampling * { cursor: crosshair !important; }
.wb-canvas.painting .wb-item { cursor: copy; }
.wb-canvas[data-tool=select] .wb-item { cursor: default; }
.wb-selbox { fill: none; stroke: var(--wb-sel); stroke-width: 1.5; }
.wb-selone { fill: none; stroke: var(--wb-sel); stroke-width: 1; stroke-dasharray: 4 3; }
.wb-selline { stroke: var(--wb-sel); stroke-width: 1; stroke-dasharray: 4 3; }
.wb-scope { fill: none; stroke: var(--wb-muted); stroke-width: 1; stroke-dasharray: 6 4; }
.wb-h { fill: var(--dg-paper); stroke: var(--wb-sel); stroke-width: 1.5; }
.wb-h.wb-rot { cursor: grab; }
.wb-rotline { stroke: var(--wb-sel); stroke-width: 1; }
.wb-h.wb-end { cursor: move; }
.wb-h.wb-end.on { fill: var(--wb-sel); }
.wb-plus { cursor: pointer; }
.wb-plus circle { fill: var(--wb-sel); stroke: var(--dg-paper); stroke-width: 1.5; }
.wb-plus path { stroke: var(--dg-paper); stroke-width: 1.8; fill: none; }
.wb-plus:hover circle { fill: var(--wb-sel-hover); }
.wb-adj { fill: var(--wb-adj); stroke: var(--wb-adj-line); stroke-width: 1; }
.wb-guide { stroke: var(--wb-guide); stroke-width: 1; stroke-dasharray: 3 2; }
.wb-marquee { fill: var(--wb-sel-soft); stroke: var(--wb-sel); stroke-width: 1; }
.wb-lockbadge rect { fill: var(--dg-paper); stroke: var(--wb-muted); }
.wb-lockbadge text { font-size: 11px; }
.wb-tip { position: absolute; z-index: 5; background: var(--text); color: var(--surface); font-size: 11px; padding: 2px 6px; border-radius: 4px; pointer-events: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wb-ghost { position: absolute; border: 1.5px dashed var(--wb-sel); background: var(--wb-sel-faint); pointer-events: none; }
.wb-texthost { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.wb-edit { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: auto; }
.wb-edit-box { position: absolute; display: flex; flex-direction: column; }
.wb-edit-in { outline: none; min-width: 4px; word-break: break-word; overflow-wrap: anywhere; cursor: text; user-select: text; -webkit-user-select: text; }
.wb-edit-in ul, .wb-edit-in ol { margin: 0; padding-left: 1.3em; }
.wb-edit-in div, .wb-edit-in p { margin: 0; }

/* ---------- zoom + board strip ---------- */
.wb-zoom { display: inline-flex; align-items: center; }
.wb-zoom button { border: 0; border-radius: var(--r-ctl); background: none; color: var(--text-2); width: 28px; height: 28px; font-size: var(--fs-md); }
.wb-zoom button:hover { background: var(--hover-bg); color: var(--text); }
.wb-pct { width: 54px; text-align: center; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 12px; font-variant-numeric: tabular-nums; }
.wb-pct:focus { outline: 1px solid var(--accent); background: var(--input-bg); }
.wb-pages { height: 38px; flex: none; display: flex; align-items: center; gap: 4px; padding: 0 8px; background: var(--panel); border-top: 1px solid var(--line); overflow-x: auto; }
.wb-ptab { display: flex; align-items: center; gap: 2px; height: 28px; padding: 0 4px 0 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-2); color: var(--text-2); cursor: pointer; white-space: nowrap; font-size: 12px; }
.wb-ptab.on { background: var(--accent-2); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.wb-ptab.drop { box-shadow: -3px 0 0 var(--accent); }
.wb-pmenu { border: 0; background: none; color: inherit; padding: 0 4px; opacity: .6; }
.wb-pmenu:hover { opacity: 1; }
.wb-prename { font: inherit; width: 120px; border: 1px solid var(--accent); border-radius: 3px; padding: 1px 4px; background: var(--input-bg); color: var(--text); }
.wb-padd { width: 28px; height: 28px; border: 1px dashed var(--line-strong); border-radius: 5px; background: none; color: var(--text-2); font-size: 16px; }
.wb-padd:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- panels ---------- */
.wb-search { font-size: 13px; }
.wb-hint { color: var(--muted); font-size: 12px; line-height: 1.35; }
.wb-empty { color: var(--muted); font-size: 12px; padding: 8px 0; }
.wb-muted { color: var(--muted); font-size: 12px; }
.wb-pcat { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 8px 0 4px; }
.wb-shgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.wb-shbtn { height: 40px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-2); padding: 0; cursor: grab; }
.wb-shbtn:hover { border-color: var(--accent); background: var(--accent-2); }
.wb-shico path { fill: var(--chip-bg); stroke: var(--text-2); stroke-width: 1.2; }
.wb-shico path.open { fill: none; }
.wb-layers { display: flex; flex-direction: column; gap: 1px; }
.wb-lrow { display: flex; align-items: center; gap: 4px; padding: 3px 4px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.wb-lrow:hover { background: var(--line-2); }
.wb-lrow.on { background: var(--accent-2); color: var(--accent); }
.wb-lrow.off .wb-lname { opacity: .5; }
.wb-lrow.drop { box-shadow: 0 -2px 0 var(--accent); }
.wb-lname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-lbtn { border: 0; background: none; width: 20px; padding: 0; color: var(--text-2); font-size: 11px; }
.wb-lrename { padding: 1px 4px; font-size: 12px; }
.wb-clipart { display: flex; flex-direction: column; gap: 8px; min-height: 0; }

/* ---------- properties ---------- */
.wb-sec { padding: 10px 0; border-bottom: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 7px; }
.wb-sec-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.wb-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wb-field { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.wb-field > span { color: var(--text-2); font-size: 12px; white-space: nowrap; }
.wb-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.wb-grid2 .wb-field > span { min-width: 18px; }
.wb-num { width: 74px; font: inherit; font-size: 12px; padding: 3px 5px; border: 1px solid var(--line); border-radius: 4px; background: var(--input-bg); color: var(--text); font-variant-numeric: tabular-nums; }
.wb-sel { font: inherit; font-size: 12px; padding: 3px 4px; border: 1px solid var(--line); border-radius: 4px; background: var(--input-bg); color: var(--text); max-width: 100%; flex: 1; }
.wb-row > .wb-sel { width: 100%; }
.wb-btn { font: inherit; font-size: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 4px; padding: 3px 8px; min-height: 26px; display: inline-flex; align-items: center; gap: 4px; }
.wb-btn:hover:not(:disabled) { border-color: var(--line-strong); background: var(--panel-2); }
.wb-btn:disabled { opacity: .4; cursor: default; }
.wb-btn.on { background: var(--accent-2); border-color: var(--accent); color: var(--accent); }
.wb-btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.wb-btn.danger { color: var(--danger); }
.wb-btnrow { display: flex; gap: 4px; flex-wrap: wrap; }
.wb-btnrow .wb-btn { flex: 1 1 auto; justify-content: center; }
.wb-tbtns .wb-btn { min-width: 30px; justify-content: center; }
.wb-presets { display: flex; gap: 3px; flex-wrap: wrap; }
.wb-presets .wb-btn { padding: 2px 6px; min-height: 22px; font-size: 11px; }
.wb-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.wb-segb { font: inherit; font-size: 12px; border: 0; border-right: 1px solid var(--line); background: var(--panel); color: var(--text-2); padding: 3px 7px; }
.wb-segb:last-child { border-right: 0; }
.wb-segb.on { background: var(--accent-2); color: var(--accent); font-weight: 600; }
.wb-check { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); }
.wb-slider { display: flex; align-items: center; gap: 6px; flex: 1; justify-content: flex-end; }
.wb-range { width: 96px; accent-color: var(--accent); }
.wb-slider .wb-num { width: 52px; }
.wb-colorbtn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 4px; padding: 3px 8px 3px 4px; min-height: 26px; }
.wb-colorbtn:hover { border-color: var(--line-strong); }
.wb-sw { width: 18px; height: 18px; border-radius: 3px; border: 1px solid var(--border-strong); background-clip: padding-box; }
.wb-colorbtn.none .wb-sw { background: linear-gradient(135deg, transparent 45%, #dc2626 45%, #dc2626 55%, transparent 55%) !important; }
.wb-swap { width: 100%; justify-content: flex-start; }
.wb-swap .wb-caret { margin-left: auto; color: var(--muted); }
.wb-swap .wb-shico path { fill: var(--chip-bg); }
.wb-stickypal { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; align-items: center; }

/* ---------- color panel ---------- */
.wb-color-pop { position: fixed; z-index: 140; width: 262px; max-height: calc(100vh - 16px); overflow-y: auto; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.wb-chead { display: flex; align-items: center; gap: 4px; }
.wb-chead .wb-btn { padding: 2px 6px; min-height: 22px; font-size: 11px; }
.wb-ctitle { display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.wb-link { border: 0; background: none; color: var(--accent); font: inherit; font-size: 11px; text-transform: none; letter-spacing: 0; cursor: pointer; padding: 0; }
.wb-chint { color: var(--accent); font-size: 11px; }
.wb-cgrid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.wb-cs { width: 100%; aspect-ratio: 1; min-height: 22px; border: 1px solid var(--border-strong); border-radius: 4px; padding: 0; cursor: pointer; }
.wb-cs:hover { transform: scale(1.12); }
.wb-cs.on { outline: 2px solid var(--accent); outline-offset: 1px; }
.wb-sv { position: relative; height: 110px; border-radius: 4px; cursor: crosshair; border: 1px solid var(--line); }
.wb-sv-knob { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); pointer-events: none; }
.wb-crow { display: flex; align-items: center; gap: 6px; }
.wb-crow > span { width: 34px; color: var(--text-2); }
.wb-hue, .wb-alpha { flex: 1; -webkit-appearance: none; appearance: none; height: 10px; border-radius: 5px; border: 1px solid var(--line); }
.wb-hue { background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
.wb-hue::-webkit-slider-thumb, .wb-alpha::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 14px; border-radius: 3px; background: #fff; border: 1px solid #555; }
.wb-hex { width: 84px; font: inherit; font-size: 12px; font-family: var(--mono); padding: 3px 5px; border: 1px solid var(--line); border-radius: 4px; background: var(--input-bg); color: var(--text); }
.wb-cnum { width: 54px; font: inherit; font-size: 12px; padding: 3px 4px; border: 1px solid var(--line); border-radius: 4px; background: var(--input-bg); color: var(--text); }
.wb-cprev { width: 22px; height: 22px; border-radius: 4px; border: 1px solid var(--line); flex: none; }

/* ---------- dialogs ---------- */
.wb-keytable { width: 100%; border-collapse: collapse; font-size: 13px; }
.wb-keytable td { padding: 4px 8px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.wb-keytable td:first-child { white-space: nowrap; width: 1%; }
.wb-keytable kbd { font-family: var(--mono); font-size: 12px; background: var(--chip-bg); border: 1px solid var(--chip-line); border-radius: 4px; padding: 1px 6px; color: var(--chip-text); }
.wb-keys { max-height: 70vh; overflow-y: auto; }
.wb-expform .wb-seg { flex-wrap: wrap; }

@media print { .dtb, .wb-rail, .wb-left, .wb-props, .wb-pages, .wb-zoom { display: none !important; } }
.wb-props { overflow-x: hidden; }
.wb-grid2 .wb-field { min-width: 0; gap: 6px; }
.wb-grid2 .wb-num { width: 100%; min-width: 0; flex: 1; }
.wb-grid2 .wb-check { white-space: nowrap; }

/* ---------- toolbar contract (Diagram.toolbar) and inspector ---------- */
.wb-toolset { display: inline-flex; align-items: center; gap: 2px; }
.dtb .wb-tool { width: 28px; height: 28px; border-radius: var(--r-ctl); }
.dtb .wb-tool .wb-ico { width: 18px; height: 18px; }
.dtb .wb-tool.on { background: var(--sel-bg); border-color: var(--sel-edge); color: var(--text); }
.wb-rail { width: 40px; }
.wb-rail .wb-tool { width: 32px; height: 32px; }
.wb-rail .wb-tool.on { background: var(--sel-bg); border-color: var(--sel-edge); color: var(--text); }
.insp .wb-props { width: auto; border: 0; background: transparent; overflow: visible; padding: var(--sp-2) var(--sp-3) var(--sp-5); font-size: var(--fs-sm); }
.wb-presenting .dtb { display: none !important; }
:root:has(.wb-presenting) .insp, :root:has(.wb-presenting) .edtabs { display: none !important; }
