/*
 * TAG Legal Desk v2.1, J154 wave 2: the sideboard (js\v21_sideboard.js). The Director's file
 * C:\Users\smurt\Downloads\TAG_Atelier_v3_Solo.html, its lines 48 to 49 and 64 to 65, with the desk's tokens:
 * the file's --panel is the desk's --solid, --line is --sb-line, --muted is --ink-3.
 * Placement (PLAN_J154.md section 6): the tab fixed on the right edge at 44 percent, the dock at right 16px, top 96px,
 * 530px wide at most (32px less than the window), a bottom sheet under 600px. Both sit in #app-main under the header (50), the welfare
 * band (48), the job's welfare band (46), the colleagues' pointer layer (44) and every sheet (80), and over the board.
 * The drawing paper is #fafaf6 in every theme (it is shared: everyone reads the same marks); the surround around it is
 * personal (the ten data-board-skin values). Reduced motion and Calm: no transitions. Forced colours and High
 * contrast: plain edges, the ink buttons keep their colour. Never printed.
 */

.v21sb-tab {
  --sb-line: color-mix(in srgb, var(--ink) 16%, transparent);
  position: fixed; right: 0; top: 44%; z-index: 38;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  min-height: 118px; min-width: 40px; padding: 12px 8px;
  border: 1px solid var(--sb-line); border-right: 0; border-radius: 12px 0 0 12px;
  background: var(--solid); color: var(--ink); box-shadow: -6px 6px 25px rgba(0, 0, 0, .07);
  font: inherit; cursor: pointer;
  transition: transform var(--t-small, 180ms) var(--ease-out, ease), box-shadow var(--t-small, 180ms) var(--ease-out, ease);
}
.v21sb-tab:hover { transform: translateX(-2px); box-shadow: -8px 8px 28px rgba(0, 0, 0, .1); }
.v21sb-tab[hidden] { display: none; }
.v21sb-pen { color: var(--accent); display: inline-grid; place-items: center; }
.v21sb-tab-word { writing-mode: vertical-rl; font-size: .75rem; font-weight: 700; letter-spacing: .06em; }
.v21sb-dot { display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.v21sb-dot[hidden] { display: none; }

.v21sb-dock {
  --sb-line: color-mix(in srgb, var(--ink) 16%, transparent);
  position: fixed; right: 16px; top: 96px; z-index: 40;
  width: min(530px, calc(100vw - 32px)); max-height: calc(100vh - 116px); max-height: calc(100dvh - 116px); overflow: auto;
  padding: 20px; border-radius: 21px; border: 1px solid var(--sb-line);
  background: var(--solid); color: var(--ink);
  box-shadow: -15px 15px 70px rgba(0, 0, 0, .27);
  overscroll-behavior: contain;
}
.v21sb-dock[hidden] { display: none; }
.v21sb-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.v21sb-eyebrow { margin: 0 0 4px; font-size: .6875rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.v21sb-title { margin: 0; display: flex; align-items: center; gap: 10px; font-family: Georgia, "Times New Roman", serif; font-size: 1.5rem; font-weight: 400; line-height: 1.2; }
.v21sb-live { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.v21sb-dock[data-ready="no"] .v21sb-live { background: var(--ink-3); }
.v21sb-close { flex: none; }

.v21sb-toolbar { display: grid; gap: 10px; margin-bottom: 12px; }
.v21sb-tools, .v21sb-inks { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.v21sb-brush {
  flex: 1 1 120px; max-width: 200px; min-width: 110px; min-height: 36px; padding: 4px 8px;
  border: 1px solid var(--sb-line); border-radius: 10px; background: var(--solid); color: var(--ink); font: inherit; font-size: .8125rem;
}
.v21sb-tool {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--sb-line); border-radius: 10px; background: transparent; color: var(--ink); cursor: pointer;
}
.v21sb-tool:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.v21sb-tool.active, .v21sb-tool[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.v21sb-ico { display: block; }
.v21sb-ink {
  width: 26px; height: 26px; min-height: 26px; padding: 0; border-radius: 50%; cursor: pointer;
  background: var(--sb-ink, #294a39); border: 2px solid transparent;
  /* A ring in the theme's own ink, so the darkest ink still shows on a dark theme or a dark surround. */
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 35%, transparent);
}
.v21sb-ink.active, .v21sb-ink[aria-pressed="true"] { border-color: var(--solid); outline: 2px solid var(--ink); outline-offset: 1px; }
.v21sb-ink:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.v21sb-width { width: 110px; margin-left: auto; accent-color: var(--accent); }

.v21sb-wrap {
  position: relative; width: 100%; aspect-ratio: 10 / 7; overflow: hidden;
  border-radius: 11px; border: 1px solid rgba(0, 0, 0, .1); background: #fafaf6;
}
.v21sb-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; background: #fafaf6; }
.v21sb-canvas[aria-disabled="true"] { cursor: not-allowed; }
.v21sb-canvas:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }

.v21sb-status { display: flex; justify-content: space-between; gap: 12px; margin: 10px 0 12px; font-size: .75rem; color: var(--ink-3); }
.v21sb-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.v21sb-act { flex: 1 1 96px; gap: 6px; }
.v21sb-act[hidden] { display: none; }
.v21sb-danger { color: var(--danger); }
.v21sb-note { margin: 12px 0 0; font-size: .75rem; color: var(--ink-3); }
.v21sb-insert-row, .v21sb-confirm-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

/* The ten surrounds (the file's line 49), with the desk's tokens. The paper inside stays #fafaf6. */
.v21sb-dock[data-board-skin="dot-grid"] { background: radial-gradient(var(--sb-line) 1px, transparent 1px) 0 0 / 12px 12px, var(--solid); }
.v21sb-dock[data-board-skin="blueprint"] { background: repeating-linear-gradient(90deg, transparent 0 19px, rgba(136, 166, 197, .08) 19px 20px), repeating-linear-gradient(0deg, transparent 0 19px, rgba(136, 166, 197, .08) 19px 20px), #1b2e41; }
.v21sb-dock[data-board-skin="dark-slate"] { background: linear-gradient(120deg, rgba(255, 255, 255, .024), rgba(0, 0, 0, .03)), #23282c; }
.v21sb-dock[data-board-skin="sage-board"] { background: color-mix(in srgb, #8faa87 18%, var(--solid)); }
.v21sb-dock[data-board-skin="warm-paper"] { background: color-mix(in srgb, #b59b71 14%, var(--solid)); border-radius: 7px; }
.v21sb-dock[data-board-skin="isometric"] { background: repeating-linear-gradient(30deg, transparent 0 19px, var(--sb-line) 19px 20px), repeating-linear-gradient(150deg, transparent 0 19px, var(--sb-line) 19px 20px), var(--solid); }
.v21sb-dock[data-board-skin="fine-rules"] { background: repeating-linear-gradient(0deg, transparent 0 21px, var(--sb-line) 21px 22px), var(--solid); }
.v21sb-dock[data-board-skin="glass-board"] { background: color-mix(in srgb, var(--solid) 92%, transparent); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.v21sb-dock[data-board-skin="graph-paper"] { background: linear-gradient(var(--sb-line) 1px, transparent 1px) 0 0 / 15px 15px, linear-gradient(90deg, var(--sb-line) 1px, transparent 1px) 0 0 / 15px 15px, var(--solid); }

/* The dark surrounds keep readable controls in every personal theme (the file's line 65). */
.v21sb-dock[data-board-skin="blueprint"], .v21sb-dock[data-board-skin="dark-slate"] {
  --ink: #edf3f7; --ink-2: #d6e1e8; --ink-3: #b3c2ce; --solid: #273947; --accent: #c1dfb7; --sb-line: rgba(201, 219, 234, .18);
  --glass-1: rgba(212, 233, 250, .08); --glass-2: rgba(212, 233, 250, .14); --glass-edge: rgba(201, 219, 234, .22); --glass-rim: rgba(0, 0, 0, .3); --glass-hi: rgba(255, 255, 255, .06);
  --brand-text: #c1dfb7; --danger: #ffb4ab; --focus: #8ab4f8;
  color: var(--ink);
}

/* Reduced motion (the computer's or the desk's own setting) and Calm: nothing moves. */
@media (prefers-reduced-motion: reduce) { .v21sb-tab, .v21sb-tab:hover { transition: none; transform: none; } }
:root[data-motion="reduced"] .v21sb-tab, :root[data-motion="reduced"] .v21sb-tab:hover,
:root[data-calm="on"] .v21sb-tab, :root[data-calm="on"] .v21sb-tab:hover { transition: none; transform: none; }

/* High contrast: plain, solid edges (the surround's pattern goes; the paper stays). */
:root[data-theme="high_contrast"] .v21sb-tab, :root[data-theme="high_contrast"] .v21sb-dock { --sb-line: #000000; box-shadow: none; border-width: 2px; }
:root[data-theme="high_contrast"] .v21sb-dock[data-board-skin] { background: var(--solid); --ink: #000000; --ink-3: #1b1b1b; --solid: #ffffff; --accent: #0b2a10; }
:root[data-theme="high_contrast"] .v21sb-wrap { border: 2px solid #000000; }
:root[data-theme="high_contrast"] .v21sb-ink { box-shadow: inset 0 0 0 2px #000000; }

/* Forced colours: the system's own colours for the frame, the ink buttons keep their ink so they can be told apart. */
@media (forced-colors: active) {
  .v21sb-tab, .v21sb-dock, .v21sb-tool, .v21sb-brush, .v21sb-wrap { border: 1px solid CanvasText; forced-color-adjust: auto; }
  .v21sb-dock[data-board-skin] { background: Canvas; }
  .v21sb-tool.active, .v21sb-tool[aria-pressed="true"] { border: 2px solid Highlight; }
  .v21sb-ink { forced-color-adjust: none; border: 2px solid CanvasText; }
  .v21sb-ink[aria-pressed="true"] { outline: 3px solid Highlight; }
  .v21sb-dot, .v21sb-live { forced-color-adjust: none; background: Highlight; }
  .v21sb-wrap, .v21sb-canvas { forced-color-adjust: none; }
}

/* A phone width: the dock is a bottom sheet over the board. */
@media (max-width: 600px) {
  .v21sb-dock { left: 0; right: 0; top: auto; bottom: 0; width: 100%; max-height: 88vh; max-height: 88dvh; border-radius: 21px 21px 0 0; padding: 16px; }
  .v21sb-width { width: 96px; }
  .v21sb-act { flex-basis: 40%; }
}

/* The quiet states, Calm, a day that matters and a welfare message hide it (the page closes it too). */
:root[data-quiet="on"] .v21sb-tab, :root[data-quiet="on"] .v21sb-dock,
:root[data-v21-welfare="on"] .v21sb-tab, :root[data-v21-welfare="on"] .v21sb-dock,
:root[data-calm="on"] .v21sb-tab, :root[data-calm="on"] .v21sb-dock,
:root[data-day-matters] .v21sb-tab, :root[data-day-matters] .v21sb-dock { display: none !important; }

@media print { .v21sb-tab, .v21sb-dock { display: none !important; } }
