/* Shared workspace header nav — the "back to workspace" button that sits
   top-left, before the tool title, on every /workspace tool.
   Header layout: [ws-home button] [tool title] · [page / space / indicators]
   Sizing and background come from each page's own .icon-btn rule so the
   button matches its neighbours; this file adds the icon and hover bubble. */

.ic-workspace { --ic: url(/assets/icons/people.svg); }

header .ws-home {
  position: relative;
  text-decoration: none;
  color: var(--accent, var(--pink));
}
header .ws-home:hover,
header .ws-home:focus-visible { color: var(--pink); }
header .ws-home .ic { font-size: 24px; }

/* Admin state on the top-right button: green with the settings icon while
   the admin is unlocked on this device; each page's own .icon-btn rule
   styles the normal (locked) look. */
header .icon-btn.admin-on {
  background: #e3f5ea;
  color: #1e8a4a;
  box-shadow: inset 0 0 0 1.5px #86d3a6;
}
header .icon-btn.admin-on:hover { background: #d3efdd; }

/* hover bubble */
header .ws-home::after {
  content: "Back to workspace";
  position: absolute; top: calc(100% + 9px); left: 0;
  padding: 7px 11px; border-radius: 9px;
  background: var(--ink, #241c1a); color: #fff;
  font-family: var(--body-font); font-size: 12.5px; font-weight: 600; line-height: 1;
  letter-spacing: .01em; white-space: nowrap;
  opacity: 0; transform: translateY(-4px); pointer-events: none;
  transition: opacity .14s ease, transform .14s ease;
  z-index: 60;
}
header .ws-home::before {
  content: ""; position: absolute; top: calc(100% + 4px); left: 14px;
  border: 5px solid transparent; border-bottom-color: var(--ink, #241c1a);
  opacity: 0; transform: translateY(-4px); pointer-events: none;
  transition: opacity .14s ease, transform .14s ease;
  z-index: 60;
}
@media (hover: hover) {
  header .ws-home:hover::after,  header .ws-home:hover::before,
  header .ws-home:focus-visible::after, header .ws-home:focus-visible::before {
    opacity: 1; transform: none; transition-delay: .25s;
  }
}
/* keyboard users on touch devices still get the bubble */
@media (hover: none) {
  header .ws-home:focus-visible::after, header .ws-home:focus-visible::before { opacity: 1; transform: none; }
}

/* the secondary label after the title ("· board id", "· CODE", "· board name") */
header .title .ws-sub {
  font-family: var(--body-font); font-weight: 600; font-size: 14px;
  color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
header .title .ws-sub:empty { display: none; }

/* ======================================================================
   Shared header layout, the padlock states, the FAB column and the sign-in
   sheet (workspace/ws-auth.js builds the sheet; every tool shares it).
   ====================================================================== */

/* a hidden button stays hidden whatever its own display rule says */
[hidden] { display: none !important; }

/* the header carries the FAB column, so it needs a stacking context above the page */
header { position: relative; z-index: 30; }

/* the padlock while an account is signed in but may not run this space */
header .icon-btn.me-on { color: var(--pink); box-shadow: inset 0 0 0 1.5px var(--accent-dim, #f2b9dc); }

/* icons the shared pieces use (a page's own identical rules win when present) */
.ic-lock     { --ic: url(/assets/icons/lock.svg); }
.ic-unlock   { --ic: url(/assets/icons/lock_open.svg); }
.ic-settings { --ic: url(/assets/icons/settings.svg); }
.ic-person   { --ic: url(/assets/icons/person.svg); }
.ic-close    { --ic: url(/assets/icons/x_cross_close.svg); }
.ic-share    { --ic: url(/assets/icons/share.svg); }
.ic-copy     { --ic: url(/assets/icons/copy.svg); }
.ic-mail     { --ic: url(/assets/icons/mail.svg); }
.ic-qr       { --ic: url(/assets/icons/qr.svg); }

/* ---------- FABs: the tool's extra buttons, in a column under the header,
   top right. Only the padlock and Share stay in the header itself. ---------- */
.ws-fabs {
  position: absolute; top: calc(100% + 10px); right: 14px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  z-index: 31; pointer-events: none;
}
.ws-fab {
  pointer-events: auto; position: relative;
  width: 38px; height: 38px; border-radius: 50%; border: none; padding: 0;
  display: grid; place-items: center; cursor: pointer; text-decoration: none;
  background: var(--surface, #fff); color: var(--ink-soft, #6b6480);
  box-shadow: 0 2px 10px rgba(43, 37, 64, .16), inset 0 0 0 1px var(--line, #eed4e6);
  transition: background .15s ease, color .15s ease, transform .1s ease;
}
.ws-fab .ic, .ws-fab .material-symbols-rounded { font-size: 19px; }
.ws-fab:hover { background: var(--surface-3, #f7e4f0); color: var(--ink, #2b2540); }
.ws-fab:active { transform: scale(.92); }
.ws-fab.on { background: var(--accent, #e6007e); color: var(--accent-ink, #fff); box-shadow: 0 2px 10px rgba(43, 37, 64, .16); }
.ws-fab.admin-on { background: #e3f5ea; color: #1e8a4a; box-shadow: 0 2px 10px rgba(43, 37, 64, .16), inset 0 0 0 1.5px #86d3a6; }
.ws-fab.admin-on:hover { background: #d3efdd; }
.ws-fab .badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--accent, #e6007e); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.ws-fab.spinning .ic { animation: ws-spin 1s linear infinite; }
@keyframes ws-spin { to { transform: rotate(360deg); } }
/* hover bubble, to the left of the button */
.ws-fab[title]::after {
  content: attr(title);
  position: absolute; right: calc(100% + 9px); top: 50%; transform: translateY(-50%) translateX(4px);
  padding: 6px 10px; border-radius: 8px; white-space: nowrap;
  background: var(--ink, #241c1a); color: #fff;
  font-family: var(--body-font); font-size: 12.5px; font-weight: 600; line-height: 1; letter-spacing: .01em;
  opacity: 0; pointer-events: none; transition: opacity .14s ease, transform .14s ease;
}
@media (hover: hover) {
  .ws-fab[title]:hover::after { opacity: 1; transform: translateY(-50%); transition-delay: .25s; }
}

/* ---------- the share sheet (QR code, or copy the link) ---------- */
.ws-share-opts { display: flex; gap: 10px; margin-top: 12px; }
.ws-share-opts .ws-btn { flex: 1 1 0; }
.ws-qr { margin: 14px auto 0; width: min(280px, 72vw); background: #fff; border: 1px solid var(--line, #eed4e6); border-radius: 14px; padding: 10px; }
.ws-qr svg { width: 100%; height: auto; display: block; }
.ws-qr-fallback { font-size: 13px; color: var(--ink-soft, #6b6480); text-align: center; padding: 18px; }
.ws-qr-url { margin-top: 10px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--ink-soft, #6b6480); text-align: center; overflow-wrap: anywhere; }
.ws-qr-url:empty { display: none; }

/* ---------- the sign-in / account sheet ---------- */
.ws-scrim {
  position: fixed; inset: 0; z-index: 80; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(43, 37, 64, .42);
}
.ws-scrim.open { display: flex; }
.ws-sheet {
  width: 100%; max-width: 440px; max-height: calc(100vh - 40px); overflow: auto;
  background: var(--surface, #fff); color: var(--ink, #2b2540);
  border-radius: 20px; box-shadow: 0 18px 50px rgba(43, 37, 64, .25);
  display: flex; flex-direction: column;
}
.ws-sheet-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px 8px;
}
.ws-sheet-head h3 { margin: 0; font-family: var(--heading-font); font-weight: 400; font-size: 22px; }
.ws-x {
  width: 38px; height: 38px; flex: 0 0 auto; border: none; border-radius: 10px; cursor: pointer;
  display: grid; place-items: center; background: var(--surface-3, #f7e4f0); color: var(--ink, #2b2540);
}
.ws-x .ic { font-size: 21px; }
.ws-sheet-body { padding: 4px 18px 14px; }
.ws-note { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-soft, #6b6480); }
.ws-note:empty { display: none; }
.ws-label {
  display: block; margin: 14px 0 5px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint, #a79fb5);
}
.ws-in {
  width: 100%; height: var(--tap, 44px); box-sizing: border-box;
  border: 1.5px solid var(--line, #eed4e6); border-radius: 11px; outline: none;
  background: var(--surface-2, #fdf4f9); color: var(--ink, #2b2540);
  font-family: inherit; font-size: 15px; padding: 0 13px;
}
.ws-in:focus { border-color: var(--accent, #e6007e); }
.ws-err { color: var(--pink, #e6007e); font-size: 13.5px; min-height: 18px; margin-top: 8px; line-height: 1.45; }
.ws-text-btn {
  display: block; margin-top: 14px; padding: 0; border: none; background: none; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink-faint, #a79fb5);
  text-decoration: underline; text-underline-offset: 3px;
}
.ws-text-btn:hover { color: var(--pink, #e6007e); }
.ws-me {
  display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px 14px;
  border-radius: 12px; background: var(--surface-2, #fdf4f9); font-size: 14px; line-height: 1.4;
}
.ws-me .ic { flex: 0 0 auto; font-size: 22px; color: var(--pink, #e6007e); }
.ws-me .ic.ok { color: #1e8a4a; }
.ws-me b { word-break: break-word; }
.ws-me-sub { color: var(--ink-soft, #6b6480); font-size: 13px; margin-top: 2px; }
.ws-sheet-foot {
  display: flex; gap: 10px; padding: 12px 18px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line, #eed4e6);
}
.ws-btn {
  flex: 1 1 auto; height: var(--tap, 44px); border: none; border-radius: 11px; cursor: pointer; padding: 0 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: inherit; font-size: 15px; font-weight: 700; transition: transform .1s ease;
}
.ws-btn:active { transform: scale(.96); }
.ws-btn:disabled { opacity: .6; cursor: default; }
.ws-btn.primary { background: var(--accent, #e6007e); color: var(--accent-ink, #fff); }
.ws-btn.ghost { background: var(--surface-3, #f7e4f0); color: var(--ink, #2b2540); }

/* ---------- keeper section (ws-lock.js): password + admin link inside a settings sheet ---------- */
.ws-keep { margin-top: 6px; }
.ws-keep .ws-row { display: flex; gap: 8px; align-items: center; }
.ws-keep .ws-row .ws-in { flex: 1 1 auto; min-width: 0; }
.ws-keep .ws-row .ws-btn { flex: 0 0 auto; white-space: nowrap; }
.ws-keep .ws-btn.primary { background: var(--accent, #e6007e); color: #fff; }
.ws-keep .ws-note { margin-top: 6px; }
.ws-keep .ws-note.ok { color: #1e8a4a; }
.ws-keep .ws-note.err { color: var(--pink, #e6007e); }
.ws-keep .ws-text-btn { margin-top: 8px; }
#wsLockScrim { z-index: 90; }
#wsLockScrim .ws-btn.primary { background: var(--accent, #e6007e); color: #fff; }
#wsLockBack { display: block; }
