/* App-only rules for the real PWA, on top of atlas.css (the approved design). Real device edges
   (safe areas), real inputs, images, the live camera, loading states. */

:root {
  --top: max(env(safe-area-inset-top, 0px), 14px);
  --bottom: env(safe-area-inset-bottom, 0px);
  --bpad: max(var(--bottom), 10px);
}
/* Screenshot parity with the mockup frames: iPhone status bar and home indicator space. */
html.frame-iphone { --top: 54px; --bottom: 34px; }

html, body { height: 100%; }
body { background: var(--bg); overscroll-behavior: none; }
@media (min-width: 600px) { body { background: var(--pg-bg); } }

.phone {
  position: fixed; inset: 0; width: 100%; max-width: 560px; height: 100%; margin: 0 auto; border-radius: 0;
  user-select: auto; -webkit-user-select: auto;
}
@media (min-width: 600px) { .phone { box-shadow: 0 0 0 1px var(--line), 0 20px 60px -30px rgba(0,0,0,.25); } }
.phone button, .phone .tab { user-select: none; -webkit-user-select: none; }

.tabbar { height: calc(56px + var(--bpad)); }
.phone.staff .tabbar { height: calc(72px + var(--bpad)); }
.scroll.has-tabs { padding-bottom: calc(96px + var(--bpad)); }
.phone.staff .scroll.has-tabs { padding-bottom: calc(112px + var(--bpad)); }
.composer-wrap { padding-bottom: calc(8px + var(--bpad)); }
.foot-cta { padding-bottom: calc(10px + var(--bpad)); }
.sheet { padding-bottom: calc(20px + var(--bpad)); }
.toast { top: calc(var(--top) + 4px); }

