/* =========================================================================
   TABLEAU BLANC (src/whiteboard.js) + the Calendrier | Tableau blanc tabs
   ========================================================================= */

/* --- Tabs (calendar header and whiteboard header) ------------------------ */
.tab-switch { display: inline-flex; background: #e2e8f0; border-radius: 10px; padding: 3px; gap: 2px; flex: none; }
.vtab {
  border: 0; background: transparent; border-radius: 8px; padding: 7px 12px;
  font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1.2; flex-shrink: 0; color: #475569; cursor: pointer; white-space: nowrap;
}
.vtab { padding: 5px 12px; }
.vtab .tab-ic { font-size: 22px; line-height: 1; display: block; }
.vtab .tab-lb { display: none; }            /* icons only (the name is in the tooltip) */
.vtab.active { background: #1e3a8a; color: #fff; }
.header-left { display: flex; align-items: center; gap: 10px; }
@media (max-width: 700px) {
  .vtab { padding: 5px 9px; }
}

/* --- The whiteboard layer: covers the calendar while its tab is open ------ */
.wb {
  position: fixed; inset: 0; top: env(safe-area-inset-top, 0px); z-index: 8000;
  display: flex; flex-direction: column; background: #f1f5f9; color: #0f172a;
  font-family: inherit;
}
.wb[hidden] { display: none; }
html[data-tab="whiteboard"] #todayFab,
html[data-tab="whiteboard"] .year-scrubber,
html[data-tab="whiteboard"] .sync-badge { display: none !important; }

.wb-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; background: #f8fafc; border-bottom: 1px solid #e2e8f0;
}
/* the tools flow on right after the tabs, wrapping onto more lines when needed */
.wb-bar-in, .wb-tools { display: contents; }
.wb-bar-in > .tab-switch { margin-right: 10px; }   /* small space before the tools */
.wb-group { display: contents; }
.wb[data-tool="text"] .wb-pen-tools, .wb[data-tool="note"] .wb-pen-tools,
.wb:not([data-tool="text"]):not([data-tool="note"]) .wb-text-tools,
.wb:not([data-tool="note"]) .wb-note-tools,
/* writing (text, post-it): the whole-board tools (photo, save, archive) step aside */
.wb[data-tool="text"] .wb-board-tools, .wb[data-tool="note"] .wb-board-tools { display: none; }
.wb-btn {
  border: 1px solid #cbd5e1; background: #fff; border-radius: 8px; padding: 7px 11px;
  font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1.2; flex-shrink: 0; color: #334155; cursor: pointer; white-space: nowrap;
  touch-action: manipulation;
}
.wb-btn.on { background: #0f172a; color: #fff; border-color: #0f172a; }
.wb-sep { width: 1px; height: 26px; background: #cbd5e1; margin: 0 2px; }
/* Categories: related buttons in one rounded group */
.wb-cat { display: inline-flex; align-items: center; gap: 2px; padding: 3px; background: #e2e8f0; border-radius: 11px; flex: none; }
.wb-cat .wb-btn { border-color: transparent; background: transparent; }
.wb-cat .wb-btn:hover:not(:disabled):not(.on) { background: #fff; }
.wb-cat .wb-btn.on { background: #0f172a; color: #fff; }
.wb-cat .wb-dot { margin: 0 2px; }
.wb-btn:disabled { opacity: .35; cursor: default; }
.wb-size { min-width: 26px; text-align: center; font-weight: 700; font-size: 14px; color: #334155; }
.wb-dot {
  width: 30px; height: 30px; border-radius: 50%; padding: 0; cursor: pointer;
  border: 2px solid #fff; box-shadow: 0 0 0 1px #cbd5e1;
}
.wb-dot.on { box-shadow: 0 0 0 3px #0f172a; }
.wb-sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-left: 4px; border: 1px solid #94a3b8; }
.wb-pop-wrap { position: relative; display: inline-flex; }
.wb-pop {
  display: none; position: fixed; top: 0; left: 0; z-index: 9600;   /* placed under its button (whiteboard.js) */
  gap: 8px; padding: 8px; background: #fff; border: 1px solid #cbd5e1; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .15); white-space: nowrap; align-items: center;
}
.wb-pop.open { display: flex; }
/* text and pen colours: a grid of 7 per row */
.wb-pop[data-pop="color"].open, .wb-pop[data-pop="ink"].open,
.wb-pop[data-pop="hilite"].open { display: grid; grid-template-columns: repeat(7, auto); }
.wb-pop[data-pop="hilite"] [data-hilite="transparent"] { grid-column: 1 / -1; }   /* « Aucun » under the colours */

/* --- Today / next working day ---------------------------------------------- */
.wb-status {
  display: flex; gap: 8px 20px; flex-wrap: wrap; padding: 7px 12px;
  background: #fff; border-bottom: 1px solid #e2e8f0; max-height: 28vh; overflow: auto;
}
.wb-day { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; min-width: 0; }
.wb-day h4 { margin: 0 4px 0 0; font-size: 13px; color: #1e3a8a; white-space: nowrap; text-transform: capitalize; }
.wb-chip {
  font-size: 12.5px; font-weight: 600; padding: 3px 8px; border-radius: 6px; white-space: nowrap;
  max-width: 340px; overflow: hidden; text-overflow: ellipsis;
}
.wb-chip.plain { background: #fff; color: #334155; border: 1px solid #cbd5e1; }
.wb-chip i { font-style: normal; font-weight: 400; opacity: .8; margin-right: 5px; }
.wb-none { font-size: 12.5px; color: #94a3b8; }

/* --- The page ---------------------------------------------------------------- */
.wb-scroll { flex: 1; overflow: auto; position: relative; scrollbar-gutter: stable; overscroll-behavior: contain; }
.wb-sizer { position: relative; margin: 0 auto; }
.wb-page {
  position: absolute; top: 0; left: 0; width: 1200px; transform-origin: 0 0;
  background: #fff repeating-linear-gradient(#fff 0 35px, #e0e7ff 35px 36px);
}
.wb-page::before { content: ""; position: absolute; left: 54px; top: 0; bottom: 0; width: 2px; background: #fecaca; }
.wb-text {
  position: relative; min-height: 360px; padding: 4px 40px 0 70px; outline: none;
  font-size: 22px; line-height: 36px; color: #111827; caret-color: #2563eb;
  overflow-wrap: break-word; white-space: pre-wrap;
}
.wb-text [style*="font-size"] { line-height: 1.3; }
.wb-text ul, .wb-text ol { margin: 0; padding-left: 30px; }
.wb-text ul ul { list-style: circle; }
.wb-text ul ul ul { list-style: square; }
.wb-text ol ol, .wb-note-text ol ol { list-style: lower-alpha; }
.wb-text ol ol ol, .wb-note-text ol ol ol { list-style: lower-roman; }
.wb-text blockquote { margin: 0 0 0 40px; }
.wb-text p { margin: 0; }
.wb-text:empty::before { content: "Écrire ici…"; color: #94a3b8; }
.wb-svg { display: block; }
/* Columns side by side (▥): each one its own lines and lists */
/* idle show: text written character by character */
.wb-tw { visibility: hidden; }   /* hides underlines too, keeps the room */
/* idle show: a list's bullet or number, standing in for the real one while it
   bounces or slides in (whiteboard.js popBullet): it sits where the marker goes */
.wb-li-anim { list-style-type: none !important; }
/* checklists: a box on each line; ticked: a black ✓ and the line struck through
   (it stays on the board: what's done stays seen) */
.wb-text ul.wb-check, .wb-note-text ul.wb-check { list-style: none; padding-left: 34px; }
ul.wb-check > li::before {
  content: ''; display: inline-block; box-sizing: border-box; width: 1em; height: 1em; margin-left: -1.5em; margin-right: .5em;
  vertical-align: -.14em; border: .12em solid #111827; border-radius: .2em; background: #fff;
  font-size: 1em; line-height: .8em; text-align: center; font-weight: 900; color: #111827; text-decoration: none;
}
ul.wb-check > li.wb-done::before { content: '✓'; }
ul.wb-check > li.wb-done { text-decoration: line-through; text-decoration-thickness: .1em; }
ul.wb-check > li.wb-done.wb-striking { text-decoration: none; }
html[data-theme="dark"] ul.wb-check > li::before { border-color: #e2e8f0; background: transparent; color: #e2e8f0; }
.wb-strike {
  background: linear-gradient(currentColor, currentColor) no-repeat 0 56% / 100% .1em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.wb-li-mark { display: inline-block; width: 0; direction: rtl; white-space: nowrap; }
.wb-li-mark > span { display: inline-block; direction: ltr; unicode-bidi: isolate; padding-right: .45em; transform-origin: 40% 60%; }
/* the cursor takes no room and is no place to break the line: a word being
   written stays where it will end up (no jump to the next line halfway) */
.wb-tw-caret { position: relative; }
.wb-tw-caret::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: #2563eb; animation: wb-blink .7s steps(1) infinite;
}
@keyframes wb-blink { 50% { opacity: 0; } }
/* idle show: the line the camera is on gets a marker sweep */
.wb-text .wb-spot {
  border-radius: 6px; background: linear-gradient(rgba(253, 224, 71, .5), rgba(253, 224, 71, .5)) no-repeat;
  animation: wb-spot .7s ease-out both;
}
@keyframes wb-spot { from { background-size: 0% 100%; } to { background-size: 100% 100%; } }
/* dark: the page is shown inverted, so this comes out amber */
html[data-theme="dark"] .wb-text .wb-spot { background-image: linear-gradient(rgba(150, 105, 0, .75), rgba(150, 105, 0, .75)); }
/* each column framed (drawn inside its box, so the text stays on the ruled lines) */
.wb-text .wb-cols { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); column-gap: 14px; }
.wb-text .wb-col { min-width: 0; min-height: 36px; padding: 0 12px; border-radius: 8px; box-shadow: inset 0 0 0 2px #a5b4fc; }
.wb-ink {
  position: absolute; inset: 0; width: 100%; overflow: visible; pointer-events: none;
  fill: none; stroke-linecap: round; stroke-linejoin: round;
}
.wb:not([data-tool="text"]):not([data-tool="note"]) .wb-ink { pointer-events: auto; touch-action: none; cursor: crosshair; }
.wb[data-tool="eraser"] .wb-ink { cursor: cell; }

/* Photos: above the text, under the ink (moved with the Sélection tool) */
.wb-photos { position: absolute; inset: 0; pointer-events: none; }
/* Links */
.wb-text a, .wb-note-text a { color: #2563eb; text-decoration: underline; text-underline-offset: 3px; }
.wb-link-pop { gap: 6px; }
.wb-link-in { width: 260px; font: inherit; font-size: 14px; padding: 6px 9px; border: 1px solid #cbd5e1; border-radius: 8px; outline: none; }
.wb-link-in:focus { border-color: #2563eb; }
@media (pointer: coarse) { .wb-link-in { font-size: 16px; } }   /* iPhone zooms into smaller boxes */
/* holding a button (🗑) must not select text or open the iPhone's bubble */
.wb-bar button { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.wb-link-chip {
  position: fixed; z-index: 20; border: 0; border-radius: 8px; padding: 6px 10px; cursor: pointer;
  background: #1e3a8a; color: #fff; font: 600 13px/1.2 inherit; font-family: inherit; box-shadow: 0 4px 12px rgba(15, 23, 42, .25);
  max-width: 80vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wb-link-chip[hidden] { display: none; }
html[data-theme="dark"] .wb-link-in { background: #0f172a; color: #e2e8f0; border-color: #334155; }
/* Post-its (above photos, under the ink) */
.wb-notes { position: absolute; inset: 0; pointer-events: none; }
.wb-note {
  position: absolute; pointer-events: auto; box-sizing: border-box; border-radius: 3px;
  /* the shadow follows the paper's shape (its lifted corner too) */
  filter: drop-shadow(0 3px 5px rgba(15, 23, 42, .38));
}
/* The paper (its colour: --c), with its bottom-right corner curled up: the
   page shows where it lifted, with the curl's shadow on it; the flap is the
   paper's underside, plainly shaded from the fold to its tip; the post-it's
   shadow follows that shape. */
.wb-note::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: var(--c, #fef08a);
  --corner: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M0 0H40V12Q27 27 12 40H0Z'/%3E%3C/svg%3E");
  -webkit-mask: linear-gradient(#000 0 0) 0 0 / calc(100% - 44px) 100% no-repeat,
                linear-gradient(#000 0 0) 0 0 / 100% calc(100% - 44px) no-repeat,
                var(--corner) 100% 100% / 46px 46px no-repeat;
          mask: linear-gradient(#000 0 0) 0 0 / calc(100% - 44px) 100% no-repeat,
                linear-gradient(#000 0 0) 0 0 / 100% calc(100% - 44px) no-repeat,
                var(--corner) 100% 100% / 46px 46px no-repeat;
}
.wb-note::after {
  content: ""; position: absolute; right: 0; bottom: 0; width: 46px; height: 46px; pointer-events: none;
  --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M40 12Q24 17 9 15Q19 26 12 40L40 40Z'/%3E%3C/svg%3E");
  -webkit-mask: var(--m) 0 0 / 100% 100% no-repeat; mask: var(--m) 0 0 / 100% 100% no-repeat;
  /* along the diagonal from the corner: the page (the post-it's one drop
     shadow, which follows the flap, is the only shadow there), then from the
     crease (34.5%) the flap, plainly shaded */
  background: linear-gradient(315deg,
              transparent 34.5%,
              color-mix(in srgb, var(--c, #fef08a) 83%, #000) 34.5%,
              color-mix(in srgb, var(--c, #fef08a) 90%, #fff) 70%);
}
/* the roll of a post-it unrolling in the idle show (whiteboard.js unroll):
   shaded across its thickness so it reads as a cylinder */
.wb-roll {
  position: absolute; left: 0; top: 0; border-radius: 10px; pointer-events: none; transform-origin: 50% 50%;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--c) 62%, #000) 0%, var(--c) 30%, color-mix(in srgb, var(--c) 55%, #fff) 50%,
    var(--c) 68%, color-mix(in srgb, var(--c) 55%, #000) 100%);
  box-shadow: 0 3px 6px rgba(15, 23, 42, .3);
}
/* a photo's pixel reveal (whiteboard.js revealPhoto) */
.wb-pix { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 4px; }
.wb-note-text {
  min-height: inherit; box-sizing: border-box; padding: 12px 16px calc(12px + 1.35em); outline: none;   /* one empty line under the text */
  font-size: 22px; line-height: 1.35; color: #111827; overflow-wrap: break-word; white-space: pre-wrap; caret-color: #2563eb;
}
.wb-note-text:empty::before { content: "Écrire…"; color: rgba(17, 24, 39, .4); }
.wb-note-text ul, .wb-note-text ol { margin: 0; padding-left: 26px; }
.wb-note-text p { margin: 0; }
.wb[data-tool="note"] .wb-page { cursor: copy; }
.wb[data-tool="note"] .wb-note, .wb[data-tool="text"] .wb-note { cursor: text; }
.wb-note-dot { border-radius: 4px; }
html[data-screensaver="1"] .wb-note-text:empty::before { content: ""; }
.wb-photo { position: absolute; border-radius: 4px; box-shadow: 0 2px 8px rgba(15, 23, 42, .25); background: #f1f5f9; }
.wb-photo img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 4px; user-select: none; }
html[data-screensaver="1"] .wb-photo { box-shadow: none; }
/* 🖼️ opens a small menu: take a photo (📷) or choose an image. On a computer
   (mouse) it goes straight to the file window instead (whiteboard.js). */
.wb-pop.wb-menu { flex-direction: column; align-items: stretch; gap: 4px; padding: 6px; }
.wb-pop.wb-menu .wb-btn { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: auto; padding: 8px 14px 8px 10px; }
.wb-menu-lb { font-size: 15px; font-weight: 600; }

/* Sélection cursors: empty spot = drag a box, on a thing or inside the
   frame = move it, while dragging = held; the ⤡ and ✕ handles have their own */
.wb[data-tool="select"] .wb-ink { cursor: crosshair; }
.wb[data-tool="select"] .wb-ink[data-hover="move"] { cursor: move; }
.wb[data-selop="move"], .wb[data-selop="move"] * { cursor: grabbing !important; }
.wb[data-selop="size"], .wb[data-selop="size"] * { cursor: nwse-resize !important; }
.wb[data-selop="lasso"], .wb[data-selop="lasso"] * { cursor: crosshair !important; }

/* Selection frame (Sélection tool) */
.wb-sel {
  --hs: 36px;
  position: absolute; pointer-events: none; border: 2px dashed #2563eb; border-radius: 6px;
  background: rgba(37, 99, 235, .06); box-sizing: border-box;
}
/* the box being dragged, like CAD: → solid blue takes what is inside,
   ← dashed green also takes what it touches */
.wb-sel.lasso { background: rgba(37, 99, 235, .1); border-style: solid; }
.wb-sel.lasso.cross { background: rgba(22, 163, 74, .1); border: 2px dashed #16a34a; }
.wb-sel.lasso > span { display: none; }
.wb-sel-del, .wb-sel-size {
  position: absolute; pointer-events: auto; touch-action: none;
  width: var(--hs); height: var(--hs); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: calc(var(--hs) * .5); box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.wb-sel-del { top: calc(var(--hs) / -2); right: calc(var(--hs) / -2); background: #dc2626; cursor: pointer; }
.wb-sel-size { bottom: calc(var(--hs) / -2); right: calc(var(--hs) / -2); background: #2563eb; cursor: nwse-resize; }
.wb-sel-size::after { content: "⤡"; }
/* the dark page is inverted: put photos back to their real colours */
html[data-theme="dark"] .wb-photo img { filter: invert(1) hue-rotate(180deg); }
/* (its shadow comes after its own inversion, then the dark page inverts it: drawn light, shown dark) */
html[data-theme="dark"] .wb-note { filter: invert(1) hue-rotate(180deg) drop-shadow(0 3px 5px rgba(255, 255, 255, .38)); }   /* real colours on the dark page */

.wb-sync {
  position: absolute; right: 18px; bottom: 12px; font-size: 12px; color: #64748b;
  background: rgba(255, 255, 255, .92); padding: 3px 9px; border-radius: 6px; pointer-events: none;
}
.wb-sync:empty { display: none; }
.wb-sync[data-state="offline"] { color: #b45309; background: #fffbeb; }

/* Icons only, on every screen (the name shows on hover) */
.wb-tools .wb-btn { display: inline-flex; align-items: center; justify-content: center; height: 40px; min-width: 42px; padding-top: 0; padding-bottom: 0; font-size: 18px; }
/* icons fill their buttons */
.wb-tools .wb-btn .ic { font-size: 22px; line-height: 1; }
.wb-tools .wb-btn[data-act="undo"] .ic, .wb-tools .wb-btn[data-act="redo"] .ic { font-size: 26px; font-weight: 700; }
.wb-tools .wb-svg { width: 24px; height: 24px; }
.wb-tools .wb-size { font-size: 18px; }
.wb-tools .wb-btn[data-act="indent"], .wb-tools .wb-btn[data-act="outdent"] { font-size: 24px; }
html[data-screensaver="1"] .wb-btn[data-act="save"] { display: none; }
.wb-tools .wb-btn[data-act="zoom-in"] .ic, .wb-tools .wb-btn[data-act="zoom-out"] .ic { font-size: 28px; font-weight: 600; }
.wb-zoom-pc { font-size: 12px; font-weight: 700; margin-left: 3px; }
.wb-zoom-pc:empty { display: none; }
.wb-btn .lb { display: none; }
.wb-btn[data-act="text"] .ic { font-weight: 800; font-family: Georgia, serif; }
/* Couleur / Surligner: the icon with the colour picked as a bar under it */
.wb-ic-pick { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; line-height: 1; vertical-align: middle; }
.wb-ic-a { font: 800 21px/1 Georgia, serif; }
.wb-pick-sw { display: block; width: 24px; height: 5px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(15, 23, 42, .15); }
.wb-pick-sw.none { background: repeating-linear-gradient(45deg, #94a3b8 0 2px, transparent 2px 5px) !important; }

/* Phone: icon tools, one swipeable line of today's cells */
@media (max-width: 700px) {
  .wb-btn .wb-sw { margin-left: 0; }
  .wb-status:not(.ticker) { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  .wb-status:not(.ticker) .wb-day { flex-wrap: nowrap; flex: none; }
  .wb-status:not(.ticker) .wb-chip, .wb-status:not(.ticker) .wb-day h4 { flex-shrink: 0; }
  .wb-bar { padding: 6px 8px; gap: 6px; }
  /* two rows at most, the rest a swipe away (whiteboard.js fitRows sets the width) */
  .wb-bar { display: block; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; overscroll-behavior-x: contain; }
  .wb-bar::-webkit-scrollbar { display: none; }
  .wb-bar-in { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
  .wb-btn { padding: 6px 8px; font-size: 13px; }
  .wb-tools .wb-btn { height: 36px; min-width: 36px; font-size: 16px; }
  .wb-tools .wb-btn .ic { font-size: 19px; }
  .wb-tools .wb-svg { width: 21px; height: 21px; }
  .wb-dot { width: 24px; height: 24px; }
  .wb-sep { display: none; }
  .wb-status { padding: 5px 8px; }
}

/* --- Dark (screensaver, ?theme=dark) ------------------------------------------
   The page is shown inverted, hue kept: black ink and text turn white, colours
   and highlights turn to lighter / deeper versions of themselves. */
html[data-theme="dark"] .wb { background: #0b1120; color: #e2e8f0; }
html[data-theme="dark"] .wb-bar { background: #0b1120; border-color: #1e293b; }
html[data-theme="dark"] .wb-btn { background: #1e293b; border-color: #334155; color: #e2e8f0; }
html[data-theme="dark"] .wb-cat { background: #1e293b; }
html[data-theme="dark"] .wb-cat .wb-btn { background: transparent; border-color: transparent; }
html[data-theme="dark"] .wb-cat .wb-btn:hover:not(:disabled):not(.on) { background: #334155; }
html[data-theme="dark"] .wb-cat .wb-btn.on { background: #e2e8f0; color: #0f172a; }
html[data-theme="dark"] .wb-btn.on { background: #e2e8f0; color: #0f172a; border-color: #e2e8f0; }
html[data-theme="dark"] .wb-dot { border-color: #0b1120; box-shadow: 0 0 0 1px #334155; }
html[data-theme="dark"] .wb-dot.on { box-shadow: 0 0 0 3px #e2e8f0; }
html[data-theme="dark"] .wb-sep { background: #334155; }
html[data-theme="dark"] .wb-size { color: #e2e8f0; }
html[data-theme="dark"] .wb-pop { background: #131c31; border-color: #334155; }
html[data-theme="dark"] .tab-switch { background: #1e293b; }
html[data-theme="dark"] .vtab { color: #94a3b8; }
html[data-theme="dark"] .vtab.active { background: #e2e8f0; color: #0f172a; }
html[data-theme="dark"] .wb-status { background: #0f172a; border-color: #1e293b; }
html[data-theme="dark"] .wb-day h4 { color: #93c5fd; }
html[data-theme="dark"] .wb-chip.plain { background: #131c31; color: #cbd5e1; border-color: #334155; }
html[data-theme="dark"] .wb-page { filter: invert(1) hue-rotate(180deg); }
/* (inverted: these light blues are shown as a dark navy page with lighter lines) */
html[data-theme="dark"] .wb-page { background: #c4d9ff repeating-linear-gradient(#c4d9ff 0 35px, #a9c5ff 35px 36px); }
html[data-theme="dark"] .wb-sync { background: rgba(15, 23, 42, .9); color: #94a3b8; }

/* Screensaver: look only — the tools hand over to the full app on the NUC. */
html[data-screensaver="1"] .wb { cursor: default; }
html[data-screensaver="1"] .wb-text:empty::before { content: ""; }
html[data-screensaver="1"] .wb-scroll { scrollbar-width: none; }
html[data-screensaver="1"] .wb-scroll::-webkit-scrollbar { display: none; }
html[data-screensaver="1"] .wb-sync { display: none; }

/* --- Idle show (whiteboard.js startShow): tools slide away, ticker, camera --- */
.wb-bar { transition: margin-top .7s ease, opacity .5s ease; }
.wb.wb-idle .wb-bar { margin-top: calc(-1 * var(--barh, 60px)); opacity: 0; pointer-events: none; }
.wb.wb-idle .wb-scroll { overflow: hidden; }
.wb.wb-idle .wb-sizer { transform-origin: 0 0; will-change: transform; }
.wb.wb-idle .wb-sync, .wb.wb-idle .wb-sel { display: none; }
.wb-status.ticker { flex-wrap: nowrap; overflow: hidden; max-height: none; padding: 9px 0; }
.wb-track { display: flex; width: max-content; animation: wb-tick 30s linear infinite; }
.wb-run { display: flex; gap: 8px 36px; padding-right: 36px; flex: none; }
.wb-run .wb-day { flex-wrap: nowrap; }
.wb-status.ticker .wb-chip { font-size: clamp(15px, 1.7vh, 24px); padding: .3em .7em; max-width: none; }
.wb-status.ticker .wb-day h4 { font-size: clamp(15px, 1.7vh, 24px); }
@keyframes wb-tick { from { transform: translateX(0); } to { transform: translateX(-50%); } }
/* the shop's weather, scrolling in the ticker after the day's jobs (whiteboard/weather.js) */
.wb-weather {
  display: flex; align-items: center; gap: .8em; flex: none; white-space: nowrap;
  font-size: clamp(15px, 1.7vh, 24px); font-weight: 600; color: #0f172a;
  padding: .15em .8em; border-radius: 8px; background: #eff6ff;
}
.wb-weather[hidden] { display: none; }
.wb-wx-now { font-size: 1.3em; font-weight: 700; }
.wb-wx-day, .wb-wx-rain { color: #334155; }
.wb-weather.wb-wx-warn { background: #ffedd5; }
.wb-weather.wb-wx-warn .wb-wx-day { color: #c2410c; }
html[data-theme="dark"] .wb-weather { color: #e2e8f0; background: #1e293b; }
html[data-theme="dark"] .wb-wx-day, html[data-theme="dark"] .wb-wx-rain { color: #cbd5e1; }
html[data-theme="dark"] .wb-weather.wb-wx-warn { background: #431407; }
html[data-theme="dark"] .wb-weather.wb-wx-warn .wb-wx-day { color: #fdba74; }
@media (prefers-reduced-motion: reduce) { .wb-track { animation: none; } }

/* Empty board during the show: today's and the next day's cells, big */
.wb-today {
  position: absolute; left: 0; right: 0; bottom: 0; top: 0; margin-top: 58px; z-index: 5;
  display: flex; flex-direction: column; justify-content: center; gap: 5vh; padding: 4vh 6vw;
  background: inherit; pointer-events: none;
}
.wb-today[hidden] { display: none; }
.wb-today .wb-day { display: flex; flex-wrap: wrap; gap: 1.6vh; align-items: center; }
.wb-today .wb-day h4 { width: 100%; font-size: clamp(22px, 3.4vh, 44px); margin: 0 0 .6vh; color: #1e3a8a; }
.wb-today .wb-chip { font-size: clamp(18px, 2.6vh, 34px); padding: .6em 1em; border-radius: 12px; max-width: none; white-space: normal; }
.wb-today .wb-none { font-size: clamp(18px, 2.6vh, 34px); }
.wb-today .wb-day { animation: wb-float 6s ease-in-out infinite alternate; }
.wb-today .wb-day + .wb-day { animation-delay: -3s; }
@keyframes wb-float { from { transform: translateY(-1.2vh); } to { transform: translateY(1.2vh); } }
html[data-theme="dark"] .wb-today .wb-day h4 { color: #93c5fd; }

/* Screensaver: the tabs float in a corner (its toolbar is hidden) */
.ss-tabs { display: none; }
html[data-screensaver="1"][data-tab="calendar"] .ss-tabs {
  display: block; position: fixed; right: 14px; bottom: 14px; z-index: 9500; opacity: .85;
}
html[data-screensaver="1"] .ss-tabs .tab-switch { box-shadow: 0 4px 14px rgba(0, 0, 0, .45); }
html[data-screensaver="1"] .ss-tabs .vtab { padding: 9px 16px; }
html[data-screensaver="1"] .ss-tabs .vtab .tab-ic { font-size: 28px; }

/* --- 🗑 Archive (whiteboard.js clearAll / openArchives) ------------------------ */
.wb-tools .wb-btn[data-act="clear"].holding { animation: wb-hold .6s linear forwards; }
@keyframes wb-hold { from { box-shadow: inset 0 0 0 0 rgba(220, 38, 38, .35); } to { box-shadow: inset 0 0 0 22px rgba(220, 38, 38, .35); } }
.wb-flash {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 9700;
  background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 15px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .3); pointer-events: none; max-width: calc(100vw - 32px);
}
.wb-flash[hidden] { display: none; }
.wb-modal { position: fixed; inset: 0; z-index: 9800; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.wb-modal[hidden] { display: none; }
.wb-modal-box {
  background: #fff; border-radius: 14px; width: min(560px, 100%); max-height: min(80vh, 720px);
  display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(15, 23, 42, .35); overflow: hidden;
}
.wb-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 18px; border-bottom: 1px solid #e2e8f0; font-size: 18px; color: #0f172a; }
.wb-modal-x { border-color: transparent; background: transparent; font-size: 20px; }
.wb-modal-list { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.wb-modal-note { margin: 18px 12px; color: #64748b; font-size: 15px; }
.wb-arch {
  display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 2px 14px; align-items: center; text-align: left; width: 100%;
  padding: 8px; border: 1px solid #e2e8f0; border-radius: 10px; background: #f8fafc; cursor: pointer; font-family: inherit;
}
.wb-arch:hover { background: #eef2ff; border-color: #c7d2fe; }
.wb-arch.busy { opacity: .5; pointer-events: none; }
/* the board's picture (white page, kept whole in its frame) */
.wb-arch-pic {
  grid-area: 1 / 1 / 3 / 2; width: 128px; height: 96px; border-radius: 6px; background: #fff;
  border: 1px solid #e2e8f0; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.wb-arch-pic img { max-width: 100%; max-height: 100%; display: block; }
.wb-arch-when { grid-area: 1 / 2; align-self: end; font-size: 13px; color: #475569; font-weight: 600; }
.wb-arch-title { grid-area: 2 / 2; align-self: start; min-width: 0; font-size: 15px; color: #0f172a; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
html[data-theme="dark"] .wb-modal-box { background: #131c31; }
html[data-theme="dark"] .wb-modal-head { color: #e2e8f0; border-color: #334155; }
html[data-theme="dark"] .wb-arch { background: #0b1120; border-color: #334155; }
html[data-theme="dark"] .wb-arch-title { color: #e2e8f0; }
html[data-theme="dark"] .wb-arch-when { color: #94a3b8; }
html[data-theme="dark"] .wb-arch-pic { border-color: #334155; }

/* iPhone: "Image prête" (whiteboard.js shareReady) */
.wb-share-box { width: min(340px, 100%); }
.wb-share-go {
  margin: 16px; padding: 14px; border: 0; border-radius: 10px; background: #1e3a8a; color: #fff;
  font: inherit; font-size: 17px; font-weight: 600; cursor: pointer;
}

/* 📋 Coller: right-click, or touch and hold with the arrow tool, on the page (whiteboard.js showPasteChip) */
.wb-paste-chip {
  position: fixed; z-index: 9650; padding: 10px 16px; border: 0; border-radius: 22px;
  background: #0f172a; color: #fff; font: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .35); -webkit-touch-callout: none; user-select: none;
}
.wb-paste-chip[hidden] { display: none; }
/* phones, when the browser keeps the clipboard: a box for the phone's own « Coller » */
.wb-paste-box {
  position: fixed; z-index: 9650; left: 50%; top: 30%; transform: translateX(-50%); width: min(340px, calc(100vw - 24px));
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; padding: 14px;
  background: #fff; border: 1px solid #cbd5e1; border-radius: 14px; box-shadow: 0 12px 32px rgba(15, 23, 42, .3);
}
.wb-paste-box[hidden] { display: none; }
.wb-paste-tip { font-size: 16px; font-weight: 600; color: #0f172a; line-height: 1.35; }
.wb-paste-in {
  grid-column: 1 / -1; min-height: 72px; border: 2px dashed #60a5fa; border-radius: 10px; background: #eff6ff;
  font-size: 16px; padding: 10px; outline: none; -webkit-user-select: text; user-select: text;
}
html[data-theme="dark"] .wb-paste-box { background: #131c31; border-color: #334155; }
html[data-theme="dark"] .wb-paste-tip { color: #e2e8f0; }
html[data-theme="dark"] .wb-paste-in { background: #0b1a33; border-color: #3b82f6; }

/* the pen's colour and width buttons (each opens its choices) */
.wb-cur-ink { display: block; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #94a3b8; }
html[data-theme="dark"] .wb-cur-ink { border-color: #0b1120; box-shadow: 0 0 0 1px #475569; }
.wb-pop[data-pop="penw"] { gap: 4px; }

/* 🎤 dictation (whiteboard/dictate.js): red and pulsing while it listens */
.wb-btn.wb-mic[hidden] { display: none; }
.wb-btn.wb-mic.listening { background: #dc2626 !important; border-color: #dc2626 !important; animation: wb-mic 1.1s ease-in-out infinite; }
@keyframes wb-mic { 50% { box-shadow: 0 0 0 7px rgba(220, 38, 38, .25); } }
/* while it listens: the same red 🎤, big, low on the screen, just above the
   words being heard (tap: finished) */
.wb-btn.wb-mic-big {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 9800; margin-left: -55px;
  width: 110px; height: 110px; padding: 0; border-radius: 26px;
  display: flex; align-items: center; justify-content: center;
}
.wb-btn.wb-mic-big[hidden] { display: none; }
.wb-btn.wb-mic-big .ic { font-size: 58px; line-height: 1; }
