/* Blocky web app shell (r10) — owner: integrator. Floating bottom nav, view frames, sheets, shared controls.
   Geometry = the Android app's DESIGN_AMENDMENT §2: bar 56 px, 12 px side insets, 8 px above the bottom safe area,
   max 480 px, r14 bar / r10 cell veil, 1 px hairline 12 % white, 24 px blur over a 64 % dark tint, 2 × 20 px lime tick.
   Shapes elsewhere: 8 px controls, 6 px chips, 12 px panels. Lime only for the go path; orange (--warn) only for real warnings. */
:root {
  --nav-h: 56px;
  --nav-gap: 8px;
  --nav-dim: #94968d;
  --glass-edge: rgba(255, 255, 255, .12);
  --sab: env(safe-area-inset-bottom, 0px);
  /* room the nav takes from the screen bottom, above body's own safe-area padding */
  --nav-room: calc(var(--nav-h) + var(--nav-gap) + 16px);
}

/* content never hides under the nav */
body.has-nav .wrap { padding-bottom: calc(40px + var(--nav-room)); }
body.has-nav .joinv { padding-bottom: calc(24px + var(--nav-room)); }
body.has-nav .toast { bottom: calc(var(--sab) + var(--nav-gap) + var(--nav-h) + 12px); }

/* ---- view frames (LISTS · ACTIVITY · SETTINGS); BLOCKS = #view-blocks (the list view + JOIN screen) ---- */
.vwrap {
  max-width: 760px; margin: 0 auto;
  padding: 20px 16px calc(40px + var(--nav-room));
  display: flex; flex-direction: column; gap: 22px;
}
.vhead { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px 12px; }
/* QA1-WEB-7: no BLOCKY wordmark line above LISTS / ACTIVITY / SETTINGS (JTEK: no app-name header) */
.vh { margin: 0; font-size: clamp(32px, 9.5vw, 52px); font-weight: 700; letter-spacing: .01em; line-height: 1.05; overflow-wrap: break-word; }
.vact { display: flex; gap: 8px; align-items: center; }
.vact:empty { display: none; }
.vbody { display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 640px) { .vwrap { padding-top: 36px; } }

/* ---- floating glass nav ---- */
.nav-prot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 44; pointer-events: none;
  height: calc(var(--sab) + 36px);
  background: linear-gradient(180deg, rgba(5, 5, 5, 0) 0, var(--bg) 28px, var(--bg) 100%);
}
.bnav {
  position: fixed; z-index: 45; left: 50%; bottom: calc(var(--sab) + var(--nav-gap));
  transform: translateX(-50%);
  width: min(calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)), 480px);
  height: var(--nav-h); padding: 1px;
  border-radius: 14px; border: 1px solid var(--glass-edge);
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, 0) 16px), rgba(14, 15, 12, .96);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .bnav {
    background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, 0) 16px), rgba(5, 5, 5, .64);
    -webkit-backdrop-filter: blur(24px) saturate(1.2); backdrop-filter: blur(24px) saturate(1.2);
  }
}
.bnav-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); height: 100%; }
.bn {
  position: relative; display: block; height: 100%; min-width: 0; padding: 0; margin: 0;
  background: none; border: 0; border-radius: 10px; cursor: pointer; touch-action: manipulation;
  color: var(--nav-dim); -webkit-user-select: none; user-select: none;
}
.bn::before { /* pressed veil + focus ring: r10, inset 4 (concentric with the r14 bar) */
  content: ""; position: absolute; inset: 4px; border-radius: 10px; pointer-events: none;
}
.bn:active::before { background: rgba(255, 255, 255, .06); }
.bn:focus-visible { outline: none; }
.bn:focus-visible::before { box-shadow: inset 0 0 0 2px var(--text); }
.bn-ic { position: absolute; left: 50%; top: 7px; width: 24px; height: 24px; transform: translateX(-50%); transition: transform .12s; }
.bn-svg { display: block; width: 24px; height: 24px; }
.bn-l {
  position: absolute; left: 0; right: 0; top: 34px; text-align: center; white-space: nowrap;
  font-size: calc(10px * var(--bn-scale, 1)); line-height: 12px; font-weight: 700; letter-spacing: .08em;
  transition: transform .12s;
}
.bn:active .bn-ic { transform: translateX(-50%) scale(.94); }
.bn:active .bn-l { transform: scale(.94); }
.bn[aria-current="page"] { color: var(--lime); }
.bn-new .bn-svg { color: var(--lime); }
.bn-new .bn-l { color: var(--text); }
.bn-badge { /* anchor: left = icon box right edge, top = icon top − 1 */
  position: absolute; left: 24px; top: -1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  font-size: 10px; line-height: 16px; font-weight: 700; text-align: center; letter-spacing: 0;
  color: var(--ink); background: var(--text); font-variant-numeric: tabular-nums;
}
.bn-badge.help { background: var(--help); box-shadow: 0 0 0 3px rgba(255, 69, 69, .22); }
.bn-tick {
  position: absolute; top: -1px; width: 20px; height: 2px; background: var(--lime); border-radius: 1px;
  left: calc(1px + (100% - 2px) / 5 * var(--bn-i, 0) + ((100% - 2px) / 5 - 20px) / 2);
  transition: left .22s cubic-bezier(.2, .9, .3, 1.15);
}
.bn-tick[hidden] { display: none; }
/* the on-screen keyboard is up (touch): the nav steps aside, like the app */
body.kb .bnav, body.kb .nav-prot { display: none; }
body.kb.has-nav .toast { bottom: calc(var(--sab) + 20px); }