/* palette switch (decision 1): neutral is the default; jarvis = cream and navy */
html.palette-jarvis { --bg: #f4efe4; --surface: #fffdf8; --fill: #ece6d8; --fill-2: #e2dbcb; --accent: #1f3a68; --accent-press: #172d52;
  --accent-soft: #e3e8f2; --accent-text: #1f3a68; --navbar: rgba(244, 239, 228, .86); --tabbar: rgba(250, 247, 240, .86); }

/* loading and empty */
.loading { display: grid; place-items: center; padding: 48px 0; color: var(--text-3); font-size: 14px; gap: 10px; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--fill-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.view .busy-bar { position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--accent); transform-origin: left; animation: busy 1.2s ease-in-out infinite; z-index: 9; }
@keyframes busy { 0% { transform: scaleX(0); } 60% { transform: scaleX(.8); } 100% { transform: scaleX(1); opacity: 0; } }
.note-line { font-size: 12.5px; line-height: 18px; color: var(--text-3); padding: 8px 4px 0; display: flex; gap: 6px; align-items: flex-start; }
.note-line svg.i { width: 14px; height: 14px; margin-top: 2px; flex: none; }

/* real composer */
.composer .box { padding: 0 5px 0 14px; color: var(--text); }
.composer .box textarea { flex: 1; min-width: 0; border: 0; background: none; resize: none; outline: none; font: inherit; font-size: 16px;
  line-height: 21px; color: var(--text); padding: 8px 0; height: 37px; max-height: 128px; }
.composer .box textarea::placeholder { color: var(--text-3); }
.composer .send { border: 0; cursor: pointer; }
.composer .send:active { transform: scale(.92); }
.att-row { display: flex; gap: 8px; overflow-x: auto; padding: 0 2px 8px; scrollbar-width: none; }
.att { flex: none; position: relative; height: 56px; min-width: 56px; max-width: 180px; border-radius: 12px; overflow: hidden; background: var(--fill);
  display: flex; align-items: center; gap: 8px; padding: 0 10px; font-size: 13px; color: var(--text-2); }
.att img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.att .rm { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; z-index: 1; }
.att .rm svg.i { width: 11px; height: 11px; stroke-width: 2.6; }
.att.up::after { content: ""; position: absolute; inset: 0; background: rgba(255,255,255,.5); }
.mention-pop { display: flex; gap: 8px; overflow-x: auto; padding: 0 2px 8px; scrollbar-width: none; }
.mention-pop .chip { height: 32px; font-size: 13.5px; flex: none; }

/* images from the hub (fetched with the sign-in token, shown from blob URLs) */
.photos .ph img, .shot img, .match-item .thumb img, .sheet .big-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos .ph, .shot { background: var(--fill); }
.sheet .big-img { border-radius: 16px; overflow: hidden; background: var(--fill); }
.sheet .big-img img { height: auto; max-height: 62vh; object-fit: contain; }
.file { width: 100%; text-align: left; }
.file .fi.csv { background: var(--ok-soft); color: var(--ok); }
.file .fi.doc { background: var(--fill); color: var(--text-2); }
.post { cursor: default; }
.post.tapme:active { background: var(--fill); }
.post .tx { white-space: pre-wrap; overflow-wrap: anywhere; }
.post.deleted .tx { color: var(--text-3); font-style: italic; }
.post .pinned-mark { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 600; color: var(--warn); }
.post .pinned-mark svg.i { width: 12px; height: 12px; }
.rx button { height: 26px; padding: 0 8px; border-radius: 13px; background: var(--fill); display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.rx button.mine { background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }
.emoji-row { display: flex; justify-content: space-between; gap: 6px; padding: 4px 0 12px; }
.emoji-row button { width: 42px; height: 42px; border-radius: 50%; background: var(--fill); font-size: 21px; display: grid; place-items: center; }
.emoji-row button:active { transform: scale(.92); }
.check-card { margin-top: 8px; border-radius: 16px; background: var(--surface); padding: 12px 14px; box-shadow: inset 0 0 0 1px var(--line); }
.check-card .vt { display: flex; align-items: center; gap: 10px; font: 650 17px/22px var(--font-display); }
.check-card .vt .lead { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; }
.check-card ul { margin: 8px 0 0; padding-left: 18px; font-size: 14.5px; line-height: 21px; color: var(--text-2); }
.check-card li.dont { color: var(--bad); }

/* real form fields */
.field { width: 100%; }
input.field, textarea.field, select.field { display: block; width: 100%; min-height: 48px; border-radius: 14px; border: 0; background: var(--fill);
  padding: 12px 14px; font-size: 16px; line-height: 22px; color: var(--text); outline: none; }
textarea.field { min-height: 96px; resize: vertical; }
input.field:focus, textarea.field:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.codefield input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font: inherit; color: var(--text); letter-spacing: .12em; }
.codefield input::placeholder { color: var(--text-3); font-family: var(--font); font-size: 18px; letter-spacing: 0; font-weight: 500; }
.sheet .err, .signin .err { color: var(--bad); font-size: 14px; line-height: 19px; margin-top: 10px; text-align: center; }
.sheet .opt-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* chat list extras */
.ch .badge { position: static; }
.ws-h .wsm { color: inherit; }

/* live camera */
.cam video, .cam .reader { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam .reader video { object-fit: cover; }
.cam .scene { filter: brightness(.9); }
.cam.torch .scene { filter: none; }
.cam .vf { top: 30%; }
.cam.mode-upc .vf { top: calc(30% + 72px); }
.cam .hintc, .cam .foundchip { top: calc(30% + 292px); }
.cam.mode-upc .hintc, .cam.mode-upc .foundchip { top: calc(30% + 214px); }
.cam .topbar { top: calc(var(--top) + 4px); }
.cam .bottom { padding-bottom: calc(18px + var(--bpad)); }
.cam .nocam { position: absolute; left: 24px; right: 24px; top: 36%; text-align: center; font-size: 16px; line-height: 23px; color: rgba(255,255,255,.86); }
.cam .nocam b { display: block; font: 650 19px/25px var(--font-display); color: #fff; margin-bottom: 6px; }
.cam .vf .hit { display: none; }

/* steps and floor */
.wk .btn[disabled] { opacity: .5; }
.hz { margin: 0 16px 16px; padding: 12px 14px; border-radius: 14px; font-size: 15px; line-height: 21px; display: flex; gap: 10px; }
.hz svg.i { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.hz.warn { background: var(--warn-soft); color: var(--warn); }
.hz.bad { background: var(--bad-soft); color: var(--bad); }
.hz.ok { background: var(--ok-soft); color: var(--ok); }
.hz b { font-weight: 650; }

/* tasks */
.task .cb[disabled] { opacity: .5; }
.task.tap:active { background: var(--fill); }
.new-task { margin-top: 12px; }

/* person sheet */
.seg3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 2px; border-radius: 10px; background: var(--fill); }
.seg3 button { height: 34px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.seg3 button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.big-code { font: 700 40px/1 var(--mono); letter-spacing: .14em; text-align: center; padding: 18px 0 8px; }

.offline { position: absolute; top: calc(var(--top) - 2px); left: 50%; transform: translateX(-50%); z-index: 34; font-size: 12px; font-weight: 600;
  background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 3px 10px; display: none; }
.phone.is-offline .offline { display: block; }
