/* Phone app layout */
body {
  min-height: 100dvh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--navy-900);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}
.topbar .brand img {
  height: 26px;
  width: auto;
}
.topbar .who {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--muted);
  min-width: 0;
}
.topbar .who strong {
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 34vw;
}

.netbar {
  padding: 9px 16px;
  font-size: 0.875rem;
  background: var(--amber-100);
  color: var(--amber-700);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.netbar.is-error {
  background: var(--red-100);
  color: var(--red-700);
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 18px 16px calc(32px + env(safe-area-inset-bottom));
}

.screen-title {
  font-size: 1.35rem;
  margin: 4px 0 16px;
}
.back {
  margin: -6px 0 6px -10px;
  color: var(--muted);
}

/* login */
.login {
  padding-top: 6vh;
}
.login .logo {
  width: 210px;
  margin: 0 auto 8px;
}
.login .tag {
  text-align: center;
  color: var(--muted);
  margin: 0 0 24px;
}

/* home */
.hello {
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0 0 14px;
}
.hello strong {
  color: var(--ink);
}
.cta {
  display: grid;
  gap: 14px;
  text-align: center;
  padding: 26px 18px;
}
.cta p {
  margin: 0;
  color: var(--muted);
}
.btn-xl {
  min-height: 64px;
  font-size: 1.15rem;
  border-radius: 16px;
}
.btn-xl svg {
  width: 26px;
  height: 26px;
}

.section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 26px 2px 10px;
}
.history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.history li {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
}
.history .h-name {
  font-weight: 600;
  color: var(--ink);
}
.history .h-meta {
  font-size: 0.85rem;
  color: var(--muted);
  grid-column: 1;
}
.history .badge {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
}
.history li.empty {
  display: block;
}

/* hospital picker */
.picker {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  max-height: 46vh;
  overflow: auto;
  margin-top: 8px;
}
.picker button {
  all: unset;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.picker button:last-child {
  border-bottom: 0;
}
.picker button:focus-visible {
  background: var(--sky-100);
}
.picker .p-name {
  font-weight: 600;
  color: var(--ink);
}
.picker .p-sub {
  font-size: 0.82rem;
  color: var(--muted);
}
.picker .p-dist {
  font-size: 0.82rem;
  color: var(--blue-600);
  white-space: nowrap;
  align-self: center;
}
.picked {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 2px solid var(--navy-900);
  border-radius: var(--radius-sm);
  background: var(--sky-100);
}
.picked strong {
  color: var(--ink);
}

.gps {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 4px 0 16px;
}
.gps::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #b7c4ce;
  flex: none;
}
.gps.ok::before {
  background: var(--green-600);
}
.gps.bad::before {
  background: var(--red-700);
}

.sticky-action {
  position: sticky;
  bottom: 0;
  padding: 12px 0 calc(4px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg-soft) 30%);
}

/* active job */
.active-card {
  padding: 0;
  overflow: hidden;
}
.active-card .a-head {
  background: var(--navy-900);
  color: #fff;
  padding: 18px;
}
.active-card .a-head .badge {
  background: rgba(255, 255, 255, 0.14);
  color: #bfeaff;
}
.active-card .a-head h2 {
  color: #fff;
  font-size: 1.3rem;
  margin: 10px 0 4px;
}
.active-card .a-head p {
  margin: 0;
  color: #bfeaff;
  font-size: 0.92rem;
}
.active-card .a-body {
  padding: 18px;
  display: grid;
  gap: 16px;
}
.elapsed {
  text-align: center;
}
.elapsed .num {
  font-size: 2.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.elapsed .lbl {
  font-size: 0.85rem;
  color: var(--muted);
}
.a-photo {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--navy-950);
  height: 46vh;
}
.a-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* keep the stamp at the bottom of the photo in view */
}

/* camera */
.camera {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #000;
  color: #fff;
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.cam-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  font-size: 0.85rem;
}
.cam-top .gps {
  margin: 0;
  color: #dfe9ef;
}
.cam-view {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.cam-view video,
.cam-view img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.cam-view video.mirror {
  transform: scaleX(-1);
}
.cam-bottom {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 12px;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
}
.cam-btn {
  all: unset;
  cursor: pointer;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.14);
}
.cam-btn svg {
  width: 24px;
  height: 24px;
}
.shutter {
  all: unset;
  cursor: pointer;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 4px solid #fff;
  display: grid;
  place-items: center;
}
.shutter::after {
  content: '';
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.1s;
}
.shutter:active::after {
  transform: scale(0.9);
}
.shutter:focus-visible,
.cam-btn:focus-visible {
  outline: 3px solid var(--sky-400);
  outline-offset: 3px;
}
.cam-bottom .btn {
  flex: 1;
  max-width: 220px;
}
.cam-bottom .btn-ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}