/* ---- sheets (Blocky.sheet) ---- */
.sheet-root { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sh-back { position: absolute; inset: 0; background: rgba(0, 0, 0, .62); animation: sh-fade .16s ease-out; }
.sheet {
  position: relative; width: min(100%, 560px); max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 24px);
  display: flex; flex-direction: column; gap: 14px; overflow-y: auto; overscroll-behavior: contain;
  padding: 16px 16px calc(16px + var(--sab));
  padding-left: calc(16px + env(safe-area-inset-left, 0px)); padding-right: calc(16px + env(safe-area-inset-right, 0px));
  border-radius: 12px 12px 0 0; border: 1px solid rgba(255, 255, 255, .10); border-bottom: 0;
  background: radial-gradient(130% 160% at 12% -20%, rgba(204, 255, 0, .06), transparent 60%), linear-gradient(180deg, #0d0e0b, #080906);
  box-shadow: 0 -14px 34px rgba(0, 0, 0, .6);
  animation: sh-up .2s cubic-bezier(.2, .9, .3, 1);
}
@media (min-width: 600px) { .sheet-root { align-items: center; } .sheet { border-radius: 12px; border-bottom: 1px solid rgba(255, 255, 255, .10); padding-bottom: 16px; } }
/* HAWK-106W-1: the head (title + close) is pinned at the top of the scroller, so a sheet opened part way down (LIST at
   LIVE) or scrolled by hand always keeps its close button on screen. The sheet's top padding moves into the head; the
   head spans the full width (side padding + safe areas) and turns to glass once the sheet scrolls under it. */
.sheet { padding-top: 0; scroll-padding-top: 60px; }
.sh-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; z-index: 3; flex: none;
  margin: 0 calc(-16px - env(safe-area-inset-right, 0px)) -8px calc(-16px - env(safe-area-inset-left, 0px));
  padding: 16px calc(16px + env(safe-area-inset-right, 0px)) 8px calc(16px + env(safe-area-inset-left, 0px));
  border-bottom: 1px solid transparent; transition: background-color .12s, border-color .12s;
}
.sheet.sh-scrolled > .sh-head { background-color: rgba(10, 11, 8, .94); border-bottom-color: rgba(255, 255, 255, .08); }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .sheet.sh-scrolled > .sh-head { background-color: rgba(10, 11, 8, .78); -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2); }
}
.sh-title { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .12em; color: var(--text); }
.sh-x { flex: none; width: 44px; height: 44px; margin: -8px -10px -8px 0; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--dim); cursor: pointer; }
.sh-x svg { display: block; margin: auto; }
.sh-body { display: flex; flex-direction: column; gap: 10px; }
.sh-acts { display: flex; flex-direction: column; gap: 8px; }
body.sheet-open { overflow: hidden; }
@keyframes sh-up { from { transform: translateY(24px); opacity: 0; } }
@keyframes sh-fade { from { opacity: 0; } }

