/* LV Board: infinite canvas of sticky notes.
   Colours and type follow lvds-brand-guidelines/tokens.json (copied as variables here because the
   Worker serves only lv_board/public/). Century Gothic only. No blue anywhere. Red only for
   overdue and 7+ days pending. */
:root {
  --font: "Century Gothic", "URW Gothic", "Didact Gothic", "Avant Garde", sans-serif;
  --charcoal: #222222;
  --terracotta: #B85042;
  --grey: #5A5A5A;
  --band: #F2F2F2;
  --red: #E4032E;
  --white: #FFFFFF;
  --paper: #F3F2EE;       /* canvas */
  --sheet: #FBFAF8;       /* zone panels, title block */
  --rule: rgba(34, 34, 34, 0.16);
  --rule-soft: rgba(34, 34, 34, 0.07);
  accent-color: var(--terracotta);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none;
  background: var(--paper); color: var(--charcoal);
  font-family: var(--font); font-size: 14px; line-height: 1.3;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
::selection { background: rgba(184, 80, 66, 0.22); color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--terracotta); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ canvas */
.viewport {
  position: fixed; inset: 0; overflow: hidden; touch-action: none;
  background-color: var(--paper);
  background-image: radial-gradient(circle, rgba(34, 34, 34, 0.20) 0.9px, transparent 1.3px);
  background-size: 40px 40px;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.viewport.space { cursor: grab; }
.viewport.panning, .viewport.space.panning { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }

/* zones: each one is a labelled drawing panel with a view-title tag */
.zone { position: absolute; pointer-events: none; }
.zone-head { position: absolute; left: 0; right: 0; top: 0; height: 84px; display: flex; align-items: flex-end; gap: 12px; padding-bottom: 10px; }
.bubble {
  flex: none; width: 46px; height: 46px; border-radius: 50%;
  border: 1.5px solid var(--charcoal); background: var(--sheet);
  display: grid; place-items: center; font-weight: 700; font-size: 17px;
}
.zone-name { flex: 1; min-width: 0; }
.zone-name h2 {
  margin: 0; padding: 0 0 5px; font-size: 23px; font-weight: 700; letter-spacing: 0.01em;
  border-bottom: 1.5px solid var(--charcoal);
}
.zone-name p { margin: 5px 0 0; font-size: 12.5px; color: var(--grey); white-space: nowrap; }
.zone-name p .late { color: var(--red); font-weight: 700; }
.zone-panel {
  position: absolute; left: 0; right: 0;
  background-color: var(--sheet);
  border: 1px solid var(--rule);
  background-image:
    linear-gradient(var(--rule-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule-soft) 1px, transparent 1px),
    linear-gradient(rgba(34, 34, 34, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 34, 34, 0.035) 1px, transparent 1px);
  background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
  background-position: -1px -1px;
}
/* the Done shelf reads as "existing / archived": light 45 degree hatch */
.z-done .zone-panel {
  background-color: #F6F5F2;
  background-image: repeating-linear-gradient(45deg, rgba(34, 34, 34, 0.05) 0 1px, transparent 1px 12px);
  background-size: auto;
}
.z-done .bubble { border-style: dashed; color: var(--grey); }
.z-done .zone-name h2 { color: var(--grey); border-bottom-style: dashed; }
.zone-empty {
  position: absolute; left: 24px; right: 24px; top: 24px; margin: 0;
  font-size: 13px; color: var(--grey); opacity: 0.85;
}

/* ------------------------------------------------------------------ notes */
.note {
  position: absolute; width: 184px; height: 148px;
  display: flex; flex-direction: column; gap: 5px;
  padding: 10px 12px 10px;
  background: var(--white); color: var(--charcoal);
  border: 1px solid rgba(34, 34, 34, 0.15); border-radius: 2px;
  box-shadow: 0 1px 0 rgba(34, 34, 34, 0.05), 0 12px 18px -16px rgba(34, 34, 34, 0.55);
  cursor: grab; transition: opacity 0.45s ease, transform 0.45s ease, box-shadow 0.2s ease;
}
.note.hi { box-shadow: inset 0 3px 0 var(--terracotta), 0 1px 0 rgba(34, 34, 34, 0.05), 0 12px 18px -16px rgba(34, 34, 34, 0.55); }
.note.dragging {
  cursor: grabbing; z-index: 50; transition: none;
  box-shadow: 0 2px 0 rgba(34, 34, 34, 0.06), 0 22px 30px -18px rgba(34, 34, 34, 0.6);
}
.note.hi.dragging { box-shadow: inset 0 3px 0 var(--terracotta), 0 22px 30px -18px rgba(34, 34, 34, 0.6); }
.note.dim { opacity: 0.16; }
.note.match { outline: 2px solid var(--terracotta); outline-offset: 2px; }
.note.ticking { opacity: 0; transform: translateY(8px) scale(0.96); }
.note.arrived { animation: arrive 1.4s ease-out; }
@keyframes arrive {
  0% { outline: 2px solid var(--terracotta); outline-offset: 8px; }
  60% { outline: 2px solid var(--terracotta); outline-offset: 2px; }
  100% { outline: 2px solid transparent; outline-offset: 2px; }
}

.n-top { display: flex; align-items: center; gap: 7px; height: 18px; font-size: 11px; color: var(--grey); white-space: nowrap; }
.n-top .num { font-weight: 700; }
.n-top .kind { color: var(--terracotta); }
.n-top .by { overflow: hidden; text-overflow: ellipsis; }
.badge {
  margin-left: auto; flex: none; min-width: 26px; height: 18px; padding: 0 6px;
  border: 1px solid currentColor; border-radius: 9px;
  font-size: 10.5px; font-weight: 700; line-height: 16px; text-align: center;
}
.badge.d0 { color: var(--grey); border-color: rgba(90, 90, 90, 0.55); }
.badge.d3 { color: var(--terracotta); }
.badge.d7 { color: var(--white); background: var(--red); border-color: var(--red); }
.n-title {
  font-size: 13.5px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.n-who { font-size: 11.5px; color: var(--grey); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.n-who .ph { margin-left: 8px; }
.n-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; font-size: 11px; min-width: 0; }
.proj {
  min-width: 0; max-width: 92px; padding: 1px 6px; border: 1px solid rgba(34, 34, 34, 0.28); border-radius: 2px;
  color: var(--grey); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.due { margin-left: auto; flex: none; color: var(--grey); white-space: nowrap; }
.due.soon { color: var(--terracotta); font-weight: 700; }
.due.late { color: var(--red); font-weight: 700; }

.tick {
  position: relative; flex: none; width: 24px; height: 24px; padding: 0;
  border: 1.5px solid var(--charcoal); border-radius: 50%; background: transparent;
  display: grid; place-items: center;
}
.tick::after { content: ""; position: absolute; inset: -9px; }  /* larger touch target */
.tick svg { width: 14px; height: 14px; fill: none; stroke: var(--charcoal); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.tick:hover svg { opacity: 0.4; }
.note.closed .tick, .note.ticked .tick { background: var(--charcoal); }
.note.closed .tick svg, .note.ticked .tick svg { stroke: var(--white); opacity: 1; }

/* coloured notes */
.note.ink { color: var(--white); border-color: rgba(0, 0, 0, 0.6); }
.note.ink .n-top, .note.ink .n-who, .note.ink .due { color: rgba(255, 255, 255, 0.72); }
.note.ink .n-top .kind { color: #E7A89D; }
.note.ink .proj { color: rgba(255, 255, 255, 0.8); border-color: rgba(255, 255, 255, 0.4); }
.note.ink .tick { border-color: var(--white); }
.note.ink .tick svg { stroke: var(--white); }
.note.ink .badge.d0 { color: rgba(255, 255, 255, 0.8); border-color: rgba(255, 255, 255, 0.5); }
.note.ink .badge.d3 { color: #E7A89D; }
.note.ink .due.soon { color: #E7A89D; }
.note.ink.ticked .tick, .note.ink.closed .tick { background: var(--white); }
.note.ink.ticked .tick svg, .note.ink.closed .tick svg { stroke: var(--charcoal); }

/* shelf notes (done / dropped in the last 7 days) */
.note.shelf {
  height: 64px; flex-direction: row; align-items: center; gap: 10px; padding: 8px 10px;
  opacity: 0.66; box-shadow: none; cursor: default;
}
.note.shelf:hover { opacity: 0.9; }
.note.shelf.dim { opacity: 0.12; }
.s-body { min-width: 0; flex: 1; }
.note.shelf .n-title { font-size: 12px; font-weight: 400; -webkit-line-clamp: 2; }
.note.shelf .n-who { font-size: 10.5px; margin-top: 2px; }
.note.dropped .n-title { text-decoration: line-through; text-decoration-color: rgba(34, 34, 34, 0.5); }
.note.dropped .tick { border-style: dashed; background: transparent; }
.note.dropped .tick svg { opacity: 0; }

/* ------------------------------------------------------------------ toolbar */
.bar {
  position: fixed; top: 12px; left: 12px; z-index: 20;
  display: flex; align-items: center; gap: 8px; padding: 6px;
  max-width: calc(100vw - 24px);
  background: rgba(251, 250, 248, 0.94); border: 1px solid var(--rule); border-radius: 4px;
  box-shadow: 0 10px 24px -20px rgba(34, 34, 34, 0.6);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  touch-action: manipulation;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 0 8px 0 4px; font-weight: 700; font-size: 15px; white-space: nowrap; }
.brand-mark {
  width: 22px; height: 22px; position: relative; flex: none;
  background: var(--white); border: 1.5px solid var(--charcoal); border-radius: 1px;
}
.brand-mark::after { content: ""; position: absolute; right: -1.5px; bottom: -1.5px; border: 5px solid; border-color: var(--terracotta) var(--paper) var(--paper) var(--terracotta); }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 10px; width: 15px; height: 15px; fill: none; stroke: var(--grey); stroke-width: 1.6; stroke-linecap: round; pointer-events: none; }
.search input {
  width: 230px; height: 34px; padding: 0 52px 0 32px;
  border: 1px solid rgba(34, 34, 34, 0.22); border-radius: 3px; background: var(--white);
  -webkit-appearance: none; appearance: none;
}
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search input:focus { border-color: var(--charcoal); }
.qcount { position: absolute; right: 9px; font-size: 11px; color: var(--grey); pointer-events: none; }
select#proj {
  height: 34px; max-width: 180px; padding: 0 30px 0 10px;
  border: 1px solid rgba(34, 34, 34, 0.22); border-radius: 3px; background-color: var(--white);
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%235A5A5A' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 12px;
}
select#proj.on { border-color: var(--terracotta); color: var(--terracotta); font-weight: 700; }
.mockchip { font-size: 11.5px; color: var(--terracotta); border: 1px dashed var(--terracotta); border-radius: 3px; padding: 4px 8px; white-space: nowrap; }

.btn {
  height: 34px; padding: 0 13px; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid rgba(34, 34, 34, 0.25); border-radius: 3px; background: var(--white);
  font-size: 13px; white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.btn:hover { border-color: var(--charcoal); }
.btn.solid { background: var(--charcoal); border-color: var(--charcoal); color: var(--white); }
.btn.solid:hover { background: var(--terracotta); border-color: var(--terracotta); }

/* ------------------------------------------------------------------ title block (summary + zoom) */
.titleblock {
  position: fixed; right: 12px; bottom: 12px; z-index: 20; width: 272px;
  background: var(--sheet); border: 1.5px solid var(--charcoal);
  box-shadow: 0 12px 26px -22px rgba(34, 34, 34, 0.7);
  font-size: 12px; touch-action: manipulation;
}
.tb-cell { padding: 7px 10px; }
.tb-row { display: flex; border-top: 1px solid var(--charcoal); }
.tb-row > * + * { border-left: 1px solid var(--charcoal); }
.tb-id { padding: 9px 10px 8px; }
.tb-studio { font-size: 10px; color: var(--grey); }
.tb-name { font-size: 18px; font-weight: 700; margin-top: 1px; }
.tb-figs .tb-cell { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.tb-figs .tb-date { flex: 1.6; }
.tb-figs span { font-size: 10px; color: var(--grey); }
.tb-figs b { font-size: 14px; }
.tb-figs b.late { color: var(--red); }
.tb-status { border-top: 1px solid var(--charcoal); font-size: 11px; color: var(--grey); display: flex; align-items: center; gap: 7px; }
.tb-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--grey); flex: none; }
.tb-status.live::before { background: var(--charcoal); }
.tb-status.mock { color: var(--terracotta); }
.tb-status.mock::before { background: var(--terracotta); }
.tb-zoom button { height: 34px; border: 0; background: transparent; font-size: 15px; padding: 0 12px; }
.tb-zoom button:hover { background: var(--band); }
.tb-zoom #zPct { flex: 1; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.tb-zoom .fit { font-size: 12.5px; font-weight: 700; }

.banner {
  position: fixed; top: 64px; left: 12px; z-index: 19; max-width: min(520px, calc(100vw - 24px));
  padding: 8px 12px; font-size: 12.5px; background: var(--sheet);
  border: 1px dashed var(--terracotta); color: var(--charcoal); border-radius: 3px;
}

/* ------------------------------------------------------------------ menu */
.menu {
  position: fixed; z-index: 40; min-width: 212px; padding: 6px;
  background: var(--white); border: 1px solid rgba(34, 34, 34, 0.22); border-radius: 3px;
  box-shadow: 0 18px 34px -20px rgba(34, 34, 34, 0.6);
  touch-action: manipulation;
}
.m-head { padding: 6px 10px 8px; font-size: 11.5px; color: var(--grey); border-bottom: 1px solid var(--rule); margin-bottom: 4px; max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu > button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 8px 10px; border: 0; background: none; text-align: left; font-size: 13.5px; border-radius: 2px; }
.menu > button:hover, .menu > button:focus-visible { background: var(--band); outline: none; }
.menu > button .on { margin-left: auto; color: var(--terracotta); font-weight: 700; }
.m-sw { display: flex; gap: 8px; padding: 8px 10px 10px; border-bottom: 1px solid var(--rule); margin-bottom: 4px; align-items: center; }
.m-sw span { font-size: 12px; color: var(--grey); margin-right: 4px; }
.sw { width: 24px; height: 24px; border-radius: 50%; border: 1px solid rgba(34, 34, 34, 0.3); padding: 0; }
.sw.on { box-shadow: 0 0 0 2px var(--white), 0 0 0 3.5px var(--terracotta); }

/* ------------------------------------------------------------------ editor */
.editor {
  position: fixed; z-index: 45; width: 344px; padding: 14px 14px 12px;
  background: var(--sheet); border: 1.5px solid var(--charcoal); border-radius: 2px;
  box-shadow: 0 24px 40px -24px rgba(34, 34, 34, 0.65);
  display: flex; flex-direction: column; gap: 10px; touch-action: manipulation;
}
.ed-head { display: flex; align-items: baseline; justify-content: space-between; font-weight: 700; font-size: 15px; padding-bottom: 6px; border-bottom: 1px solid var(--charcoal); }
.ed-head small { font-weight: 400; font-size: 11px; color: var(--grey); }
.ed-kinds { display: flex; flex-wrap: wrap; gap: 5px; }
.ed-kinds label { position: relative; }
.ed-kinds input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.ed-kinds span { display: block; padding: 5px 9px; font-size: 12px; border: 1px solid rgba(34, 34, 34, 0.25); border-radius: 2px; background: var(--white); cursor: pointer; }
.ed-kinds input:checked + span { background: var(--charcoal); color: var(--white); border-color: var(--charcoal); }
.ed-kinds input:focus-visible + span { outline: 2px solid var(--terracotta); outline-offset: 1px; }
.f { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.f > span { font-size: 11px; color: var(--grey); }
.f input {
  height: 34px; padding: 0 9px; width: 100%;
  border: 1px solid rgba(34, 34, 34, 0.22); border-radius: 2px; background: var(--white);
  -webkit-appearance: none; appearance: none;
}
.f input:focus { border-color: var(--charcoal); }
.f input[name="title"] { font-weight: 700; }
.ed-row { display: flex; gap: 8px; }
.ed-check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.ed-check input { width: 16px; height: 16px; margin: 0; }
.ed-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 2px; }
.ed-err { font-size: 12px; color: var(--terracotta); min-height: 0; }

/* ------------------------------------------------------------------ toast */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 50;
  display: flex; align-items: center; gap: 14px; padding: 10px 14px; max-width: calc(100vw - 24px);
  background: var(--charcoal); color: var(--white); font-size: 13px; border-radius: 3px;
  box-shadow: 0 16px 28px -18px rgba(34, 34, 34, 0.8);
}
.toast button { border: 0; background: none; color: var(--white); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; padding: 2px 0; }

/* ------------------------------------------------------------------ phone */
@media (max-width: 640px) {
  .bar { left: 8px; right: 8px; top: max(8px, env(safe-area-inset-top)); gap: 6px; padding: 5px; max-width: none; }
  .brand { padding: 0 2px; }
  .brand-name { display: none; }
  .search { flex: 1; min-width: 0; }
  .search input { width: 100%; font-size: 16px; padding-right: 8px; }   /* 16px stops iOS zooming into the field */
  .qcount { display: none; }
  select#proj { width: 88px; font-size: 16px; padding-right: 24px; background-position: right 8px center; }
  #newBtn { padding: 0 10px; }
  #newBtn span { display: none; }
  .mockchip { display: none !important; }
  .titleblock { right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); width: auto; }
  .titleblock .tb-id, .titleblock .tb-figs, .titleblock .tb-status { display: none; }
  .titleblock .tb-zoom { border-top: 0; }
  .tb-zoom button { height: 40px; min-width: 40px; }
  .banner { top: 58px; left: 8px; right: 8px; }
  .editor {
    left: 0 !important; right: 0; top: auto !important; bottom: 0; width: auto;
    border-width: 1.5px 0 0; padding-bottom: max(12px, env(safe-area-inset-bottom));
    max-height: 88vh; overflow: auto;
  }
  .f input { font-size: 16px; }
  .toast { bottom: 70px; }
}

@media (prefers-reduced-motion: reduce) {
  .note { transition: none; }
  .note.arrived { animation: none; }
}
