/* AgentSnaps. Design tokens and the pin / comments / composer language come from RocketSim Flows. */
:root {
  --bg: #101116;
  --solid: #1f2027;
  --raised: #262832;
  --hair: rgba(255, 255, 255, 0.13);
  --fg: #ececf1;
  --fg2: #9a9dad;
  --acc: #4c8dff;
  --ca: #ffd60a;
  --ca-on: #2b2200;
  --ca-rgb: 255, 214, 10;
  --ok: #32d74b;
  --warn: #ff9f0a;
  --bad: #ff453a;
  --nf: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --rail: 232px;
  --side: 340px;
  --top: 56px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.noscript { padding: 24px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--hair); background: var(--raised); font-weight: 560; white-space: nowrap; }
.btn:hover:not(:disabled) { background: #2f313d; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--acc); border-color: transparent; color: #fff; }
.btn.primary:hover:not(:disabled) { background: #6aa0ff; }
.btn.ok { background: rgba(50, 215, 75, 0.16); border-color: rgba(50, 215, 75, 0.5); color: #8df0a0; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.icon-btn { width: 34px; padding: 0; }
.seg { display: inline-flex; border: 1px solid var(--hair); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; background: transparent; min-height: 32px; padding: 0 12px; font-weight: 560; }
.seg button[aria-pressed="true"] { background: var(--raised); color: var(--fg); box-shadow: inset 0 0 0 1px var(--hair); }
.seg button:not([aria-pressed="true"]) { color: var(--fg2); }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--raised); border: 1px solid var(--hair); color: var(--fg2); white-space: nowrap; }
.chip { flex: none; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.in_review { color: var(--acc); }
.chip.changes_requested { color: var(--warn); }
.chip.approved { color: var(--ok); }
.chip.draft { color: var(--fg2); }

/* Layout */
#app { height: 100%; display: flex; flex-direction: column; }
.top { height: var(--top); flex: none; display: flex; align-items: center; gap: 10px; padding: 0 14px; padding-top: env(safe-area-inset-top); border-bottom: 1px solid var(--hair); background: rgba(16, 17, 22, 0.92); }
.brand { font-weight: 700; letter-spacing: -0.01em; color: var(--fg2); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.brand img { width: 22px; height: 22px; }
.title { font-weight: 650; font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spacer { flex: 1; }
.top select { min-height: 32px; border-radius: 9px; border: 1px solid var(--hair); background: var(--raised); padding: 0 8px; }
.work { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--rail) minmax(0, 1fr) var(--side); }
.rail { overflow: auto; border-right: 1px solid var(--hair); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.stage { overflow: auto; position: relative; padding: 16px; display: flex; flex-direction: column; gap: 14px; align-items: center; background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px); background-size: 22px 22px; }
.side { border-left: 1px solid var(--hair); display: flex; flex-direction: column; min-height: 0; background: rgba(26, 27, 33, 0.9); }

/* Rail */
.rail h2, .side h2 { margin: 0; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg2); font-weight: 650; }
.shot { display: block; width: 100%; text-align: left; border: 1px solid var(--hair); border-radius: 12px; padding: 8px; background: var(--solid); }
.shot[aria-current="true"] { border-color: var(--acc); box-shadow: 0 0 0 2px rgba(76, 141, 255, 0.35); }
.shot .thumb { display: grid; place-items: center; height: 120px; border-radius: 8px; background: #0b0c10; overflow: hidden; }
.shot img { max-width: 100%; max-height: 120px; object-fit: contain; display: block; }
.shot .name { margin-top: 6px; display: flex; gap: 6px; align-items: center; font-weight: 580; }
.shot .name span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: rgba(76, 141, 255, 0.18); color: #9ec2ff; font-weight: 650; }
.tag.count { background: rgba(var(--ca-rgb), 0.2); color: var(--ca); }

/* Stage */
.notes { width: 100%; max-width: 760px; display: grid; gap: 8px; }
.note { border: 1px solid var(--hair); border-radius: 12px; background: var(--solid); padding: 10px 14px; }
.note .label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg2); font-weight: 650; margin-bottom: 4px; }
.note p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.banner { width: 100%; max-width: 760px; display: flex; gap: 10px; align-items: center; border: 1px solid rgba(76, 141, 255, 0.5); background: rgba(76, 141, 255, 0.12); border-radius: 12px; padding: 8px 12px; }
.banner span { flex: 1; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
/* Auto margins centre a small screenshot and keep a zoomed one scrollable from its left edge. */
.frame-wrap { position: relative; flex: none; align-self: flex-start; margin-inline: auto; }
.frame { position: relative; border-radius: 12px; overflow: visible; box-shadow: 0 0 0 1px var(--hair), 0 12px 40px rgba(0, 0, 0, 0.5); background: #0b0c10; touch-action: manipulation; }
.frame.compose { cursor: crosshair; }
.frame, .frame * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.dot { --d: 16px; position: absolute; z-index: 4; width: var(--d); height: var(--d); margin: calc(var(--d) / -2) 0 0 calc(var(--d) / -2); border-radius: 50%; pointer-events: none; background: rgba(var(--ca-rgb), 0.25); border: 2px solid var(--ca); transform: scale(0.3); animation: dot-press 380ms ease-out forwards; }
.dot.placed { animation: dot-placed 260ms cubic-bezier(0.3, 1.6, 0.5, 1) forwards; background: var(--ca); border-color: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 0 0 calc(var(--d) * 0.35) rgba(var(--ca-rgb), 0.35); }
.haptic { position: fixed; left: -100px; top: -100px; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.dot.rest { animation: none; transform: scale(1.1); }
@keyframes dot-press { from { transform: scale(0.3); opacity: 0.2; } to { transform: scale(1); opacity: 1; } }
@keyframes dot-placed { from { transform: scale(1); } to { transform: scale(1.25); } }
@media (prefers-reduced-motion: reduce) { .dot, .dot.placed { animation: none; transform: scale(1); } }
.frame img { display: block; width: 100%; height: 100%; border-radius: 12px; user-select: none; -webkit-user-drag: none; }
.hl { position: absolute; pointer-events: none; border: 2px solid var(--acc); background: rgba(76, 141, 255, 0.14); border-radius: 4px; z-index: 2; }
.hl.pick { border-color: var(--ca); background: rgba(var(--ca-rgb), 0.16); }
.hl .tagline { position: absolute; left: -2px; bottom: 100%; margin-bottom: 4px; padding: 2px 8px; border-radius: 6px; background: var(--solid); border: 1px solid var(--hair); font-size: 11.5px; white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.pins { position: absolute; inset: 0; z-index: 3; pointer-events: none; }

/* Pins: a yellow round with one squared corner that touches the element (as in RocketSim Flows). */
.pin { position: absolute; left: 0; top: 0; width: 22px; height: 22px; margin: -11px 0 0 -11px; padding: 0; border-radius: 50% 50% 50% 0; border: 2px solid #fff; background: var(--ca); color: var(--ca-on); display: grid; place-items: center; font: 600 11px/1 var(--nf); font-variant-numeric: tabular-nums; pointer-events: auto; cursor: pointer; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.45); }
.pin.fx { border-radius: 50% 50% 0 50%; }
.pin.fy { border-radius: 0 50% 50% 50%; }
.pin.fx.fy { border-radius: 50% 0 50% 50%; }
.pin:hover { box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 0 0 4px rgba(var(--ca-rgb), 0.4), 0 2px 6px rgba(0, 0, 0, 0.45); }
.pin.on { box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 0 0 4px rgba(var(--ca-rgb), 0.65), 0 2px 6px rgba(0, 0, 0, 0.5); z-index: 2; }
.pin.sent { background: var(--solid); color: var(--ca); border-color: var(--ca); }
.pin.resolved { background: rgba(50, 215, 75, 0.22); color: #8df0a0; border-color: var(--ok); }

/* Composer */
.composer { position: absolute; z-index: 9; width: 300px; border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: rgba(30, 31, 38, 0.97); border: 1px solid var(--hair); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.4); -webkit-backdrop-filter: blur(22px) saturate(1.7); backdrop-filter: blur(22px) saturate(1.7); }
.composer .target { font-size: 12px; color: var(--fg2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer .target b { color: var(--fg); font-weight: 600; }
textarea { width: 100%; min-height: 76px; resize: vertical; border-radius: 9px; border: 1px solid var(--hair); background: #15161c; padding: 8px 10px; }
.composer .row { display: flex; align-items: center; gap: 8px; }
.counter { font-size: 12px; color: var(--fg2); margin-right: auto; }
.counter.over { color: var(--bad); }

/* Sidebar */
.tabs { display: flex; gap: 4px; padding: 10px 12px 0; }
.tabs button { flex: 1; white-space: nowrap; font-size: 14px; min-height: 32px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--fg2); font-weight: 600; }
.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--ca); }
.panel { flex: 1; min-height: 0; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.empty { color: var(--fg2); text-align: center; padding: 28px 12px; }
.group h3 { margin: 0 0 6px; font-size: 12.5px; color: var(--fg2); font-weight: 650; display: flex; gap: 8px; align-items: center; }
.group h3 span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 8px; align-items: start; border: 1px solid var(--hair); border-radius: 12px; padding: 8px; background: var(--solid); margin-bottom: 6px; }
.item[data-on="true"] { border-color: var(--ca); }
.item .num { width: 22px; height: 22px; border-radius: 50% 50% 50% 0; background: var(--ca); color: var(--ca-on); font: 600 11px/22px var(--nf); text-align: center; border: 2px solid #fff; box-sizing: content-box; margin: -2px; }
.item .num.sent { background: var(--solid); color: var(--ca); border-color: var(--ca); }
.item .num.resolved { background: rgba(50, 215, 75, 0.22); color: #8df0a0; border-color: var(--ok); }
.item .where { font-size: 12px; color: var(--fg2); overflow-wrap: anywhere; }
.item .text { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.item > * { min-width: 0; }
.item textarea { min-height: 60px; }
.item .x { border: 0; background: transparent; color: var(--fg2); width: 28px; height: 28px; border-radius: 8px; }
.item .x:hover { background: var(--raised); color: var(--fg); }
.res { font-size: 12.5px; color: #8df0a0; margin-top: 4px; }
.foot { border-top: 1px solid var(--hair); padding: 12px; display: grid; gap: 8px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
.foot .row { display: flex; gap: 8px; }
.foot .row .btn { flex: 1; }
.foot input[type="text"] { width: 100%; min-height: 34px; border-radius: 9px; border: 1px solid var(--hair); background: #15161c; padding: 0 10px; }
details.prompt { border: 1px solid var(--hair); border-radius: 10px; background: #15161c; }
details.prompt summary { padding: 6px 10px; cursor: pointer; color: var(--fg2); font-size: 12.5px; }
details.prompt pre { margin: 0; padding: 8px 10px; max-height: 180px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: 11.5px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--fg2); }
.sub { border: 1px solid var(--hair); border-radius: 12px; padding: 10px; background: var(--solid); display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; }
.sub .meta { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--fg2); flex-wrap: wrap; }
.sub .msg { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Index */
.index { max-width: 880px; width: 100%; margin: 0 auto; padding: 28px 18px 60px; overflow: auto; }
.index h1 { font-size: 26px; letter-spacing: -0.02em; margin: 6px 0 4px; }
.index p.lead { color: var(--fg2); margin: 0 0 22px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card { display: grid; gap: 8px; text-decoration: none; color: inherit; border: 1px solid var(--hair); border-radius: 14px; padding: 14px; background: var(--solid); }
.card:hover { border-color: rgba(255, 255, 255, 0.3); }
.card .t { font-weight: 650; overflow-wrap: anywhere; }
.card .m { color: var(--fg2); font-size: 12.5px; }
.error-box { margin: 60px auto; max-width: 460px; text-align: center; color: var(--fg2); padding: 0 18px; }
.error-box h1 { color: var(--fg); font-size: 20px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--raised); border: 1px solid var(--hair); border-radius: 12px; padding: 10px 16px; z-index: 50; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5); max-width: calc(100vw - 32px); }

/* Responsive: rail becomes a strip, the sidebar a bottom sheet. */
.only-narrow { display: none; }
.btn.icon { position: relative; width: 38px; min-width: 38px; padding: 0; justify-content: center; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--ca); color: var(--ca-on); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; border: 2px solid var(--bg, #101116); box-sizing: content-box; }
.picker { align-items: center; gap: 6px; min-width: 0; flex: 0 1 440px; margin-right: auto; height: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--hair); background: var(--raised); font-weight: 620; font-size: 14px; text-align: left; }
.picker .pname { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker .pcount { font-size: 11px; color: var(--fg2); font-variant-numeric: tabular-nums; }
.picker .ico { width: 16px; height: 16px; color: var(--fg2); }
.menu-back { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.35); }
.menu { position: fixed; z-index: 41; left: 8px; right: 8px; top: calc(var(--top) + env(safe-area-inset-top) - 4px); max-height: min(70vh, 460px); overflow-y: auto; overscroll-behavior: contain; padding: 6px; border-radius: 14px; background: var(--solid); border: 1px solid var(--hair); box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55); }
.chip.statusbtn { cursor: pointer; }
.chip.statusbtn.in_review { color: var(--fg2); }
.chip.statusbtn.in_review.live { color: var(--ok); }
.dotlive { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.statusbtn.live::before, .dotlive.on { background: var(--ok); animation: live-pulse 1.8s ease-out infinite; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(50, 215, 75, 0.55); } 100% { box-shadow: 0 0 0 7px rgba(50, 215, 75, 0); } }
@media (prefers-reduced-motion: reduce) { .statusbtn.live::before, .dotlive.on { animation: none; } }
.status-title { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.menu.info p { margin: 0; color: var(--fg2); line-height: 1.4; }
.menu.status { top: calc(var(--top) + 4px); left: 12px; right: auto; width: 340px; }
.menu.info { display: grid; gap: 8px; padding: 10px; }
.menu.info .btn { justify-self: end; }
.menu-head { padding: 6px 10px 8px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg2); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item { background: transparent; display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border-radius: 10px; text-align: left; border: 1px solid transparent; }
.menu-item[aria-selected="true"] { background: rgba(76, 141, 255, 0.16); border-color: rgba(76, 141, 255, 0.45); }
.menu-item .mthumb { width: 38px; height: 38px; flex: none; border-radius: 7px; background: #0b0c10; display: grid; place-items: center; overflow: hidden; }
.menu-item .mthumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.menu-item .mname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 580; }
@media (max-width: 960px) {
  :root { --side: 340px; }
  .work { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .rail { display: none; }
  .rail { flex-direction: row; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid var(--hair); padding: 8px 12px; }
  .rail h2 { display: none; }
  .shot { width: 118px; flex: none; padding: 6px; }
  .shot .thumb { height: 76px; }
  .shot img { max-height: 76px; }
  .side { background: var(--solid); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; max-height: 72vh; border: 1px solid var(--hair); border-radius: 18px 18px 0 0; transform: translateY(105%); transition: transform 0.2s ease; box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5); }
  .side.open { transform: none; }
  .composer { position: fixed; left: 0 !important; right: 0; bottom: 0; top: auto !important; width: auto; overflow-y: auto; overscroll-behavior: contain; border-radius: 16px 16px 0 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); z-index: 30; }
  /* 16px or larger stops iOS Safari from zooming the page when a field is focused. */
  textarea, input { font-size: 16px; }
  .composer { gap: 6px; }
  .composer textarea { min-height: 0; resize: none; padding: 6px 10px; line-height: 1.35; }
  .zoombar { position: fixed; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 15; background: var(--solid); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5); border-radius: 12px; }
  .zoombar button { min-height: 40px; min-width: 44px; }
  body[data-composer="1"] .zoombar, body[data-composer="1"] .statusbtn { display: none; }
  .chip.statusbtn { position: fixed; left: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 15; height: 42px; padding: 0 16px; font-size: 13.5px; background: var(--solid); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5); }
  .menu.status { top: auto; bottom: calc(66px + env(safe-area-inset-bottom)); left: 8px; right: 8px; width: auto; }
  .stage { padding-bottom: 72px; }
  html, body { touch-action: pan-x pan-y; }
  .only-narrow { display: inline-flex; }
  .picker { display: inline-flex; }
  .title { font-size: 14px; flex: 1 1 auto; }
  .spacer { display: none; }
  .top { gap: 8px; padding: 0 10px; }
  .top .brand { display: none; }
  .chip { height: 22px; padding: 0 8px; font-size: 11px; flex: none; }
  .hide-narrow { display: none; }
  .stage { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