/* ---- shared controls for view modules (use these, don't restyle per view) ---- */
.b-go, .b-btn, .b-warn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 48px; padding: 0 16px; border-radius: 8px; cursor: pointer; touch-action: manipulation;
  font: inherit; font-size: 13px; font-weight: 700; letter-spacing: .12em; text-decoration: none; text-align: center;
}
.b-go { background: var(--lime); color: var(--ink); border: 0; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
.b-btn { background: transparent; color: var(--text); border: 1px solid rgba(255, 255, 255, .16); }
.b-warn { background: transparent; color: var(--warn); border: 1px solid rgba(255, 138, 31, .55); }
.b-go:active, .b-btn:active, .b-warn:active { transform: scale(.97); }
.b-go[disabled], .b-btn[disabled], .b-warn[disabled] { opacity: .5; cursor: default; }
.b-go:focus-visible, .b-btn:focus-visible, .b-warn:focus-visible, .b-row:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.b-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  min-height: 52px; padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(255, 255, 255, .02); color: var(--text); font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.b-row:active { background: rgba(255, 255, 255, .05); }
.b-row .b-k { font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; min-width: 0; overflow-wrap: anywhere; }
.b-row .b-v { flex: none; font-size: 11px; letter-spacing: .08em; color: var(--text); }
.b-label { font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--label); margin: 8px 0 0; }
.b-empty { margin: 0; font-size: 13px; letter-spacing: .06em; color: var(--dim); }
.b-field {
  width: 100%; height: 52px; padding: 0 14px; border-radius: 8px; -webkit-appearance: none; appearance: none;
  font: inherit; font-size: 17px; color: var(--text); background: rgba(255, 255, 255, .03);
  border: 1px solid var(--field-edge); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}
.b-field:focus { outline: none; border-color: var(--lime); }
.b-field::placeholder { color: var(--dim); }
.b-err { margin: 0; font-size: 13px; line-height: 1.45; color: var(--warn); }
.b-err:empty { display: none; }
.b-foot { margin-top: 12px; font-size: 10px; letter-spacing: .14em; color: var(--label); }

@media (prefers-reduced-motion: reduce) { .bn-tick, .bn-ic, .bn-l, .sh-head { transition: none; } .sheet, .sh-back { animation: none; } }
/* r12 W-12: a field that failed stays marked until it is edited (no lime) */
.b-field[aria-invalid="true"], .b-field[aria-invalid="true"]:focus { border-color: var(--warn); box-shadow: none; }
/* r12 C8: nav labels 11 px where they fit (≥ 360 px wide); 320 px phones keep 10 px */
@media (min-width: 360px) { .bn-l { font-size: calc(11px * var(--bn-scale, 1)); } }
/* QA2-WEB-2: page zoom (≤ 300 CSS px): the nav takes the full width and its labels shrink so ACTIVITY and SETTINGS never touch */
@media (max-width: 300px) {
  .bnav { width: calc(100vw - 8px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)); }
  .bn-l { font-size: 8px; letter-spacing: .02em; }
}
/* HAWK-106W-2: phone landscape (the compact header's query): the nav is one 44 px row, icon and label side by side, so a
   real list with notes shows 2 full rows. Same 5 cells, names, order and badges; wider bar so each label still fits. */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --nav-h: 44px; --nav-gap: 4px; }
  .bnav { width: min(calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)), 600px); border-radius: 12px; }
  .bn { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 4px; }
  .bn::before { inset: 3px; border-radius: 9px; }
  .bn-ic { position: relative; left: auto; top: auto; flex: none; transform: none; }
  .bn:active .bn-ic { transform: scale(.94); }
  .bn-l { position: static; min-width: 0; overflow: hidden; text-overflow: clip; }
  .bn-badge { left: 13px; top: -7px; }
  .nav-prot { height: calc(var(--sab) + 26px); }
}
